1
0
forked from me/IronOS

Track and return Operating Mode with BLE (#1553)

Track and return Operating Mode with BLE
This commit is contained in:
Thomas White
2023-02-04 06:33:43 +08:00
committed by GitHub
parent e19e1a066d
commit 9802a622d5
7 changed files with 33 additions and 3 deletions

View File

@@ -20,6 +20,7 @@
#include "log.h"
#include "uuid.h"
#include "OperatingModes.h"
#include "USBPD.h"
#include "ble_characteristics.h"
#include "ble_handlers.h"
@@ -30,7 +31,8 @@
#include "pd.h"
#endif
extern TickType_t lastMovementTime;
extern TickType_t lastMovementTime;
extern OperatingMode currentMode;
int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, u16_t len, u16_t offset) {
if (attr == NULL || attr->uuid == NULL) {
@@ -123,6 +125,9 @@ int ble_char_read_status_callback(struct bt_conn *conn, const struct bt_gatt_att
case 13:
// Operating mode
// TODO: Needs tracking
temp = currentMode;
memcpy(buf, &temp, sizeof(temp));
return sizeof(temp);
break;
case 14:
// Estimated watts
@@ -237,4 +242,4 @@ int ble_char_write_setting_value_callback(struct bt_conn *conn, const struct bt_
}
MSG("Unhandled attr write %d | %d\n", (uint32_t)attr->uuid, uuid_value);
return 0;
}
}