@@ -287,41 +287,41 @@ void HandleSimulateLatchPosition(Json::Value & jsonValue)
287
287
}
288
288
289
289
/* *
290
- * Named pipe handler for simulating a latched switch movement .
290
+ * Named pipe handler for simulating a Door Opening .
291
291
*
292
292
* Usage example:
293
293
* echo '{"Name":"SetRefDoorStatus", "EndpointId": 1, "Status": 1}' > /tmp/chip_all_clusters_fifo_1146610
294
294
*
295
295
* JSON Arguments:
296
296
* - "Name": Must be "SetRefDoorStatus"
297
- * - "EndpointId": ID of endpoint having a switch cluster
298
- * - "Status ": Status of the door, open or closed.
297
+ * - "EndpointId": ID of endpoint
298
+ * - "DoorOpen ": Status of the door, open or closed.
299
299
*
300
300
* @param jsonValue - JSON payload from named pipe
301
301
*/
302
302
void SetRefrigetatorDoorStatusHandler (Json::Value & jsonValue)
303
303
{
304
304
bool hasEndpointId = HasNumericField (jsonValue, " EndpointId" );
305
- bool hasDoorStatus = HasNumericField (jsonValue, " Status " );
305
+ bool hasDoorStatus = HasNumericField (jsonValue, " DoorOpen " );
306
306
307
307
if (!hasEndpointId || !hasDoorStatus)
308
308
{
309
309
std::string inputJson = jsonValue.toStyledString ();
310
310
ChipLogError (NotSpecified, " Missing or invalid value for one of EndpointId, Status in %s" , inputJson.c_str ());
311
311
return ;
312
312
}
313
- // values to updatethe state
313
+ // values to update the door status
314
314
EndpointId endpointId = static_cast <EndpointId>(jsonValue[" EndpointId" ].asUInt ());
315
- uint8_t doorStatus = static_cast <uint8_t >(jsonValue[" Status " ].asUInt ());
315
+ bool doorStatus = static_cast <bool >(jsonValue[" DoorOpen " ].asBool ());
316
316
ChipLogDetail (NotSpecified, " SetRefrigetatorDoorStatusHandler State -> %d." ,doorStatus);
317
- if ( doorStatus == 0 ) {
317
+ if ( ! doorStatus ) {
318
318
RefrigeratorAlarmServer::Instance ().SetMaskValue (endpointId,doorStatus);
319
319
ChipLogDetail (NotSpecified, " Refrigeratoralarm status updated to :%d" , doorStatus);
320
- }else if (doorStatus == 1 ){
320
+ }else if (doorStatus){
321
321
RefrigeratorAlarmServer::Instance ().SetMaskValue (endpointId,doorStatus);
322
322
RefrigeratorAlarmServer::Instance ().SetStateValue (endpointId,doorStatus);
323
323
}else {
324
- ChipLogError (NotSpecified, " Invalid State value to set." );
324
+ ChipLogError (NotSpecified, " Invalid value to set." );
325
325
return ;
326
326
}
327
327
}
0 commit comments