Implemented a few functions.
This commit is contained in:
@@ -77,42 +77,42 @@ namespace Pinetime {
|
||||
* Checks if an event of a certain type exists in the timeline
|
||||
* @return
|
||||
*/
|
||||
bool HasTimelineEventOfType(const WeatherData::eventtype type) const;
|
||||
bool HasTimelineEventOfType(WeatherData::eventtype type) const;
|
||||
|
||||
private:
|
||||
// 00030000-78fc-48fe-8e23-433b3a1942d0
|
||||
static constexpr ble_uuid128_t BaseUUID() {
|
||||
return CharUUID(0x00, 0x00);
|
||||
static constexpr ble_uuid128_t BaseUuid() {
|
||||
return CharUuid(0x00, 0x00);
|
||||
}
|
||||
|
||||
// 0003yyxx-78fc-48fe-8e23-433b3a1942d0
|
||||
static constexpr ble_uuid128_t CharUUID(uint8_t x, uint8_t y) {
|
||||
static constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
|
||||
return ble_uuid128_t {.u = {.type = BLE_UUID_TYPE_128},
|
||||
.value = {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, x, y, 0x03, 0x00}};
|
||||
}
|
||||
|
||||
ble_uuid128_t weatherUUID {BaseUUID()};
|
||||
ble_uuid128_t weatherUuid {BaseUuid()};
|
||||
|
||||
/**
|
||||
* Just write timeline data here
|
||||
*/
|
||||
ble_uuid128_t weatherDataCharUUID {CharUUID(0x00, 0x01)};
|
||||
ble_uuid128_t weatherDataCharUuid {CharUuid(0x00, 0x01)};
|
||||
/**
|
||||
* This doesn't take timeline data,
|
||||
* provides some control over it
|
||||
*/
|
||||
ble_uuid128_t weatherControlCharUUID {CharUUID(0x00, 0x02)};
|
||||
ble_uuid128_t weatherControlCharUuid {CharUuid(0x00, 0x02)};
|
||||
|
||||
const struct ble_gatt_chr_def characteristicDefinition[3] = {
|
||||
{.uuid = &weatherDataCharUUID.u,
|
||||
{.uuid = &weatherDataCharUuid.u,
|
||||
.access_cb = WeatherCallback,
|
||||
.arg = this,
|
||||
.flags = BLE_GATT_CHR_F_WRITE,
|
||||
.val_handle = &eventHandle},
|
||||
{.uuid = &weatherControlCharUUID.u, .access_cb = WeatherCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ},
|
||||
{.uuid = &weatherControlCharUuid.u, .access_cb = WeatherCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ},
|
||||
{nullptr}};
|
||||
const struct ble_gatt_svc_def serviceDefinition[2] = {
|
||||
{.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &weatherUUID.u, .characteristics = characteristicDefinition}, {0}};
|
||||
{.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &weatherUuid.u, .characteristics = characteristicDefinition}, {0}};
|
||||
|
||||
uint16_t eventHandle {};
|
||||
|
||||
|
Reference in New Issue
Block a user