Setting time from a BLE characteristic (mbed os 5)

09 May 2017

I'm trying to set the time via a BLE characteristic, but I don't think i'm doing it right as the time never updates

Here's the code for onDataWritten

   void onDataWritten(const GattWriteCallbackParams *params)
    {
        if (params->handle == setTimeChar.getValueAttribute().getHandle()) {
            set_time((time_t )*params->data);
        }
    }

I'm sending the data via the nordic connect android app as 0xBBBBBB

and then i'm getting the value of the time via:

unsigned long millis = us_ticker_read() / 1000L;

to update another characteristic for sending.

The code compiles fine, but I wonder if i'm passing the right args to set_time()

10 May 2017

I ended up figuring it out with

set_time(*((time_t *)(params->data)));

although I misunderstood the ticker, so it still doesnt' do what i want.