libCodec

package
v0.0.0-...-5961e9c Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterfaceToBytes

func InterfaceToBytes(key interface{}) ([]byte, error)

func Register

func Register(name string, c Codec)

Types

type Codec

type Codec interface {
	Encode(ctx context.Context, rawData interface{}) (*DeviceDecodeMsg, error)
	Decode(ctx context.Context, msg DeviceData) (interface{}, error)
	Save(ctx context.Context, dmesg *DeviceDecodeMsg) error
}

func HttpCodec

func HttpCodec() Codec

func MqttCodec

func MqttCodec() Codec

func Open

func Open(name string) (Codec, error)

type DeviceData

type DeviceData struct {
	CategoryId int
	Name       string
	Type       int
	Data       interface{}
	Time       *gtime.Time
	Ratio      string
}

type DeviceDecodeMsg

type DeviceDecodeMsg struct {
	// contains filtered or unexported fields
}

func (*DeviceDecodeMsg) GetDataList

func (d *DeviceDecodeMsg) GetDataList() []*DeviceData

func (*DeviceDecodeMsg) GetDeviceInfo

func (d *DeviceDecodeMsg) GetDeviceInfo() *model.DeviceAllInfo

func (*DeviceDecodeMsg) GetEventList

func (d *DeviceDecodeMsg) GetEventList() []*DeviceEvent

type DeviceEvent

type DeviceEvent struct {
	Name string
	Data interface{}
}

Jump to

Keyboard shortcuts

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