summaryrefslogtreecommitdiff
path: root/src/components/ble/DeviceInformationService.h
diff options
context:
space:
mode:
authorAvamander <avamander@gmail.com>2020-10-02 22:16:48 +0300
committerAvamander <avamander@gmail.com>2020-10-02 22:16:48 +0300
commit6c86d1d9d706706fcb6f214aba8259e61ed68755 (patch)
tree2f4137a9916869cee18fd01449aa83ee586b9604 /src/components/ble/DeviceInformationService.h
parent4daab2692692d47af24a9384eb0f402821527882 (diff)
Fixed all the includes that were broken due to the renames
Diffstat (limited to 'src/components/ble/DeviceInformationService.h')
-rw-r--r--src/components/ble/DeviceInformationService.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/components/ble/DeviceInformationService.h b/src/components/ble/DeviceInformationService.h
new file mode 100644
index 00000000..25ab8402
--- /dev/null
+++ b/src/components/ble/DeviceInformationService.h
@@ -0,0 +1,76 @@
+#pragma once
+#include <cstdint>
+#include <array>
+
+#include <host/ble_gap.h>
+#include <Version.h>
+
+namespace Pinetime {
+ namespace Controllers {
+ class DeviceInformationService {
+ public:
+ DeviceInformationService();
+ void Init();
+
+ int OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle,
+ struct ble_gatt_access_ctxt *ctxt);
+
+ private:
+ static constexpr uint16_t deviceInfoId {0x180a};
+ static constexpr uint16_t manufacturerNameId {0x2a29};
+ static constexpr uint16_t modelNumberId {0x2a24};
+ static constexpr uint16_t serialNumberId {0x2a25};
+ static constexpr uint16_t fwRevisionId {0x2a26};
+ static constexpr uint16_t hwRevisionId {0x2a27};
+ static constexpr uint16_t swRevisionId {0x2a28};
+
+ static constexpr const char* manufacturerName = "PINE64";
+ static constexpr const char* modelNumber = "PineTime";
+ static constexpr const char* hwRevision = "1.0.0";
+ static constexpr const char* serialNumber = "0";
+ static constexpr const char* fwRevision = Version::VersionString();
+ static constexpr const char* swRevision = "InfiniTime";
+
+
+ static constexpr ble_uuid16_t deviceInfoUuid {
+ .u { .type = BLE_UUID_TYPE_16 },
+ .value = deviceInfoId
+ };
+
+ static constexpr ble_uuid16_t manufacturerNameUuid {
+ .u { .type = BLE_UUID_TYPE_16 },
+ .value = manufacturerNameId
+ };
+
+ static constexpr ble_uuid16_t modelNumberUuid {
+ .u { .type = BLE_UUID_TYPE_16 },
+ .value = modelNumberId
+ };
+
+ static constexpr ble_uuid16_t serialNumberUuid {
+ .u { .type = BLE_UUID_TYPE_16 },
+ .value = serialNumberId
+ };
+
+ static constexpr ble_uuid16_t fwRevisionUuid {
+ .u { .type = BLE_UUID_TYPE_16 },
+ .value = fwRevisionId
+ };
+
+ static constexpr ble_uuid16_t hwRevisionUuid {
+ .u {.type = BLE_UUID_TYPE_16},
+ .value = hwRevisionId
+ };
+
+ static constexpr ble_uuid16_t swRevisionUuid {
+ .u {.type = BLE_UUID_TYPE_16},
+ .value = swRevisionId
+ };
+
+ struct ble_gatt_chr_def characteristicDefinition[7];
+ struct ble_gatt_svc_def serviceDefinition[2];
+
+
+ };
+ }
+} \ No newline at end of file