예제 #1
0
        private void ZWave_NodeUpdated(object sender, NodeEvent eventData)
        {
            ZWaveNode node = (ZWaveNode)sender;

            if (eventData.Parameter == EventParameter.SecurityDecriptedMessage && eventData.Value is byte[])
            {
                node.ApplicationCommandHandler((byte[])eventData.Value);
                return;
            }
            else if (eventData.Parameter == EventParameter.SecurityNodeInformationFrame)
            {
                node.SecuredNodeInformationFrame = (byte[])eventData.Value;

                // we take them one a a time to make sure we keep the list with unique elements
                foreach (byte nodeInfo in node.SecuredNodeInformationFrame)
                {
                    // if we found the COMMAND_CLASS_MARK we get out of the for loop
                    if (nodeInfo == (byte)0xEF)
                    {
                        break;
                    }
                    node.NodeInformationFrame = Utility.AppendByteToArray(node.NodeInformationFrame, nodeInfo);
                }
                // we just send other events and save the node data
                NodeInformationFrameDone(node);
            }
            // Route node event
            OnNodeUpdated(new NodeUpdatedEventArgs(eventData.Node.Id, eventData));
        }
예제 #2
0
        private void SetupNetworkKey(ZWaveNode node)
        {
            byte[] initialNetworkKey = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

            byte[] EncryptPassword = new byte[] { 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA };
            byte[] AuthPassword    = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 };

            byte[] NetworkKey;

            if (adding_node && !networkKeySet)
            {
                NetworkKey = initialNetworkKey;
                Utility.logMessage("In SetupNetworkKey  - in node inclusion mode.");
            }
            else
            {
                NetworkKey = PrivateNetworkKey;
            }

            encryptKey = enc.ECB_EncryptMessage(NetworkKey, EncryptPassword);
            authKey    = enc.ECB_EncryptMessage(NetworkKey, AuthPassword);

            // Utility.logMessage("In SetupNetworkKey  - Network key - " + Utility.ByteArrayToString(NetworkKey));
            // Utility.logMessage("In SetupNetworkKey  - Encrypt key - " + Utility.ByteArrayToString(encryptKey));
            // Utility.logMessage("In SetupNetworkKey  - Authent key - " + Utility.ByteArrayToString(authKey));
        }
예제 #3
0
 private void gotNodeUpdateInformation(ZWaveNode znode)
 {
     // once we get the security command classes we'll issue the same events and call SaveNodesConfig();
     RaiseUpdateParameterEvent(new ZWaveEvent(znode, EventParameter.NodeInfo, Utility.ByteArrayToString(znode.NodeInformationFrame), 0));
     RaiseUpdateParameterEvent(new ZWaveEvent(znode, EventParameter.WakeUpNotify, "1", 0));
     SaveNodesConfig();
 }
예제 #4
0
 public ZWaveEvent(ZWaveNode node, EventParameter eventType, object eventValue, int instance)
 {
     this.Node      = node;
     this.Parameter = eventType;
     this.Value     = eventValue;
     this.Instance  = instance;
 }
예제 #5
0
        private void CreateDevices(byte[] receivedMessage)
        {
            var nodeList = ExtractNodesFromBitMask(receivedMessage);

            foreach (byte i in nodeList)
            {
                var node = devices.Find(n => n.Id == i);
                if (node == null)
                {
                    //Console.WriteLine("Z-Wave Adding node " + i + " Class[ Basic=" + receivedMessage[7].ToString("X2") + " Generic=" + ((GenericType)receivedMessage[8]).ToString() + " Specific=" + receivedMessage[9].ToString("X2") + " ]");
                    devices.Add(CreateDevice(i, 0x00));
                }
                else
                {
                    OnControllerEvent(new ControllerEventArgs(i, ControllerStatus.NodeUpdated));
                }
            }
            while (nodeList.Count > 0)
            {
                ZWaveNode nextNode = devices.Find(zn => zn.BasicClass == 0x00);
                if (nextNode != null)
                {
                    GetNodeCapabilities(nextNode.Id);
                }
                else
                {
                    OnControllerEvent(new ControllerEventArgs(0x00, ControllerStatus.DiscoveryEnd));
                    break;
                }
            }
        }
예제 #6
0
        private void CreateDevices(byte[] receivedMessage)
        {
            var nodeList = ExtractNodesFromBitMask(receivedMessage);

            foreach (byte i in nodeList)
            {
                var node = devices.Find(n => n.Id == i);
                if (node == null)
                {
                    devices.Add(CreateDevice(i, 0x00));
                }
                else
                {
                    OnControllerEvent(new ControllerEventArgs(i, ControllerStatus.NodeUpdated));
                }
            }
            while (nodeList.Count > 0)
            {
                ZWaveNode nextNode = devices.Find(zn => zn.BasicClass == 0x00);
                if (nextNode != null)
                {
                    GetNodeCapabilities(nextNode.Id);
                }
                else
                {
                    OnControllerEvent(new ControllerEventArgs(0x00, ControllerStatus.DiscoveryEnd));
                    break;
                }
            }
        }
예제 #7
0
 public NodeEvent(ZWaveNode node, EventParameter eventType, object eventValue, int instance)
 {
     Node      = node;
     Parameter = eventType;
     Value     = eventValue;
     Instance  = instance;
     Timestamp = DateTime.UtcNow;
 }
예제 #8
0
 private void NodeInformationFrameDone(ZWaveNode znode)
 {
     znode.UpdateCommandClassList();
     // once we get the security command classes we'll issue the same events and call SaveNodesConfig();
     OnNodeUpdated(new NodeUpdatedEventArgs(znode.Id, new NodeEvent(znode, EventParameter.NodeInfo, BitConverter.ToString(znode.NodeInformationFrame).Replace("-", " "), 0)));
     // TODO: deprecate the WakeUpNotify event?
     OnNodeUpdated(new NodeUpdatedEventArgs(znode.Id, new NodeEvent(znode, EventParameter.WakeUpNotify, "1", 0)));
 }
예제 #9
0
 private void init(ZWaveNode node)
 {
     //ZWaveNode node = null;
     if (enc == null)
     {
         enc = new AES_work();
     }
     SetupNetworkKey(node);
 }
예제 #10
0
        public void sendSupportedGet(ZWaveNode node)
        {
            var message = ZWaveMessage.CreateRequest(node.Id, new byte[] {
                (byte)CommandClass.Security,
                (byte)SecurityCommand.SupportedGet
            });

            encryptAndSend(node, message);
        }
예제 #11
0
 public void getScheme(ZWaveNode node)
 {
     if (adding_node)
     {
         schemeRequestSent = true;
         node.SendRequest(new byte[] {
             (byte)CommandClass.Security,
             (byte)SecurityCommand.SchemeGet,
             0
         });
     }
 }
예제 #12
0
 public void RequestNeighborsUpdate(ZWaveNode node)
 {
     node.SendMessage(new byte[] {
         (byte)MessageHeader.SOF,
         0x05,                      /* packet length */
         (byte)MessageType.Request, /* Type of message */
         (byte)Function.RequestNodeNeighborsUpdate,
         node.Id,
         0x00,
         0x00
     });
 }
예제 #13
0
        public void SendNonceReport(ZWaveNode node)
        {
            byte[] message = new byte[10];

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

            Array.Copy(c_currentNonce, 0, message, 2, 8);

            node.SendRequest(message);

            c_nonceTimer.Reset();
        }
예제 #14
0
 internal void RaiseUpdateParameterEvent(ZWaveNode node, int pid, EventParameter peventtype, object value)
 {
     if (UpdateNodeParameter != null)
     {
         UpdateNodeParameter(node, new UpdateNodeParameterEventArgs()
         {
             NodeId        = (int)node.NodeId,
             ParameterId   = pid,
             ParameterName = peventtype,
             Value         = value
         });
     }
 }
예제 #15
0
 public void GetNeighborsRoutingInfo(ZWaveNode node)
 {
     node.SendMessage(new byte[] {
         (byte)MessageHeader.SOF,
         0x07,                      /* packet length */
         (byte)MessageType.Request, /* Type of message */
         (byte)Function.GetRoutingInfo,
         node.Id,
         0x00,
         0x00,
         0x03,
         0x00
     });
 }
예제 #16
0
        public void ProcessNonceReport(ZWaveNode node, byte[] message, int start)
        {
            d_nonceTimer.Restart();

            ProcessNonceReport(message, start);
            EncryptMessage(node, message);
            waitingForNonce = false;

            // if we still have items in the queue request a new nonce
            if (secure_payload.Count > 0)
            {
                sendRequestNonce(node);
            }
        }
예제 #17
0
 private void QueuePayload(ZWaveNode node, SecutiryPayload payload)
 {
     lock (secure_payload)
     {
         secure_payload.Add(payload);
         if (d_nonceTimer.ElapsedMilliseconds > 10000)
         {
             waitingForNonce = false;
         }
         if (!waitingForNonce)
         {
             sendRequestNonce(node);
         }
     }
 }
예제 #18
0
        private void sendMsg(ZWaveNode node, byte[] message)
        {
            Utility.logMessage("In sendMsg - SecurityHandler");

            if (message.Length < 7)
            {
                Utility.logMessage("Message too short");
            }

            if (message[3] != 0x13)
            {
                Utility.logMessage("Invalid Message type");
            }

            int length = message[5];

            if (length > 28)
            {
                SecutiryPayload t_payload = new SecutiryPayload();
                t_payload.length = 28;
                t_payload.part   = 1;
                byte[] t_message = new byte[t_payload.length];
                System.Array.Copy(message, 6, t_message, 0, t_payload.length);
                t_payload.message = t_message;
                QueuePayload(node, t_payload);

                SecutiryPayload t_payload2 = new SecutiryPayload();
                t_payload2.length = length - 28;
                t_payload2.part   = 2;
                byte[] t_message2 = new byte[t_payload.length];
                System.Array.Copy(message, 34, t_message2, 0, t_payload2.length);
                t_payload2.message = t_message2;
                QueuePayload(node, t_payload2);
            }
            else
            {
                SecutiryPayload t_payload = new SecutiryPayload();
                t_payload.length = length;
                t_payload.part   = 0;
                byte[] t_message = new byte[t_payload.length];
                System.Array.Copy(message, 6, t_message, 0, t_payload.length);
                t_payload.message = t_message;
                QueuePayload(node, t_payload);
            }
        }
예제 #19
0
        private bool sendRequestNonce(ZWaveNode node)
        {
            Utility.logMessage("In sendRequestNonce - SecurityHandler");

            if (waitingForNonce)
            {
                return(false);
            }

            Utility.logMessage("In sendRequestNonce - not waiting for Nonce - SecurityHandler");
            waitingForNonce = true;

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

            return(true);
        }
예제 #20
0
        private ZWaveNode AddNode(byte nodeId, byte genericClass)
        {
            ZWaveNode node;

            switch (genericClass)
            {
            case (byte)GenericType.StaticController:
                // TODO: what should be done here?...
                node = null;
                break;

            default: // generic node
                node = new ZWaveNode(this, nodeId, genericClass);
                break;
            }
            node.NodeUpdated += ZWave_NodeUpdated;
            UpdateOperationProgress(nodeId, NodeQueryStatus.NodeAdded);
            return(node);
        }
예제 #21
0
        private ZWaveNode CreateDevice(byte nodeId, byte genericClass)
        {
            ZWaveNode node;

            switch (genericClass)
            {
            case (byte)GenericType.StaticController:
                // TODO: this is very untested...
                node = (ZWaveNode) new Controller(zwavePort);
                break;

            default:     // generic node
                node = new ZWaveNode(nodeId, zwavePort, genericClass);
                break;
            }
            node.ParameterChanged             += znode_ParameterChanged;
            node.ManufacturerSpecificResponse += znode_ManufacturerSpecificResponse;
            //
            OnControllerEvent(new ControllerEventArgs(nodeId, ControllerStatus.NodeAdded));
            //
            return(node);
        }
예제 #22
0
        private void znode_ParameterChanged(object sender, ZWaveEvent eventData)
        {
            if (sender is ZWaveNode)
            {
                ZWaveNode node = (ZWaveNode)sender;
                if (eventData.Parameter == EventParameter.SecurityDecriptedMessage && eventData.Value is byte[])
                {
                    node.MessageRequestHandler((byte[])eventData.Value);
                    return;
                }
                else if (eventData.Parameter == EventParameter.SecurityGeneratedKey && eventData.Value is int)
                {
                    SaveNodesConfig();
                    return;
                }
                else if (eventData.Parameter == EventParameter.SecurityNodeInformationFrame)
                {
                    node.SecuredNodeInformationFrame = (byte[])eventData.Value;

                    // we take them one a a time to make sure we keep the list with unique elements
                    foreach (byte nodeInfo in node.SecuredNodeInformationFrame)
                    {
                        // if we found the COMMAND_CLASS_MARK we get out of the for loop
                        if (nodeInfo == (byte)0xEF)
                        {
                            break;
                        }
                        node.NodeInformationFrame = Utility.AppendByteToArray(node.NodeInformationFrame, nodeInfo);
                    }

                    // we just send other events and save the node data
                    gotNodeUpdateInformation(node);
                }
            }
            // Route node event
            RaiseUpdateParameterEvent(eventData);
        }
예제 #23
0
 public void GetNeighborsRoutingInfo(ZWaveNode node)
 {
     node.SendMessage(new byte[] {
         (byte)MessageHeader.SOF,
         0x07, /* packet length */
         (byte)MessageType.Request, /* Type of message */
         (byte)Function.GetRoutingInfo,
         node.Id,
         0x00,
         0x00,
         0x03,
         0x00
     });
 }
예제 #24
0
 private void SetNodeLevel(ZWaveNode node, int level)
 {
     node.UpdateData("Level", level);
     if (level > 0)
         node.UpdateData("LastLevel", level);
 }
예제 #25
0
 private int GetNodeLevel(ZWaveNode node)
 {
     return (int)node.GetData("Level", 0).Value;
 }
예제 #26
0
 public void GetNodeCcsVersion(ZWaveNode zn)
 {            
     // If node support version command class, query each one for its version.
     if (zn.SupportCommandClass(CommandClass.Version))
     {
         foreach (var cmdClass in zn.CommandClasses)
         {
             if (controllerStatus != ControllerStatus.Ready || !serialPort.IsConnected)
                 break;
             // if not cached query the node.
             if (cmdClass.CommandClass != CommandClass.NotSet && cmdClass.Version == -1)
                 ZWaveLib.CommandClasses.Version.Get(zn, cmdClass.CommandClass).Wait();
         }
     }
 }
예제 #27
0
 // use with care
 public bool encryptAndSend(ZWaveNode node, byte[] message)
 {
     Utility.logMessage("In encryptAndSend - SecurityHandler - " + Utility.ByteArrayToString(message));
     sendMsg(node, message);
     return(true);
 }
예제 #28
0
        public bool DecryptMessage(ZWaveNode node, byte[] message, int start)
        {
            if (enc == null)
            {
                init(node);
            }

            Utility.logMessage("In DecryptMessage - SecurityHandler");
            if (c_nonceTimer.ElapsedMilliseconds > 10000)
            {
                Utility.logMessage("Received the nonce  too late'" + c_nonceTimer.ElapsedMilliseconds + "' > 10000");
                return(false);
            }


            //            Utility.logMessage("Message to be decrypted: " + Utility.ByteArrayToString(message));

            byte[] iv = getVIFromPacket_inbound(message, start + 1);

            int _length = message.Length;
            int encryptedpackagesize = _length - 11 - 8; //19 + 11 + 8

            byte[] encryptedpacket = new byte[encryptedpackagesize];


            Array.Copy(message, 8 + start + 1, encryptedpacket, 0, encryptedpackagesize);

            byte[] decryptedpacket = enc.OFB_EncryptMessage(encryptKey, iv, encryptedpacket);
//            Utility.logMessage("Message          " + Utility.ByteArrayToString(message));
//            Utility.logMessage("IV               " + Utility.ByteArrayToString(iv));
//            Utility.logMessage("Encrypted Packet " + Utility.ByteArrayToString(encryptedpacket));
            Utility.logMessage("Decrypted Packet " + Utility.ByteArrayToString(decryptedpacket));

            byte[] mac = GenerateAuthentication(message, start, _length, node.Id, 0x01, iv, enc);

            byte[] e_mac = new byte[8];
            Array.Copy(message, start + 8 + encryptedpackagesize + 2, e_mac, 0, 8);
            if (!Enumerable.SequenceEqual(mac, e_mac))
            {
                Utility.logMessage("Computed mac " + Utility.ByteArrayToString(mac) + " does not match the provider mac " + Utility.ByteArrayToString(e_mac) + ". Dropping.");
                if (secure_payload.Count > 1)
                {
                    sendRequestNonce(node);
                }
                return(false);
            }

            if (decryptedpacket[1] == (byte)CommandClass.Security && 1 == 0)
            {
                byte[] msg = new byte[decryptedpacket.Length - 1];
                Array.Copy(decryptedpacket, 1, msg, 0, msg.Length);

                Utility.logMessage("Processing Internally: " + Utility.ByteArrayToString(msg));
            }
            else
            {
                byte[] msg = new byte[decryptedpacket.Length - 2 + 8];
                Array.Clear(msg, 0, 7);
                Array.Copy(decryptedpacket, 1, msg, 7, msg.Length - 7);

                msg[6] = (byte)(msg.Length - 7);

                Utility.logMessage("Forwarding: " + Utility.ByteArrayToString(msg));

                /* send to the Command Class for Proecssing */
                Utility.logMessage("Received External Command Class: " + Utility.ByteArrayToString(new byte[] { decryptedpacket[1] }));
                node.MessageRequestHandler(node.pController, msg);
            }
            Utility.logMessage("In DecryptMessage - Finished");

            return(true);
        }
예제 #29
0
 public ZWaveEvent(ZWaveNode node, EventParameter eventType, object eventValue, int instance)
 {
     this.Node = node;
     this.Event = eventType;
     this.Value = eventValue;
     this.Instance = instance;
 }
예제 #30
0
 private ZWaveNode CreateNode(byte nodeId, byte genericType)
 {
     ZWaveNode node;
     switch (genericType)
     {
     case (byte) GenericType.StaticController:
         // TODO: what should be done here?...
         node = null;
         break;
     default: // generic node
         node = new ZWaveNode(this, nodeId, genericType);
         break;
     }
     node.NodeUpdated += ZWave_NodeUpdated;
     UpdateOperationProgress(nodeId, NodeQueryStatus.NodeAdded);
     return node;
 }
예제 #31
0
 private void gotNodeUpdateInformation(ZWaveNode znode)
 {
     // once we get the security command classes we'll issue the same events and call SaveNodesConfig();
     RaiseUpdateParameterEvent(new ZWaveEvent(znode, EventParameter.NodeInfo, Utility.ByteArrayToString(znode.NodeInformationFrame), 0));
     RaiseUpdateParameterEvent(new ZWaveEvent(znode, EventParameter.WakeUpNotify, "1", 0));
     SaveNodesConfig();
 }
예제 #32
0
 private ZWaveNode CreateDevice(byte nodeId, byte genericClass)
 {
     ZWaveNode node;
     switch (genericClass)
     {
         case (byte) GenericType.StaticController:
             // TODO: this is very untested...
             node = (ZWaveNode) new Controller(zwavePort);
             break;
         default: // generic node
             node = new ZWaveNode(nodeId, zwavePort, genericClass);
             break;
     }
     node.ParameterChanged += znode_ParameterChanged;
     node.ManufacturerSpecificResponse += znode_ManufacturerSpecificResponse;
     //
     OnControllerEvent(new ControllerEventArgs(nodeId, ControllerStatus.NodeAdded));
     //
     return node;
 }
 public void GetNodeCcsVersion(ZWaveNode zn)
 {
     // If node support version command class, query each one for its version.
     if (zn.SupportCommandClass(CommandClass.Version))
     {
         foreach (var cmdClass in zn.CommandClasses)
         {
             // if not cached query the node.
             if (cmdClass.Version == 0)
                 ZWaveLib.CommandClasses.Version.Get(zn, cmdClass.CommandClass).Wait();
         }
     }
 }
예제 #34
0
파일: ZWave.cs 프로젝트: Qu3uk/HomeGenie
 private void SetNodeLevel(ZWaveNode node, int level)
 {
     if (!node.Data.ContainsKey("Level"))
     {
         node.Data.Add("Level", level);
     }
     else
     {
         node.Data["Level"] = level;
     }
 }
예제 #35
0
 public void RequestNeighborsUpdate(ZWaveNode node)
 {
     node.SendMessage(new byte[] {
         (byte)MessageHeader.SOF,
         0x05, /* packet length */
         (byte)MessageType.Request, /* Type of message */
         (byte)Function.RequestNodeNeighborsUpdate,
         node.Id,
         0x00,
         0x00
     });
 }
예제 #36
0
파일: ZWave.cs 프로젝트: Qu3uk/HomeGenie
 private int GetNodeLevel(ZWaveNode node)
 {
     int level = 0;
     if (node.Data.ContainsKey("Level"))
     {
         level = (int)node.Data["Level"];
     }
     return level;
 }
예제 #37
0
        // IN the mesage to be Encrypted
        // OUT - true - message processed and sent - proceed to next one
        //     - false - we need to wait for the nonce report to come
        private bool EncryptMessage(ZWaveNode node, byte[] message)
        {
            if (enc == null)
            {
                init(node);
            }

            Utility.logMessage("In EncryptMessage - secure_payload [" + secure_payload.Count + "]  - " + d_nonceTimer.ElapsedMilliseconds);

            // if we get true we need to wait for the new Nonce
            // if we get false we need to proceed
            //            if (sendRequestNonce())
            //                return false;
            if (d_nonceTimer.ElapsedMilliseconds > 10000)
            {
                return(false);
            }

            SecutiryPayload payload = null;

            lock (secure_payload)
            {
                if (secure_payload.Count > 0)
                {
                    payload = secure_payload.First();
                    secure_payload.Remove(payload);
                }
            }

            if (payload != null)
            {
                int len = payload.length + 20;

                byte[] t_message = new byte[len];

                int i = 0;

                t_message[i]      = (byte)CommandClass.Security;
                i++; t_message[i] = (byte)SecurityCommand.MessageEncap;

                byte[] initializationVector = new byte[16];
                for (int a = 0; a < 8; a++)
                {
                    initializationVector[a] = (byte)0xAA;
                    i++;
                    t_message[i] = initializationVector[a];
                }

                Array.Copy(d_currentNonce, 0, initializationVector, 8, 8);

                int sequence = 0;

                if (payload.part == 1)
                {
                    ++m_sequenceCounter;
                    sequence  = m_sequenceCounter & (byte)0x0f;
                    sequence |= (byte)0x10;
                }
                else if (payload.part == 2)
                {
                    ++m_sequenceCounter;
                    sequence  = m_sequenceCounter & (byte)0x0f;
                    sequence |= (byte)0x30;
                }

                byte[] plaintextmsg = new byte[payload.length + 1];
                plaintextmsg[0] = (byte)sequence;
                for (int a = 0; a < payload.length; a++)
                {
                    plaintextmsg[a + 1] = payload.message[a];
                }

                byte[] encryptedPayload = new byte[30];

                encryptedPayload = enc.OFB_EncryptMessage(encryptKey, initializationVector, plaintextmsg);

//                Utility.logMessage("authKey " + Utility.ByteArrayToString(authKey));
//                Utility.logMessage("EncryptKey " + Utility.ByteArrayToString(encryptKey));
                Utility.logMessage("Input Packet: " + Utility.ByteArrayToString(plaintextmsg));
//                Utility.logMessage("IV " + Utility.ByteArrayToString(initializationVector));
//                Utility.logMessage("encryptedPayload " + Utility.ByteArrayToString(encryptedPayload));

                for (int a = 0; a < payload.length + 1; ++a)
                {
                    i++;
                    t_message[i] = encryptedPayload[a];
                }

                i++; t_message[i] = d_currentNonce[0];

                //GenerateAuthentication
                int    start = 1;
                byte[] mac   = GenerateAuthentication(t_message, start, t_message.Length + 2 - start - 1, 0x01, node.Id, initializationVector, enc);
                for (int a = 0; a < 8; ++a)
                {
                    i++;
                    t_message[i] = mac[a];
                }

                node.SendRequest(t_message);
                Utility.logMessage("In EncryptMessage - message sent");

                if ((networkKeySet == false) && payload.message[0] == 0x98 && payload.message[1] == 0x06)
                {
                    networkKeySet = true;
                    adding_node   = false;
                    SetupNetworkKey(node);
                }

                return(true);
            }
            return(true);
        }
예제 #38
0
 private void NodeInformationFrameDone(ZWaveNode znode)
 {
     znode.UpdateCommandClassList();
     // once we get the security command classes we'll issue the same events and call SaveNodesConfig();
     OnNodeUpdated(new NodeUpdatedEventArgs(znode.Id, new NodeEvent(znode, EventParameter.NodeInfo, BitConverter.ToString(znode.NodeInformationFrame).Replace("-", " "), 0)));
 }
예제 #39
0
 internal void RaiseUpdateParameterEvent(ZWaveNode node, int pid, EventParameter peventtype, object value)
 {
     if (UpdateNodeParameter != null)
     {
         UpdateNodeParameter(node, new UpdateNodeParameterEventArgs() {
             NodeId = (int)node.NodeId,
             ParameterId = pid,
             ParameterName = peventtype,
             Value = value
         });
     }
 }