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

Method SetValueListSelection

cpp/src/Manager.cpp:3064–3094  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Sets the selected item in a list by value -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3062// Sets the selected item in a list by value
3063//-----------------------------------------------------------------------------
3064bool Manager::SetValueListSelection
3065(
3066 ValueID const& _id,
3067 string const& _selectedItem
3068)
3069{
3070 bool res = false;
3071
3072 if( ValueID::ValueType_List == _id.GetType() )
3073 {
3074 if( Driver* driver = GetDriver( _id.GetHomeId() ) )
3075 {
3076 if( _id.GetNodeId() != driver->GetControllerNodeId() )
3077 {
3078 LockGuard LG(driver->m_nodeMutex);
3079 if( ValueList* value = static_cast<ValueList*>( driver->GetValue( _id ) ) )
3080 {
3081 res = value->SetByLabel( _selectedItem );
3082 value->Release();
3083 } else {
3084 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to SetValueListSelection");
3085 }
3086 }
3087
3088 }
3089 } else {
3090 OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to SetValueListSelection is not a List Value");
3091 }
3092
3093 return res;
3094}
3095
3096//-----------------------------------------------------------------------------
3097// <Manager::SetValue>

Callers

nothing calls this directly

Calls 5

GetNodeIdMethod · 0.80
GetControllerNodeIdMethod · 0.80
SetByLabelMethod · 0.80
GetValueMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected