diff options
author | JF002 <JF002@users.noreply.github.com> | 2020-05-16 16:15:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 16:15:38 +0200 |
commit | d58f57b1b5a616debf893f209f1d96cac101489e (patch) | |
tree | 9df19606a2615586bb533d39fb42c84be8774092 /src/Components/Ble/DfuService.h | |
parent | 24a1f87a78584d3b67f07ea7972ea0d8e1f8167c (diff) | |
parent | d6c6ac4cf5801e17caf7bfc0878423703ed0413b (diff) |
Merge pull request #30 from JF002/nimble
Nimble
Diffstat (limited to 'src/Components/Ble/DfuService.h')
-rw-r--r-- | src/Components/Ble/DfuService.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/Components/Ble/DfuService.h b/src/Components/Ble/DfuService.h new file mode 100644 index 00000000..6249893d --- /dev/null +++ b/src/Components/Ble/DfuService.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 |