コード例 #1
0
 public ArduinoCommand TryAddCommand(String commandAlias, ArduinoCommand.CommandType commandType, bool expectsResponse = false)
 {
     return(TryAddCommand(commandAlias, String.Empty, 1, 1, commandType, expectsResponse));
 }
コード例 #2
0
 public ArduinoCommand TryAddCommand(String commandAlias, String commandAliases = null, int delay = 1, int repeat = 1, ArduinoCommand.CommandType commandType = ArduinoCommand.CommandType.NOT_SET, bool expectsResponse = false)
 {
     String[] aliases = commandAliases == null || commandAliases == String.Empty ? null : commandAliases.Split(',');
     return(TryAddCommand(commandAlias, aliases, delay, repeat, commandType, expectsResponse));
 }
コード例 #3
0
        public ArduinoCommand AddCommand(String commandAlias, String[] commandAliases, int delay = 1, int repeat = 1, ArduinoCommand.CommandType commandType = ArduinoCommand.CommandType.NOT_SET, bool expectsResponse = false)
        {
            var command = new ArduinoCommand(commandAlias, commandType);

            command.Delay           = delay;
            command.Repeat          = repeat;
            command.ExpectsResponse = expectsResponse;
            if (commandAliases != null)
            {
                for (int i = 0; i < commandAliases.Length; i++)
                {
                    var c = GetCommand(commandAliases[i]);
                    if (c == null)
                    {
                        throw new Exception("No command found with alias " + commandAliases[i]);
                    }
                    command.Commands.Add(c);
                }
            }
            return(AddCommand(command));
        }
コード例 #4
0
 public ArduinoCommand TryAddCommand(String commandAlias, String[] commandAliases, int delay = 1, int repeat = 1, ArduinoCommand.CommandType commandType = ArduinoCommand.CommandType.NOT_SET, bool expectsResponse = false)
 {
     try
     {
         ArduinoCommand cmd = AddCommand(commandAlias, commandAliases, delay, repeat, commandType, expectsResponse);
         return(cmd);
     } catch (Exception)
     {
         return(null);
     }
 }
コード例 #5
0
 public ArduinoCommand AddCommand(String commandAlias, ArduinoCommand.CommandType commandType = ArduinoCommand.CommandType.NOT_SET)
 {
     return(AddCommand(new ArduinoCommand(commandAlias, commandType)));
 }