iot

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IotDeviceInfo

type IotDeviceInfo struct {
	CollectorMac       string `json:"collectorMac"`       //网关Mac
	DeviceId           string `json:"deviceId"`           //设备编号
	SystemTick         uint32 `json:"systemTick"`         //系统时刻
	Sport              uint32 `json:"sport"`              //运动量
	SportTime          uint32 `json:"sportTime"`          //运动时间
	Temperature        uint16 `json:"temperature"`        //体温 2B uint16,绝对温度值,单位0.01度(减去27315就是摄氏0.01度)
	Voltage            uint16 `json:"voltage"`            //电压 2B	uint16,mV
	DeviceStatus       uint8  `json:"deviceStatus"`       //设备状态 1B 各设备自定义 (定位卡,定位耳标 bit2:0x00活跃~0x04静止,bit0:低电压~0x01)
	LowVoltage         uint8  `json:"lowVoltage"`         //低电压 1B 各设备自定义 (定位卡,定位耳标 bit2:0x00活跃~0x04静止,bit0:低电压~0x01)
	RSSI               byte   `json:"rssi"`               //rssi
	DataFlag           byte   `json:"dataFlag"`           //数据标志:1定位数据,0非定位数据
	TagType            byte   `json:"tagType"`            //标签类型:1-动物标签,2-人员标签,3-资产标签,4-外购标签,5-手机
	Complete           bool   `json:"complete"`           //是否完成
	UploadTimeUnix     int64  `json:"uploadTimeUnix"`     //上传时间 unix时间戳
	UploadTime         string `json:"uploadTimeFormat"`   //上传时间 时间格式:2006-01-02 15:04:05.000
	LastActiveTimeUnix int64  `json:"lastActiveTimeUnix"` //上传活跃时间 unix时间戳
}

IotDeviceInfo 标签数据信息

func (*IotDeviceInfo) GetDeviceInfo

func (model *IotDeviceInfo) GetDeviceInfo(buffers []byte) error

GetDeviceInfo 解析数据

type IotGatewayInfo

type IotGatewayInfo struct {
	CollectorMac    string `json:"collectorMac"`    //网关Mac
	Mark            string `json:"mark"`            //设备MARK(复位计数 4B)
	MomentTime      uint32 `json:"momentTime"`      //当前时刻(4字节 10ms)
	DeviceType      uint16 `json:"deviceType"`      //设备型号(2B)
	FirmwareVersion uint16 `json:"firmwareVersion"` //设备固件版本
	HardwareVersion uint16 `json:"hardwareVersion"` //设备硬件版本

	Module4G           byte `json:"module4G"`           //4G模块存在 true是存在
	Module24G          byte `json:"module24G"`          //2.4G采集模块存在 true是存在
	ModuleBT           byte `json:"moduleBT"`           //正常蓝牙采集模块存在 true是存在
	ModuleLRBT         byte `json:"moduleLRBT"`         //远距离蓝牙采集模块存在 true是存在
	ModuleInternalWlan byte `json:"moduleInternalWlan"` //内部无线模块存在 true是存在

	Module4GState           byte `json:"module4GState"`           //4G模块异常 true是异常
	Module24GState          byte `json:"module24GState"`          //2.4G采集模块异常 true是异常
	ModuleBTState           byte `json:"moduleBTState"`           //正常蓝牙采集模块异常 true是异常
	ModuleLRBTState         byte `json:"moduleLRBTState"`         //远距离蓝牙采集模块异常 true是异常
	ModuleInternalWlanState byte `json:"moduleInternalWlanState"` //内部无线模块异常 true是异常

	AuthInfo     string `json:"authInfo"`     //授权信息(4B时间+8B验证码)
	Flag         byte   `json:"flag"`         //设备标志位(1B)
	TransferMode byte   `json:"transferMode"` //传输工作模式(1B)
	ModuleMode   byte   `json:"moduleMode"`   //模块工作模式(1B)
	Net4G        byte   `json:"net4G"`        //4G网络状态(1B)

	Signal4G          byte    `json:"signal4G"`          //4G信号强度(1B)
	IMEI4G            string  `json:"imei4G"`            //4G模块IMEI(8B) 设备识别码
	IMSI4G            string  `json:"imsi4G"`            //IMSI(8B) SIM卡识别码
	FirmwareType4G    uint16  `json:"firmwareType4G"`    //4G模块固件型号(2B)
	FirmwareVersion4G uint16  `json:"firmwareVersion4G"` //4G模块固件版本(2B)
	Hardware4G        uint16  `json:"hardware4G"`        //4G模块硬件型号(1B)
	UploadTimeUnix    int64   `json:"uploadTimeUnix"`    //上传时间 unix时间戳
	UploadTime        string  `json:"uploadTimeFormat"`  //上传时间 时间格式:2006-01-02 15:04:05.000
	ModuleGPS         byte    `json:"moduleGPS"`         //gps模块
	ExternalPower     byte    `json:"externalPower"`     //市电还是使用电池 1-市电
	Voltage           uint16  `json:"voltage"`           //电压 2B	uint16,mV
	Longitude         float64 `json:"longitude"`         //经度 2B	uint16, 6位小数
	Latitude          float64 `json:"latitude"`          //经度 2B	uint16, 6位小数
}

IotGatewayInfo 网关上报的ping信息

func (*IotGatewayInfo) GetGatewayInfo

func (model *IotGatewayInfo) GetGatewayInfo(buffers []byte) error

GetGatewayInfo 解析网关上报的Ping信息

func (*IotGatewayInfo) GetGatewayInfoV2

func (model *IotGatewayInfo) GetGatewayInfoV2(buffers []byte) error

@title GetGatewayInfoV2 @description 解析网关上报的Ping信息 V2 @auth yushuo 时间(2021/09/10 08:57 ) @param buffers []byte 数据包格式CLA-1B,INS-1B,PARAMS @param PARAMS []byte PARAMS=标签ID(6B)+数据标志(1B)+标签类型(1B)+[0x0C(1B)+RSSI(1B)]+TV格式数据 @param TV []byte 定位数据才包含[0x0C(1B)+RSSI(1B)],后面没有TV数据;非定位数据只有后面的TV数据< @return IotGatewayInfo IotGatewayInfo "网关信息实体"

type IotInfo

type IotInfo struct {
	Success        bool            `json:"success"`        //数据解析是否完成 false-失败,true-成功
	DataType       int             `json:"dataType"`       //0-网关的ping信息,1-标签数据信息
	IotDeviceInfo  *IotDeviceInfo  `json:"iotDeviceInfo"`  //标签数据信息
	IotGatewayInfo *IotGatewayInfo `json:"iotGatewayInfo"` //网关的ping信息
	Message        string          `json:"message"`        //信息
}

IotInfo 解析后得到的信息

func ParseData

func ParseData(buffers []byte) (*IotInfo, error)

ParseData 解析数据

Jump to

Keyboard shortcuts

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