diff options
| author | JF <jf@codingfield.com> | 2020-05-17 08:29:13 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2020-05-17 08:29:13 (GMT) |
| commit | 8a94750e30399bfb204cbec59a769d9d1b6b5baa (patch) | |
| tree | 8a1a58beae54e238d28aff116c900f3b428b7db4 /src/Components/Ble/DeviceInformationService.h | |
| parent | 86d5732b960fbe7f81ed711b2de7e6b79293c96a (diff) | |
| parent | be1ad9b07083e656a649d223750ff4b14b781b7b (diff) | |
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/Components/Ble/DeviceInformationService.h')
| -rw-r--r-- | src/Components/Ble/DeviceInformationService.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/Components/Ble/DeviceInformationService.h b/src/Components/Ble/DeviceInformationService.h new file mode 100644 index 0000000..6249893 --- /dev/null +++ b/src/Components/Ble/DeviceInformationService.h @@ -0,0 +1,67 @@ +#pragma once +#include <cstdint> +#include <array> + +#include <host/ble_gap.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 char* manufacturerName = "Codingfield"; + static constexpr char* modelNumber = "1"; + static constexpr char* serialNumber = "9.8.7.6.5.4"; + static constexpr char* fwRevision = "0.5.0"; + static constexpr char* hwRevision = "1.0.0"; + + 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 + }; + + struct ble_gatt_chr_def characteristicDefinition[6]; + struct ble_gatt_svc_def serviceDefinition[2]; + + + }; + } +}
\ No newline at end of file |
