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

Method SetValue

cpp/src/Manager.cpp:2734–2767  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Sets a bit in a BitSet Value -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2732// Sets a bit in a BitSet Value
2733//-----------------------------------------------------------------------------
2734bool Manager::SetValue
2735(
2736 ValueID const& _id,
2737 uint8 _pos,
2738 bool const _value
2739)
2740{
2741 bool res = false;
2742
2743 if( ValueID::ValueType_BitSet == _id.GetType() )
2744 {
2745 if( Driver* driver = GetDriver( _id.GetHomeId() ) )
2746 {
2747 if( _id.GetNodeId() != driver->GetControllerNodeId() )
2748 {
2749 LockGuard LG(driver->m_nodeMutex);
2750 if( ValueBitSet* value = static_cast<ValueBitSet*>( driver->GetValue( _id ) ) )
2751 {
2752 if (_value)
2753 res = value->SetBit(_pos);
2754 else
2755 res = value->ClearBit(_pos);
2756 value->Release();
2757 } else {
2758 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to SetValue");
2759 }
2760 }
2761 }
2762 } else {
2763 OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to SetValue is not a BitSet Value");
2764 }
2765
2766 return res;
2767}
2768
2769//-----------------------------------------------------------------------------
2770// <Manager::SetValue>

Callers 2

SetSceneValueMethod · 0.45

Calls 11

GetNodeIdMethod · 0.80
GetControllerNodeIdMethod · 0.80
SetBitMethod · 0.80
ClearBitMethod · 0.80
SetByLabelMethod · 0.80
GetValueMethod · 0.45
ReleaseMethod · 0.45
SetMethod · 0.45
GetSizeMethod · 0.45
SetFromStringMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected