Пример #1
0
 /// <summary>
 /// Sends telemetry data of the specified type to the server.
 /// </summary>
 /// <param name="commandInfo">Type of the Telemetry Data</param>
 /// <param name="telemetryData">Telemetry Data which will be sent</param>
 public async void SendTelemetryData(CommandInformation commandInfo, object telemetryData)
 {
     await m_pTelemetryWriterSemaphoreSlim.WaitAsync();
     try
     {
         m_pTelemetryWriter.WriteByte((byte) commandInfo);
         switch (commandInfo)
         {
             case CommandInformation.Information:
                 m_pTelemetryWriter.WriteUInt32((uint) ((string) telemetryData).Length);
                 m_pTelemetryWriter.WriteString((string) telemetryData);
                 break;
             case CommandInformation.Gyroscope:
                 var angle = ((GyroscopeData) telemetryData).Angle;
                 var gyroTime = ((GyroscopeData) telemetryData).TimeStamp;
                 m_pTelemetryWriter.WriteDouble(angle.X);
                 m_pTelemetryWriter.WriteDouble(angle.Y);
                 m_pTelemetryWriter.WriteDouble(angle.Z);
                 m_pTelemetryWriter.WriteInt64(gyroTime.Ticks);
                 break;
             case CommandInformation.Accelerometer:
                 var acc = ((AccelerometerData) telemetryData).Acceleration;
                 var accTime = ((AccelerometerData) telemetryData).TimeStamp;
                 m_pTelemetryWriter.WriteDouble(acc.X);
                 m_pTelemetryWriter.WriteDouble(acc.Y);
                 m_pTelemetryWriter.WriteDouble(acc.Z);
                 m_pTelemetryWriter.WriteInt64(accTime.Ticks);
                 break;
             case CommandInformation.Servo:
                 var id = ((ServoControllerData) telemetryData).ServoId;
                 var velocity = ((ServoControllerData) telemetryData).VelocityValue;
                 var servoTime = ((ServoControllerData) telemetryData).TimeStamp;
                 m_pTelemetryWriter.WriteByte(id);
                 m_pTelemetryWriter.WriteByte(velocity);
                 m_pTelemetryWriter.WriteInt64(servoTime.Ticks);
                 break;
         }
         await m_pTelemetryWriter.StoreAsync();
     }
     finally
     {
         m_pTelemetryWriterSemaphoreSlim.Release();
     }
 }
Пример #2
0
        public void InsertUserdefinedCommand(Type commandType, string name, string absoluteFilePath)
        {
            CommandInformation<string> information = new CommandInformation<string>(commandType, name, absoluteFilePath);
            InsertUserdefinedCommand(information);

            //TODO: remember to init the command
        }
Пример #3
0
        public void InsertIRCCommand(Type commandType, Model.Query.IRCCommand name, string absoluteFilePath)
        {
            CommandInformation<Model.Query.IRCCommand> information = new CommandInformation<Model.Query.IRCCommand>(commandType, name, absoluteFilePath);
            InsertIRCCommand(information);

            //TODO: remember to init the command
        }
Пример #4
0
        /// <summary>
        /// Inserts a command. If the command is allready in the collection. The old command is removed, and the new command
        /// is inserted. The command is identified by the name of the command.
        /// </summary>
        /// <param name="command">The command to be inserted.</param>
        public void InsertUserdefinedCommand(CommandInformation<string> command)
        {
            _userdefinedCommands.TryInsert(command.Name, new List<CommandInformation<string>>());
            _userdefinedCommands[command.Name].Add(command);

            //TODO: remember to init the command
        }
Пример #5
0
        public void InsertIRCCommand(CommandInformation<Model.Query.IRCCommand> command)
        {
            _ircCommands.TryInsert(command.Name, new List<CommandInformation<Model.Query.IRCCommand>>());
            _ircCommands[command.Name].Add(command);

            if (command.Name == Model.Query.IRCCommand.ALL)
            {
                _ircCommandsGlobal.TryInsert(command.Name, new List<CommandInformation<Model.Query.IRCCommand>>());
                _ircCommandsGlobal[command.Name].Add(command);
            }

            //TODO: remember to init the command
        }
Пример #6
0
 public override bool ExecuteRootCommand(string commandId,
                                         Dictionary<string, string> properties,
                                         CommandInformation commandInfo,
                                         Root root)
 {
     return CommandDispatcher.ExecuteCommand(commandId, properties);
 }
Пример #7
0
 public Group(string newgroupId, string groupType, string groupName, string ownerId, GroupStatus status, dynamic profile, Dictionary <string, string[]> customPermissions, CommandInformation commandInformation)
 {
     Id                            = newgroupId;
     GroupId                       = newgroupId;
     GroupType                     = groupType;
     GroupName                     = groupName;
     OwnerId                       = ownerId;
     Status                        = status;
     Profile                       = profile;
     CustomPermissions             = customPermissions;
     CreatedCommandInformation     = commandInformation;
     LastChangedCommandInformation = commandInformation;
 }
Пример #8
0
 private void RunTestFunc(CommandInformation ci)
 {
     RunTestParse();
 }
Пример #9
0
 private void PrepareTestFunc(CommandInformation ci)
 {
     PrepareInput(true);
 }