Пример #1
0
        public Boolean  ProcessCommandResponse(string message, ref int commandIndex)
        {
            message     += message + ";";
            commandIndex = this.ValidCommandResponse(message);
            Boolean result = false;

            switch (commandIndex)
            {
            case 0:
            case 1:
            case 2:
            {
                DeviceCommand command = new ReadDeviceKeysCommand(this);
                result = command.ParseResponseText(message);
                break;
            }

            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            {
                DeviceCommand command = new WriteDeviceKeysCommand(this);
                result = command.ParseResponseText(message);
                break;
            }

            case 8:                                        {
                DeviceCommand command = new ConnectToServerCommand(this);
                result = command.ParseResponseText(message);
                break;
            }

            case 9:
            {
                DeviceCommand command = new ReadConnectStatusCommand(this);
                result = command.ParseResponseText(message);
                break;
            }

            case 10:
            {
                DeviceCommand command = new ReadDeviceStatusCommand(this);
                result = command.ParseResponseText(message);
                break;
            }
            }
            return(result);
        }
Пример #2
0
        public void ConnectToServer()
        {
            DeviceCommand command = new ConnectToServerCommand(this);

            this.controller.serialChannel.SendCommandSync(command.Package());
        }