diff --git a/frameworks/src/sensor_agent_proxy.c b/frameworks/src/sensor_agent_proxy.c index c14a04de9a00e99d69760bdbf93c843b4da061d9..47b77b40fae8780057e65e47b554233d273d3563 100755 --- a/frameworks/src/sensor_agent_proxy.c +++ b/frameworks/src/sensor_agent_proxy.c @@ -124,39 +124,44 @@ int32_t GetSensorInfos(IOwner owner, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "%s begin", __func__); SensorNotifyBuffer *notify = (SensorNotifyBuffer *)owner; - notify->retCode = IpcIoPopInt32(reply); - if (notify->retCode < 0) { - HILOG_ERROR(HILOG_MODULE_APP, "%s failed, retCode: %d", __func__, notify->retCode); + if (notify == null) { + HILOG_ERROR(HILOG_MODULE_APP, "%s notify is null", __func__); return SENSOR_ERROR_INVALID_PARAM; - } - notify->count = IpcIoPopInt32(reply); - BuffPtr *dataBuf = IpcIoPopDataBuff(reply); - if ((notify->count <= 0) || (dataBuf == NULL) || (dataBuf->buff == NULL)) { - HILOG_ERROR(HILOG_MODULE_APP, "%s failed, count is incorrect or dataBuf is NULL or buff is NULL", __func__); - notify->retCode = SENSOR_ERROR_INVALID_PARAM; - return SENSOR_ERROR_INVALID_PARAM; - } - SensorInfo *sensorInfo = (SensorInfo *)(dataBuf->buff); - *(notify->sensorInfo) = (SensorInfo *)malloc(sizeof(SensorInfo) * notify->count); - if (*(notify->sensorInfo) == NULL) { - HILOG_ERROR(HILOG_MODULE_APP, "%s malloc sensorInfo failed", __func__); - FreeBuffer(NULL, dataBuf->buff); - notify->retCode = SENSOR_ERROR_INVALID_PARAM; - return SENSOR_ERROR_INVALID_PARAM; - } - for (int32_t i = 0; i < notify->count; i++) { - if (memcpy_s((*(notify->sensorInfo) + i), sizeof(SensorInfo), (sensorInfo + i), - sizeof(SensorInfo))) { - HILOG_ERROR(HILOG_MODULE_APP, "%s copy sensorInfo failed", __func__); + } else { + notify->retCode = IpcIoPopInt32(reply); + if (notify->retCode < 0) { + HILOG_ERROR(HILOG_MODULE_APP, "%s failed, retCode: %d", __func__, notify->retCode); + return SENSOR_ERROR_INVALID_PARAM; + } + notify->count = IpcIoPopInt32(reply); + BuffPtr *dataBuf = IpcIoPopDataBuff(reply); + if ((notify->count <= 0) || (dataBuf == NULL) || (dataBuf->buff == NULL)) { + HILOG_ERROR(HILOG_MODULE_APP, "%s failed, count is incorrect or dataBuf is NULL or buff is NULL", __func__); + notify->retCode = SENSOR_ERROR_INVALID_PARAM; + return SENSOR_ERROR_INVALID_PARAM; + } + SensorInfo *sensorInfo = (SensorInfo *)(dataBuf->buff); + *(notify->sensorInfo) = (SensorInfo *)malloc(sizeof(SensorInfo) * notify->count); + if (*(notify->sensorInfo) == NULL) { + HILOG_ERROR(HILOG_MODULE_APP, "%s malloc sensorInfo failed", __func__); FreeBuffer(NULL, dataBuf->buff); - free(*(notify->sensorInfo)); - *(notify->sensorInfo) = NULL; notify->retCode = SENSOR_ERROR_INVALID_PARAM; return SENSOR_ERROR_INVALID_PARAM; } + for (int32_t i = 0; i < notify->count; i++) { + if (memcpy_s((*(notify->sensorInfo) + i), sizeof(SensorInfo), (sensorInfo + i), + sizeof(SensorInfo))) { + HILOG_ERROR(HILOG_MODULE_APP, "%s copy sensorInfo failed", __func__); + FreeBuffer(NULL, dataBuf->buff); + free(*(notify->sensorInfo)); + *(notify->sensorInfo) = NULL; + notify->retCode = SENSOR_ERROR_INVALID_PARAM; + return SENSOR_ERROR_INVALID_PARAM; + } + } + FreeBuffer(NULL, dataBuf->buff); + return notify->retCode; } - FreeBuffer(NULL, dataBuf->buff); - return notify->retCode; } int32_t Notify(IOwner owner, int32_t code, IpcIo *reply) @@ -167,17 +172,22 @@ int32_t Notify(IOwner owner, int32_t code, IpcIo *reply) return GetSensorInfos(owner, reply); } int32_t *ret = (int32_t *)owner; - if ((functionId > SENSOR_SERVICE_ID_GetAllSensors) && (functionId < SENSORMGR_LISTENER_NAME_LEN)) { - *ret = IpcIoPopInt32(reply); - HILOG_DEBUG(HILOG_MODULE_APP, "%s ret: %d", __func__, *ret); + if (ret == NULL) { + HILOG_ERROR(HILOG_MODULE_APP, "%s ret is null", __func__); + return SENSOR_ERROR_INVALID_PARAM; } else { - *ret = SENSOR_ERROR_INVALID_PARAM; - HILOG_ERROR(HILOG_MODULE_APP, "%s functionId: %d is invalid", __func__, functionId); + if ((functionId > SENSOR_SERVICE_ID_GetAllSensors) && (functionId < SENSORMGR_LISTENER_NAME_LEN)) { + *ret = IpcIoPopInt32(reply); + HILOG_DEBUG(HILOG_MODULE_APP, "%s ret: %d", __func__, *ret); + } else { + *ret = SENSOR_ERROR_INVALID_PARAM; + HILOG_ERROR(HILOG_MODULE_APP, "%s functionId: %d is invalid", __func__, functionId); + } + return *ret; } - return *ret; } -void DispatchData(SensorEvent *sensorEvent) +void DispatchData(const SensorEvent *sensorEvent) { HILOG_DEBUG(HILOG_MODULE_APP, "%s begin", __func__); if (sensorEvent == NULL) { @@ -240,18 +250,23 @@ int32_t RegisterSensorChannel(const void *proxy, int32_t sensorId) return SENSOR_ERROR_INVALID_PARAM; } IClientProxy *client = (IClientProxy *)proxy; - int32_t retCode = -1; - ret = client->Invoke(client, SENSOR_SERVICE_ID_SubscribeSensor, &request, &retCode, Notify); - if ((ret != LITEIPC_OK) || (retCode != SENSOR_OK)) { - HILOG_ERROR(HILOG_MODULE_APP, "%s failed, ret: %d, retCode: %d", __func__, ret, retCode); + if (client == NULL) { + HILOG_ERROR(HILOG_MODULE_APP, "%s client is null", __func__); return SENSOR_ERROR_INVALID_PARAM; - } - if (g_sensorEvent == NULL) { - g_sensorEvent = (SensorEvent *)malloc(sizeof(SensorEvent)); - if (g_sensorEvent == NULL) { - HILOG_ERROR(HILOG_MODULE_APP, "%s malloc failed", __func__); + } else { + int32_t retCode = -1; + ret = client->Invoke(client, SENSOR_SERVICE_ID_SubscribeSensor, &request, &retCode, Notify); + if ((ret != LITEIPC_OK) || (retCode != SENSOR_OK)) { + HILOG_ERROR(HILOG_MODULE_APP, "%s failed, ret: %d, retCode: %d", __func__, ret, retCode); return SENSOR_ERROR_INVALID_PARAM; } + if (g_sensorEvent == NULL) { + g_sensorEvent = (SensorEvent *)malloc(sizeof(SensorEvent)); + if (g_sensorEvent == NULL) { + HILOG_ERROR(HILOG_MODULE_APP, "%s malloc failed", __func__); + return SENSOR_ERROR_INVALID_PARAM; + } + } } } else { HILOG_DEBUG(HILOG_MODULE_APP, "%s sensorChannel has been registered ", __func__); @@ -272,18 +287,23 @@ int32_t UnregisterSensorChannel(const void *proxy, int32_t sensorId) HILOG_ERROR(HILOG_MODULE_APP, "%s ipc communication failed", __func__); return SENSOR_ERROR_INVALID_PARAM; } - int32_t retCode = -1; IClientProxy *client = (IClientProxy *)proxy; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_UnsubscribeSensor, &request, &retCode, Notify); - if ((ret != SENSOR_OK) || (retCode != SENSOR_OK)) { - HILOG_ERROR(HILOG_MODULE_APP, "%s failed, ret: %d, retCode: %d", __func__, ret, retCode); + if (client == NULL) { + HILOG_ERROR(HILOG_MODULE_APP, "%s client is null", __func__); return SENSOR_ERROR_INVALID_PARAM; + } else { + int32_t retCode = -1; + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_UnsubscribeSensor, &request, &retCode, Notify); + if ((ret != SENSOR_OK) || (retCode != SENSOR_OK)) { + HILOG_ERROR(HILOG_MODULE_APP, "%s failed, ret: %d, retCode: %d", __func__, ret, retCode); + return SENSOR_ERROR_INVALID_PARAM; + } + if (g_sensorEvent != NULL) { + free(g_sensorEvent); + g_sensorEvent = NULL; + } + HILOG_DEBUG(HILOG_MODULE_APP, "%s sensorChannel has been destroyed ", __func__); } - if (g_sensorEvent != NULL) { - free(g_sensorEvent); - g_sensorEvent = NULL; - } - HILOG_DEBUG(HILOG_MODULE_APP, "%s sensorChannel has been destroyed ", __func__); } return SENSOR_OK; } @@ -435,7 +455,7 @@ int32_t SubscribeSensorByProxy(const void *proxy, int32_t sensorId, const Sensor HILOG_ERROR(HILOG_MODULE_APP, "%s proxy or user or callback is NULL", __func__); return SENSOR_ERROR_INVALID_PARAM; } - if (CheckSensorTypeId(sensorId)) { + if (CheckSensorTypeId(sensorId) != SENSOR_OK) { HILOG_ERROR(HILOG_MODULE_APP, "%s sensorid: %d is invalid", __func__, sensorId); return SENSOR_ERROR_INVALID_PARAM; } @@ -459,7 +479,7 @@ int32_t UnsubscribeSensorByProxy(const void *proxy, int32_t sensorId, const Sens HILOG_ERROR(HILOG_MODULE_APP, "%s proxy or user or callback is NULL", __func__); return SENSOR_ERROR_INVALID_PARAM; } - if (CheckSensorTypeId(sensorId)) { + if (CheckSensorTypeId(sensorId) != SENSOR_OK) { HILOG_ERROR(HILOG_MODULE_APP, "%s sensorid: %d is invalid", __func__, sensorId); return SENSOR_ERROR_INVALID_PARAM; } diff --git a/interfaces/kits/native/test/performance/src/sensor_lite_test_performance.cpp b/interfaces/kits/native/test/performance/src/sensor_lite_test_performance.cpp index 5b1d5fa61cb4819edf45b3fcc54de914de8e306b..001687364c1a09624c928ea72c81c2cd058eddff 100755 --- a/interfaces/kits/native/test/performance/src/sensor_lite_test_performance.cpp +++ b/interfaces/kits/native/test/performance/src/sensor_lite_test_performance.cpp @@ -58,7 +58,7 @@ uint64_t GetCurrentMillSecTime() { struct timespec ts = {0, 0}; clock_gettime(CLOCK_REALTIME, &ts); - return ((ts.tv_sec * MS_PER_SECOND) + (ts.tv_nsec / NS_PER_MS)); + return (uint64_t)((ts.tv_sec * MS_PER_SECOND) + (ts.tv_nsec / NS_PER_MS)); } /** diff --git a/interfaces/kits/native/test/unittest/src/sensor_agent_interfaces_test.cpp b/interfaces/kits/native/test/unittest/src/sensor_agent_interfaces_test.cpp index 1f20f432befd47ea8a920144e7254ed08da7a28e..de4e706908158fda76290f53bf95518fa034f701 100755 --- a/interfaces/kits/native/test/unittest/src/sensor_agent_interfaces_test.cpp +++ b/interfaces/kits/native/test/unittest/src/sensor_agent_interfaces_test.cpp @@ -108,7 +108,7 @@ HWTEST_F(SensorAgentInterfacesTest, GetAllSensorsInterfaceTest003, TestSize.Leve */ HWTEST_F(SensorAgentInterfacesTest, GetAllSensorsInterfaceTest004, TestSize.Level1) { - HILOG_INFO(HILOG_MODULE_APP, "%GetAllSensorsInterfaceTest004 called"); + HILOG_INFO(HILOG_MODULE_APP, "GetAllSensorsInterfaceTest004 called"); SensorInfo *sensorInfo = (SensorInfo *)NULLPTR; int32_t ret = GetAllSensors(&sensorInfo, (int32_t *)NULLPTR); EXPECT_EQ(ret, SENSOR_ERROR_INVALID_PARAM) << "GetAllSensors ret = " << ret << endl; diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c index 5064f6bf4b317f01a3e54a797cfc309d145a33bc..f7bbb9d47cfd9af86179e07925d774921578c7bd 100755 --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -24,65 +24,69 @@ int32_t GetAllSensorsInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - SensorInfo *sensorInfo = NULL; - int32_t count = 0; + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_GetAllSensors); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else{ + SensorInfo *sensorInfo = NULL; + int32_t count = 0; + int32_t ret = defaultApi->GetAllSensors(&sensorInfo, &count); + if (ret != SENSOR_OK) { + HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, ret: %d", SENSOR_SERVICE, __func__, ret); + IpcIoPushInt32(reply, ret); + return ret; + } + BuffPtr dataBuff = { + .buffSz = (uint32_t)(count * sizeof(SensorInfo)), + .buff = sensorInfo + }; + IpcIoPushInt32(reply, SENSOR_OK); + IpcIoPushInt32(reply, count); + IpcIoPushDataBuff(reply, &dataBuff); + return SENSOR_OK; } - int32_t ret = defaultApi->GetAllSensors(&sensorInfo, &count); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_GetAllSensors); - if (ret != SENSOR_OK) { - HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, ret: %d", SENSOR_SERVICE, __func__, ret); - IpcIoPushInt32(reply, ret); - return ret; - } - BuffPtr dataBuff = { - .buffSz = (uint32_t)(count * sizeof(SensorInfo)), - .buff = sensorInfo - }; - IpcIoPushInt32(reply, SENSOR_OK); - IpcIoPushInt32(reply, count); - IpcIoPushDataBuff(reply, &dataBuff); - return SENSOR_OK; } int32_t ActivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_ActivateSensor); int32_t sensorId = IpcIoPopInt32(req); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else { + SensorUser sensorUser; + int32_t ret = defaultApi->ActivateSensor(sensorId, &sensorUser); + IpcIoPushInt32(reply, ret); + return ret; } - SensorUser sensorUser; - int32_t ret = defaultApi->ActivateSensor(sensorId, &sensorUser); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_ActivateSensor); - IpcIoPushInt32(reply, ret); - return ret; } int32_t DeactivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_DeactivateSensor); int32_t sensorId = IpcIoPopInt32(req); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else { + SensorUser sensorUser; + int32_t ret = defaultApi->DeactivateSensor(sensorId, &sensorUser); + IpcIoPushInt32(reply, ret); + return ret; } - SensorUser sensorUser; - int32_t ret = defaultApi->DeactivateSensor(sensorId, &sensorUser); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_DeactivateSensor); - IpcIoPushInt32(reply, ret); - return ret; } int32_t SetBatchInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SetBatchs); int32_t sensorId = IpcIoPopInt32(req); int64_t updateInterval = IpcIoPopInt64(req); int64_t maxDelay = IpcIoPopInt64(req); @@ -90,79 +94,83 @@ int32_t SetBatchInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else { + SensorUser sensorUser; + int32_t ret = defaultApi->SetBatch(sensorId, &sensorUser, updateInterval, maxDelay); + IpcIoPushInt32(reply, ret); + return ret; } - SensorUser sensorUser; - int32_t ret = defaultApi->SetBatch(sensorId, &sensorUser, updateInterval, maxDelay); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SetBatchs); - IpcIoPushInt32(reply, ret); - return ret; } int32_t SubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SubscribeSensor); int32_t sensorId = IpcIoPopInt32(req); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else { + SensorUser sensorUser; + int32_t ret = defaultApi->SubscribeSensor(sensorId, &sensorUser); + SetSvcIdentity(req, reply); + IpcIoPushInt32(reply, ret); + return ret; } - SensorUser sensorUser; - int32_t ret = defaultApi->SubscribeSensor(sensorId, &sensorUser); - SetSvcIdentity(req, reply); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SubscribeSensor); - IpcIoPushInt32(reply, ret); - return ret; } int32_t UnsubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_UnsubscribeSensor); int32_t sensorId = IpcIoPopInt32(req); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else { + SensorUser sensorUser; + int32_t ret = defaultApi->UnsubscribeSensor(sensorId, &sensorUser); + IpcIoPushInt32(reply, ret); + return ret; } - SensorUser sensorUser; - int32_t ret = defaultApi->UnsubscribeSensor(sensorId, &sensorUser); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_UnsubscribeSensor); - IpcIoPushInt32(reply, ret); - return ret; } int32_t SetModeInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SetMode); int32_t sensorId = IpcIoPopInt32(req); int32_t mode = IpcIoPopInt32(req); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else { + SensorUser sensorUser; + int32_t ret = defaultApi->SetMode(sensorId, &sensorUser, mode); + IpcIoPushInt32(reply, ret); + return ret; } - SensorUser sensorUser; - int32_t ret = defaultApi->SetMode(sensorId, &sensorUser, mode); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SetMode); - IpcIoPushInt32(reply, ret); - return ret; } int32_t SetOptionInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); + IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SetOption); int32_t sensorId = IpcIoPopInt32(req); int32_t option = IpcIoPopInt32(req); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); IpcIoPushInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; + } else { + SensorUser sensorUser; + int32_t ret = defaultApi->SetOption(sensorId, &sensorUser, option); + IpcIoPushInt32(reply, ret); + return ret; } - SensorUser sensorUser; - int32_t ret = defaultApi->SetOption(sensorId, &sensorUser, option); - IpcIoPushInt32(reply, SENSOR_SERVICE_ID_SetOption); - IpcIoPushInt32(reply, ret); - return ret; } static InvokeFunc g_invokeFuncList[] = { diff --git a/services/src/sensor_service_impl.c b/services/src/sensor_service_impl.c index 6452d965aab3f671a77774a32401dcccd7c1db5e..be6b6860e0b2a2101cc3316ae24a45ac6c65a597 100755 --- a/services/src/sensor_service_impl.c +++ b/services/src/sensor_service_impl.c @@ -54,7 +54,7 @@ const char *SENSOR_GetName(Service *service) return SENSOR_SERVICE; } -static int SensorDataCallback(SensorEvent *event) +static int SensorDataCallback(const SensorEvent *event) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); if ((event == NULL) || (event->dataLen == 0)) {