-
Notifications
You must be signed in to change notification settings - Fork 181
Support for requesting SoC temperature for nrf51822 application. #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bojh it would be great if there was a more generic API, the nRF8001 and nRf51822 both have temp. sensors on board, but future supported boards might not. What do you think of?
Maybe, it's getting too fancy .. Note: Right now, if you extend virtual void BLEDeviceAddressReceived(BLEDevice& device, const unsigned char* address);
virtual void BLEDeviceTemperatureReceived(BLEDevice& device, float temperature);
virtual void BLEDeviceBatteryLevelReceived(BLEDevice& device, float batteryLevel); and have acces to the following
|
@sandeepmistry The question is cerainly justified and I allready had it realized, as you have proposed by a derived BLEPeripheral class. |
@prjh we could make it a union? union BLEDeviceResponse {
float f;
char[6] address;
// ....
};
typedef void (* BLEDeviceResponseHandler)(BLEDevice& central, BLEDeviceResponse& response); Slightly unrelated, I've been also thinking about making a breaking change to the API, to expose BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST); to something like: // nRF8001
BLENRF8001Device nRF80001 = BLENRF8001Device(BLE_REQ, BLE_RDY, BLE_RST);
BLEPeripheral blePeripheral = BLEPeripheral(nRF80001);
// nRF51822
BLENRF51822Device nRF51822 = BLENRF51822Device();
BLEPeripheral blePeripheral = BLEPeripheral(nRF51822); It would make sketches less portable (require one line change), but would support other slave boards like the nRF8001. |
@sandeepmistry OK the union would al be fine, but I we than have to use a discriminator value (may be BLEDeviceRequest ) to know the callback reason. Your ideas to the API is OK for me, because the hardware does no change so often for real projects. From compatibility view, I think it's OK to have a individual HW dependend constructor. |
OK for me |
Re-opening, as this is not implemented yet :) |
I will provide an minimal, incremental solution as PR, making the BLEDevice::requestTemperature() function accessible from the BLEPeripheral class. |
For to use/retrieve the temperature value from the nrf51822 SoC, it would be nice to have a:
method for the BLEPeripheral class.
For to get notified with the value, we can create a new derived MyBLE class overloading BLEPeripheral virtual method:
method. An optional alternative would be to register a callback giving back (only) the temperature.
The text was updated successfully, but these errors were encountered: