diff --git a/frameworks/src/sensor_agent_proxy.c b/frameworks/src/sensor_agent_proxy.c index 00f47568e4f0810d2bad10e979c7b57c4670a28e..458c49e51ec9bedf88888c5842ac83f24204de71 100644 --- a/frameworks/src/sensor_agent_proxy.c +++ b/frameworks/src/sensor_agent_proxy.c @@ -130,7 +130,7 @@ int32_t GetSensorInfos(IOwner owner, IpcIo *reply) if (notify == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "%s notify is null", __func__); return SENSOR_ERROR_INVALID_PARAM; - } else { + } else { ReadInt32(reply, &(notify->retCode)); if (notify->retCode < 0) { HILOG_ERROR(HILOG_MODULE_APP, "%s failed, retCode: %d", __func__, notify->retCode); @@ -171,7 +171,7 @@ int32_t Notify(IOwner owner, int32_t code, IpcIo *reply) HILOG_DEBUG(HILOG_MODULE_APP, "%s begin", __func__); int32_t functionId = -1; ReadInt32(reply, &functionId); - if (functionId == SENSOR_SERVICE_ID_GetAllSensors) { + if (functionId == SENSOR_SERVICE_ID_GET_ALL_SENSORS) { return GetSensorInfos(owner, reply); } int32_t *ret = (int32_t *)owner; @@ -179,7 +179,7 @@ int32_t Notify(IOwner owner, int32_t code, IpcIo *reply) HILOG_ERROR(HILOG_MODULE_APP, "%s ret is null", __func__); return SENSOR_ERROR_INVALID_PARAM; } else { - if ((functionId > SENSOR_SERVICE_ID_GetAllSensors) && (functionId < SENSORMGR_LISTENER_NAME_LEN)) { + if ((functionId > SENSOR_SERVICE_ID_GET_ALL_SENSORS) && (functionId < SENSORMGR_LISTENER_NAME_LEN)) { ReadInt32(reply, ret); HILOG_DEBUG(HILOG_MODULE_APP, "%s ret: %d", __func__, *ret); } else { @@ -263,7 +263,7 @@ int32_t RegisterSensorChannel(const void *proxy, int32_t sensorId) return SENSOR_ERROR_INVALID_PARAM; } int32_t retCode = -1; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SubscribeSensor, &request, &retCode, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SUBSCRIBE_SENSOR, &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; @@ -292,7 +292,7 @@ int32_t UnregisterSensorChannel(const void *proxy, int32_t sensorId) return SENSOR_ERROR_INVALID_PARAM; } else { int32_t retCode = -1; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_UnsubscribeSensor, &request, &retCode, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_UN_SUBSCRIBE_SENSOR, &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; @@ -323,7 +323,7 @@ int32_t InitSensorList(const void *proxy) char data[MAX_IO_SIZE]; IpcIoInit(&request, data, MAX_IO_SIZE, IPC_MAX_OBJECTS); IClientProxy *client = (IClientProxy *)proxy; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_GetAllSensors, &request, &owner, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_GET_ALL_SENSORS, &request, &owner, Notify); if ((ret != SENSOR_OK) || (owner.retCode != SENSOR_OK)) { HILOG_ERROR(HILOG_MODULE_APP, "%s failed, ret: %d, retCode: %d", __func__, ret, owner.retCode); return SENSOR_ERROR_INVALID_PARAM; @@ -364,7 +364,7 @@ int32_t ActivateSensorByProxy(const void *proxy, int32_t sensorId, const SensorU WriteInt32(&request, sensorId); int32_t retCode = -1; IClientProxy *client = (IClientProxy *)proxy; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_ActivateSensor, &request, &retCode, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_ACTIVATE_SENSOR, &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; @@ -385,7 +385,7 @@ int32_t DeactivateSensorByProxy(const void *proxy, int32_t sensorId, const Senso WriteInt32(&request, sensorId); int32_t retCode = -1; IClientProxy *client = (IClientProxy *)proxy; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_DeactivateSensor, &request, &retCode, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_DEACTIVATE_SENSOR, &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; @@ -409,7 +409,7 @@ int32_t SetBatchByProxy(const void *proxy, int32_t sensorId, const SensorUser *u WriteInt64(&request, reportInterval); int32_t retCode = -1; IClientProxy *client = (IClientProxy *)proxy; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SetBatchs, &request, &retCode, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SET_BATCHS, &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; @@ -494,7 +494,7 @@ int32_t SetModeByProxy(const void *proxy, int32_t sensorId, const SensorUser *us WriteInt32(&request, mode); int32_t retCode = -1; IClientProxy *client = (IClientProxy *)proxy; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SetMode, &request, &retCode, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SET_MODE, &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; @@ -516,7 +516,7 @@ int32_t SetOptionByProxy(const void *proxy, int32_t sensorId, const SensorUser * WriteInt32(&request, option); int32_t retCode = -1; IClientProxy *client = (IClientProxy *)proxy; - int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SetOption, &request, &retCode, Notify); + int32_t ret = client->Invoke(client, SENSOR_SERVICE_ID_SET_OPTION, &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; diff --git a/services/include/sensor_service.h b/services/include/sensor_service.h index 399ea117ebcf73c94c7a6806c40ebc034afd1e2f..7dd1403007dbdaa27cf620b9023ce36fdb44c692 100755 --- a/services/include/sensor_service.h +++ b/services/include/sensor_service.h @@ -38,14 +38,14 @@ extern "C" { #define SENSOR_SERVICE "sensor_service" #define SENSOR_FEATURE "sensor_feature" -#define SENSOR_SERVICE_ID_GetAllSensors 0 -#define SENSOR_SERVICE_ID_ActivateSensor 1 -#define SENSOR_SERVICE_ID_DeactivateSensor 2 -#define SENSOR_SERVICE_ID_SetBatchs 3 -#define SENSOR_SERVICE_ID_SubscribeSensor 4 -#define SENSOR_SERVICE_ID_UnsubscribeSensor 5 -#define SENSOR_SERVICE_ID_SetMode 6 -#define SENSOR_SERVICE_ID_SetOption 7 +#define SENSOR_SERVICE_ID_GET_ALL_SENSORS 0 +#define SENSOR_SERVICE_ID_ACTIVATE_SENSOR 1 +#define SENSOR_SERVICE_ID_DEACTIVATE_SENSOR 2 +#define SENSOR_SERVICE_ID_SET_BATCHS 3 +#define SENSOR_SERVICE_ID_SUBSCRIBE_SENSOR 4 +#define SENSOR_SERVICE_ID_UN_SUBSCRIBE_SENSOR 5 +#define SENSOR_SERVICE_ID_SET_MODE 6 +#define SENSOR_SERVICE_ID_SET_OPTION 7 #define SENSORMGR_LISTENER_NAME_LEN 8 typedef struct SensorFeatureApi { diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c index e04f215fe1c5b38b56fa57cc97658f2b6e69fd38..6dc928df433c3598962eeb399e3204692bace366 100755 --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -24,7 +24,7 @@ int32_t GetAllSensorsInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_GetAllSensors); + WriteInt32(reply, SENSOR_SERVICE_ID_GET_ALL_SENSORS); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); WriteInt32(reply, SENSOR_ERROR_UNKNOWN); @@ -48,7 +48,7 @@ int32_t GetAllSensorsInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *rep int32_t ActivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_ActivateSensor); + WriteInt32(reply, SENSOR_SERVICE_ID_ACTIVATE_SENSOR); int32_t sensorId = -1; ReadInt32(req, &sensorId); if (defaultApi == NULL) { @@ -66,7 +66,7 @@ int32_t ActivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *re int32_t DeactivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_DeactivateSensor); + WriteInt32(reply, SENSOR_SERVICE_ID_DEACTIVATE_SENSOR); int32_t sensorId = -1; ReadInt32(req, &sensorId); if (defaultApi == NULL) { @@ -84,7 +84,7 @@ int32_t DeactivateSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo * int32_t SetBatchInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_SetBatchs); + WriteInt32(reply, SENSOR_SERVICE_ID_SET_BATCHS); int32_t sensorId = -1; ReadInt32(req, &sensorId); int64_t updateInterval; @@ -106,7 +106,7 @@ int32_t SetBatchInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) int32_t SubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_SubscribeSensor); + WriteInt32(reply, SENSOR_SERVICE_ID_SUBSCRIBE_SENSOR); int32_t sensorId = -1; ReadInt32(req, &sensorId); if (defaultApi == NULL) { @@ -125,14 +125,14 @@ int32_t SubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *r int32_t UnsubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_UnsubscribeSensor); + WriteInt32(reply, SENSOR_SERVICE_ID_UN_SUBSCRIBE_SENSOR); int32_t sensorId = -1; ReadInt32(req, &sensorId); if (defaultApi == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); WriteInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; - } else { + } else { SensorUser sensorUser; int32_t ret = defaultApi->UnsubscribeSensor(sensorId, &sensorUser); WriteInt32(reply, ret); @@ -143,7 +143,7 @@ int32_t UnsubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo int32_t SetModeInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_SetMode); + WriteInt32(reply, SENSOR_SERVICE_ID_SET_MODE); int32_t sensorId = -1; ReadInt32(req, &sensorId); int32_t mode = -1; @@ -163,7 +163,7 @@ int32_t SetModeInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) int32_t SetOptionInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo *reply) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); - WriteInt32(reply, SENSOR_SERVICE_ID_SetOption); + WriteInt32(reply, SENSOR_SERVICE_ID_SET_OPTION); int32_t sensorId = -1; ReadInt32(req, &sensorId); int32_t option = -1; @@ -200,7 +200,7 @@ int32_t Invoke(IServerProxy *iProxy, int funcId, void *origin, IpcIo *req, IpcIo return SENSOR_ERROR_INVALID_PARAM; } SensorFeatureApi *defaultApi = (SensorFeatureApi *)iProxy; - if ((funcId >= 0) && (funcId <= SENSOR_SERVICE_ID_UnsubscribeSensor)) { + if ((funcId >= 0) && (funcId <= SENSOR_SERVICE_ID_UN_SUBSCRIBE_SENSOR)) { return g_invokeFuncList[funcId](defaultApi, req, reply); } return SENSOR_ERROR_INVALID_PARAM;