int ret_val = BATTERY_MONITOR_ERROR_NONE;
bool mode = false;
- gl_hash = g_hash_table_new_full(g_str_hash, g_str_equal, bm_data_free, g_free);
+ gl_hash = g_hash_table_new_full(g_str_hash, g_str_equal, bm_data_free, NULL);
if (!gl_hash)
_ERR("Global Hash creation failed");
for (id = BM_PLUGIN_ID_BLE; id <= BM_PLUGIN_ID_DEVICE_NETWORK; ++id) {
#endif
bm_get_feature_plugin_handle(&bm_plugin, id);
-
+ handle = NULL;
if (!bm_plugin || !bm_plugin->api) {
_WARN("Plugin with ID: %s is NULL", bm_get_plugin_name(id));
continue;
}
-
_INFO(" requesting data from plugin - %s", bm_get_plugin_name(id));
switch (id) {
case BM_PLUGIN_ID_BLE: /* BLE Data */
ret_val = bm_plugin->api->get_feature_data(&handle, id);
-
- BM_CHECK_VAL((ret_val == BATTERY_MONITOR_ERROR_NONE), "'ble' data not available");
-
+ if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
+ _DBG("ble data not available : improper value");
+ handle = NULL;
+ }
if (handle != NULL) {
_DBG("received ble data handle");
bm_data_handle->bm_ble_handle = (bm_bluetooth_st *)(handle);
break;
case BM_PLUGIN_ID_WIFI: /* WI-FI Data */
ret_val = bm_plugin->api->get_feature_data(&handle, id);
-
- BM_CHECK_VAL((ret_val == BATTERY_MONITOR_ERROR_NONE), "'wifi' data not available");
-
+ if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
+ _DBG("wifi data not available : improper value");
+ handle = NULL;
+ }
if (handle != NULL) {
_DBG("received wifi data handle");
bm_data_handle->bm_wifi_handle = (bm_wifi_st *)(handle);
break;
case BM_PLUGIN_ID_CPU: /* CPU Data */
ret_val = bm_plugin->api->get_feature_data(&handle, id);
-
- BM_CHECK_VAL((ret_val == BATTERY_MONITOR_ERROR_NONE), "'cpu' data not available");
-
+ if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
+ _DBG("cpu data not available : improper value");
+ handle = NULL;
+ }
if (handle != NULL) {
_DBG("received cpu data handle");
bm_data_handle->bm_cpu_handle = (bm_cpu_st *)(handle);
break;
case BM_PLUGIN_ID_DISPLAY: /* DISPLAY Data */
ret_val = bm_plugin->api->get_feature_data(&handle, id);
-
- BM_CHECK_VAL((ret_val == BATTERY_MONITOR_ERROR_NONE), "'display' data not available");
-
+ if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
+ _DBG("display data not available : improper value");
+ handle = NULL;
+ }
if (handle != NULL) {
_DBG("received display data handle");
bm_data_handle->bm_display_handle = (bm_display_st *)(handle);
break;
case BM_PLUGIN_ID_DEVICE_NETWORK: /* DEVICE-NETWORK Data */
ret_val = bm_plugin->api->get_feature_data(&handle, id);
-
- BM_CHECK_VAL((ret_val == BATTERY_MONITOR_ERROR_NONE), "'device-network' data not available");
-
+ if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
+ _DBG("device-network data not available : improper value");
+ handle = NULL;
+ }
if (handle != NULL) {
_DBG("received device network data handle");
bm_data_handle->bm_dn_handle = (bm_device_network_st *)(handle);
#ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
case BM_PLUGIN_ID_GPS_SENSOR: /* GPS Sensor Data */
ret_val = bm_plugin->api->get_feature_data(&handle, id);
-
- BM_CHECK_VAL((ret_val == BATTERY_MONITOR_ERROR_NONE), "'gps-sensor' data not available");
-
+ if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
+ _DBG("gps data not available : improper value");
+ handle = NULL;
+ }
if (handle != NULL) {
_DBG("received gps data handle");
bm_data_handle->bm_gps_handle = (bm_gps_st *)(handle);
break;
case BM_PLUGIN_ID_HRM_SENSOR: /* HRM Sensor Data */
ret_val = bm_plugin->api->get_feature_data(&handle, id);
-
- BM_CHECK_VAL((ret_val == BATTERY_MONITOR_ERROR_NONE), "'hrm-sensor' data not available");
-
+ if (ret_val != BATTERY_MONITOR_ERROR_NONE) {
+ _DBG("hrm data not available : improper value");
+ handle = NULL;
+ }
if (handle != NULL) {
_DBG("received hrm data handle");
bm_data_handle->bm_hrm_handle = (bm_hrm_sensor_st *)(handle);