本文整理汇总了C#中ZWaveNode.GetCommandClass方法的典型用法代码示例。如果您正苦于以下问题:C# ZWaveNode.GetCommandClass方法的具体用法?C# ZWaveNode.GetCommandClass怎么用?C# ZWaveNode.GetCommandClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZWaveNode
的用法示例。
在下文中一共展示了ZWaveNode.GetCommandClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEvent
public NodeEvent GetEvent(ZWaveNode node, byte[] message)
{
NodeEvent nodeEvent = null;
Command type = (Command)message[1];
if (type == Command.VersionCommandClassReport)
{
if (!Enum.IsDefined(typeof(CommandClass), message[2]))
{
return nodeEvent;
}
CommandClass cmdClass = (CommandClass)message[2];
VersionValue value = new VersionValue(cmdClass, message[3]);
// Update node CC data
if (cmdClass != CommandClass.NotSet)
{
var nodeCc = node.GetCommandClass(cmdClass);
if (nodeCc != null)
nodeCc.Version = value.Version;
// Set the VersionCommandClass event
nodeEvent = new NodeEvent(node, EventParameter.VersionCommandClass, value, 0);
}
else
{
Utility.logger.Warn("Command Class {0} ({1}) not supported yet", message[3], message[3].ToString("X2"));
}
}
return nodeEvent;
}
示例2: GetEvent
public NodeEvent GetEvent(ZWaveNode node, byte[] message)
{
NodeEvent nodeEvent = null;
var type = (Command)message[1];
if (type == Command.VersionReport)
{
var nodeVersion = new NodeVersion {
LibraryType = message[2],
ProtocolVersion = message[3],
ProtocolSubVersion = message[4],
ApplicationVersion = message[5],
ApplicationSubVersion = message[6]
};
node.Version = nodeVersion;
nodeEvent = new NodeEvent(node, EventParameter.VersionCommandClass, nodeVersion, 0);
}
if (type == Command.VersionCommandClassReport)
{
var cmdClass = (CommandClass)message[2];
var value = new VersionValue(cmdClass, message[3]);
// Update node CC data
if (cmdClass != CommandClass.NotSet)
{
var nodeCc = node.GetCommandClass(cmdClass);
if (nodeCc != null)
nodeCc.Version = value.Version;
// Set the VersionCommandClass event
nodeEvent = new NodeEvent(node, EventParameter.VersionCommandClass, value, 0);
}
else
{
Utility.logger.Warn("Command Class {0} ({1}) not supported yet", message[3], message[3].ToString("X2"));
}
}
return nodeEvent;
}
示例3: GetEvent
public NodeEvent GetEvent(ZWaveNode node, byte[] message)
{
NodeEvent nodeEvent = null;
byte cmdType = message[1];
if (cmdType == (byte)Command.SensorBinaryReport)
{
var cc = node.GetCommandClass(GetClassId());
int version = (cc != null ? cc.Version : 0);
if (version == 1 || message.Length <= 3)
{
nodeEvent = new NodeEvent(node, EventParameter.SensorGeneric, message[2], 0);
}
else
{
byte tmp = message[3];
ZWaveSensorBinaryParameter sensorType = ZWaveSensorBinaryParameter.General;
EventParameter eventType;
if (Enum.IsDefined(typeof(ZWaveSensorBinaryParameter), tmp))
{
sensorType = (ZWaveSensorBinaryParameter)tmp;
}
switch (sensorType)
{
case ZWaveSensorBinaryParameter.Smoke:
eventType = EventParameter.AlarmSmoke;
break;
case ZWaveSensorBinaryParameter.CarbonMonoxide:
eventType = EventParameter.AlarmCarbonMonoxide;
break;
case ZWaveSensorBinaryParameter.CarbonDioxide:
eventType = EventParameter.AlarmCarbonDioxide;
break;
case ZWaveSensorBinaryParameter.Heat:
eventType = EventParameter.AlarmHeat;
break;
case ZWaveSensorBinaryParameter.Water:
eventType = EventParameter.AlarmFlood;
break;
case ZWaveSensorBinaryParameter.Tamper:
eventType = EventParameter.AlarmTampered;
break;
case ZWaveSensorBinaryParameter.DoorWindow:
eventType = EventParameter.AlarmDoorWindow;
break;
case ZWaveSensorBinaryParameter.Motion:
eventType = EventParameter.SensorMotion;
break;
case ZWaveSensorBinaryParameter.Freeze:
case ZWaveSensorBinaryParameter.Auxiliary:
case ZWaveSensorBinaryParameter.Tilt:
case ZWaveSensorBinaryParameter.General:
default:
// Catch-all for the undefined types above.
eventType = EventParameter.SensorGeneric;
break;
}
nodeEvent = new NodeEvent(node, eventType, message[2], 0);
}
}
return nodeEvent;
}