public static ZWaveMessage Get(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] { 
         (byte)CommandClass.SwitchMultilevel, 
         (byte)Command.SwitchMultilevelGet 
     });
 }
        public NodeEvent GetEvent(ZWaveNode node, byte[] message)
        {
            NodeEvent nodeEvent = null;
            byte      cmdType   = message[1];

            if (message.Length > 4 && cmdType == (byte)Command.ConfigurationReport)
            {
                byte paramId     = message[2];
                byte paramLength = message[3];
                //
                var nodeConfigParamsLength = GetConfigParamsData(node);
                if (!nodeConfigParamsLength.ContainsKey(paramId))
                {
                    nodeConfigParamsLength.Add(paramId, paramLength);
                }
                else
                {
                    // this shouldn't change on read... but you never know! =)
                    nodeConfigParamsLength[paramId] = paramLength;
                }
                //
                byte[] bval = new byte[4];
                // extract bytes value
                Array.Copy(message, 4, bval, 4 - (int)paramLength, (int)paramLength);
                uint paramValue = bval[0];
                Array.Reverse(bval);
                // convert it to uint
                paramValue = BitConverter.ToUInt32(bval, 0);
                nodeEvent  = new NodeEvent(node, EventParameter.Configuration, paramValue, paramId);
            }
            return(nodeEvent);
        }
Exemple #3
0
 public static void Unlock(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Basic,
         (byte)Command.BasicGet
     });
 }
Exemple #4
0
 public static void Get(ZWaveNode node)
 {
     node.SendDataRequest(new byte[] {
         (byte)CommandClass.Battery,
         (byte)Command.BatteryGet
     });
 }
Exemple #5
0
        public NodeEvent GetEvent(ZWaveNode node, byte[] message)
        {
            NodeEvent nodeEvent = null;
            byte      cmdType   = message[1];

            switch (cmdType)
            {
            case (byte)Command.WakeUpIntervalReport:
                if (message.Length > 4)
                {
                    uint interval = ((uint)message[2]) << 16;
                    interval |= (((uint)message[3]) << 8);
                    interval |= (uint)message[4];
                    nodeEvent = new NodeEvent(node, EventParameter.WakeUpInterval, interval, 0);
                }
                break;

            case (byte)Command.WakeUpNotification:
                // Resend queued messages while node was asleep
                var wakeUpResendQueue = GetResendQueueData(node);
                for (int m = 0; m < wakeUpResendQueue.Count; m++)
                {
                    node.SendMessage(wakeUpResendQueue[m]);
                }
                wakeUpResendQueue.Clear();
                nodeEvent = new NodeEvent(node, EventParameter.WakeUpNotify, 1, 0);
                break;
            }
            return(nodeEvent);
        }
        public NodeEvent GetEvent(ZWaveNode node, byte [] message)
        {
            if (message.Length == 0)
            {
                return(null);
            }

            byte cmdType = message [1];

            if (cmdType == (byte)Command.ScheduleReport)
            {
                var climateControlScheduleValue = ClimateControlScheduleValue.Parse(message);
                return(new NodeEvent(node, EventParameter.ClimateControlSchedule, climateControlScheduleValue, 0));
            }

            if (cmdType == (byte)Command.ScheduleChangedReport)
            {
                return(new NodeEvent(node, EventParameter.ClimateControlScheduleChanged, message[2], 0));
            }

            if (cmdType == (byte)Command.ScheduleOverrideReport)
            {
                var climateControlScheduleOverrideValue = ClimateControlScheduleOverrideValue.Parse(message);
                return(new NodeEvent(node, EventParameter.ClimateControlScheduleOverride, climateControlScheduleOverrideValue, 0));
            }

            return(null);
        }
Exemple #7
0
        public NodeEvent GetEvent(ZWaveNode node, byte[] message)
        {
            NodeEvent nodeEvent = null;

            if (message.Length > 7)
            {
                byte[] manufacturerId = new byte[2] {
                    message[2], message[3]
                };
                byte[] typeId = new byte[2] {
                    message[4], message[5]
                };
                byte[] productId = new byte[2] {
                    message[6], message[7]
                };

                var manufacturerSpecs = new ManufacturerSpecificInfo()
                {
                    TypeId         = BitConverter.ToString(typeId).Replace("-", ""),
                    ProductId      = BitConverter.ToString(productId).Replace("-", ""),
                    ManufacturerId = BitConverter.ToString(manufacturerId).Replace("-", "")
                };
                node.ManufacturerSpecific.ManufacturerId = manufacturerSpecs.ManufacturerId;
                node.ManufacturerSpecific.TypeId         = manufacturerSpecs.TypeId;
                node.ManufacturerSpecific.ProductId      = manufacturerSpecs.ProductId;
                nodeEvent = new NodeEvent(node, EventParameter.ManufacturerSpecific, manufacturerSpecs, 0);
            }

            return(nodeEvent);
        }
Exemple #8
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.DoorLock,
         (byte)Command.DoorLockGet
     });
 }
Exemple #9
0
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] { 
         (byte)CommandClass.WakeUp, 
         (byte)Command.WakeUpIntervalGet 
     });
 }
Exemple #10
0
 public static void Reset(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterReset
     });
 }
 public static ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
 {
     ZWaveEvent nodeEvent = null;
     byte cmdType = message[8];
     if (message.Length > 11 && cmdType == (byte)Command.ConfigurationReport)
     {
         byte paramId = message[9];
         byte paramLength = message[10];
         //
         var nodeConfigParamsLength = GetConfigParamsData(node);
         if (!nodeConfigParamsLength.ContainsKey(paramId))
         {
             nodeConfigParamsLength.Add(paramId, paramLength);
         }
         else
         {
             // this shouldn't change on read... but you never know! =)
             nodeConfigParamsLength[paramId] = paramLength;
         }
         //
         byte[] bval = new byte[4];
         // extract bytes value
         Array.Copy(message, 11, bval, 4 - (int)paramLength, (int)paramLength);
         uint paramval = bval[0];
         Array.Reverse(bval);
         // convert it to uint
         paramval = BitConverter.ToUInt32(bval, 0);
         nodeEvent = new ZWaveEvent(node, EventParameter.Configuration, paramval, paramId);
     }
     return nodeEvent;
 }
Exemple #12
0
 public static ZWaveMessage Report(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] { 
         (byte)CommandClass.Version, 
         (byte)Command.VersionGet,
     });
 }
 public static void Get(ZWaveNode node)
 {
     node.SendDataRequest(new byte[] {
         (byte)CommandClass.Battery,
         (byte)Command.BatteryGet
     });
 }
Exemple #14
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SensorBinary,
         (byte)Command.SensorBinaryGet
     });
 }
Exemple #15
0
 public static ZWaveMessage GetSupported(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] { 
         (byte)CommandClass.Meter, 
         (byte)Command.MeterSupportedGet
     });
 }
Exemple #16
0
 public static ZWaveMessage GetCapabilityReport(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.SwitchColor,
         (byte)Command.SwitchColorCapabilityGet
     }));
 }
Exemple #17
0
 public static ZWaveMessage Reset(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] { 
         (byte)CommandClass.Meter, 
         (byte)Command.MeterReset
     });
 }
Exemple #18
0
        private ZWaveEvent HandleMultiChannelEncapReport(ZWaveNode node, byte[] message)
        {
            if (message.Length < 6)
            {
                Utility.DebugLog(DebugMessageType.Warning, String.Format("MultiChannel encapsulated message ERROR: message is too short: {0}", Utility.ByteArrayToString(message)));
                return(null);
            }

            var instanceNumber   = message[2];
            var instanceCmdClass = message[4];
            var instanceMessage  = new byte[message.Length - 4]; //TODO

            Array.Copy(message, 4, instanceMessage, 0, message.Length - 4);

            Utility.DebugLog(DebugMessageType.Information, String.Format("MultiChannel encapsulated message: CmdClass: {0}; message: {1}", instanceCmdClass, Utility.ByteArrayToString(instanceMessage)));

            var cc = CommandClassFactory.GetCommandClass(instanceCmdClass);

            if (cc == null)
            {
                Utility.DebugLog(DebugMessageType.Warning, String.Format("Can't find CommandClass handler for command class {0}", instanceCmdClass));
                return(null);
            }
            ZWaveEvent zevent = cc.GetEvent(node, instanceMessage);

            zevent.Instance    = instanceNumber;
            zevent.NestedEvent = GetNestedEvent(instanceCmdClass, zevent);
            return(zevent);
        }
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.SensorBinary,
         (byte)Command.SensorBinaryGet
     }));
 }
Exemple #20
0
 public static void Get(ZWaveNode node)
 {
     node.SendDataRequest(new byte[] {
         (byte)CommandClass.WakeUp,
         (byte)Command.WakeUpIntervalGet
     });
 }
Exemple #21
0
 public NodeEvent(ZWaveNode node, EventParameter eventType, object eventValue, int instance)
 {
     this.Node = node;
     this.Parameter = eventType;
     this.Value = eventValue;
     this.Instance = instance;
 }
 public static ZWaveMessage ChangedGet(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte [] {
         (byte)CommandClass.ClimateControlSchedule,
         (byte)Command.ScheduleChangedGet
     }));
 }
        private NodeEvent HandleMultiInstanceEncapReport(ZWaveNode node, byte[] message)
        {
            if (message.Length < 5)
            {
                Utility.logger.Error(String.Format("MultiInstance encapsulated message ERROR: message is too short: {0}", BitConverter.ToString(message)));
                return(null);
            }

            byte instanceNumber   = message[2];
            var  instanceCmdClass = message[3];
            var  instanceMessage  = new byte[message.Length - 3]; //TODO:

            Array.Copy(message, 3, instanceMessage, 0, message.Length - 3);

            Utility.logger.Debug(String.Format("MultiInstance encapsulated message: CmdClass: {0}; message: {1}", instanceCmdClass, BitConverter.ToString(instanceMessage)));

            var cc = CommandClassFactory.GetCommandClass(instanceCmdClass);

            if (cc == null)
            {
                Utility.logger.Error(String.Format("Can't find CommandClass handler for command class {0}", instanceCmdClass));
                return(null);
            }
            NodeEvent zevent = cc.GetEvent(node, instanceMessage);

            zevent.Instance    = instanceNumber;
            zevent.NestedEvent = GetNestedEvent(instanceCmdClass, zevent);
            return(zevent);
        }
        public ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
        {
            ZWaveEvent nodeEvent = null;

            if (message.Length > 7)
            {
                byte[] manufacturerId = new byte[2] {
                    message[2], message[3]
                };
                byte[] typeId = new byte[2] {
                    message[4], message[5]
                };
                byte[] productId = new byte[2] {
                    message[6], message[7]
                };

                var manufacturerSpecs = new ManufacturerSpecificInfo()
                {
                    TypeId         = Utility.ByteArrayToString(typeId).Replace(" ", ""),
                    ProductId      = Utility.ByteArrayToString(productId).Replace(" ", ""),
                    ManufacturerId = Utility.ByteArrayToString(manufacturerId).Replace(" ", "")
                };

                nodeEvent = new ZWaveEvent(node, EventParameter.ManufacturerSpecific, manufacturerSpecs, 0);
            }

            return(nodeEvent);
        }
        public NodeEvent GetEvent(ZWaveNode node, byte[] message)
        {
            //Set up the color values array
            var colordata = node.GetData("ColorValues");
            if (colordata == null) { colordata = new NodeData("ColorValues", new List<ColorValue>()); }
            var colorvals = colordata.Value as List<ColorValue>;
            NodeEvent nodeEvent = null;
            byte cmdType = message[1];
            if (cmdType == (byte)Command.SwitchColorCapabilityReport)
            {
                for (int i = 2; i < 4; i++)
                {
                    for (int j = 0; j < 8; j++)
                    {
                        if ((message[i] & 0x1 << j) > 0)
                        {
                            var colnum = (ZWaveSwitchColorNumber)(8*i+j);
                            var exist = (from val in colorvals
                                         where val.ColorNumber == colnum
                                         select val).FirstOrDefault();
                            if (exist == null) { colorvals.Add(new ColorValue { ColorNumber = colnum, Value = 0 }); }
                            Get(node, 8 * i + j);
                        }
                    }
                }
            }
            else if (cmdType == (byte)Command.SwitchColorReport)
            {

            }
            node.UpdateData("ColorValues", colorvals);
            return nodeEvent;
        }
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] {
         (byte)CommandClass.SensorBinary,
         (byte)Command.SensorBinaryGet
     });
 }
 public static ZWaveMessage GetCapabilityReport(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] {
         (byte)CommandClass.SwitchColor,
         (byte)Command.SwitchColorCapabilityGet
     });
 }
 public static ZWaveMessage Report(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.Version,
         (byte)Command.VersionGet,
     }));
 }
Exemple #29
0
        public static void ResendOnWakeUp(ZWaveNode node, byte[] msg)
        {
            int minCommandLength = 8;

            if (msg.Length >= minCommandLength && !(msg[6] == (byte)CommandClass.WakeUp && msg[7] == (byte)Command.WakeUpNoMoreInfo))
            {
                byte[] command = new byte[minCommandLength];
                Array.Copy(msg, 0, command, 0, minCommandLength);
                // discard any message having same header and command (first 8 bytes = header + command class + command)
                var wakeUpResendQueue = GetResendQueueData(node);
                for (int i = wakeUpResendQueue.Count - 1; i >= 0; i--)
                {
                    byte[] queuedCommand = new byte[minCommandLength];
                    Array.Copy(wakeUpResendQueue[i], 0, queuedCommand, 0, minCommandLength);
                    if (queuedCommand.SequenceEqual(command))
                    {
                        Utility.logger.Trace("Removing old message {0}", BitConverter.ToString(wakeUpResendQueue[i]));
                        wakeUpResendQueue.RemoveAt(i);
                    }
                }
                Utility.logger.Trace("Adding message {0}", BitConverter.ToString(msg));
                wakeUpResendQueue.Add(msg);
                var wakeUpStatus = (WakeUpStatus)node.GetData("WakeUpStatus", new WakeUpStatus()).Value;
                if (!wakeUpStatus.IsSleeping)
                {
                    wakeUpStatus.IsSleeping = true;
                    var nodeEvent = new NodeEvent(node, EventParameter.WakeUpSleepingStatus, 1 /* 1 = sleeping, 0 = awake */, 0);
                    node.OnNodeUpdated(nodeEvent);
                }
            }
        }
 public static void GetOperatingState(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatOperatingState,
         (byte)Command.BasicGet
     });
 }
Exemple #31
0
 public static ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
 {
     ZWaveEvent nodeEvent = null;
     byte cmdType = message[8];
     if (message.Length > 12 && cmdType == (byte)Command.AssociationReport)
     {
         byte groupId = message[9];
         byte maxAssociations = message[10];
         byte numAssociations = message[11]; // it is always zero ?!?
         string assocNodes = "";
         if (message.Length > 13)
         {
             for (int a = 12; a < message.Length - 1; a++)
             {
                 assocNodes += message[a] + ",";
             }
         }
         assocNodes = assocNodes.TrimEnd(',');
         //
         var associationRespose = new AssociationResponse() {
             Max = maxAssociations,
             Count = numAssociations,
             NodeList = assocNodes,
             GroupId = groupId
         };
         nodeEvent = new ZWaveEvent(node, EventParameter.Association, associationRespose, 0);
     }
     return nodeEvent;
 }
Exemple #32
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatFanMode,
         (byte)Command.BasicGet
     });
 }
Exemple #33
0
        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;
        }
Exemple #34
0
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.WakeUp,
         (byte)Command.WakeUpIntervalGet
     }));
 }
        public static ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
        {
            ZWaveEvent nodeEvent = null;
            byte       cmdType   = message[8];

            if (message.Length > 14)
            {
                byte[] manufacturerId = new byte[2] {
                    message[9], message[10]
                };
                byte[] typeId = new byte[2] {
                    message[11], message[12]
                };
                byte[] productId = new byte[2] {
                    message[13], message[14]
                };

                var manufacturerSpecs = new ManufacturerSpecificInfo()
                {
                    TypeId         = Utility.ByteArrayToString(typeId).Replace(" ", ""),
                    ProductId      = Utility.ByteArrayToString(productId).Replace(" ", ""),
                    ManufacturerId = Utility.ByteArrayToString(manufacturerId).Replace(" ", "")
                };

                nodeEvent = new ZWaveEvent(node, EventParameter.ManufacturerSpecific, manufacturerSpecs, 0);
            }

            return(nodeEvent);
        }
Exemple #36
0
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.Clock,
         (byte)Command.ClockGet
     }));
 }
Exemple #37
0
        public static ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
        {
            ZWaveEvent nodeEvent = null;
            byte       cmdType   = message[8];

            if (message.Length > 12 && cmdType == (byte)Command.AssociationReport)
            {
                byte   groupId         = message[9];
                byte   maxAssociations = message[10];
                byte   numAssociations = message[11]; // it is always zero ?!?
                string assocNodes      = "";
                if (message.Length > 13)
                {
                    for (int a = 12; a < message.Length - 1; a++)
                    {
                        assocNodes += message[a] + ",";
                    }
                }
                assocNodes = assocNodes.TrimEnd(',');
                //
                var associationRespose = new AssociationResponse()
                {
                    Max      = maxAssociations,
                    Count    = numAssociations,
                    NodeList = assocNodes,
                    GroupId  = groupId
                };
                nodeEvent = new ZWaveEvent(node, EventParameter.Association, associationRespose, 0);
            }
            return(nodeEvent);
        }
 public static void Get(ZWaveNode node)
 {
     node.SendDataRequest(new byte[] {
         (byte)CommandClass.WakeUp,
         (byte)Command.WakeUpIntervalGet
     });
 }
 public static void ResendOnWakeUp(ZWaveNode node, byte[] msg)
 {
     int minCommandLength = 8;
     if (msg.Length >= minCommandLength)
     {
         byte[] command = new byte[minCommandLength];
         Array.Copy(msg, 0, command, 0, minCommandLength);
         // discard any message having same header and command (first 8 bytes = header + command class + command)
         var wakeUpResendQueue = GetResendQueueData(node);
         for (int i = wakeUpResendQueue.Count - 1; i >= 0; i--)
         {
             byte[] queuedCommand = new byte[minCommandLength];
             Array.Copy(wakeUpResendQueue[i], 0, queuedCommand, 0, minCommandLength);
             if (queuedCommand.SequenceEqual(command))
             {
                 Utility.logger.Trace("Removing old message {0}", BitConverter.ToString(wakeUpResendQueue[i]));
                 wakeUpResendQueue.RemoveAt(i);
             }
         }
         Utility.logger.Trace("Adding message {0}", BitConverter.ToString(msg));
         wakeUpResendQueue.Add(msg);
         var wakeUpStatus = (WakeUpStatus)node.GetData("WakeUpStatus", new WakeUpStatus()).Value;
         if (!wakeUpStatus.IsSleeping)
         {
             wakeUpStatus.IsSleeping = true;
             var nodeEvent = new NodeEvent(node, EventParameter.WakeUpSleepingStatus, 1 /* 1 = sleeping, 0 = awake */, 0);
             node.OnNodeUpdated(nodeEvent);
         }
     }
 }
Exemple #40
0
        public NodeEvent GetEvent(ZWaveNode node, byte[] message)
        {
            NodeEvent nodeEvent = null;
            var       type      = (Command)message[1];

            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);
        }
Exemple #41
0
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.SwitchMultilevel,
         (byte)Command.SwitchMultilevelGet
     }));
 }
Exemple #42
0
 public static void GetSupported(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterSupportedGet
     });
 }
 public NodeEvent GetEvent(ZWaveNode node, byte[] message)
 {
     NodeEvent nodeEvent = null;
     byte cmdType = message[1];
     switch (cmdType)
     {
     case (byte)Command.WakeUpIntervalReport:
         if (message.Length > 4)
         {
             uint interval = ((uint)message[2]) << 16;
             interval |= (((uint)message[3]) << 8);
             interval |= (uint)message[4];
             nodeEvent = new NodeEvent(node, EventParameter.WakeUpInterval, interval, 0);
         }
         break;
     case (byte)Command.WakeUpNotification:
         // Resend queued messages while node was asleep
         var wakeUpResendQueue = GetResendQueueData(node);
         for (int m = 0; m < wakeUpResendQueue.Count; m++)
         {
             node.SendMessage(wakeUpResendQueue[m]);
         }
         wakeUpResendQueue.Clear();
         nodeEvent = new NodeEvent(node, EventParameter.WakeUpNotify, 1, 0);
         break;
     }
     return nodeEvent;
 }
Exemple #44
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SwitchMultilevel,
         (byte)Command.SwitchMultilevelGet
     });
 }
Exemple #45
0
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.ThermostatMode,
         (byte)Command.BasicGet
     }));
 }
Exemple #46
0
 public static ZWaveMessage SupportedGet(ZWaveNode node)
 {
     return(node.SendDataRequest(new byte[] {
         (byte)CommandClass.CentralScene,
         (byte)Command.CentralSceneSupportedGet
     }));
 }
Exemple #47
0
 public static void Get(ZWaveNode node)
 {
     node.SendDataRequest(new byte[] {
         (byte)CommandClass.DoorLock,
         (byte)Command.DoorLockGet
     });
 }
Exemple #48
0
        private ZWaveEvent HandleMultiInstanceEncapReport(ZWaveNode node, byte[] message)
        {
            if (message.Length < 5)
            {
                Console.WriteLine("\nZWaveLib: MultiInstance encapsulated message ERROR: message is too short: {0}", Utility.ByteArrayToString(message));
                return(null);
            }

            byte instanceNumber   = message[2];
            var  instanceCmdClass = message[3];
            var  instanceMessage  = new byte[message.Length - 3]; //TODO:

            Array.Copy(message, 3, instanceMessage, 0, message.Length - 3);

            Console.WriteLine("\nZWaveLib: MultiInstance encapsulated message: CmdClass: {0}; message: {1}", instanceCmdClass, Utility.ByteArrayToString(instanceMessage));

            var cc = CommandClassFactory.GetCommandClass(instanceCmdClass);

            if (cc == null)
            {
                Console.WriteLine("\nZWaveLib: Can't find CommandClass handler for command class {0}", instanceCmdClass);
                return(null);
            }
            ZWaveEvent zevent = cc.GetEvent(node, instanceMessage);

            zevent.Instance    = instanceNumber;
            zevent.NestedEvent = GetNestedEvent(instanceCmdClass, zevent);
            return(zevent);
        }
Exemple #49
0
 public static ZWaveMessage Get(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] { 
         (byte)CommandClass.DoorLock, 
         (byte)Command.DoorLockGet
     });
 }
Exemple #50
0
 public static void Reset(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterReset
     });
 }
Exemple #51
0
        public ZWaveEvent GetEvent(ZWaveNode node, byte[] message)
        {
            ZWaveEvent nodeEvent = null;
            byte       cmdType   = message[1];

            if (message.Length > 5 && cmdType == (byte)Command.AssociationReport)
            {
                byte   groupId          = message[2];
                byte   associationMax   = message[3];
                byte   associationCount = message[4]; // it is always zero ?!?
                string associationNodes = "";
                if (message.Length > 4)
                {
                    for (int a = 5; a < message.Length; a++)
                    {
                        associationNodes += message[a] + ",";
                    }
                }
                associationNodes = associationNodes.TrimEnd(',');
                //
                var associationResponse = new AssociationResponse()
                {
                    Max      = associationMax,
                    Count    = associationCount,
                    NodeList = associationNodes,
                    GroupId  = groupId
                };
                nodeEvent = new ZWaveEvent(node, EventParameter.Association, associationResponse, 0);
            }
            return(nodeEvent);
        }
Exemple #52
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SensorBinary,
         (byte)Command.SensorBinaryGet
     });
 }
 public static ZWaveMessage GetOperatingState(ZWaveNode node)
 {
     return node.SendDataRequest(new byte[] {
         (byte)CommandClass.ThermostatOperatingState,
         (byte)Command.BasicGet
     });
 }
Exemple #54
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatMode,
         (byte)Command.BasicGet
     });
 }
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SensorMultilevel,
         (byte)Command.SensorMultilevelGet
     });
 }
Exemple #56
0
 public static ZWaveMessage Set(ZWaveNode node, int value)
 {
     return node.SendDataRequest(new byte[] { 
         (byte)CommandClass.Basic, 
         (byte)Command.BasicSet, 
         byte.Parse(value.ToString())
     });
 }
Exemple #57
0
 public static void Get(ZWaveNode node, byte scaleType)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterGet,
         scaleType
     });
 }
Exemple #58
0
 public static void Get(ZWaveNode node, byte groupId)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Association,
         (byte)Command.AssociationGet,
         groupId
     });
 }
Exemple #59
0
 public static void GetCount(ZWaveNode node, byte commandClass)
 {
     node.SendRequest(new byte[] {
         (byte) CommandClass.MultiInstance,
         (byte) Command.MultiInstanceCountGet,
         commandClass
     });
 }
Exemple #60
0
 private static UserCodeValue GetUserCodeData(ZWaveNode node)
 {
     if (!node.Data.ContainsKey("UserCode"))
     {
         node.Data.Add("UserCode", new UserCodeValue());
     }
     return (UserCodeValue)node.Data["UserCode"];
 }