Skip to content
Snippets Groups Projects
Commit cb046114 authored by Hauke Mehrtens's avatar Hauke Mehrtens
Browse files

Merge branch 'genofire/ble-card10-timeread' into 'master'

ble: card10 svc - time read

See merge request card10/firmware!208
parents 051036fe d5de041f
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ The current draft uses following service specification: ...@@ -18,7 +18,7 @@ The current draft uses following service specification:
- Time update characteristic: - Time update characteristic:
UUID: ``42230201-2342-2342-2342-234223422342`` UUID: ``42230201-2342-2342-2342-234223422342``
write no response read and write no response
- Vibra characteristic: - Vibra characteristic:
...@@ -70,6 +70,11 @@ The current draft uses following service specification: ...@@ -70,6 +70,11 @@ The current draft uses following service specification:
UUID: ``42230218-2342-2342-2342-234223422342`` UUID: ``42230218-2342-2342-2342-234223422342``
write no response write no response
- Personal State characteristic:
UUID: ``42230219-2342-2342-2342-234223422342``
read and write with response
- LEDs above characteristic: - LEDs above characteristic:
UUID: ``42230220-2342-2342-2342-234223422342`` UUID: ``42230220-2342-2342-2342-234223422342``
...@@ -83,7 +88,7 @@ The current draft uses following service specification: ...@@ -83,7 +88,7 @@ The current draft uses following service specification:
Time update characteristic Time update characteristic
--------------------------------- ---------------------------------
The time update characteristic makes it possible to set the current time given in milliseconds after 1.1.1970 in the UTC timezone. The value is represented as a big endian ``uint64`` The time update characteristic makes it possible to set and get the current time given in milliseconds after 1.1.1970 in the UTC timezone. The value is represented as a big endian ``uint64``
- Thu Aug 15 19:40:45 UTC 2019 : ``0x0 0x0 0x1 0x6c 0x96 0xcb 0xf8 0xcc`` - Thu Aug 15 19:40:45 UTC 2019 : ``0x0 0x0 0x1 0x6c 0x96 0xcb 0xf8 0xcc``
...@@ -153,6 +158,16 @@ This characteristic makes it possible to activate the flashlight. ...@@ -153,6 +158,16 @@ This characteristic makes it possible to activate the flashlight.
- enabled: ``0x01`` - enabled: ``0x01``
- disabled: ``0x00`` - disabled: ``0x00``
Personal state characteristic
---------------------------------
This characteristic makes it possible to read and write the personal state.
It writes always as persistant and it gives feedback if the value is in range and your firmware support it.
- No State ``0x0000``
- No Contact ``0x0100``
- Chaos ``0x0100``
- ...
LEDs above characteristic LEDs above characteristic
--------------------------------- ---------------------------------
This characteristic set every 11 leds on the top module at once. This characteristic set every 11 leds on the top module at once.
......
...@@ -27,8 +27,8 @@ enum { ...@@ -27,8 +27,8 @@ enum {
/*!< \brief card10 service declaration */ /*!< \brief card10 service declaration */
CARD10_SVC_HDL = CARD10_START_HDL, CARD10_SVC_HDL = CARD10_START_HDL,
/*!< \brief time update characteristic */ /*!< \brief time update characteristic */
CARD10_TIME_UPDATE_CH_HDL, CARD10_TIME_CH_HDL,
CARD10_TIME_UPDATE_VAL_HDL, CARD10_TIME_VAL_HDL,
/*!< \brief vibra characteristic */ /*!< \brief vibra characteristic */
CARD10_VIRBA_CH_HDL, CARD10_VIRBA_CH_HDL,
CARD10_VIBRA_VAL_HDL, CARD10_VIBRA_VAL_HDL,
...@@ -81,12 +81,16 @@ static const uint16_t UUID_len = sizeof(UUID_svc); ...@@ -81,12 +81,16 @@ static const uint16_t UUID_len = sizeof(UUID_svc);
// starting at 0x01 with write (non visual) charateristics // starting at 0x01 with write (non visual) charateristics
/* BLE UUID for card10 time update */ /* BLE UUID for card10 time */
static const uint8_t UUID_char_time[] = { static const uint8_t UUID_char_time[] = {
ATT_PROP_WRITE_NO_RSP, (ATT_PROP_READ | ATT_PROP_WRITE_NO_RSP),
UINT16_TO_BYTES(CARD10_TIME_UPDATE_VAL_HDL), UINT16_TO_BYTES(CARD10_TIME_VAL_HDL),
CARD10_UUID_SUFFIX, 0x01, CARD10_UUID_PREFIX CARD10_UUID_SUFFIX, 0x01, CARD10_UUID_PREFIX
}; };
static uint8_t timeValue[] = { UINT32_TO_BYTES(0), UINT32_TO_BYTES(0) };
static uint16_t timeLen = sizeof(timeValue);
// works vor everyone? // works vor everyone?
static const uint16_t UUID_char_len = sizeof(UUID_char_time); static const uint16_t UUID_char_len = sizeof(UUID_char_time);
...@@ -245,280 +249,236 @@ static const uint8_t UUID_attChar_light_sensor[] = { ...@@ -245,280 +249,236 @@ static const uint8_t UUID_attChar_light_sensor[] = {
static uint8_t initLightSensorValue[] = { UINT16_TO_BYTES(0) }; static uint8_t initLightSensorValue[] = { UINT16_TO_BYTES(0) };
static uint16_t initLightSensorLen = sizeof(initLightSensorValue); static uint16_t initLightSensorLen = sizeof(initLightSensorValue);
/* clang-format on */
/* /*
* Create the BLE service description. * Create the BLE service description.
*/ */
static const attsAttr_t card10SvcAttrList[] = static const attsAttr_t card10SvcAttrList[] = {
{ { .pUuid = attPrimSvcUuid,
{ .pValue = (uint8_t *)UUID_svc,
.pUuid = attPrimSvcUuid, .pLen = (uint16_t *)&UUID_len,
.pValue = (uint8_t *) UUID_svc, .maxLen = sizeof(UUID_svc),
.pLen = (uint16_t *) &UUID_len, .permissions = ATTS_PERMIT_READ },
.maxLen = sizeof(UUID_svc),
.permissions = ATTS_PERMIT_READ
},
// TIME // TIME
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_time,
.pValue = (uint8_t *) UUID_char_time, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_time),
.maxLen = sizeof(UUID_char_time), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_time,
}, .pValue = timeValue,
{ .pLen = &timeLen,
.pUuid = UUID_attChar_time, .maxLen = sizeof(uint64_t),
.pValue = NULL, .settings = (ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK),
.maxLen = sizeof(uint64_t), .permissions =
.settings = ATTS_SET_WRITE_CBACK, (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC | ATTS_PERMIT_WRITE_AUTH | ATTS_PERMIT_READ |
ATTS_PERMIT_WRITE_AUTH) ATTS_PERMIT_READ_ENC | ATTS_PERMIT_READ_AUTH) },
},
// VIBRA // VIBRA
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_vibra,
.pValue = (uint8_t *) UUID_char_vibra, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_vibra),
.maxLen = sizeof(UUID_char_vibra), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_vibra,
}, .pValue = NULL,
{ .maxLen = sizeof(uint16_t),
.pUuid = UUID_attChar_vibra, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = sizeof(uint16_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// ROCKETS // ROCKETS
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_rockets,
.pValue = (uint8_t *) UUID_char_rockets, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_rockets),
.maxLen = sizeof(UUID_char_rockets), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_rockets,
}, .pValue = NULL,
{ .maxLen = 3 * sizeof(uint8_t),
.pUuid = UUID_attChar_rockets, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = 3 * sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// BG LED Bottom left // BG LED Bottom left
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_led_bg_bottom_left,
.pValue = (uint8_t *) UUID_char_led_bg_bottom_left, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_led_bg_bottom_left),
.maxLen = sizeof(UUID_char_led_bg_bottom_left), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_led_bg_bottom_left,
}, .pValue = NULL,
{ .maxLen = 3 * sizeof(uint8_t),
.pUuid = UUID_attChar_led_bg_bottom_left, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = 3 * sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// BG LED Bottom right // BG LED Bottom right
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_led_bg_bottom_right,
.pValue = (uint8_t *) UUID_char_led_bg_bottom_right, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_led_bg_bottom_right),
.maxLen = sizeof(UUID_char_led_bg_bottom_right), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_led_bg_bottom_right,
}, .pValue = NULL,
{ .maxLen = 3 * sizeof(uint8_t),
.pUuid = UUID_attChar_led_bg_bottom_right, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = 3 * sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// BG LED top right // BG LED top right
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_led_bg_top_right,
.pValue = (uint8_t *) UUID_char_led_bg_top_right, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_led_bg_top_right),
.maxLen = sizeof(UUID_char_led_bg_top_right), .settings = 0,
.settings = 0, .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_led_bg_top_right,
}, .pValue = NULL,
{ .maxLen = 3 * sizeof(uint8_t),
.pUuid = UUID_attChar_led_bg_top_right, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = 3 * sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// BG LED top left // BG LED top left
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_led_bg_top_left,
.pValue = (uint8_t *) UUID_char_led_bg_top_left, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_led_bg_top_left),
.maxLen = sizeof(UUID_char_led_bg_top_left), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_led_bg_top_left,
}, .pValue = NULL,
{ .maxLen = 3 * sizeof(uint8_t),
.pUuid = UUID_attChar_led_bg_top_left, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = 3 * sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// Dim bottom module // Dim bottom module
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_leds_bottom_dim,
.pValue = (uint8_t *) UUID_char_leds_bottom_dim, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_leds_bottom_dim),
.maxLen = sizeof(UUID_char_leds_bottom_dim), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_leds_bottom_dim,
}, .pValue = NULL,
{ .pLen = 0,
.pUuid = UUID_attChar_leds_bottom_dim, .maxLen = sizeof(uint8_t),
.pValue = NULL, .settings = ATTS_SET_WRITE_CBACK,
.pLen = 0, .permissions =
.maxLen = sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// Dim top module // Dim top module
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_leds_top_dim,
.pValue = (uint8_t *) UUID_char_leds_top_dim, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_leds_top_dim),
.maxLen = sizeof(UUID_char_leds_top_dim), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_leds_top_dim,
}, .pValue = NULL,
{ .maxLen = sizeof(uint8_t),
.pUuid = UUID_attChar_leds_top_dim, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// led powersafe // led powersafe
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_led_powersafe,
.pValue = (uint8_t *) UUID_char_led_powersafe, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_led_powersafe),
.maxLen = sizeof(UUID_char_led_powersafe), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_led_powersafe,
}, .pValue = NULL,
{ .maxLen = sizeof(uint8_t),
.pUuid = UUID_attChar_led_powersafe, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// flashlight // flashlight
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_flashlight,
.pValue = (uint8_t *) UUID_char_flashlight, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_flashlight),
.maxLen = sizeof(UUID_char_flashlight), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_flashlight,
}, .pValue = NULL,
{ .maxLen = sizeof(uint8_t),
.pUuid = UUID_attChar_flashlight, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// personal state // personal state
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_personal_state,
.pValue = (uint8_t *) UUID_char_personal_state, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_personal_state),
.maxLen = sizeof(UUID_char_personal_state), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_personal_state,
}, .pValue = &personalStateValue,
{ .pLen = &personalStateLen,
.pUuid = UUID_attChar_personal_state, .maxLen = sizeof(uint16_t),
.pValue = &personalStateValue, .settings = (ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK),
.pLen = &personalStateLen, .permissions =
.maxLen = sizeof(uint16_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = (ATTS_SET_WRITE_CBACK | ATTS_SET_READ_CBACK), ATTS_PERMIT_WRITE_AUTH | ATTS_PERMIT_READ |
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC | ATTS_PERMIT_READ_ENC | ATTS_PERMIT_READ_AUTH) },
ATTS_PERMIT_WRITE_AUTH |
ATTS_PERMIT_READ | ATTS_PERMIT_READ_ENC |
ATTS_PERMIT_READ_AUTH)
},
// ABOVE LEDS // ABOVE LEDS
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_leds_above,
.pValue = (uint8_t *) UUID_char_leds_above, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_leds_above),
.maxLen = sizeof(UUID_char_leds_above), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_leds_above,
}, .pValue = NULL,
{ .maxLen = 11 * 3 * sizeof(uint8_t),
.pUuid = UUID_attChar_leds_above, .settings = ATTS_SET_WRITE_CBACK,
.pValue = NULL, .permissions =
.maxLen = 11 * 3 * sizeof(uint8_t), (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
.settings = ATTS_SET_WRITE_CBACK, ATTS_PERMIT_WRITE_AUTH) },
.permissions = (ATTS_PERMIT_WRITE | ATTS_PERMIT_WRITE_ENC |
ATTS_PERMIT_WRITE_AUTH)
},
// Light sensor // Light sensor
{ { .pUuid = attChUuid,
.pUuid = attChUuid, .pValue = (uint8_t *)UUID_char_light_sensor,
.pValue = (uint8_t *) UUID_char_light_sensor, .pLen = (uint16_t *)&UUID_char_len,
.pLen = (uint16_t *) &UUID_char_len, .maxLen = sizeof(UUID_char_light_sensor),
.maxLen = sizeof(UUID_char_light_sensor), .permissions = ATTS_PERMIT_READ },
.permissions = ATTS_PERMIT_READ { .pUuid = UUID_attChar_light_sensor,
}, .pValue = initLightSensorValue,
{ .pLen = &initLightSensorLen,
.pUuid = UUID_attChar_light_sensor, .maxLen = sizeof(uint8_t),
.pValue = initLightSensorValue, .settings = ATTS_SET_READ_CBACK,
.pLen = &initLightSensorLen, .permissions =
.maxLen = sizeof(uint8_t), (ATTS_PERMIT_READ | ATTS_PERMIT_READ_ENC |
.settings = ATTS_SET_READ_CBACK, ATTS_PERMIT_READ_AUTH) },
.permissions = (ATTS_PERMIT_READ | ATTS_PERMIT_READ_ENC |
ATTS_PERMIT_READ_AUTH)
},
}; };
/* clang-format on */
// validating, that the service really get all charateristics // validating, that the service really get all charateristics
WSF_CT_ASSERT( WSF_CT_ASSERT(
...@@ -536,7 +496,7 @@ static uint8_t setTime(uint8_t *pValue) ...@@ -536,7 +496,7 @@ static uint8_t setTime(uint8_t *pValue)
time = __bswap64(timeNet); time = __bswap64(timeNet);
epic_rtc_set_milliseconds(time); epic_rtc_set_milliseconds(time);
APP_TRACE_INFO1("ble-card10: set time to: %d\n", time); APP_TRACE_INFO0("ble-card10: set time");
return ATT_SUCCESS; return ATT_SUCCESS;
} }
...@@ -558,7 +518,7 @@ static uint8_t writeCard10CB( ...@@ -558,7 +518,7 @@ static uint8_t writeCard10CB(
switch (handle) { switch (handle) {
// time // time
case CARD10_TIME_UPDATE_VAL_HDL: case CARD10_TIME_VAL_HDL:
return setTime(pValue); return setTime(pValue);
// vibra // vibra
case CARD10_VIBRA_VAL_HDL: case CARD10_VIBRA_VAL_HDL:
...@@ -764,8 +724,18 @@ static uint8_t readCard10CB( ...@@ -764,8 +724,18 @@ static uint8_t readCard10CB(
attsAttr_t *pAttr attsAttr_t *pAttr
) { ) {
uint16_t ui16 = 0; uint16_t ui16 = 0;
uint64_t ui64 = 0;
switch (handle) { switch (handle) {
case CARD10_TIME_VAL_HDL:
ui64 = epic_rtc_get_milliseconds();
uint64_t time;
time = __bswap64(ui64);
memcpy(pAttr->pValue, &time, sizeof(time));
APP_TRACE_INFO0("ble-card10: read time\n");
return ATT_SUCCESS;
case CARD10_PERSONAL_STATE_VAL_HDL: case CARD10_PERSONAL_STATE_VAL_HDL:
ui16 = epic_personal_state_get(); ui16 = epic_personal_state_get();
*pAttr->pValue = ui16; *pAttr->pValue = ui16;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment