diff --git a/apps/main/apps.cpp b/apps/main/apps.cpp index 39e25df..18d291b 100644 --- a/apps/main/apps.cpp +++ b/apps/main/apps.cpp @@ -18,39 +18,6 @@ #include "ibrt.h" #include "key_handler.h" #include "led_control.h" -#ifdef GFPS_ENABLED -#include "app_gfps.h" -#ifdef GFPS_ENABLED -static void app_tell_battery_info_handler(uint8_t *batteryValueCount, - uint8_t *batteryValue) { - GFPS_BATTERY_STATUS_E status; - if (app_battery_is_charging()) { - status = BATTERY_CHARGING; - } else { - status = BATTERY_NOT_CHARGING; - } - - // TODO: add the charger case's battery level -#ifdef IBRT - if (app_tws_ibrt_tws_link_connected()) { - *batteryValueCount = 2; - } else { - *batteryValueCount = 1; - } -#else - *batteryValueCount = 1; -#endif - - TRACE(2, "%s,*batteryValueCount is %d", __func__, *batteryValueCount); - if (1 == *batteryValueCount) { - batteryValue[0] = ((app_battery_current_level() + 1) * 10) | (status << 7); - } else { - batteryValue[0] = ((app_battery_current_level() + 1) * 10) | (status << 7); - batteryValue[1] = ((app_battery_current_level() + 1) * 10) | (status << 7); - } -} -#endif -#endif #ifdef BTIF_BLE_APP_DATAPATH_SERVER #include "app_ble_cmd_handler.h" diff --git a/apps/main/gfps.cpp b/apps/main/gfps.cpp index c88990c..f205acd 100644 --- a/apps/main/gfps.cpp +++ b/apps/main/gfps.cpp @@ -1,5 +1,40 @@ // Google Fast pairing Service +#include "common_apps_imports.h" + +#ifdef GFPS_ENABLED +#include "app_gfps.h" +#ifdef GFPS_ENABLED +static void app_tell_battery_info_handler(uint8_t *batteryValueCount, + uint8_t *batteryValue) { + GFPS_BATTERY_STATUS_E status; + if (app_battery_is_charging()) { + status = BATTERY_CHARGING; + } else { + status = BATTERY_NOT_CHARGING; + } + + // TODO: add the charger case's battery level +#ifdef IBRT + if (app_tws_ibrt_tws_link_connected()) { + *batteryValueCount = 2; + } else { + *batteryValueCount = 1; + } +#else + *batteryValueCount = 1; +#endif + + TRACE(2, "%s,*batteryValueCount is %d", __func__, *batteryValueCount); + if (1 == *batteryValueCount) { + batteryValue[0] = ((app_battery_current_level() + 1) * 10) | (status << 7); + } else { + batteryValue[0] = ((app_battery_current_level() + 1) * 10) | (status << 7); + batteryValue[1] = ((app_battery_current_level() + 1) * 10) | (status << 7); + } +} +#endif +#endif #ifdef GFPS_ENABLED static void app_tell_battery_info_handler(uint8_t *batteryValueCount,