Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 6 months ago.
RPC calls
Will you provide any way to remotely execute a function hosted on the mbed BLE device in a similar way as RPC? I would need to be able to call a function or a class method accepting some aprameters and returning an int.
Question relating to:
1 Answer
8 years, 6 months ago.
Maybe. For now with SimpleBLE probably the easiest way is using a characteristic that is read/write and has notifications on. Then whenever a write happens to that characteristic, use that as input to the function. Then after processing write back to the characteristic, and the client will get a notification.
F.e.:
void writeCallback(uint32_t aArgs) { uint8_t* args = (uint8_t*)& aArgs; // now you have args[0], args[1], etc. c = args[0] * 2; } SimpleChar<uint32_t> c = ble.readWrite_u32(0x8600, 0x8601, &writeCallback);
I don't want to put too much logic into SimpleBLE. Just small usecases.
At the moment it is a viable solution. If I understand well SimpleBLE is a layer or a wrapper over the mbed BLE implementation that is a little bit complex to use so not well done to be used during workshops. May you point me to the RPC implementation on the BLE library (if it is implemented of course)?
posted by 13 Jun 2016