func Parse_Add_Del_Device(buffer []byte, id uint64) *Add_Del_Device_Packet { reader := ParseHeader(buffer) action, _ := reader.ReadByte() deviceid := base.ReadQuaWord(reader) namelen, _ := reader.ReadByte() name := base.ReadString(reader, namelen) device_type_count, _ := reader.ReadByte() var device base.Device device.ID = deviceid device.Name = name for i := 0; byte(i) < device_type_count; i++ { endpoint, _ := reader.ReadByte() devicetypeid := base.ReadWord(reader) var zonetype uint16 = 0 if devicetypeid == base.SS_Device_DeviceTypeID { zonetype = base.ReadWord(reader) } device.Endpoints = append(device.Endpoints, base.Endpoint{ Endpoint: endpoint, DeviceTypeID: devicetypeid, Zonetype: zonetype, }) } return &Add_Del_Device_Packet{ GatewayID: id, Name: name, Action: action, Device: &device, } }
func Parse_Feedback_Deployment(buffer []byte, id uint64) *Feedback_Deployment_Packet { reader := ParseHeader(buffer) serialnum := base.ReadDWord(reader) deviceid := base.ReadQuaWord(reader) endpoint, _ := reader.ReadByte() armmodel, _ := reader.ReadByte() start_time_hour, _ := reader.ReadByte() start_time_min, _ := reader.ReadByte() end_time_hour, _ := reader.ReadByte() end_time_min, _ := reader.ReadByte() result, _ := reader.ReadByte() return &Feedback_Deployment_Packet{ GatewayID: id, SerialNum: serialnum, DeviceID: deviceid, EndPoint: endpoint, ArmModel: armmodel, StartTimeHour: start_time_hour, StartTimeMin: start_time_min, EndTimeHour: end_time_hour, EndTimeMin: end_time_min, Result: result, } }
func Parse_Notification(buffer []byte, id uint64) *Notification_Packet { reader := ParseHeader(buffer) deviceid := base.ReadQuaWord(reader) notification_time := base.ReadQuaWord(reader) + 8*60*60 endpoint, _ := reader.ReadByte() devicetypeid := base.ReadWord(reader) zonetype := base.ReadWord(reader) zonestatus := base.ReadWord(reader) return &Notification_Packet{ GatewayID: id, DeviceID: deviceid, NotificationTime: notification_time, Endpoint: endpoint, DeviceTypeID: devicetypeid, Zonetype: zonetype, ZoneStatus: zonestatus, } }
func Parse_Feedback_Del_Device(buffer []byte, id uint64) *Feedback_Del_Device_Packet { reader := ParseHeader(buffer) serialnum := base.ReadDWord(reader) deviceid := base.ReadQuaWord(reader) result, _ := reader.ReadByte() return &Feedback_Del_Device_Packet{ GatewayID: id, SerialNum: serialnum, DeviceID: deviceid, Result: result, } }
func Parse_Notify_OnOff(buffer []byte, id uint64) *Notify_OnOff_Packet { reader := ParseHeader(buffer) serialid := base.ReadDWord(reader) deviceid := base.ReadQuaWord(reader) endpoint, _ := reader.ReadByte() status, _ := reader.ReadByte() return &Notify_OnOff_Packet{ GatewayID: id, SerialID: serialid, DeviceID: deviceid, Endpoint: endpoint, Status: status, } }
func Parse_Notify_Level(buffer []byte, id uint64) *Notify_Level_Packet { reader := ParseHeader(buffer) serialid := base.ReadDWord(reader) deviceid := base.ReadQuaWord(reader) endpoint, _ := reader.ReadByte() value, _ := reader.ReadByte() return &Notify_Level_Packet{ GatewayID: id, SerialID: serialid, DeviceID: deviceid, Endpoint: endpoint, Value: value, } }
func Parse_Feedback_SetName(buffer []byte, id uint64) *Feedback_SetName_Packet { reader := ParseHeader(buffer) serialnum := base.ReadDWord(reader) deviceid := base.ReadQuaWord(reader) result, _ := reader.ReadByte() devicename_length, _ := reader.ReadByte() devicename := base.ReadString(reader, devicename_length) return &Feedback_SetName_Packet{ GatewayID: id, DeviceID: deviceid, SerialNum: serialnum, Result: result, DeviceName: devicename, } }
func Parse_Feedback_Read_OnOff_Status(buffer []byte, id uint64) *Feedback_Read_OnOff_Status_Packet { reader := ParseHeader(buffer) serialnum := base.ReadDWord(reader) deviceid := base.ReadQuaWord(reader) endpoint, _ := reader.ReadByte() action, _ := reader.ReadByte() result, _ := reader.ReadByte() return &Feedback_Read_OnOff_Status_Packet{ GatewayID: id, SerialNum: serialnum, DeviceID: deviceid, Endpoint: endpoint, Action: action, Result: result, } }
func Parse_Feedback_Query_Attr(buffer []byte, id uint64) *Feedback_Query_Attr_Packet { reader := ParseHeader(buffer) serialnum := base.ReadDWord(reader) deviceid := base.ReadQuaWord(reader) endpoint, _ := reader.ReadByte() shortaddr := base.ReadWord(reader) profileid := base.ReadWord(reader) zclversion, _ := reader.ReadByte() applicationversion, _ := reader.ReadByte() stackversion, _ := reader.ReadByte() hwversion, _ := reader.ReadByte() manufacturernamelen, _ := reader.ReadByte() manufacturername := base.ReadString(reader, manufacturernamelen) modelidentifierlen, _ := reader.ReadByte() modelidentifier := base.ReadString(reader, modelidentifierlen) datecodelen, _ := reader.ReadByte() datecode := base.ReadString(reader, datecodelen) powersouce, _ := reader.ReadByte() return &Feedback_Query_Attr_Packet{ GatewayID: id, SerialNum: serialnum, DeviceID: deviceid, Endpoint: endpoint, ShortAddr: shortaddr, ProfileID: profileid, ZclVersion: zclversion, ApplicationVersion: applicationversion, StackVersion: stackversion, HwVersion: hwversion, ManufacturerName: manufacturername, ModelIdentifier: modelidentifier, DateCode: datecode, PowerSource: powersouce, } }