diff --git a/handlers.go b/handlers.go index 5fc9da1..d1fe8a1 100644 --- a/handlers.go +++ b/handlers.go @@ -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"` diff --git a/iotdevice.go b/iot_device.go similarity index 100% rename from iotdevice.go rename to iot_device.go diff --git a/options.go b/options.go index 2d5e8fd..83b940b 100644 --- a/options.go +++ b/options.go @@ -4,4 +4,16 @@ package iot type SubDevicesAddHandler func(devices SubDeviceInfo) //子设备删除糊掉函数 -type SubDevicesDeleteHandler func(devices SubDeviceInfo) \ No newline at end of file +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 \ No newline at end of file