diff --git a/apps/aqhome-data/s_getdevices.c b/apps/aqhome-data/s_getdevices.c index 9be4988..f255f05 100644 --- a/apps/aqhome-data/s_getdevices.c +++ b/apps/aqhome-data/s_getdevices.c @@ -47,59 +47,57 @@ static void _sendDeviceList(AQH_OBJECT *ep, const AQH_DEVICE_LIST *vl, uint32_t * ------------------------------------------------------------------------------------------------ */ -void AqHomeDataServer_HandleGetDevices(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg, const GWEN_TAG16_LIST *tagList) +void AqHomeDataServer_HandleGetDevices(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *msg, GWEN_UNUSED const GWEN_TAG16_LIST *tagList) { - if (tagList) { - AQHOME_SERVER *xo; - - xo=AqHomeDataServer_GetServerData(o); - if (xo) { - const AQH_DEVICE_LIST *origDeviceList; - uint32_t refMsgId; - - refMsgId=AQH_IpcMessage_GetMsgId(msg); - - DBG_ERROR(NULL, "HandleGetDevices"); - origDeviceList=AQH_Storage_GetDeviceList(xo->storage); - if (origDeviceList) { - DBG_ERROR(NULL, "Have a list of %d devices", AQH_Device_List_GetCount(origDeviceList)); - if (AQH_Device_List_GetCount(origDeviceList)=AQHOMEDATA_DEVICESPERMSG) { - DBG_ERROR(NULL, "Sending %d devices", AQH_Device_List_GetCount(tmpDeviceList)); - _sendDeviceList(ep, tmpDeviceList, next?0:AQH_MSGDATA_DEVICES_FLAGS_LASTMSG, refMsgId); - AQH_Device_List_Clear(tmpDeviceList); - } - v=next; - } - if (AQH_Device_List_GetCount(tmpDeviceList)) { - DBG_ERROR(NULL, "Sending %d devices", AQH_Device_List_GetCount(tmpDeviceList)); - _sendDeviceList(ep, tmpDeviceList, AQH_MSGDATA_DEVICES_FLAGS_LASTMSG, refMsgId); /* send remaining */ - } - AQH_Device_List_free(tmpDeviceList); - } + AQHOME_SERVER *xo; + + xo=AqHomeDataServer_GetServerData(o); + if (xo) { + const AQH_DEVICE_LIST *origDeviceList; + uint32_t refMsgId; + + refMsgId=AQH_IpcMessage_GetMsgId(msg); + + DBG_INFO(NULL, "HandleGetDevices"); + origDeviceList=AQH_Storage_GetDeviceList(xo->storage); + if (origDeviceList) { + DBG_INFO(NULL, "Have a list of %d devices", AQH_Device_List_GetCount(origDeviceList)); + if (AQH_Device_List_GetCount(origDeviceList)=AQHOMEDATA_DEVICESPERMSG) { + DBG_INFO(NULL, "Sending %d devices", AQH_Device_List_GetCount(tmpDeviceList)); + _sendDeviceList(ep, tmpDeviceList, next?0:AQH_MSGDATA_DEVICES_FLAGS_LASTMSG, refMsgId); + AQH_Device_List_Clear(tmpDeviceList); + } + v=next; + } + if (AQH_Device_List_GetCount(tmpDeviceList)) { + DBG_INFO(NULL, "Sending %d devices", AQH_Device_List_GetCount(tmpDeviceList)); + _sendDeviceList(ep, tmpDeviceList, AQH_MSGDATA_DEVICES_FLAGS_LASTMSG, refMsgId); /* send remaining */ + } + AQH_Device_List_free(tmpDeviceList); } } + else { + /* empty list */ + _sendDeviceList(ep, NULL, AQH_MSGDATA_DEVICES_FLAGS_LASTMSG, refMsgId); + } } } @@ -109,7 +107,7 @@ void _sendDeviceList(AQH_OBJECT *ep, const AQH_DEVICE_LIST *vl, uint32_t flags, { AQH_MESSAGE *msg; - DBG_ERROR(NULL, "Sending msg (refMsgId=%d)", refMsgId); + DBG_INFO(NULL, "Sending msg (refMsgId=%d)", refMsgId); msg=AQH_IpcdMessageDevices_new(AQH_MSGTYPE_IPC_DATA_GETDEVICES_RSP, AQH_Endpoint_GetNextMessageId(ep), refMsgId, flags, vl); AQH_Endpoint_AddMsgOut(ep, msg); }