----------------------------------------------------------------------------- Request number of instances of the specified command class from the device -----------------------------------------------------------------------------
| 102 | // Request number of instances of the specified command class from the device |
| 103 | //----------------------------------------------------------------------------- |
| 104 | bool 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 | |
| 158 | bool MultiInstance::HandleIncomingMsg |
| 159 | ( |
no test coverage detected