hmtrp: Added functions that throw exceptions when failing to read from sensors, and added java exception handling.
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
committed by
Mihai Tudor Panu
parent
9bfda4219d
commit
4de9734f0a
@@ -452,6 +452,15 @@ bool HMTRP::getRFSignalStrength(uint8_t *strength)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t HMTRP::getRFSignalStrength()
|
||||
{
|
||||
uint8_t strength = 0;
|
||||
if (!getRFSignalStrength(&strength))
|
||||
throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
|
||||
": readData() failed");
|
||||
return strength;
|
||||
}
|
||||
|
||||
bool HMTRP::getModSignalStrength(uint8_t *strength)
|
||||
{
|
||||
if (!strength)
|
||||
@@ -484,3 +493,12 @@ bool HMTRP::getModSignalStrength(uint8_t *strength)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t HMTRP::getModSignalStrength()
|
||||
{
|
||||
uint8_t strength = 0;
|
||||
if (!getModSignalStrength(&strength))
|
||||
throw std::runtime_error(std::string(__PRETTY_FUNCTION__) +
|
||||
": readData() failed");
|
||||
return strength;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user