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

Method SetValueLabel

cpp/src/Manager.cpp:1777–1806  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Sets the user-friendly label for the value -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1775// Sets the user-friendly label for the value
1776//-----------------------------------------------------------------------------
1777void Manager::SetValueLabel
1778(
1779 ValueID const& _id,
1780 string const& _value,
1781 int32 _pos
1782)
1783{
1784 if( Driver* driver = GetDriver( _id.GetHomeId() ) )
1785 {
1786 LockGuard LG(driver->m_nodeMutex);
1787 if (_pos != -1) {
1788 if (_id.GetType() != ValueID::ValueType_BitSet) {
1789 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "ValueID passed to SetValueLabel is not a BitSet but a position was requested");
1790 return;
1791 }
1792 ValueBitSet *value = static_cast<ValueBitSet *>(driver->GetValue( _id ));
1793 value->SetBitLabel(_pos, _value);
1794 value->Release();
1795 return;
1796 } else {
1797 if( Value* value = driver->GetValue( _id ) )
1798 {
1799 value->SetLabel( _value );
1800 value->Release();
1801 return;
1802 }
1803 }
1804 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to SetValueLabel");
1805 }
1806}
1807
1808//-----------------------------------------------------------------------------
1809// <Manager::GetValueUnits>

Callers 1

SetLabelMethod · 0.45

Calls 4

SetBitLabelMethod · 0.80
GetValueMethod · 0.45
ReleaseMethod · 0.45
SetLabelMethod · 0.45

Tested by

no test coverage detected