aiot

package
v1.7.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2022 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MSG_TYPE_name = map[int32]string{
	0: "HEART_BEAT",
	1: "REGISTER",
	2: "DATA_REPORT",
	3: "CONTROL",
	9: "BUSINESS",
}
View Source
var MSG_TYPE_value = map[string]int32{
	"HEART_BEAT":  0,
	"REGISTER":    1,
	"DATA_REPORT": 2,
	"CONTROL":     3,
	"BUSINESS":    9,
}
View Source
var REQ_TYPE_name = map[int32]string{
	0: "REQUEST",
	1: "RESPONSE",
}
View Source
var REQ_TYPE_value = map[string]int32{
	"REQUEST":  0,
	"RESPONSE": 1,
}
View Source
var RequestContentType_name = map[int32]string{
	0: "ContentTypeDefault",
	1: "ApplicationJson",
	2: "ApplicationXWwwFormUrlencoded",
	3: "MultipartFormData",
	4: "ApplicationXml",
}
View Source
var RequestContentType_value = map[string]int32{
	"ContentTypeDefault":            0,
	"ApplicationJson":               1,
	"ApplicationXWwwFormUrlencoded": 2,
	"MultipartFormData":             3,
	"ApplicationXml":                4,
}
View Source
var RequestMethod_name = map[int32]string{
	0: "MethodDefault",
	1: "Post",
	2: "Get",
	3: "Put",
	4: "Delete",
}
View Source
var RequestMethod_value = map[string]int32{
	"MethodDefault": 0,
	"Post":          1,
	"Get":           2,
	"Put":           3,
	"Delete":        4,
}
View Source
var RequestType_name = map[int32]string{
	0: "sync",
	1: "Async",
}
View Source
var RequestType_value = map[string]int32{
	"sync":  0,
	"Async": 1,
}

Functions

func RegisterAiotServiceHandler

func RegisterAiotServiceHandler(s server.Server, hdlr AiotServiceHandler, opts ...server.HandlerOption) error

Types

type AiotService

type AiotService interface {
	// 发送指向单个设备的请求
	Request(ctx context.Context, in *BusinessReq, opts ...client.CallOption) (*BusinessReply, error)
}

func NewAiotService

func NewAiotService(name string, c client.Client) AiotService

type AiotServiceHandler

type AiotServiceHandler interface {
	// 发送指向单个设备的请求
	Request(context.Context, *BusinessReq, *BusinessReply) error
}

type BusinessProto

type BusinessProto struct {
	Topic                string   `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	Request              []byte   `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
	Authorization        string   `protobuf:"bytes,3,opt,name=authorization,proto3" json:"authorization,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

消息体

func (*BusinessProto) Descriptor

func (*BusinessProto) Descriptor() ([]byte, []int)

func (*BusinessProto) GetAuthorization

func (m *BusinessProto) GetAuthorization() string

func (*BusinessProto) GetRequest

func (m *BusinessProto) GetRequest() []byte

func (*BusinessProto) GetTopic

func (m *BusinessProto) GetTopic() string

func (*BusinessProto) ProtoMessage

func (*BusinessProto) ProtoMessage()

func (*BusinessProto) Reset

func (m *BusinessProto) Reset()

func (*BusinessProto) String

func (m *BusinessProto) String() string

func (*BusinessProto) XXX_DiscardUnknown

func (m *BusinessProto) XXX_DiscardUnknown()

func (*BusinessProto) XXX_Marshal

func (m *BusinessProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BusinessProto) XXX_Merge

func (m *BusinessProto) XXX_Merge(src proto.Message)

func (*BusinessProto) XXX_Size

func (m *BusinessProto) XXX_Size() int

func (*BusinessProto) XXX_Unmarshal

func (m *BusinessProto) XXX_Unmarshal(b []byte) error

type BusinessReply

type BusinessReply struct {
	// 返回的错误码
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// 错误信息
	Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// 是否success
	Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"`
	// 返回结果
	Data                 []byte   `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

响应的body体

func (*BusinessReply) Descriptor

func (*BusinessReply) Descriptor() ([]byte, []int)

func (*BusinessReply) GetCode

func (m *BusinessReply) GetCode() int32

func (*BusinessReply) GetData

func (m *BusinessReply) GetData() []byte

func (*BusinessReply) GetMsg

func (m *BusinessReply) GetMsg() string

func (*BusinessReply) GetSuccess

func (m *BusinessReply) GetSuccess() bool

func (*BusinessReply) ProtoMessage

func (*BusinessReply) ProtoMessage()

func (*BusinessReply) Reset

func (m *BusinessReply) Reset()

func (*BusinessReply) String

func (m *BusinessReply) String() string

func (*BusinessReply) XXX_DiscardUnknown

func (m *BusinessReply) XXX_DiscardUnknown()

func (*BusinessReply) XXX_Marshal

func (m *BusinessReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BusinessReply) XXX_Merge

func (m *BusinessReply) XXX_Merge(src proto.Message)

func (*BusinessReply) XXX_Size

func (m *BusinessReply) XXX_Size() int

func (*BusinessReply) XXX_Unmarshal

func (m *BusinessReply) XXX_Unmarshal(b []byte) error

type BusinessReq

type BusinessReq struct {
	// 请求的topic url
	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	// 请求的同步/异步类型
	SyncType RequestType `protobuf:"varint,4,opt,name=syncType,proto3,enum=aiot.RequestType" json:"syncType,omitempty"`
	// method
	Method RequestMethod `protobuf:"varint,5,opt,name=method,proto3,enum=aiot.RequestMethod" json:"method,omitempty"`
	// content-type
	ContentType RequestContentType `protobuf:"varint,6,opt,name=contentType,proto3,enum=aiot.RequestContentType" json:"contentType,omitempty"`
	// 请求业务参数
	Req                  []byte   `protobuf:"bytes,7,opt,name=req,proto3" json:"req,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

设备列表请求参数

func (*BusinessReq) Descriptor

func (*BusinessReq) Descriptor() ([]byte, []int)

func (*BusinessReq) GetContentType

func (m *BusinessReq) GetContentType() RequestContentType

func (*BusinessReq) GetMethod

func (m *BusinessReq) GetMethod() RequestMethod

func (*BusinessReq) GetReq

func (m *BusinessReq) GetReq() []byte

func (*BusinessReq) GetSyncType

func (m *BusinessReq) GetSyncType() RequestType

func (*BusinessReq) GetTopic

func (m *BusinessReq) GetTopic() string

func (*BusinessReq) ProtoMessage

func (*BusinessReq) ProtoMessage()

func (*BusinessReq) Reset

func (m *BusinessReq) Reset()

func (*BusinessReq) String

func (m *BusinessReq) String() string

func (*BusinessReq) XXX_DiscardUnknown

func (m *BusinessReq) XXX_DiscardUnknown()

func (*BusinessReq) XXX_Marshal

func (m *BusinessReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BusinessReq) XXX_Merge

func (m *BusinessReq) XXX_Merge(src proto.Message)

func (*BusinessReq) XXX_Size

func (m *BusinessReq) XXX_Size() int

func (*BusinessReq) XXX_Unmarshal

func (m *BusinessReq) XXX_Unmarshal(b []byte) error

type DataReport

type DataReport struct {
	DataKey              string   `protobuf:"bytes,1,opt,name=dataKey,proto3" json:"dataKey,omitempty"`
	Data                 []byte   `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

数据上报

func (*DataReport) Descriptor

func (*DataReport) Descriptor() ([]byte, []int)

func (*DataReport) GetData

func (m *DataReport) GetData() []byte

func (*DataReport) GetDataKey

func (m *DataReport) GetDataKey() string

func (*DataReport) ProtoMessage

func (*DataReport) ProtoMessage()

func (*DataReport) Reset

func (m *DataReport) Reset()

func (*DataReport) String

func (m *DataReport) String() string

func (*DataReport) XXX_DiscardUnknown

func (m *DataReport) XXX_DiscardUnknown()

func (*DataReport) XXX_Marshal

func (m *DataReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DataReport) XXX_Merge

func (m *DataReport) XXX_Merge(src proto.Message)

func (*DataReport) XXX_Size

func (m *DataReport) XXX_Size() int

func (*DataReport) XXX_Unmarshal

func (m *DataReport) XXX_Unmarshal(b []byte) error

type DeviceNode

type DeviceNode struct {
	DeviceId             string   `protobuf:"bytes,1,opt,name=deviceId,proto3" json:"deviceId,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

注册节点ID

func (*DeviceNode) Descriptor

func (*DeviceNode) Descriptor() ([]byte, []int)

func (*DeviceNode) GetDeviceId

func (m *DeviceNode) GetDeviceId() string

func (*DeviceNode) ProtoMessage

func (*DeviceNode) ProtoMessage()

func (*DeviceNode) Reset

func (m *DeviceNode) Reset()

func (*DeviceNode) String

func (m *DeviceNode) String() string

func (*DeviceNode) XXX_DiscardUnknown

func (m *DeviceNode) XXX_DiscardUnknown()

func (*DeviceNode) XXX_Marshal

func (m *DeviceNode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeviceNode) XXX_Merge

func (m *DeviceNode) XXX_Merge(src proto.Message)

func (*DeviceNode) XXX_Size

func (m *DeviceNode) XXX_Size() int

func (*DeviceNode) XXX_Unmarshal

func (m *DeviceNode) XXX_Unmarshal(b []byte) error

type DeviceRegister

type DeviceRegister struct {
	// 设备ID
	DeviceId string `protobuf:"bytes,1,opt,name=deviceId,proto3" json:"deviceId,omitempty"`
	//设备名称
	ServerName string `protobuf:"bytes,2,opt,name=serverName,proto3" json:"serverName,omitempty"`
	// 设备IP地址
	Ip                   string   `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

设备注册包

func (*DeviceRegister) Descriptor

func (*DeviceRegister) Descriptor() ([]byte, []int)

func (*DeviceRegister) GetDeviceId

func (m *DeviceRegister) GetDeviceId() string

func (*DeviceRegister) GetIp

func (m *DeviceRegister) GetIp() string

func (*DeviceRegister) GetServerName

func (m *DeviceRegister) GetServerName() string

func (*DeviceRegister) ProtoMessage

func (*DeviceRegister) ProtoMessage()

func (*DeviceRegister) Reset

func (m *DeviceRegister) Reset()

func (*DeviceRegister) String

func (m *DeviceRegister) String() string

func (*DeviceRegister) XXX_DiscardUnknown

func (m *DeviceRegister) XXX_DiscardUnknown()

func (*DeviceRegister) XXX_Marshal

func (m *DeviceRegister) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeviceRegister) XXX_Merge

func (m *DeviceRegister) XXX_Merge(src proto.Message)

func (*DeviceRegister) XXX_Size

func (m *DeviceRegister) XXX_Size() int

func (*DeviceRegister) XXX_Unmarshal

func (m *DeviceRegister) XXX_Unmarshal(b []byte) error

type HeartBeatProto

type HeartBeatProto struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

心跳包

func (*HeartBeatProto) Descriptor

func (*HeartBeatProto) Descriptor() ([]byte, []int)

func (*HeartBeatProto) ProtoMessage

func (*HeartBeatProto) ProtoMessage()

func (*HeartBeatProto) Reset

func (m *HeartBeatProto) Reset()

func (*HeartBeatProto) String

func (m *HeartBeatProto) String() string

func (*HeartBeatProto) XXX_DiscardUnknown

func (m *HeartBeatProto) XXX_DiscardUnknown()

func (*HeartBeatProto) XXX_Marshal

func (m *HeartBeatProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HeartBeatProto) XXX_Merge

func (m *HeartBeatProto) XXX_Merge(src proto.Message)

func (*HeartBeatProto) XXX_Size

func (m *HeartBeatProto) XXX_Size() int

func (*HeartBeatProto) XXX_Unmarshal

func (m *HeartBeatProto) XXX_Unmarshal(b []byte) error

type MSG_TYPE

type MSG_TYPE int32

消息类型

const (
	// 心跳
	MSG_TYPE_HEART_BEAT MSG_TYPE = 0
	// 注册
	MSG_TYPE_REGISTER MSG_TYPE = 1
	// 数据上报
	MSG_TYPE_DATA_REPORT MSG_TYPE = 2
	// 设备控制
	MSG_TYPE_CONTROL MSG_TYPE = 3
	// 业务消息
	MSG_TYPE_BUSINESS MSG_TYPE = 9
)

func (MSG_TYPE) EnumDescriptor

func (MSG_TYPE) EnumDescriptor() ([]byte, []int)

func (MSG_TYPE) String

func (x MSG_TYPE) String() string

type MsgIdProto

type MsgIdProto struct {
	MsgId                string   `protobuf:"bytes,1,opt,name=msgId,proto3" json:"msgId,omitempty"`
	PreMsgId             string   `protobuf:"bytes,2,opt,name=preMsgId,proto3" json:"preMsgId,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

消息ID

func (*MsgIdProto) Descriptor

func (*MsgIdProto) Descriptor() ([]byte, []int)

func (*MsgIdProto) GetMsgId

func (m *MsgIdProto) GetMsgId() string

func (*MsgIdProto) GetPreMsgId

func (m *MsgIdProto) GetPreMsgId() string

func (*MsgIdProto) ProtoMessage

func (*MsgIdProto) ProtoMessage()

func (*MsgIdProto) Reset

func (m *MsgIdProto) Reset()

func (*MsgIdProto) String

func (m *MsgIdProto) String() string

func (*MsgIdProto) XXX_DiscardUnknown

func (m *MsgIdProto) XXX_DiscardUnknown()

func (*MsgIdProto) XXX_Marshal

func (m *MsgIdProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgIdProto) XXX_Merge

func (m *MsgIdProto) XXX_Merge(src proto.Message)

func (*MsgIdProto) XXX_Size

func (m *MsgIdProto) XXX_Size() int

func (*MsgIdProto) XXX_Unmarshal

func (m *MsgIdProto) XXX_Unmarshal(b []byte) error

type Protocol

type Protocol struct {
	SenderId             string      `protobuf:"bytes,2,opt,name=senderId,proto3" json:"senderId,omitempty"`
	ReceiverId           string      `protobuf:"bytes,3,opt,name=receiverId,proto3" json:"receiverId,omitempty"`
	MsgType              MSG_TYPE    `protobuf:"varint,4,opt,name=msgType,proto3,enum=aiot.MSG_TYPE" json:"msgType,omitempty"`
	ReqType              REQ_TYPE    `protobuf:"varint,5,opt,name=reqType,proto3,enum=aiot.REQ_TYPE" json:"reqType,omitempty"`
	MsgProto             *MsgIdProto `protobuf:"bytes,6,opt,name=msgProto,proto3" json:"msgProto,omitempty"`
	Data                 []byte      `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

消息体组成

func (*Protocol) Descriptor

func (*Protocol) Descriptor() ([]byte, []int)

func (*Protocol) GetData

func (m *Protocol) GetData() []byte

func (*Protocol) GetMsgProto

func (m *Protocol) GetMsgProto() *MsgIdProto

func (*Protocol) GetMsgType

func (m *Protocol) GetMsgType() MSG_TYPE

func (*Protocol) GetReceiverId

func (m *Protocol) GetReceiverId() string

func (*Protocol) GetReqType

func (m *Protocol) GetReqType() REQ_TYPE

func (*Protocol) GetSenderId

func (m *Protocol) GetSenderId() string

func (*Protocol) ProtoMessage

func (*Protocol) ProtoMessage()

func (*Protocol) Reset

func (m *Protocol) Reset()

func (*Protocol) String

func (m *Protocol) String() string

func (*Protocol) XXX_DiscardUnknown

func (m *Protocol) XXX_DiscardUnknown()

func (*Protocol) XXX_Marshal

func (m *Protocol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Protocol) XXX_Merge

func (m *Protocol) XXX_Merge(src proto.Message)

func (*Protocol) XXX_Size

func (m *Protocol) XXX_Size() int

func (*Protocol) XXX_Unmarshal

func (m *Protocol) XXX_Unmarshal(b []byte) error

type REQ_TYPE

type REQ_TYPE int32

请求类型

const (
	// 收到请求
	REQ_TYPE_REQUEST REQ_TYPE = 0
	// 收到应答
	REQ_TYPE_RESPONSE REQ_TYPE = 1
)

func (REQ_TYPE) EnumDescriptor

func (REQ_TYPE) EnumDescriptor() ([]byte, []int)

func (REQ_TYPE) String

func (x REQ_TYPE) String() string

type RequestContentType

type RequestContentType int32

请求header

const (
	RequestContentType_ContentTypeDefault            RequestContentType = 0
	RequestContentType_ApplicationJson               RequestContentType = 1
	RequestContentType_ApplicationXWwwFormUrlencoded RequestContentType = 2
	RequestContentType_MultipartFormData             RequestContentType = 3
	RequestContentType_ApplicationXml                RequestContentType = 4
)

func (RequestContentType) EnumDescriptor

func (RequestContentType) EnumDescriptor() ([]byte, []int)

func (RequestContentType) String

func (x RequestContentType) String() string

type RequestMethod

type RequestMethod int32

请求方式

const (
	// 默认
	RequestMethod_MethodDefault RequestMethod = 0
	// post请求
	RequestMethod_Post RequestMethod = 1
	// get请求
	RequestMethod_Get RequestMethod = 2
	// put请求
	RequestMethod_Put RequestMethod = 3
	// delete请求
	RequestMethod_Delete RequestMethod = 4
)

func (RequestMethod) EnumDescriptor

func (RequestMethod) EnumDescriptor() ([]byte, []int)

func (RequestMethod) String

func (x RequestMethod) String() string

type RequestType

type RequestType int32

请求类型

const (
	// 同步请求 默认
	RequestType_sync RequestType = 0
	// 异步请求
	RequestType_Async RequestType = 1
)

func (RequestType) EnumDescriptor

func (RequestType) EnumDescriptor() ([]byte, []int)

func (RequestType) String

func (x RequestType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL