Versions in this module Expand all Collapse all v1 v1.0.0 Sep 7, 2022 Changes in this version + const ClientStaClose + const ClientStaConnect + const ClientStaData + const ClientStaLogin + const ClientStaRegister + const ControlClosed + const ControlData + const ControlError + const ControlHeart + const ControlLogin + const ControlRegister + const HeadCRC8Len + const PluginErr + const PluginRun + const PluginStarting + const PluginStop + const PluginUnStart + const ProtocolRPC + const ProtocolTopic + func GetCrc8(buf []byte) (crc byte) + func TopMsgPack(msg *TopMessage) ([]byte, error) + type DataPack struct + func (dp *DataPack) GetHeadLen() uint32 + func (dp *DataPack) Pack(msg IMessage) ([]byte, error) + func (dp *DataPack) Unpack(binaryData []byte) (IMessage, error) + type ErrConnectionFailed error + type ErrHttpServe error + type ErrInvalidMessage error + type ErrRegistrationTimeout error + type IMessage interface + CheckDataCRC func([]byte) bool + GetCRCLen func() uint32 + GetControl func() byte + GetData func() []byte + GetDataCRC func() uint32 + GetDataLen func() uint32 + GetHeadCRC func([]byte) byte + GetMsgID func() uint32 + GetProtocol func() byte + GetVer func() byte + SetData func([]byte) + SetDataLen func(uint32) + SetMsgID func(uint32) + func NewMsgPackage(ID uint32, ctr byte, data []byte) IMessage + func NewMsgPackageWithProtocol(ID uint32, ctr byte, Protocol byte, data []byte) IMessage + type LoginCfg struct + Id uint32 + Name string + Passwd string + type Message struct + Control byte + Data []byte + DataCRC uint32 + DataLen uint32 + HeadCRC byte + ID uint32 + Protocol byte + Version byte + func (msg *Message) CheckDataCRC([]byte) bool + func (msg *Message) GetCRCLen() uint32 + func (msg *Message) GetControl() byte + func (msg *Message) GetData() []byte + func (msg *Message) GetDataCRC() uint32 + func (msg *Message) GetDataLen() uint32 + func (msg *Message) GetHeadCRC(data []byte) byte + func (msg *Message) GetMsgID() uint32 + func (msg *Message) GetProtocol() byte + func (msg *Message) GetVer() byte + func (msg *Message) SetData(data []byte) + func (msg *Message) SetDataLen(len uint32) + func (msg *Message) SetMsgID(msgID uint32) + type Packet interface + GetHeadLen func() uint32 + Pack func(msg IMessage) ([]byte, error) + Unpack func(binaryData []byte) (IMessage, error) + func NewDataPack() Packet + type PluginApp interface + Close func(ctx context.Context) error + Open func(ctx context.Context, f func(filter, client string, qos byte) bool) error + Start func(cfg *PluginCfg, ctx context.Context) error + Update func(ctx context.Context) error + type PluginCfg struct + Name string + Params string + Passwd string + Proto string + ServerAddr string + Unixdir string + type RegisterCfg struct + Id uint32 + Name string + Qos byte + Topic string + type ServiceMsg struct + type TopMessage struct + Data []byte + DataLen uint32 + Qos byte + Retain byte + TopicLen uint16 + TopicName []byte + func TopMsgUnpack(binaryData []byte) (*TopMessage, error) + type TopicInfo struct + Qos byte + Retain bool + TopicName string + type TopicMap map[string]TopicInfo