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

Method RequestInstances

cpp/src/command_classes/MultiInstance.cpp:104–156  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Request number of instances of the specified command class from the device -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

102// Request number of instances of the specified command class from the device
103//-----------------------------------------------------------------------------
104bool MultiInstance::RequestInstances
105(
106)
107{
108 bool res = false;
109
110 if( GetVersion() == 1 )
111 {
112 if( Node* node = GetNodeUnsafe() )
113 {
114 // MULTI_INSTANCE
115 for( map<uint8,CommandClass*>::const_iterator it = node->m_commandClassMap.begin(); it != node->m_commandClassMap.end(); ++it )
116 {
117 CommandClass* cc = it->second;
118 if( cc->GetCommandClassId() == NoOperation::StaticGetCommandClassId() )
119 {
120 continue;
121 }
122 if( cc->HasStaticRequest( StaticRequest_Instances ) )
123 {
124 Log::Write( LogLevel_Info, GetNodeId(), "MultiInstanceCmd_Get for %s", cc->GetCommandClassName().c_str() );
125
126 Msg* msg = new Msg( "MultiInstanceCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
127 msg->Append( GetNodeId() );
128 msg->Append( 3 );
129 msg->Append( GetCommandClassId() );
130 msg->Append( MultiInstanceCmd_Get );
131 msg->Append( cc->GetCommandClassId() );
132 msg->Append( GetDriver()->GetTransmitOptions() );
133 GetDriver()->SendMsg( msg, Driver::MsgQueue_Query );
134 res = true;
135 }
136 }
137 }
138 }
139 else
140 {
141 // MULTI_CHANNEL
142
143 Log::Write( LogLevel_Info, GetNodeId(), "MultiChannelCmd_EndPointGet for node %d", GetNodeId() );
144
145 Msg* msg = new Msg( "MultiChannelCmd_EndPointGet", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
146 msg->Append( GetNodeId() );
147 msg->Append( 2 );
148 msg->Append( GetCommandClassId() );
149 msg->Append( MultiChannelCmd_EndPointGet );
150 msg->Append( GetDriver()->GetTransmitOptions() );
151 GetDriver()->SendMsg( msg, Driver::MsgQueue_Query );
152 res = true;
153 }
154
155 return res;
156}
157
158bool MultiInstance::HandleIncomingMsg
159(

Callers 1

AdvanceQueriesMethod · 0.80

Calls 11

GetVersionFunction · 0.85
WriteFunction · 0.85
GetCommandClassIdFunction · 0.85
SendMsgMethod · 0.80
GetNodeIdFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
GetCommandClassIdMethod · 0.45
c_strMethod · 0.45
GetCommandClassNameMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected