代码重构
This commit is contained in:
parent
9c5af1c91b
commit
4120bf44f9
|
@ -1,7 +1,5 @@
|
|||
package iot
|
||||
|
||||
type CommandHandler func(Command) bool
|
||||
|
||||
// 设备命令
|
||||
type Command struct {
|
||||
ObjectDeviceId string `json:"object_device_id"`
|
||||
|
@ -28,8 +26,6 @@ func FailedIotCommandResponse() CommandResponse {
|
|||
}
|
||||
}
|
||||
|
||||
// 设备消息
|
||||
type MessageHandler func(message Message) bool
|
||||
|
||||
type Message struct {
|
||||
ObjectDeviceId string `json:"object_device_id"`
|
||||
|
@ -50,7 +46,6 @@ type ServicePropertyEntry struct {
|
|||
}
|
||||
|
||||
// 平台设置设备属性==================================================
|
||||
type DevicePropertiesSetHandler func(message DevicePropertyDownRequest) bool
|
||||
|
||||
type DevicePropertyDownRequest struct {
|
||||
ObjectDeviceId string `json:"object_device_id"`
|
||||
|
@ -82,9 +77,6 @@ func FailedPropertiesSetResponse() DevicePropertyDownResponse {
|
|||
}
|
||||
|
||||
// 平台设置设备属性==================================================
|
||||
|
||||
// 平台查询设备属性
|
||||
type DevicePropertyQueryHandler func(query DevicePropertyQueryRequest) ServicePropertyEntry
|
||||
type DevicePropertyQueryRequest struct {
|
||||
ObjectDeviceId string `json:"object_device_id"`
|
||||
ServiceId string `json:"service_id"`
|
||||
|
|
14
options.go
14
options.go
|
@ -4,4 +4,16 @@ package iot
|
|||
type SubDevicesAddHandler func(devices SubDeviceInfo)
|
||||
|
||||
//子设备删除糊掉函数
|
||||
type SubDevicesDeleteHandler func(devices SubDeviceInfo)
|
||||
type SubDevicesDeleteHandler func(devices SubDeviceInfo)
|
||||
|
||||
// 处理平台下发的命令
|
||||
type CommandHandler func(Command) bool
|
||||
|
||||
// 设备消息
|
||||
type MessageHandler func(message Message) bool
|
||||
|
||||
// 平台设置设备属性
|
||||
type DevicePropertiesSetHandler func(message DevicePropertyDownRequest) bool
|
||||
|
||||
// 平台查询设备属性
|
||||
type DevicePropertyQueryHandler func(query DevicePropertyQueryRequest) ServicePropertyEntry
|
Loading…
Reference in New Issue