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

Method RequestValue

cpp/src/command_classes/Meter.cpp:179–214  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Request current value from the device -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

177// Request current value from the device
178//-----------------------------------------------------------------------------
179bool Meter::RequestValue
180(
181 uint32 const _requestFlags,
182 uint16 const _dummy1, // = 0 (not used)
183 uint8 const _instance,
184 Driver::MsgQueue const _queue
185)
186{
187 bool res = false;
188 if ( !m_com.GetFlagBool(COMPAT_FLAG_GETSUPPORTED))
189 {
190 Log::Write( LogLevel_Info, GetNodeId(), "MeterCmd_Get Not Supported on this node");
191 return false;
192 }
193 for( uint8 i=0; i<8; ++i )
194 {
195 uint8 baseIndex = i<<2;
196
197 Value* value = GetValue( _instance, baseIndex );
198 if( value != NULL )
199 {
200 value->Release();
201 Msg* msg = new Msg( "MeterCmd_Get", GetNodeId(), REQUEST, FUNC_ID_ZW_SEND_DATA, true, true, FUNC_ID_APPLICATION_COMMAND_HANDLER, GetCommandClassId() );
202 msg->SetInstance( this, _instance );
203 msg->Append( GetNodeId() );
204 msg->Append( 3 );
205 msg->Append( GetCommandClassId() );
206 msg->Append( MeterCmd_Get );
207 msg->Append( (uint8)( i << 3 ) );
208 msg->Append( GetDriver()->GetTransmitOptions() );
209 GetDriver()->SendMsg( msg, _queue );
210 res |= true;
211 }
212 }
213 return res;
214}
215
216//-----------------------------------------------------------------------------
217// <Meter::HandleMsg>

Callers

nothing calls this directly

Calls 8

WriteFunction · 0.85
GetCommandClassIdFunction · 0.85
GetFlagBoolMethod · 0.80
SendMsgMethod · 0.80
GetNodeIdFunction · 0.70
ReleaseMethod · 0.45
SetInstanceMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected