private string CreateAck()
        {
            string ackMessage = String.Format("{0},0", (int)ControlMode.NoControlMode);
            string command    = CommandFormatter.CreateCommand(CtrlCommand, ackMessage);

            return(command);
        }
        public virtual void SendFlightAnimationCommand(IFlightAnimation flightAnimation)
        {
            string message = string.Format("{0},{1}", (int)flightAnimation.Animation,
                                           flightAnimation.MaydayTimeoutInMilliseconds);
            string command = CommandFormatter.CreateCommand(AnimCommand, message);

            CommandQueue.Enqueue(command);
        }
        public virtual void SendLedAnimationCommand(ILedAnimation ledAnimatoin)
        {
            int    freq    = FloatToInt32Converter.Convert(ledAnimatoin.FrequencyInHz);
            string message = string.Format("{0},{1},{2}", (int)ledAnimatoin.Animation, freq, ledAnimatoin.DurationInSeconds);
            string command = CommandFormatter.CreateCommand(LedCommand, message);

            CommandQueue.Enqueue(command);
        }
        private string CreateConfigCommand(string key, string value)
        {
            string configIdsMessage = String.Format("\"{0}\",\"{1}\",\"{2}\"", SessionId, ProfileId, ApplicationId);
            string configIdsCommand = CommandFormatter.CreateCommand(ConfigIdsCommand, configIdsMessage);
            string configMessage    = String.Format("\"{0}\",\"{1}\"", key, value);
            string configCommand    = CommandFormatter.CreateCommand(ConfigCommand, configMessage);
            string command          = configIdsCommand + configCommand;

            return(command);
        }
Beispiel #5
0
        public void GivenCommandType_CreateCommand_ReturnsFormattedCommand()
        {
            // Arrange
            const string commandTypeA = "commandTypeA";
            const string commandTypeB = "commandTypeB";
            const string commandTypeC = "commandTypeC";

            // Act
            var result1 = _target.CreateCommand(commandTypeA);
            var result2 = _target.CreateCommand(commandTypeB);
            var result3 = _target.CreateCommand(commandTypeC);

            // Assert
            result1.Should().Be("AT*" + commandTypeA + "=1\r");
            result2.Should().Be("AT*" + commandTypeB + "=2\r");
            result3.Should().Be("AT*" + commandTypeC + "=3\r");
        }
        internal virtual void SendProgressiveCommand(IProgressiveCommand args)
        {
            string command;

            ProgressiveCommandFormatter.Load(args);

            if (args.AbsoluteControlMode)
            {
                string message = string.Format("{0},{1},{2},{3},{4},{5},{6}", (int)ProgressiveCommandFormatter.Mode,
                                               ProgressiveCommandFormatter.Roll, ProgressiveCommandFormatter.Pitch, ProgressiveCommandFormatter.Gaz,
                                               ProgressiveCommandFormatter.Yaw, ProgressiveCommandFormatter.MagnetoPsi,
                                               ProgressiveCommandFormatter.MagnetoPsiAccuracy);
                command = CommandFormatter.CreateCommand(PcmdMagCommand, message);
            }
            else
            {
                string message = string.Format("{0},{1},{2},{3},{4}", (int)ProgressiveCommandFormatter.Mode,
                                               ProgressiveCommandFormatter.Roll, ProgressiveCommandFormatter.Pitch, ProgressiveCommandFormatter.Gaz,
                                               ProgressiveCommandFormatter.Yaw);
                command = CommandFormatter.CreateCommand(PcmdCommand, message);
            }

            CommandQueue.Enqueue(command);
        }
        public virtual void SendFlatTrimCommand()
        {
            string command = CommandFormatter.CreateCommand(FtrimCommand);

            CommandQueue.Enqueue(command);
        }
        private void SendPModeCommand(int mode)
        {
            string command = CommandFormatter.CreateCommand(PmodeCommand, mode.ToString());

            CommandQueue.Enqueue(command);
        }
        private void SendMiscellaneousCommand(string message)
        {
            string command = CommandFormatter.CreateCommand(MiscCommand, message);

            CommandQueue.Enqueue(command);
        }
        internal virtual void SendResetWatchDogCommand()
        {
            string command = CommandFormatter.CreateCommand(ComwdgCommand);

            CommandQueue.Enqueue(command);
        }
        internal virtual void SendCalibrateCompassCommand()
        {
            string command = CommandFormatter.CreateCommand(CalibCommand, "0");

            CommandQueue.Enqueue(command);
        }
        public virtual void SendRefCommand(RefCommands refCommand)
        {
            string command = CommandFormatter.CreateCommand(RefCommand, ((int)refCommand).ToString());

            CommandQueue.Enqueue(command);
        }