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

Method HandleMsg

cpp/src/command_classes/MeterPulse.cpp:98–125  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

96// Handle a message from the Z-Wave network
97//-----------------------------------------------------------------------------
98bool MeterPulse::HandleMsg
99(
100 uint8 const* _data,
101 uint32 const _length,
102 uint32 const _instance // = 1
103)
104{
105 if( MeterPulseCmd_Report == (MeterPulseCmd)_data[0] )
106 {
107 int32 count = 0;
108 for( uint8 i=0; i<4; ++i )
109 {
110 count <<= 8;
111 count |= (uint32)_data[i+1];
112 }
113
114 Log::Write( LogLevel_Info, GetNodeId(), "Received a meter pulse count: Count=%d", count );
115 if( ValueInt* value = static_cast<ValueInt*>( GetValue( _instance, 0 ) ) )
116 {
117 value->OnValueRefreshed( count );
118 value->Release();
119 }
120
121 return true;
122 }
123
124 return false;
125}
126
127//-----------------------------------------------------------------------------
128// <MeterPulse::CreateVars>

Callers

nothing calls this directly

Calls 4

WriteFunction · 0.85
GetNodeIdFunction · 0.70
OnValueRefreshedMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected