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

Method GetValueListSelection

cpp/src/Manager.cpp:2540–2577  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Gets the selected item from a list value (returning a string) -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2538// Gets the selected item from a list value (returning a string)
2539//-----------------------------------------------------------------------------
2540bool Manager::GetValueListSelection
2541(
2542 ValueID const& _id,
2543 string* o_value
2544)
2545{
2546 bool res = false;
2547
2548 if( o_value )
2549 {
2550 if( ValueID::ValueType_List == _id.GetType() )
2551 {
2552 if( Driver* driver = GetDriver( _id.GetHomeId() ) )
2553 {
2554 LockGuard LG(driver->m_nodeMutex);
2555 if( ValueList* value = static_cast<ValueList*>( driver->GetValue( _id ) ) )
2556 {
2557 ValueList::Item const *item = value->GetItem();
2558 if( item != NULL && item->m_label.length() > 0)
2559 {
2560 *o_value = item->m_label;
2561 res = true;
2562 } else {
2563 o_value = NULL;
2564 Log::Write(LogLevel_Warning, "ValueList returned a NULL value for GetValueListSelection: %s", value->GetLabel().c_str());
2565 }
2566 value->Release();
2567 } else {
2568 OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to GetValueListSelection");
2569 }
2570 }
2571 } else {
2572 OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to GetValueListSelection is not a List Value");
2573 }
2574 }
2575
2576 return res;
2577}
2578
2579//-----------------------------------------------------------------------------
2580// <Manager::GetValueListSelection>

Callers

nothing calls this directly

Calls 7

WriteFunction · 0.85
GetItemMethod · 0.80
GetValueMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45
GetLabelMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected