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

Method Set

cpp/src/command_classes/MultiChannelAssociation.cpp:377–422  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Add an association between devices -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

375// Add an association between devices
376//-----------------------------------------------------------------------------
377void MultiChannelAssociation::Set
378(
379 uint8 _groupIdx,
380 uint8 _targetNodeId,
381 uint8 _instance
382)
383{
384
385 /* for Qubino devices, we should always set a Instance if its the ControllerNode, so MultChannelEncap works. - See Bug #857 */
386 if ( ( m_com.GetFlagBool(COMPAT_FLAG_MCA_FORCEINSTANCES) == true )
387 && ( _instance == 0 )
388 && ( GetDriver()->GetControllerNodeId() == _targetNodeId ) )
389 {
390 _instance = 0x01;
391 }
392
393 Log::Write( LogLevel_Info, GetNodeId(), "MultiChannelAssociation::Set - Adding instance %d on node %d to group %d of node %d",
394 _instance, _targetNodeId, _groupIdx, GetNodeId() );
395
396 if ( _instance == 0x00 )
397 {
398 Msg* msg = new Msg( "MultiChannelAssociationCmd_Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
399 msg->Append( GetNodeId() );
400 msg->Append( 4 );
401 msg->Append( GetCommandClassId() );
402 msg->Append( MultiChannelAssociationCmd_Set );
403 msg->Append( _groupIdx );
404 msg->Append( _targetNodeId );
405 msg->Append( GetDriver()->GetTransmitOptions() );
406 GetDriver()->SendMsg( msg, Driver::MsgQueue_Send );
407 }
408 else
409 {
410 Msg* msg = new Msg( "MultiChannelAssociationCmd_Set", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true );
411 msg->Append( GetNodeId() );
412 msg->Append( 6 );
413 msg->Append( GetCommandClassId() );
414 msg->Append( MultiChannelAssociationCmd_Set );
415 msg->Append( _groupIdx );
416 msg->Append( 0x00 ); // marker
417 msg->Append( _targetNodeId );
418 msg->Append( _instance );
419 msg->Append( GetDriver()->GetTransmitOptions() );
420 GetDriver()->SendMsg( msg, Driver::MsgQueue_Send );
421 }
422}
423
424//-----------------------------------------------------------------------------
425// <MultiChannelAssociation::Remove>

Callers

nothing calls this directly

Calls 7

WriteFunction · 0.85
GetCommandClassIdFunction · 0.85
GetFlagBoolMethod · 0.80
GetControllerNodeIdMethod · 0.80
SendMsgMethod · 0.80
GetNodeIdFunction · 0.70
AppendMethod · 0.45

Tested by

no test coverage detected