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

Method RequestState

cpp/src/command_classes/Alarm.cpp:101–146  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Request current state from the device -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

99// Request current state from the device
100//-----------------------------------------------------------------------------
101bool Alarm::RequestState
102(
103 uint32 const _requestFlags,
104 uint8 const _instance,
105 Driver::MsgQueue const _queue
106)
107{
108 if( ( _requestFlags & RequestFlag_Static ) && HasStaticRequest( StaticRequest_Values ) )
109 {
110 if( GetVersion() > 1 )
111 {
112 // Request the supported alarm types
113 Msg* msg = new Msg( "AlarmCmd_SupportedGet", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
114 msg->SetInstance( this, _instance );
115 msg->Append( GetNodeId() );
116 msg->Append( 2 );
117 msg->Append( GetCommandClassId() );
118 msg->Append( AlarmCmd_SupportedGet );
119 msg->Append( GetDriver()->GetTransmitOptions() );
120 GetDriver()->SendMsg( msg, _queue );
121 }
122 else
123 {
124 /* create version 1 ValueID's */
125 if( Node* node = GetNodeUnsafe() )
126 {
127 m_v1Params = true;
128 node->CreateValueByte( ValueID::ValueGenre_User, GetCommandClassId(), _instance, AlarmIndex_Type, "Alarm Type", "", true, false, 0, 0 );
129 node->CreateValueByte( ValueID::ValueGenre_User, GetCommandClassId(), _instance, AlarmIndex_Level, "Alarm Level", "", true, false, 0, 0 );
130 }
131 }
132 if (GetVersion() < 4) {
133 if ( Node* node = GetNodeUnsafe() ) {
134 node->CreateValueInt( ValueID::ValueGenre_Config, GetCommandClassId(), _instance, AlarmIndex_AutoClearEvents, "Automatically Clear Events", "ms", false, false, m_ClearTimeout, 0);
135 }
136 }
137
138 }
139
140 if( _requestFlags & RequestFlag_Dynamic )
141 {
142 return RequestValue( _requestFlags, 0, _instance, _queue );
143 }
144
145 return false;
146}
147
148bool Alarm::SetValue
149(

Callers

nothing calls this directly

Calls 10

HasStaticRequestFunction · 0.85
GetVersionFunction · 0.85
GetCommandClassIdFunction · 0.85
RequestValueFunction · 0.85
SendMsgMethod · 0.80
CreateValueByteMethod · 0.80
CreateValueIntMethod · 0.80
GetNodeIdFunction · 0.70
SetInstanceMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected