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

Method GetValueAsBitSet

cpp/src/Manager.cpp:2081–2110  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Gets a bit from a BitSet as a bool -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2079// Gets a bit from a BitSet as a bool
2080//-----------------------------------------------------------------------------
2081bool Manager::GetValueAsBitSet
2082(
2083 ValueID const& _id,
2084 uint8 _pos,
2085 bool* o_value
2086)
2087{
2088
2089 if( o_value )
2090 {
2091 if( ValueID::ValueType_BitSet == _id.GetType() )
2092 {
2093 if( Driver* driver = GetDriver( _id.GetHomeId() ) )
2094 {
2095 LockGuard LG(driver->m_nodeMutex);
2096 if( ValueBitSet* value = static_cast<ValueBitSet*>( driver->GetValue( _id ) ) )
2097 {
2098 *o_value = value->GetBit(_pos);
2099 value->Release();
2100 return true;
2101 } else {
2102 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to GetValueAsBitSet");
2103 }
2104 }
2105 } else {
2106 OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to GetValueAsBitSet is not a BitSet Value");
2107 }
2108 }
2109 return false;
2110}
2111
2112//-----------------------------------------------------------------------------
2113// <Manager::GetValueAsBool>

Callers

nothing calls this directly

Calls 3

GetBitMethod · 0.80
GetValueMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected