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

Method HandleMsg

cpp/src/command_classes/ApplicationStatus.cpp:49–96  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

47// Handle a message from the Z-Wave network
48//-----------------------------------------------------------------------------
49bool ApplicationStatus::HandleMsg
50(
51 uint8 const* _data,
52 uint32 const _length,
53 uint32 const _instance // = 1
54)
55{
56 Notification* notification = new Notification( Notification::Type_Notification );
57 notification->SetHomeAndNodeIds( GetHomeId(), GetNodeId() );
58 notification->SetNotification( Notification::Type_UserAlerts );
59 if( ApplicationStatusCmd_Busy == (ApplicationStatusCmd)_data[0] )
60 {
61 switch( _data[1] )
62 {
63 case 0:
64 {
65 notification->SetUserAlertNofification(Notification::Alert_ApplicationStatus_Retry);
66 break;
67 }
68 case 1:
69 {
70 notification->SetUserAlertNofification(Notification::Alert_ApplicationStatus_Retry);
71 notification->SetRetry(_data[2]);
72 break;
73 }
74 case 2:
75 {
76 notification->SetUserAlertNofification(Notification::Alert_ApplicationStatus_Queued);
77 break;
78 }
79 default:
80 {
81 // Invalid status
82 Log::Write( LogLevel_Warning, GetNodeId(), "Received a unknown Application Status Message %d - Assuming Rejected", _data[1]);
83 notification->SetUserAlertNofification(Notification::Alert_ApplicationStatus_Rejected);
84 }
85 }
86 }
87
88 if( ApplicationStatusCmd_RejectedRequest == (ApplicationStatusCmd)_data[0] )
89 {
90 notification->SetUserAlertNofification(Notification::Alert_ApplicationStatus_Rejected);
91 }
92
93 GetDriver()->QueueNotification( notification );
94
95 return true;
96}
97

Callers

nothing calls this directly

Calls 4

WriteFunction · 0.85
QueueNotificationMethod · 0.80
GetHomeIdFunction · 0.70
GetNodeIdFunction · 0.70

Tested by

no test coverage detected