2020-04-23 18:34:38 +00:00
|
|
|
#pragma once
|
2020-11-15 14:05:51 +00:00
|
|
|
#define min // workaround: nimble's min/max macros conflict with libstdc++
|
|
|
|
#define max
|
2020-04-23 18:34:38 +00:00
|
|
|
#include <host/ble_gap.h>
|
2020-11-15 14:05:51 +00:00
|
|
|
#undef max
|
|
|
|
#undef min
|
|
|
|
#include "Version.h"
|
2020-04-23 18:34:38 +00:00
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace Controllers {
|
|
|
|
class DeviceInformationService {
|
2021-04-24 09:00:45 +00:00
|
|
|
public:
|
2021-04-18 17:28:14 +00:00
|
|
|
DeviceInformationService();
|
|
|
|
void Init();
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
int OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-24 09:00:45 +00:00
|
|
|
private:
|
2021-04-18 17:28:14 +00:00
|
|
|
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};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
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";
|
2020-09-02 19:31:31 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
static constexpr ble_uuid16_t deviceInfoUuid {.u {.type = BLE_UUID_TYPE_16}, .value = deviceInfoId};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
static constexpr ble_uuid16_t manufacturerNameUuid {.u {.type = BLE_UUID_TYPE_16}, .value = manufacturerNameId};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
static constexpr ble_uuid16_t modelNumberUuid {.u {.type = BLE_UUID_TYPE_16}, .value = modelNumberId};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
static constexpr ble_uuid16_t serialNumberUuid {.u {.type = BLE_UUID_TYPE_16}, .value = serialNumberId};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
static constexpr ble_uuid16_t fwRevisionUuid {.u {.type = BLE_UUID_TYPE_16}, .value = fwRevisionId};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
static constexpr ble_uuid16_t hwRevisionUuid {.u {.type = BLE_UUID_TYPE_16}, .value = hwRevisionId};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
static constexpr ble_uuid16_t swRevisionUuid {.u {.type = BLE_UUID_TYPE_16}, .value = swRevisionId};
|
2020-04-23 18:34:38 +00:00
|
|
|
|
2021-04-18 17:28:14 +00:00
|
|
|
struct ble_gatt_chr_def characteristicDefinition[7];
|
|
|
|
struct ble_gatt_svc_def serviceDefinition[2];
|
2020-04-23 18:34:38 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|