Skip to content

Make BLEDevice::requestTemperature() accessible for BLEPeripheral class. #115

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

Closed
wants to merge 3 commits into from

Conversation

bojh
Copy link
Contributor

@bojh bojh commented Dec 20, 2016

Signed-off-by: Joerg Hubschneider [email protected]
... reflecting issue #33

@sandeepmistry
Copy link
Owner

@bojh how can the temperature value be accessed then?

An example sketch would be helpful to explain this.

@bojh
Copy link
Contributor Author

bojh commented Jan 3, 2017

No problem at all. I have added an example requesting the SoC temperature.
Idea: I just saw, that we can change the "Environmental Sensing Service" (0x181e) and the characteristics service to "Temperature" (0x2A6e) using sint16.

Signed-off-by: Joerg Hubschneider <[email protected]>
@sandeepmistry
Copy link
Owner

@bojh thanks for adding the example, I'm still not keen about making the user extend a class to gain access to this feature ...

@bojh
Copy link
Contributor Author

bojh commented Jan 16, 2017

@sandeepmistry as I can asume the requestTemperuture() method was design originally for the externel nrf8001 sub-device as a async construction. For to keep the interface for nrf5x micro controller with softdevice a sync method could be called as it is relaized at the moment. So if you are not keen to support the current API for the device objects (nrf8001 & nrf51822 classes) an application also can call directly the softdevice function like the implementation in the nrf51822 class.

void nRF51822::requestTemperature() {
#ifndef __RFduino__
  int32_t rawTemperature = 0;

  sd_temp_get(&rawTemperature);

  float temperature = rawTemperature / 4.0;

  if (this->_eventListener) {
    this->_eventListener->BLEDeviceTemperatureReceived(*this, temperature);
  }
#endif
}

The pro argument: The applicaton does not have to create a BLEPeripheral subclass and should than directly call the softdevice function it self. The con: No unified way to get the SoC temperature.
Any thought from your side?

@sandeepmistry
Copy link
Owner

@bojh yes, that sound reasonable.

Maybe we should remove all of the battery level and temperature code from the library internals since it's not actually used or exposed?

@bojh
Copy link
Contributor Author

bojh commented Jan 30, 2017

@sandeepmistry with an viewing angle of an multi platform BLE library (i.e. Areduino101 CurieBLE) you are right. SoC temperature from nRF5 would than be more a library idea for arduino nRF5 core.

@probonopd
Copy link

What is the status of this? Is requestTemperature() usable now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants