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

Method CreateVars

cpp/src/command_classes/SimpleAV.cpp:86–164  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Create the values managed by this command class -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

84// Create the values managed by this command class
85//-----------------------------------------------------------------------------
86void SimpleAV::CreateVars
87(
88 uint8 const _instance
89)
90{
91 if (Node* node = GetNodeUnsafe())
92 {
93 // Create list value
94 vector<ValueList::Item> items;
95 vector<SimpleAVCommandItem> commands = SimpleAVCommandItem::GetCommands();
96 vector<SimpleAVCommandItem>::iterator iterator;
97 string helpList = "Possible values: \n";
98 string helpNumeric = "Possible values: \n";
99 for (iterator = commands.begin(); iterator != commands.end(); iterator++)
100 {
101 SimpleAVCommandItem command = *iterator;
102 if (command.GetVersion() <= GetVersion())
103 {
104 ValueList::Item item;
105 item.m_value = command.GetCode();
106 item.m_label = command.GetName();
107 items.push_back(item);
108
109#if 0
110 // ValueList - create command description for help
111 string codeStr = string("ZWave command number: ").append(std::to_string(command.GetCode()));
112 string descriptionFull = "";
113 if (command.GetDescription() == "")
114 {
115 descriptionFull =
116 command
117 .GetName()
118 .append(" (")
119 .append(codeStr)
120 .append(")\n");
121 }
122 else
123 {
124 descriptionFull =
125 command
126 .GetName()
127 .append(" (")
128 .append(command.GetDescription())
129 .append("; ")
130 .append(codeStr)
131 .append(")\n");
132 }
133 helpList += descriptionFull;
134
135 // ValueShort - create command description for help
136 if (command.GetDescription() == "")
137 {
138 descriptionFull =
139 std::to_string(command.GetCode())
140 .append(" (")
141 .append(command.GetName())
142 .append(")\n");
143 }

Callers

nothing calls this directly

Calls 9

GetVersionFunction · 0.85
GetCommandClassIdFunction · 0.85
GetCodeMethod · 0.80
GetDescriptionMethod · 0.80
CreateValueListMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetVersionMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected