From 1aa5b0a440de3015b5b4c88aa32d149a69bfa707 Mon Sep 17 00:00:00 2001 From: JF Date: Wed, 2 Sep 2020 21:31:31 +0200 Subject: Fix firmware version reported by Device Information Service on BLE. It was previously hard-coded, it is now set by CMake accoridng to the project version. Fix Manufacturer name, model number, sw revision according to https://wiki.pine64.org/index.php?title=Firmware_versioning_for_companion_apps. --- src/Components/Ble/DeviceInformationService.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Components/Ble/DeviceInformationService.cpp') diff --git a/src/Components/Ble/DeviceInformationService.cpp b/src/Components/Ble/DeviceInformationService.cpp index c1d55541..406db1cf 100644 --- a/src/Components/Ble/DeviceInformationService.cpp +++ b/src/Components/Ble/DeviceInformationService.cpp @@ -8,6 +8,8 @@ constexpr ble_uuid16_t DeviceInformationService::serialNumberUuid; constexpr ble_uuid16_t DeviceInformationService::fwRevisionUuid; constexpr ble_uuid16_t DeviceInformationService::deviceInfoUuid; constexpr ble_uuid16_t DeviceInformationService::hwRevisionUuid; +constexpr ble_uuid16_t DeviceInformationService::swRevisionUuid; + int DeviceInformationCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { auto deviceInformationService = static_cast(arg); @@ -44,6 +46,9 @@ int DeviceInformationService::OnDeviceInfoRequested(uint16_t conn_handle, uint16 case hwRevisionId: str = hwRevision; break; + case swRevisionId: + str = swRevision; + break; default: return BLE_ATT_ERR_UNLIKELY; } @@ -84,6 +89,12 @@ DeviceInformationService::DeviceInformationService() : .arg = this, .flags = BLE_GATT_CHR_F_READ, }, + { + .uuid = (ble_uuid_t *) &swRevisionUuid, + .access_cb = DeviceInformationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + }, { 0 } -- cgit v1.2.3-70-g09d2