Merge "gfrm200 remote battery check"
diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c
index 58be9fd..522cb25 100644
--- a/profiles/battery/battery.c
+++ b/profiles/battery/battery.c
@@ -64,8 +64,6 @@
#define BATTERY_DIR "/tmp/batteries"
-#define CHECK_TIME (8*60*60)
-
struct service {
guint attio_id;
uint16_t value_handle;
@@ -82,8 +80,6 @@
struct service level;
int batt_level;
-
- time_t next_check;
};
static GSList *devices = NULL;
@@ -181,7 +177,6 @@
static void check_level(struct batt_device *battdev)
{
- battdev->next_check = wallclock() + CHECK_TIME;
if (battdev->level.value_handle == 0)
return;
@@ -189,18 +184,6 @@
level_read_char_cb, battdev);
}
-static int is_time_for_level_check(struct batt_device* battdev)
-{
-
- time_t now = wallclock();
- if (now < battdev->next_check) {
- DBG("BATT not time for level check yet");
- return 0;
- }
- DBG("BATT time for battery check");
- return 1;
-}
-
static void char_discovered_cb(uint8_t status, GSList *chars, void* user_data)
{
struct batt_device *battdev = user_data;
@@ -233,10 +216,7 @@
if (g_strcmp0(chr->uuid, BATT_LEVEL_UUID) == 0) {
battdev->level.value_handle = chr->value_handle;
DBG("BATT found BATT_LEVEL_UUID value_handle=0x%04x", chr->value_handle);
- //discover_desc(battdev, chr, next);
- if (is_time_for_level_check(battdev)) {
- check_level(battdev);
- }
+ check_level(battdev);
}
}
}
@@ -259,9 +239,7 @@
prim->range.end, NULL,
char_discovered_cb, battdev);
} else {
- if (is_time_for_level_check(battdev)) {
- check_level(battdev);
- }
+ check_level(battdev);
}
}