Commit 223c5bbd authored by genofire's avatar genofire Committed by schneider
Browse files

ble: make set time easier

parent 14b869a9
......@@ -504,19 +504,16 @@ static void *addCard10GroupDyn(void)
/*
* Set the time given in milliseconds since 1.1.1970 as 64 bit integer.
*/
static uint8_t setTime(uint8_t *pValue, uint16_t len)
static uint8_t setTime(uint8_t *pValue)
{
uint64_t timeNet;
uint64_t time;
if (len < sizeof(uint64_t)) {
return ATT_ERR_LENGTH;
}
memcpy(&timeNet, pValue, sizeof(timeNet));
time = __bswap64(timeNet);
epic_rtc_set_milliseconds(time);
APP_TRACE_INFO1("set time to: %d\n", time);
return ATT_SUCCESS;
}
......@@ -539,13 +536,7 @@ static uint8_t writeCard10CB(
switch (handle) {
// time
case CARD10_TIME_UPDATE_VAL_HDL:
if (operation == ATT_PDU_PREP_WRITE_REQ) {
if (len < sizeof(uint64_t)) {
return ATT_ERR_LENGTH;
}
return ATT_SUCCESS;
}
return setTime(pValue, len);
return setTime(pValue);
// vibra
case CARD10_VIBRA_VAL_HDL:
BYTES_TO_UINT16(ui16, pValue);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment