Esempio n. 1
0
 public static void Reset(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterReset
     });
 }
 public static void GetOperatingState(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatOperatingState,
         (byte)Command.BasicGet
     });
 }
Esempio n. 3
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatMode,
         (byte)Command.BasicGet
     });
 }
Esempio n. 4
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.DoorLock,
         (byte)Command.DoorLock_Get
     });
 }
Esempio n. 5
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SwitchMultilevel,
         (byte)Command.SwitchMultilevelGet
     });
 }
Esempio n. 6
0
 public static void GetSupported(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterSupportedGet
     });
 }
Esempio n. 7
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.WakeUp,
         (byte)Command.WakeUpIntervalGet
     });
 }
Esempio n. 8
0
 public static void Reset(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterReset
     });
 }
Esempio n. 9
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SensorBinary,
         (byte)Command.SensorBinaryGet
     });
 }
Esempio n. 10
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.WakeUp,
         (byte)Command.WakeUpIntervalGet
     });
 }
Esempio n. 11
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SensorBinary,
         (byte)Command.SensorBinaryGet
     });
 }
Esempio n. 12
0
 public static void Unlock(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Basic,
         (byte)Command.BasicGet
     });
 }
Esempio n. 13
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatFanMode,
         (byte)Command.BasicGet
     });
 }
Esempio n. 14
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.DoorLock,
         (byte)Command.DoorLockGet
     });
 }
Esempio n. 15
0
 public static void Get(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SensorMultilevel,
         (byte)Command.SensorMultilevelGet
     });
 }
Esempio n. 16
0
 public static void GetSupported(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterSupportedGet
     });
 }
Esempio n. 17
0
 public static void Get(ZWaveNode node, byte scaleType)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterGet,
         scaleType
     });
 }
Esempio n. 18
0
 public static void Get(ZWaveNode node, Value ptype)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatSetPoint,
         (byte)Command.ThermostatSetPointGet,
         (byte)ptype
     });
 }
Esempio n. 19
0
 public static void Get(ZWaveNode node, byte parameter)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Configuration,
         (byte)Command.ConfigurationGet,
         parameter
     });
 }
Esempio n. 20
0
 public static void GetScheme(ZWaveNode node)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Security,
         (byte)SecurityCommand.SchemeGet,
         0
     });
 }
Esempio n. 21
0
 public static void GetSetPoint(ZWaveNode node, SetPointType ptype)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatSetPoint,
         (byte)Command.ThermostatSetPointGet,
         (byte)ptype
     });
 }
Esempio n. 22
0
 public static void Set(ZWaveNode node, Value mode)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatMode,
         (byte)Command.BasicSet,
         (byte)mode
     });
 }
Esempio n. 23
0
 public static void GetCount(ZWaveNode node, byte commandClass)
 {
     node.SendRequest(new byte[] {
         (byte) CommandClass.MultiInstance,
         (byte) Command.MultiInstanceCountGet,
         commandClass
     });
 }
Esempio n. 24
0
 public static void GetCount(ZWaveNode node, byte commandClass)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.MultiInstance,
         (byte)Command.MultiInstanceCountGet,
         commandClass
     });
 }
Esempio n. 25
0
 public static void Get(ZWaveNode node, byte groupId)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Association,
         (byte)Command.AssociationGet,
         groupId
     });
 }
Esempio n. 26
0
 public static void Get(ZWaveNode node, byte parameter)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Configuration,
         (byte)Command.ConfigurationGet,
         parameter
     });
 }
Esempio n. 27
0
 public static void Get(ZWaveNode node, byte groupId)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Association,
         (byte)Command.AssociationGet,
         groupId
     });
 }
Esempio n. 28
0
 public static void Set(ZWaveNode node, Value mode)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.ThermostatFanMode,
         (byte)Command.BasicSet,
         (byte)mode
     });
 }
Esempio n. 29
0
 public static void Set(ZWaveNode node, int value)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.SwitchMultilevel,
         (byte)Command.SwitchMultilevelSet,
         byte.Parse(value.ToString())
     });
 }
Esempio n. 30
0
 public static void Set(ZWaveNode node, int value)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Basic,
         (byte)Command.BasicSet,
         byte.Parse(value.ToString())
     });
 }
Esempio n. 31
0
 public static void Get(ZWaveNode node, byte scaleType)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Meter,
         (byte)Command.MeterGet,
         scaleType
     });
 }
Esempio n. 32
0
 public static void Set(ZWaveNode node, int value)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Basic,
         (byte)Command.BasicSet,
         byte.Parse(value.ToString())
     });
 }
Esempio n. 33
0
 public static void Remove(ZWaveNode node, byte groupId, byte targetNodeId)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Association,
         (byte)Command.AssociationRemove,
         groupId,
         targetNodeId
     });
 }
Esempio n. 34
0
 public static void Remove(ZWaveNode node, byte groupid, byte targetnodeid)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Association,
         (byte)Command.AssociationRemove,
         groupid,
         targetnodeid
     });
 }
Esempio n. 35
0
 public static void Set(ZWaveNode node, byte groupid, byte targetNodeId)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Association,
         (byte)Command.AssociationSet,
         groupid,
         targetNodeId
     });
 }
Esempio n. 36
0
 public static void Set(ZWaveNode node, byte groupid, byte targetnodeid)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.Association,
         (byte)Command.AssociationSet,
         groupid,
         targetnodeid
     });
 }
Esempio n. 37
0
        public static void Set(ZWaveNode node, byte parameter, Int32 paramValue)
        {
            int valueLength            = 1;
            var nodeConfigParamsLength = GetConfigParamsData(node);

            if (!nodeConfigParamsLength.ContainsKey(parameter))
            {
                Get(node, parameter);
                int retries = 0;
                while (!nodeConfigParamsLength.ContainsKey(parameter) && retries++ <= 5)
                {
                    Thread.Sleep(1000);
                }
            }
            if (nodeConfigParamsLength.ContainsKey(parameter))
            {
                valueLength = nodeConfigParamsLength[parameter];
            }
            //Console.WriteLine("GOT Parameter Length: " + valuelen);
            //
            //byte[] value = new byte[valuelen]; // { (byte)intvalue };//BitConverter.GetBytes(Int32.Parse(intvalue));
            byte[] value32 = BitConverter.GetBytes(paramValue);
            Array.Reverse(value32);
            //int curbyte = valuelen - 1;
            //for (int x = 0; x < value32.Length && curbyte >= 0; x++)
            //{
            //    value[curbyte--] = value32[x];
            //}
            ////if (value32[0] != 0 && valuelen > 1)
            ////{
            ////    value[0] = value32[0];
            ////}
            ////
            //Console.WriteLine("\n\n\nCOMPUTED VALUE: " + zp.ByteArrayToString(value32) + "\n->" + zp.ByteArrayToString(BitConverter.GetBytes(intvalue)) + "\n\n");
            //
            byte[] msg = new byte[4 + valueLength];
            msg[0] = (byte)CommandClass.Configuration;
            msg[1] = (byte)Command.ConfigurationSet;
            msg[2] = parameter;
            msg[3] = (byte)valueLength;
            switch (valueLength)
            {
            case 1:
                Array.Copy(value32, 3, msg, 4, 1);
                break;

            case 2:
                Array.Copy(value32, 2, msg, 4, 2);
                break;

            case 4:
                Array.Copy(value32, 0, msg, 4, 4);
                break;
            }
            node.SendRequest(msg);
        }
Esempio n. 38
0
 public static void SensorMultiLevelGet(ZWaveNode node, byte instance)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.MultiInstance,
         0x06, // ??
         instance,
         (byte)CommandClass.SensorMultilevel,
         0x04 //
     });
 }
Esempio n. 39
0
 public static void SensorMultiLevelGet(ZWaveNode node, byte instance)
 {
     node.SendRequest(new byte[] {
         (byte) CommandClass.MultiInstance,
         0x06, // ??
         instance,
         (byte) CommandClass.SensorMultilevel,
         0x04 //
     });
 }
Esempio n. 40
0
 public static void SwitchMultiLevelGet(ZWaveNode node, byte instance)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.MultiInstance,
         0x0d, // ?? (MultiInstaceV2Encapsulated ??)
         0x00, // ??
         instance,
         (byte)CommandClass.SwitchMultilevel,
         (byte)Command.MultiInstanceGet
     });
 }
Esempio n. 41
0
 public static void Set(ZWaveNode node, uint interval)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.WakeUp,
         (byte)Command.WakeUpIntervalSet,
         (byte)((interval >> 16) & 0xff),
         (byte)((interval >> 8) & 0xff),
         (byte)((interval) & 0xff),
         0x01
     });
 }
Esempio n. 42
0
 public static void Set(ZWaveNode node, uint interval)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.WakeUp,
         (byte)Command.WakeUpIntervalSet,
         (byte)((interval >> 16) & 0xff),
         (byte)((interval >> 8) & 0xff),
         (byte)((interval) & 0xff),
         0x01
     });
 }
Esempio n. 43
0
 public static void SwitchBinaryGet(ZWaveNode node, byte instance)
 {
     node.SendRequest(new byte[] {
         (byte) CommandClass.MultiInstance,
         0x0d, // ?? (MultiInstaceV2Encapsulated ??)
         0x00, // ??
         instance,
         (byte) CommandClass.SwitchBinary,
         (byte) Command.MultiInstanceGet
     });
 }
Esempio n. 44
0
 public static void SwitchMultiLevelSet(ZWaveNode node, byte instance, int value)
 {
     node.SendRequest(new byte[] {
         (byte)CommandClass.MultiInstance,
         0x0d, // ?? (MultiInstaceV2Encapsulated ??)
         0x00, // ??
         instance,
         (byte)CommandClass.SwitchMultilevel,
         (byte)Command.MultiInstanceSet,
         byte.Parse(value.ToString())
     });
 }
Esempio n. 45
0
 public static void Set(ZWaveNode node, Value ptype, double temperature)
 {
     List<byte> message = new List<byte>();
     message.AddRange(new byte[] {
         (byte)CommandClass.ThermostatSetPoint,
         (byte)Command.ThermostatSetPointSet,
         (byte)ptype
     });
     var setPoint = ThermostatSetPoint.GetSetPointData(node);
     message.AddRange(ZWaveValue.GetValueBytes(temperature, setPoint.Precision, setPoint.Scale, setPoint.Size));
     node.SendRequest(message.ToArray());
 }
Esempio n. 46
0
        public static void Set(ZWaveNode node, Value value)
        {
            byte lockValue;
            if (value == DoorLock.Value.Secured)
                lockValue = 255;
            else
                lockValue = 0;

            node.SendRequest(new byte[] {
                (byte)CommandClass.DoorLock,
                (byte)Command.DoorLockSet,
                (byte)lockValue
            });
        }
Esempio n. 47
0
 public static void Set(ZWaveNode node, UserCodeValue newUserCode)
 {
     var userCode = GetUserCodeData(node);
     userCode.TagCode = newUserCode.TagCode;
     userCode.UserId = newUserCode.UserId;
     userCode.UserIdStatus = newUserCode.UserIdStatus;
     List<byte> message = new List<byte>();
     message.Add((byte)CommandClass.UserCode);
     message.Add((byte)Command.UserCodeSet);
     message.Add(userCode.UserId);
     message.Add(userCode.UserIdStatus);
     message.AddRange(userCode.TagCode);
     node.SendRequest(message.ToArray());
 }
Esempio n. 48
0
        public static void SetSetPoint(ZWaveNode node, SetPointType ptype, double temperature)
        {
            List <byte> message = new List <byte>();

            message.AddRange(new byte[] {
                (byte)CommandClass.ThermostatSetPoint,
                (byte)Command.ThermostatSetPointSet,
                (byte)ptype
            });
            var setPoint = GetSetPointData(node);

            message.AddRange(ZWaveValue.GetValueBytes(temperature, setPoint.Precision, setPoint.Scale, setPoint.Size));
            node.SendRequest(message.ToArray());
        }
Esempio n. 49
0
        private static void SendNonceReport(ZWaveNode node)
        {
            byte[] message = new byte[10];

            message[0] = (byte)CommandClass.Security;
            message[1] = (byte)SecurityCommand.NonceReport;

            GetSecurityData(node).GenerateControllerCurrentNonce();

            Array.Copy(GetSecurityData(node).GetControllerCurrentNonce(), 0, message, 2, 8);

            node.SendRequest(message);

            GetSecurityData(node).ControllerNonceTimer.Reset();
        }
Esempio n. 50
0
        public static void Set(ZWaveNode node, UserCodeValue newUserCode)
        {
            var userCode = GetUserCodeData(node);

            userCode.TagCode      = newUserCode.TagCode;
            userCode.UserId       = newUserCode.UserId;
            userCode.UserIdStatus = newUserCode.UserIdStatus;
            List <byte> message = new List <byte>();

            message.Add((byte)CommandClass.UserCode);
            message.Add((byte)Command.UserCodeSet);
            message.Add(userCode.UserId);
            message.Add(userCode.UserIdStatus);
            message.AddRange(userCode.TagCode);
            node.SendRequest(message.ToArray());
        }
Esempio n. 51
0
        public static void Set(ZWaveNode node, byte parameter, Int32 paramValue)
        {
            int valueLength            = 1;
            var nodeConfigParamsLength = GetConfigParamsData(node);

            if (!nodeConfigParamsLength.ContainsKey(parameter))
            {
                Get(node, parameter);
                int retries = 0;
                while (!nodeConfigParamsLength.ContainsKey(parameter) && retries++ <= 5)
                {
                    Thread.Sleep(1000);
                }
            }
            if (nodeConfigParamsLength.ContainsKey(parameter))
            {
                valueLength = nodeConfigParamsLength[parameter];
            }
            //
            byte[] value32 = BitConverter.GetBytes(paramValue);
            Array.Reverse(value32);
            //
            byte[] msg = new byte[4 + valueLength];
            msg[0] = (byte)CommandClass.Configuration;
            msg[1] = (byte)Command.ConfigurationSet;
            msg[2] = parameter;
            msg[3] = (byte)valueLength;
            switch (valueLength)
            {
            case 1:
                Array.Copy(value32, 3, msg, 4, 1);
                break;

            case 2:
                Array.Copy(value32, 2, msg, 4, 2);
                break;

            case 4:
                Array.Copy(value32, 0, msg, 4, 4);
                break;
            }
            node.SendRequest(msg);
        }
Esempio n. 52
0
        public static void Set(ZWaveNode node, Value value)
        {
            byte lockValue;

            if (value == DoorLock.Value.Secured)
            {
                lockValue = 255;
            }
            else
            {
                lockValue = 0;
            }

            node.SendRequest(new byte[] {
                (byte)CommandClass.DoorLock,
                (byte)Command.DoorLockSet,
                (byte)lockValue
            });
        }
Esempio n. 53
0
        private static bool RequestNonce(ZWaveNode node)
        {
            var nodeSecurityData = GetSecurityData(node);

            Utility.DebugLog(DebugMessageType.Information, "In sendRequestNonce - SecurityHandler");

            if (nodeSecurityData.IsWaitingForNonce)
            {
                return(false);
            }

            Utility.DebugLog(DebugMessageType.Information, "In sendRequestNonce - not waiting for Nonce - SecurityHandler");
            nodeSecurityData.IsWaitingForNonce = true;

            node.SendRequest(new byte[] {
                (byte)CommandClass.Security,
                (byte)SecurityCommand.NonceGet
            });

            return(true);
        }
Esempio n. 54
0
 public static void Set(ZWaveNode node, byte parameter, Int32 paramValue)
 {
     int valueLength = 1;
     var nodeConfigParamsLength = GetConfigParamsData(node);
     if (!nodeConfigParamsLength.ContainsKey(parameter))
     {
         Get(node, parameter);
         int retries = 0;
         while (!nodeConfigParamsLength.ContainsKey(parameter) && retries++ <= 5)
         {
             Thread.Sleep(1000);
         }
     }
     if (nodeConfigParamsLength.ContainsKey(parameter))
     {
         valueLength = nodeConfigParamsLength[parameter];
     }
     //
     byte[] value32 = BitConverter.GetBytes(paramValue);
     Array.Reverse(value32);
     //
     byte[] msg = new byte[4 + valueLength];
     msg[0] = (byte)CommandClass.Configuration;
     msg[1] = (byte)Command.ConfigurationSet;
     msg[2] = parameter;
     msg[3] = (byte)valueLength;
     switch (valueLength)
     {
         case 1:
         Array.Copy(value32, 3, msg, 4, 1);
         break;
         case 2:
         Array.Copy(value32, 2, msg, 4, 2);
         break;
         case 4:
         Array.Copy(value32, 0, msg, 4, 4);
         break;
     }
     node.SendRequest(msg);
 }
Esempio n. 55
0
 public static void Set(ZWaveNode node, byte parameter, Int32 paramValue)
 {
     int valueLength = 1;
     var nodeConfigParamsLength = GetConfigParamsData(node);
     if (!nodeConfigParamsLength.ContainsKey(parameter))
     {
         Get(node, parameter);
         int retries = 0;
         while (!nodeConfigParamsLength.ContainsKey(parameter) && retries++ <= 5)
         {
             Thread.Sleep(1000);
         }
     }
     if (nodeConfigParamsLength.ContainsKey(parameter))
     {
         valueLength = nodeConfigParamsLength[parameter];
     }
     //Console.WriteLine("GOT Parameter Length: " + valuelen);
     //
     //byte[] value = new byte[valuelen]; // { (byte)intvalue };//BitConverter.GetBytes(Int32.Parse(intvalue));
     byte[] value32 = BitConverter.GetBytes(paramValue);
     Array.Reverse(value32);
     //int curbyte = valuelen - 1;
     //for (int x = 0; x < value32.Length && curbyte >= 0; x++)
     //{
     //    value[curbyte--] = value32[x];
     //}
     ////if (value32[0] != 0 && valuelen > 1)
     ////{
     ////    value[0] = value32[0];
     ////}
     ////
     //Console.WriteLine("\n\n\nCOMPUTED VALUE: " + zp.ByteArrayToString(value32) + "\n->" + zp.ByteArrayToString(BitConverter.GetBytes(intvalue)) + "\n\n");
     //
     byte[] msg = new byte[4 + valueLength];
     msg[0] = (byte)CommandClass.Configuration;
     msg[1] = (byte)Command.ConfigurationSet;
     msg[2] = parameter;
     msg[3] = (byte)valueLength;
     switch (valueLength)
     {
         case 1:
         Array.Copy(value32, 3, msg, 4, 1);
         break;
         case 2:
         Array.Copy(value32, 2, msg, 4, 2);
         break;
         case 4:
         Array.Copy(value32, 0, msg, 4, 4);
         break;
     }
     node.SendRequest(msg);
 }
Esempio n. 56
0
 public static void SwitchBinarySet(ZWaveNode node, byte instance, int value)
 {
     node.SendRequest(new byte[] {
         (byte) CommandClass.MultiInstance,
         0x0d, //  ?? (MultiInstaceV2Encapsulated ??)
         0x00, // ??
         instance,
         (byte) CommandClass.SwitchBinary,
         (byte) Command.MultiInstanceSet,
         byte.Parse(value.ToString())
     });
 }