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_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_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,
	}
}