Exemplo n.º 1
0
        private void HandleCommand(LJU3Commands command, object[] args)
        {
            LogLevel loglevel = LogLevel.INFO;

            switch (command)
            {
            case LJU3Commands.GET_CONFIG:
                double value = 0;
                LJUD.eGet(u3.ljhandle, LJUD.IO.GET_CONFIG, (LJUD.CHANNEL)args[0], ref value, 0);
                break;

            case LJU3Commands.PIN_CONFIGURATION_RESET:
                LJUD.ePut(u3.ljhandle, LJUD.IO.PIN_CONFIGURATION_RESET, 0, 0, 0);
                break;

            case LJU3Commands.PUT_ANALOG_ENABLE_PORT:
                LJUD.ePut(u3.ljhandle, LJUD.IO.PUT_ANALOG_ENABLE_PORT, (LJUD.CHANNEL)args[0], Convert.ToDouble(args[1]), (int)args[2]);
                break;

            case LJU3Commands.GET_DIGITAL_BIT:
                LJUD.AddRequest(u3.ljhandle, LJUD.IO.GET_DIGITAL_BIT, (LJUD.CHANNEL)args[0], Convert.ToDouble(args[1]), (int)args[2], Convert.ToDouble(args[3]));
                loglevel = LogLevel.RAW;
                break;

            case LJU3Commands.PUT_DIGITAL_BIT:
                LJUD.AddRequest(u3.ljhandle, LJUD.IO.PUT_DIGITAL_BIT, (LJUD.CHANNEL)args[0], Convert.ToDouble(args[1]), 0, 0);
                break;

            default:
                evth.LogMessage(this, new LogEventArgs(LogLevel.ERROR, command.ToString() + ": Unhandled Command."));
                break;
            }
            evth.LogMessage(this, new LogEventArgs(loglevel, "Command executed: " + command.ToString()));
        }
Exemplo n.º 2
0
 public void LJU3Request(LJU3Commands lju3Command, object[] param)
 {
     if (onLJU3Request == null)
     {
         return;
     }
     onLJU3Request(this, new LJU3RequestArgs(lju3Command, param));
 }
Exemplo n.º 3
0
 public void Execute(LJU3Commands command, object[] args)
 {
     if (!isValid)
     {
         evth.LogMessage(this, new LogEventArgs(LogLevel.ERROR, "Not initialized, aborting."));
         return;
     }
     cmdQueue.Enqueue(new LJU3Command(command, args));
 }
Exemplo n.º 4
0
 public LJU3RequestArgs(LJU3Commands command, object[] args)
 {
     Command = command;
     Args    = args;
 }
Exemplo n.º 5
0
 public LJU3Command(LJU3Commands command, object[] args)
 {
     Command = command; Args = args;
 }
Exemplo n.º 6
0
 public DataReadyEventArgs(LJU3Commands command, object[] data)
 {
     Command = command;
     Data    = data;
 }