summaryrefslogtreecommitdiff
path: root/src/Components/Ble/DeviceInformationService.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-09-02 19:31:31 (GMT)
committerJF <jf@codingfield.com>2020-09-02 19:31:31 (GMT)
commit1aa5b0a440de3015b5b4c88aa32d149a69bfa707 (patch)
tree28e6735e6bce40c59bd237e250113ac687494c2b /src/Components/Ble/DeviceInformationService.cpp
parent61e7ad9186831269f8ea9478c75dd6a57e474638 (diff)
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.
Diffstat (limited to 'src/Components/Ble/DeviceInformationService.cpp')
-rw-r--r--src/Components/Ble/DeviceInformationService.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Components/Ble/DeviceInformationService.cpp b/src/Components/Ble/DeviceInformationService.cpp
index c1d5554..406db1c 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<DeviceInformationService*>(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;
}
@@ -85,6 +90,12 @@ DeviceInformationService::DeviceInformationService() :
.flags = BLE_GATT_CHR_F_READ,
},
{
+ .uuid = (ble_uuid_t *) &swRevisionUuid,
+ .access_cb = DeviceInformationCallback,
+ .arg = this,
+ .flags = BLE_GATT_CHR_F_READ,
+ },
+ {
0
}
},