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

Method GetValueAsByte

cpp/src/Manager.cpp:2167–2197  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Gets a value as an 8-bit unsigned integer -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2165// Gets a value as an 8-bit unsigned integer
2166//-----------------------------------------------------------------------------
2167bool Manager::GetValueAsByte
2168(
2169 ValueID const& _id,
2170 uint8* o_value
2171)
2172{
2173 bool res = false;
2174
2175 if( o_value )
2176 {
2177 if( ValueID::ValueType_Byte == _id.GetType() )
2178 {
2179 if( Driver* driver = GetDriver( _id.GetHomeId() ) )
2180 {
2181 LockGuard LG(driver->m_nodeMutex);
2182 if( ValueByte* value = static_cast<ValueByte*>( driver->GetValue( _id ) ) )
2183 {
2184 *o_value = value->GetValue();
2185 value->Release();
2186 res = true;
2187 } else {
2188 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to GetValueAsByte");
2189 }
2190 }
2191 } else {
2192 OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to GetValueAsByte is not a Byte Value");
2193 }
2194 }
2195
2196 return res;
2197}
2198
2199//-----------------------------------------------------------------------------
2200// <Manager::GetValueAsFloat>

Callers

nothing calls this directly

Calls 2

GetValueMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected