----------------------------------------------------------------------------- Handle a message from the Z-Wave network -----------------------------------------------------------------------------
| 124 | // Handle a message from the Z-Wave network |
| 125 | //----------------------------------------------------------------------------- |
| 126 | bool TimeParameters::HandleMsg |
| 127 | ( |
| 128 | uint8 const* _data, |
| 129 | uint32 const _length, |
| 130 | uint32 const _instance // = 1 |
| 131 | ) |
| 132 | { |
| 133 | if (TimeParametersCmd_Report == (TimeParametersCmd)_data[0]) |
| 134 | { |
| 135 | uint16 year = (_data[1] << 8) + (_data[2] & 0xFF); |
| 136 | uint8 month = (_data[3] & 0x0F); |
| 137 | uint8 day = (_data[4] & 0x1F); |
| 138 | uint8 hour = (_data[5] & 0x1F); |
| 139 | uint8 minute = (_data[6] & 0x3F); |
| 140 | uint8 second = (_data[7] & 0x3F); |
| 141 | |
| 142 | Log::Write( LogLevel_Info, GetNodeId(), "Received TimeParameters report: %02d/%02d/%04d %02d:%02d:%02d", (int)day, (int)month, (int)year, (int)hour, (int)minute, (int)second); |
| 143 | if( ValueString* value = static_cast<ValueString*>( GetValue( _instance, TimeParametersIndex_Date ) ) ) |
| 144 | { |
| 145 | char msg[512]; |
| 146 | snprintf(msg, sizeof(msg), "%02d/%02d/%04d", (int)day, (int)month, (int)year); |
| 147 | value->OnValueRefreshed( msg ); |
| 148 | value->Release(); |
| 149 | } |
| 150 | if( ValueString* value = static_cast<ValueString*>( GetValue( _instance, TimeParametersIndex_Time ) ) ) |
| 151 | { |
| 152 | char msg[512]; |
| 153 | snprintf(msg, sizeof(msg), "%02d:%02d:%02d", (int)hour, (int)minute, (int)second); |
| 154 | value->OnValueRefreshed( msg ); |
| 155 | value->Release(); |
| 156 | } |
| 157 | ClearStaticRequest( StaticRequest_Values ); |
| 158 | return true; |
| 159 | } |
| 160 | |
| 161 | return false; |
| 162 | } |
| 163 | |
| 164 | //----------------------------------------------------------------------------- |
| 165 | // <TimeParameters::SetValue> |
nothing calls this directly
no test coverage detected