----------------------------------------------------------------------------- Nothing to do for UserCode -----------------------------------------------------------------------------
| 368 | // Nothing to do for UserCode |
| 369 | //----------------------------------------------------------------------------- |
| 370 | bool UserCode::RequestValue |
| 371 | ( |
| 372 | uint32 const _requestFlags, |
| 373 | uint16 const _userCodeIdx, |
| 374 | uint8 const _instance, |
| 375 | Driver::MsgQueue const _queue |
| 376 | ) |
| 377 | { |
| 378 | if( _instance != 1 ) |
| 379 | { |
| 380 | // This command class doesn't work with multiple instances |
| 381 | return false; |
| 382 | } |
| 383 | if ( !m_com.GetFlagBool(COMPAT_FLAG_GETSUPPORTED) ) |
| 384 | { |
| 385 | Log::Write( LogLevel_Info, GetNodeId(), "UserNumberCmd_Get Not Supported on this node"); |
| 386 | return false; |
| 387 | } |
| 388 | if( _userCodeIdx == UserCodeIndex_Count ) |
| 389 | { |
| 390 | // Get number of supported user codes. |
| 391 | Msg* msg = new Msg( "UserNumberCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() ); |
| 392 | msg->Append( GetNodeId() ); |
| 393 | msg->Append( 2 ); |
| 394 | msg->Append( GetCommandClassId() ); |
| 395 | msg->Append( UserNumberCmd_Get ); |
| 396 | msg->Append( GetDriver()->GetTransmitOptions() ); |
| 397 | GetDriver()->SendMsg( msg, _queue ); |
| 398 | return true; |
| 399 | } |
| 400 | if (_userCodeIdx == 0) |
| 401 | { |
| 402 | Log::Write( LogLevel_Warning, GetNodeId(), "UserCodeCmd_Get with Index 0 not Supported"); |
| 403 | return false; |
| 404 | } |
| 405 | if (_userCodeIdx > m_dom.GetFlagByte(STATE_FLAG_USERCODE_COUNT)) |
| 406 | { |
| 407 | Log::Write( LogLevel_Warning, GetNodeId(), "UserCodeCmd_Get with index %d is greater than max UserCodes", _userCodeIdx); |
| 408 | return false; |
| 409 | } |
| 410 | Msg* msg = new Msg( "UserCodeCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() ); |
| 411 | msg->Append( GetNodeId() ); |
| 412 | msg->Append( 3 ); |
| 413 | msg->Append( GetCommandClassId() ); |
| 414 | msg->Append( UserCodeCmd_Get ); |
| 415 | msg->Append( (_userCodeIdx & 0xFF) ); |
| 416 | msg->Append( GetDriver()->GetTransmitOptions() ); |
| 417 | GetDriver()->SendMsg( msg, _queue ); |
| 418 | return true; |
| 419 | } |
| 420 | |
| 421 | //----------------------------------------------------------------------------- |
| 422 | // <UserCode::HandleMsg> |
nothing calls this directly
no test coverage detected