Esempio n. 1
0
        /// <summary>
        ///     Send Message selection
        /// </summary>
        /// <returns></returns>
        public async Task SetMessageData(IProgress <DownloadProgress> iProgress)
        {
            var z = new SetMessageSelection(
                LibraryData.FuturamaSys.Messages,
                LibraryData.FuturamaSys.PreannAlrm1,
                LibraryData.FuturamaSys.PreannAlrm2,
                LibraryData.FuturamaSys.PreannFp,
                LibraryData.FuturamaSys.PreannEvac,
                LibraryData.FuturamaSys.PreannFds,
                LibraryData.FuturamaSys.PreannExt,
                Main.Id);

            CommunicationViewModel.AddData(z);

            await z.WaitAsync();

            iProgress.Report(new DownloadProgress()
            {
                Progress = 1, Total = 1
            });
        }
        public void MessageSelectionTest()
        {
            var z = new List<MessageSelectModel>(Enumerable.Range(0, 3).Select(n => new MessageSelectModel()));

            z[0].ButtonA1 = 0;
            z[0].ButtonA2 = 1;

            z[0].ButtonB1 = 2;
            z[0].ButtonB2 = 3;

            z[0].ButtonC1 = 4;
            z[0].ButtonC2 = 5;

            z[0].ButtonD1 = 6;
            z[0].ButtonD2 = 7;

            z[1].ButtonC1 = 255;
            z[1].ButtonC2 = 254;
            //            z[1].ButtonD1 = 253; //==no message;
            z[1].ButtonD2 = 252;

            z[2].ButtonB2 = 3;
            z[2].ButtonC1 = 0;

            int a = 4;

            var sendPacket = new SetMessageSelection(z, a, a, a, a, 250, 255, 0);
            var receivePacket = new GetMessageSelection(0);

            var connection = new Connection();
            var modeChanged = new AutoResetEvent(false);

            CreateConnection(connection, modeChanged);

            connection.EnQueue(sendPacket);
            sendPacket.WaitAsync().Wait();

            connection.EnQueue(receivePacket);
            receivePacket.WaitAsync().Wait();

            DisConnection(connection, modeChanged);

            Assert.AreEqual(a, receivePacket.PreannounceEP);
            Assert.AreEqual(255, receivePacket.PreannounceExtAudio);
            Assert.AreEqual(250, receivePacket.PreannounceFDS);
            Assert.AreEqual(a, receivePacket.PreannounceFP);

            Assert.AreEqual(a, receivePacket.AlarmTrack);
            Assert.AreEqual(a, receivePacket.AlertTrack);

            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(z[i], receivePacket.MessageSelectModels[i]);
            }
        }