Beispiel #1
0
        public void SendCommandTest()
        {
            INuvoEssentiaSingleCommand command = new NuvoEssentiaSingleCommand(ENuvoEssentiaCommands.MuteALLZoneOFF);
            Address zoneAddress = new Address(_deviceId, 0);    // Zone x -> not used

            _protDriver.SendCommand(zoneAddress, command);
            Thread.Sleep(2000); // give control to worker thread

            Assert.IsTrue(_nuvoTelegramMock.TelegramList.Count >= 1);
            Assert.AreEqual(true, _nuvoTelegramMock.TelegramList.Contains("ALLMOFF"));
        }
Beispiel #2
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     if (cmbComSelect.Text.Contains("private"))
     {
         // Open a MSMQ queue
         _msgQueue = SerialPortQueue.GetQueue(".\\" + cmbComSelect.Text);
         if (chkReceive.Checked)
         {
             _msgQueue.ReceiveCompleted += new ReceiveCompletedEventHandler(_msgQueue_ReceiveCompleted);
             _msgQueue.BeginReceive();
         }
         DisplayData(MessageType.Normal, string.Format("Open connection to Queue '{0}'", cmbComSelect.Text));
     }
     else
     {
         // Open a protocol stack (using a class implementing IProtocol)
         DisplayData(MessageType.Normal, string.Format("Open connection to Port '{0}'", cmbComSelect.Text));
         _nuvoServer = new NuvoEssentiaProtocolDriver();
         if (chkReceive.Checked)
         {
             _nuvoServer.onCommandReceived  += new ProtocolCommandReceivedEventHandler(nuvoServer_onCommandReceived);
             _nuvoServer.onZoneStatusUpdate += new ProtocolZoneUpdatedEventHandler(_nuvoServer_onZoneStatusUpdate);
         }
         _nuvoServer.Open(ENuvoSystem.NuVoEssentia, 1, new Communication(cmbComSelect.Text, 9600, 8, 1, "None"));
         if (chkSend.Checked)
         {
             DisplayData(MessageType.Normal, "Read version ...");
             NuvoEssentiaSingleCommand command = new NuvoEssentiaSingleCommand(ENuvoEssentiaCommands.ReadVersion);
             DisplayData(MessageType.Outgoing, command.OutgoingCommand);
             _nuvoServer.SendCommand(_address, command);
         }
     }
 }