コード例 #1
0
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,
	}
}
コード例 #2
0
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,
	}
}
コード例 #3
0
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,
	}
}
コード例 #4
0
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,
	}
}
コード例 #5
0
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,
	}
}
コード例 #6
0
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,
	}
}
コード例 #7
0
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,
	}
}