Creating function pointers to class member functions for use with MINAR PostCallback

I’m having trouble creating a function pointer to a function that is part of a class in order to add it to the MINAR queue to be called periodically. I’ve read the MINAR docs here and the examples here and I’m not sure what’s going wrong.

The offending lines:

    FunctionPointer0<void> update_temperature_ptr(&lwm2mclient, &LWM2MClient::update_temperature);
    minar::Scheduler::postCallback(update_temperature_ptr.bind()).period(minar::milliseconds(5000));

Where lwm2mclient is an instance of LWM2MClient. I want to call update_temperature on the instance. This is being called in app_start, after lwm2mclient has been instantiated. The declaration of update_temperature is:

    void update_temperature(void);

It’s throwing:

error: no matching function for call to 'mbed::util::FunctionPointer0<void>::FunctionPointer0(LWM2MClient**, void (LWM2MClient::*)())'

Looks like you want this instead:

FunctionPointer0<void> update_temperature_ptr(lwm2mclient, &LWM2MClient::update_temperature);

Because from the error message, lwm2mclient is already a pointer.

Also, looks like our syntax highlighting is broken cc @dan!

Yep that was it, thanks!