本文整理汇总了C++中Notification::SetHomeNodeIdAndInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ Notification::SetHomeNodeIdAndInstance方法的具体用法?C++ Notification::SetHomeNodeIdAndInstance怎么用?C++ Notification::SetHomeNodeIdAndInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::SetHomeNodeIdAndInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNodeId
//-----------------------------------------------------------------------------
// <Basic::HandleMsg>
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
bool Basic::HandleMsg
(
uint8 const* _data,
uint32 const _length,
uint32 const _instance // = 1
)
{
if( BasicCmd_Report == (BasicCmd)_data[0] )
{
// Level
Log::Write( LogLevel_Info, GetNodeId(), "Received Basic report from node %d: level=%d", GetNodeId(), _data[1] );
if( ValueByte* value = static_cast<ValueByte*>( GetValue( _instance, 0 ) ) )
{
value->OnValueRefreshed( _data[1] );
value->Release();
}
return true;
}
if( BasicCmd_Set == (BasicCmd)_data[0] )
{
// Commmand received from the node. Handle as a notification event
Log::Write( LogLevel_Info, GetNodeId(), "Received Basic set from node %d: level=%d. Sending event notification.", GetNodeId(), _data[1] );
Notification* notification = new Notification( Notification::Type_NodeEvent );
notification->SetHomeNodeIdAndInstance( GetHomeId(), GetNodeId(), _instance );
notification->SetEvent( _data[1] );
GetDriver()->QueueNotification( notification );
return true;
}
return false;
}
示例2: if
//-----------------------------------------------------------------------------
// <Basic::HandleMsg>
// Handle a message from the Z-Wave network
//-----------------------------------------------------------------------------
bool Basic::HandleMsg
(
uint8 const* _data,
uint32 const _length,
uint32 const _instance // = 1
)
{
if( BasicCmd_Report == (BasicCmd)_data[0] )
{
// Level
Log::Write( LogLevel_Info, GetNodeId(), "Received Basic report from node %d: level=%d instance=%d", GetNodeId(), _data[1],_instance );
if( !m_ignoreMapping && m_mapping != 0 )
{
UpdateMappedClass( _instance, m_mapping, _data[1] );
}
else if( ValueByte* value = static_cast<ValueByte*>( GetValue( _instance, 0 ) ) )
{
value->OnValueRefreshed( _data[1] );
value->Release();
}
else if( ValueByte* value = static_cast<ValueByte*>( GetValue( 1, 0 ) ) )
{
value->OnValueRefreshed( _data[1] );
value->Release();
}
return true;
}
if( BasicCmd_Set == (BasicCmd)_data[0] )
{
if( m_setAsReport )
{
Log::Write( LogLevel_Info, GetNodeId(), "Received Basic set from node %d: level=%d. Treating it as a Basic report. instance=%d", GetNodeId(), _data[1], _instance );
if( !m_ignoreMapping && m_mapping != 0 )
{
UpdateMappedClass( _instance, m_mapping, _data[1] );
}
else if( ValueByte* value = static_cast<ValueByte*>( GetValue( _instance, 0 ) ) )
{
value->OnValueRefreshed( _data[1] );
value->Release();
}
else if (ValueByte* value = static_cast<ValueByte*>( GetValue( 1, 0 ) ))
{
if (_data[1] <16)
value->OnValueRefreshed( _data[1]+100 );
value->Release();
}
}
else
{
// Commmand received from the node. Handle as a notification event
Log::Write( LogLevel_Info, GetNodeId(), "Received Basic set from node %d: level=%d. Sending event notification.", GetNodeId(), _data[1] );
Notification* notification = new Notification( Notification::Type_NodeEvent );
notification->SetHomeNodeIdAndInstance( GetHomeId(), GetNodeId(), _instance );
notification->SetEvent( _data[1] );
GetDriver()->QueueNotification( notification );
}
return true;
}
return false;
}