----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------
| 96 | // Handle a message from the Z-Wave network |
| 97 | //----------------------------------------------------------------------------- |
| 98 | bool 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> |
nothing calls this directly
no test coverage detected