Esempio n. 1
0
 /// <summary>
 /// Start inclusion process
 /// </summary>
 public void AddNewNodeStart()
 {
     ZWaveJob job = new ZWaveJob();
     job.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                    ZWaveProtocol.Function.ADD_NODE_TO_NETWORK);
     job.Request.AddParameter(ZWaveProtocol.CommandClass.NODE_ANY);
     job.ResponseReceived += ResponseReceived;
     this._port.EnqueueJob(job);
 }
Esempio n. 2
0
 private void GetMeterReport()
 {
     ZWaveJob mr = new ZWaveJob();
     mr.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                   ZWaveProtocol.Function.SEND_DATA,
                                   this._nodeId,
                                   0x3D,
                                   0x04);
     mr.ResponseReceived += ResponseReceived;
     //this.EnqueueJob(mr);
 }
Esempio n. 3
0
 private void GetMeterReport()
 {
     ZWaveJob mr = new ZWaveJob();
     mr.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                   ZWaveProtocol.Function.SEND_DATA,
                                   this._node._nodeId,
                                   ZWaveProtocol.CommandClass.METER,
                                   ZWaveProtocol.Command.METER_REPORT_GET);
     mr.ResponseReceived += MeterReportReceived;
     this._node.EnqueueJob(mr);
 }
Esempio n. 4
0
 /// <summary>
 /// Set level
 /// </summary>
 /// <param name="level"></param>
 public void SetLevel(byte level)
 {
     ZWaveJob job = new ZWaveJob();
     job.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                    ZWaveProtocol.Function.SEND_DATA,
                                    this._nodeId,
                                    ZWaveProtocol.CommandClass.SWITCH_MULTILEVEL,
                                    ZWaveProtocol.Command.SWITCH_MULTILEVEL_SET);
     job.Request.AddParameter(level);
     job.ResponseReceived += ResponseReceived;
     this.EnqueueJob(job);
 }
Esempio n. 5
0
 private void RequestNeighborUpdate()
 {
     ZWaveJob nu = new ZWaveJob();
     nu.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                   ZWaveProtocol.Function.REQUEST_NODE_NEIGHBOR_UPDATE,
                                   this._nodeId);
     nu.ResponseReceived += ResponseReceived;
     this.EnqueueJob(nu);
 }
Esempio n. 6
0
 private void GetNodeCapabilities()
 {
     ZWaveJob cc = new ZWaveJob();
     cc.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                   ZWaveProtocol.Function.GET_NODE_CAPABILITIES,
                                   this._nodeId);
     cc.ResponseReceived += this.ResponseReceived;
     cc.JobCanceled += this.RequestFailed;
     this.EnqueueJob(cc);
 }
Esempio n. 7
0
 private void GetManufacturerSpecificReport()
 {
     ZWaveJob msr = new ZWaveJob();
     msr.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                    ZWaveProtocol.Function.SEND_DATA,
                                    this._nodeId,
                                    ZWaveProtocol.CommandClass.MANUFACTURER_SPECIFIC,
                                    ZWaveProtocol.Command.MANUFACTURER_SPECIFIC_GET);
     msr.ResponseReceived += this.ResponseReceived;
     msr.JobCanceled += this.RequestFailed;
     this.EnqueueJob(msr);
 }
Esempio n. 8
0
 internal void EnqueueJob(ZWaveJob job)
 {
     if (this._isSleepingNode)
     {
         this.JobQueue.Enqueue(job);
         this.FireBaseNodeInitializedEvent();
     }
     else
     {
         this._port.EnqueueJob(job);
     }
 }
Esempio n. 9
0
 private void GetState(object sender, EventArgs e)
 {
     ZWaveJob gis = new ZWaveJob();
     gis.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                    ZWaveProtocol.Function.SEND_DATA,
                                    this._nodeId,
                                    ZWaveProtocol.CommandClass.SWITCH_BINARY,
                                    ZWaveProtocol.Command.SWITCH_BINARY_GET);
     gis.ResponseReceived += ResponseReceived;
     this.EnqueueJob(gis);
 }
Esempio n. 10
0
 private void GetSuccessorNode()
 {
     ZWaveJob job = new ZWaveJob();
     job.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                                  ZWaveProtocol.Function.GET_SUC_NODE_ID);
     job.ResponseReceived += this.ResponseReceived;
     this._port.EnqueueJob(job);
 }
Esempio n. 11
0
        private void SetWakeupInterval(byte nodeId)
        {
            ZWaveJob wi = new ZWaveJob();
            wi.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                          ZWaveProtocol.Function.SEND_DATA,
                                          nodeId,
                                          ZWaveProtocol.CommandClass.WAKE_UP,
                                          ZWaveProtocol.Command.WAKE_UP_INTERVAL_SET);

            long seconds = (long)(ZWaveProtocol.ValueConstants.WAKE_UP_INTERVAL / 1000);
            System.Diagnostics.Debug.WriteLine(seconds);
            // MSB
            wi.Request.AddParameter((byte)((seconds >> 16) & 0xFF));
            wi.Request.AddParameter((byte)((seconds >> 8) & 0xFF));
            // LSB
            wi.Request.AddParameter((byte)(seconds & 0xFF));
            wi.Request.AddParameter(this._nodeId);

            wi.ResponseReceived += ResponseReceived;
            this._port.EnqueueJob(wi);
        }
Esempio n. 12
0
 private void GetNodeProtocolInfo(byte nodeId)
 {
     ZWaveJob pInfo = new ZWaveJob();
     pInfo.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                      ZWaveProtocol.Function.GET_NODE_PROTOCOL_INFO,
                                      nodeId);
     pInfo.ResponseReceived += ResponseReceived;
     this._port.EnqueueJob(pInfo);
 }
Esempio n. 13
0
 /// <summary>
 /// Reset Z-Wave controller
 /// </summary>
 public void Reset()
 {
     ZWaveJob job = new ZWaveJob();
     job.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                    ZWaveProtocol.Function.SET_DEFAULT);
     job.ResponseReceived += ResponseReceived;
     this._port.EnqueueJob(job);
 }
Esempio n. 14
0
        /// <summary>
        /// Perform discovery
        /// </summary>
        public void Discovery()
        {
            DebugLogger.GetLogger.LogMessage(this, "Performing node discovery");

            ZWaveJob job = new ZWaveJob();
            job.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                                        ZWaveProtocol.Function.SERIAL_API_INIT_DATA);
            job.ResponseReceived += ResponseReceived;
            this._port.EnqueueJob(job);
        }
Esempio n. 15
0
        /// <summary>
        /// Become successor node
        /// </summary>
        public void BecomeSuccessorNode()
        {
            ZWaveJob enable = new ZWaveJob();
            enable.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                                        ZWaveProtocol.Function.ENABLE_SUC);
            enable.ResponseReceived += ResponseReceived;
            this._port.EnqueueJob(enable);

            ZWaveJob set = new ZWaveJob();
            set.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                                        ZWaveProtocol.Function.SET_SUC_NODE_ID);
            set.Request.AddParameter(this._nodeId);

            // SUC = 0, SIS = 1
            set.Request.AddParameter(0x01);

            // No low-power shit
            set.Request.AddParameter(0x00);

            // What's this for? Oh well, we need to follow the specification anyway
            set.Request.AddParameter(ZWaveProtocol.Function.NODEID_SERVER);
            set.ResponseReceived += ResponseReceived;
            this._port.EnqueueJob(set);
        }
Esempio n. 16
0
 /// <summary>
 /// Stop inclusion process
 /// </summary>
 public void AddNewNodeStop()
 {
     DebugLogger.Logger.Trace("");
     ZWaveJob job = new ZWaveJob();
     job.Request = new ZWaveMessage(ZWaveProtocol.MessageType.REQUEST,
                                    ZWaveProtocol.Function.ADD_NODE_TO_NETWORK);
     job.Request.AddParameter(ZWaveProtocol.CommandClass.ADD_NODE_STOP);
     job.ResponseReceived += ResponseReceived;
     this._port.EnqueueJob(job);
 }