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

Method HandleMsg

cpp/src/command_classes/ManufacturerProprietary.cpp:58–102  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

56// Handle a message from the Z-Wave network
57//-----------------------------------------------------------------------------
58bool ManufacturerProprietary::HandleMsg
59(
60 uint8 const* _data,
61 uint32 const _length,
62 uint32 const _instance // = 1
63)
64{
65 uint8 const* payload = _data+2;
66 if( MANUFACTURER_ID_FIBARO[0] == _data[0] &&
67 MANUFACTURER_ID_FIBARO[1] == _data[1] )
68 {
69
70 if( FIBARO_VENETIEN_BLINDS_REPORT_ID[0] == payload[0] &&
71 FIBARO_VENETIEN_BLINDS_REPORT_ID[1] == payload[1] &&
72 FIBARO_VENETIEN_BLINDS_REPORT_ID[2] == payload[2] )
73 {
74 ValueByte* blindsValue = static_cast<ValueByte*>( GetValue( _instance, FibaroVenetianBlindsValueIds_Blinds ) );
75 ValueByte* tiltValue = static_cast<ValueByte*>( GetValue( _instance, FibaroVenetianBlindsValueIds_Tilt ) );
76
77 if( NULL != blindsValue && NULL != tiltValue)
78 {
79 Log::Write( LogLevel_Info, GetNodeId(), "Received Fibaro proprietary blind/slat position for node %d: Blinds: %d Slats: %d",
80 GetNodeId(), payload[3], payload[4] );
81 blindsValue->OnValueRefreshed( payload[3] );
82 tiltValue->OnValueRefreshed( payload[4] );
83 blindsValue->Release();
84 tiltValue->Release();
85 }
86 else
87 {
88 Log::Write( LogLevel_Warning, GetNodeId(), "Error setting Fibaro blind/slat position. Values were not found." );
89 }
90 return true;
91 }
92 else
93 {
94 Log::Write( LogLevel_Warning, GetNodeId(), "Received unknown Fibaro proprietary message for node %d.",
95 GetNodeId());
96 return false;
97 }
98 }
99 Log::Write( LogLevel_Warning, GetNodeId(), "Received unknown manufacturer proprietary message for node %d.",
100 GetNodeId());
101 return false;
102}
103
104//-----------------------------------------------------------------------------
105// <ManufacturerProprietary::RequestValue>

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