----------------------------------------------------------------------------- Gets the user-friendly label for the value -----------------------------------------------------------------------------
| 1728 | // Gets the user-friendly label for the value |
| 1729 | //----------------------------------------------------------------------------- |
| 1730 | string Manager::GetValueLabel |
| 1731 | ( |
| 1732 | ValueID const& _id, |
| 1733 | int32 _pos |
| 1734 | ) |
| 1735 | { |
| 1736 | string label; |
| 1737 | if( Driver* driver = GetDriver( _id.GetHomeId() ) ) |
| 1738 | { |
| 1739 | LockGuard LG(driver->m_nodeMutex); |
| 1740 | if (_pos != -1) { |
| 1741 | if (_id.GetType() != ValueID::ValueType_BitSet) { |
| 1742 | OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "ValueID passed to GetValueLabel is not a BitSet but a position was requested"); |
| 1743 | return label; |
| 1744 | } |
| 1745 | ValueBitSet *value = static_cast<ValueBitSet *>(driver->GetValue( _id )); |
| 1746 | label = value->GetBitLabel(_pos); |
| 1747 | value->Release(); |
| 1748 | return label; |
| 1749 | } else { |
| 1750 | bool useinstancelabels = true; |
| 1751 | Options::Get()->GetOptionAsBool( "IncludeInstanceLabel", &useinstancelabels ); |
| 1752 | Node* node = driver->GetNode( _id.GetNodeId() ); |
| 1753 | if ( (useinstancelabels) && ( node ) ) |
| 1754 | { |
| 1755 | if ( node->GetNumInstances(_id.GetCommandClassId()) > 1 ) |
| 1756 | { |
| 1757 | label = GetInstanceLabel(_id).append(" "); |
| 1758 | } |
| 1759 | } |
| 1760 | if ( Value* value = driver->GetValue( _id ) ) |
| 1761 | { |
| 1762 | |
| 1763 | label.append(value->GetLabel()); |
| 1764 | value->Release(); |
| 1765 | return label; |
| 1766 | } |
| 1767 | } |
| 1768 | OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to GetValueLabel"); |
| 1769 | } |
| 1770 | return label; |
| 1771 | } |
| 1772 | |
| 1773 | //----------------------------------------------------------------------------- |
| 1774 | // <Manager::SetValueLabel> |
no test coverage detected