MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / GetValueFloatPrecision

Method GetValueFloatPrecision

cpp/src/Manager.cpp:2698–2728  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Gets a value's scale as a uint8 -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2696// Gets a value's scale as a uint8
2697//-----------------------------------------------------------------------------
2698bool Manager::GetValueFloatPrecision
2699(
2700 ValueID const& _id,
2701 uint8* o_value
2702)
2703{
2704 bool res = false;
2705
2706 if( o_value )
2707 {
2708 if( ValueID::ValueType_Decimal == _id.GetType() )
2709 {
2710 if( Driver* driver = GetDriver( _id.GetHomeId() ) )
2711 {
2712 LockGuard LG(driver->m_nodeMutex);
2713 if( ValueDecimal* value = static_cast<ValueDecimal*>( driver->GetValue( _id ) ) )
2714 {
2715 *o_value = value->GetPrecision();
2716 value->Release();
2717 res = true;
2718 } else {
2719 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to GetValueFloatPrecision");
2720 }
2721 }
2722 } else {
2723 OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to GetValueFloatPrecision is not a Decimal Value");
2724 }
2725 }
2726
2727 return res;
2728}
2729
2730//-----------------------------------------------------------------------------
2731// <Manager::SetValue>

Callers

nothing calls this directly

Calls 3

GetPrecisionMethod · 0.80
GetValueMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected