Esempio n. 1
0
 public override ProsthesisStateBase OnProsthesisCommand(ProsthesisCore.ProsthesisConstants.ProsthesisCommand command, TCP.ConnectionState from)
 {
     switch (command)
     {
     case ProsthesisCore.ProsthesisConstants.ProsthesisCommand.Resume:
         return(new ProsthesisActive(mContext, mArduinos));
     }
     return(base.OnProsthesisCommand(command, from));
 }
        public virtual ProsthesisStateBase OnProsthesisCommand(ProsthesisCore.ProsthesisConstants.ProsthesisCommand command, TCP.ConnectionState from)
        {
            switch (command)
            {
            case ProsthesisCore.ProsthesisConstants.ProsthesisCommand.Shutdown:
                return(new Shutdown(mContext));

            default:
                return(this);
            }
        }
Esempio n. 3
0
        public override ProsthesisStateBase OnProsthesisCommand(ProsthesisCore.ProsthesisConstants.ProsthesisCommand command, TCP.ConnectionState from)
        {
            switch (command)
            {
            case ProsthesisCore.ProsthesisConstants.ProsthesisCommand.Initialize:
                return(new RunSelfTest(mContext, mArduinos));

            case ProsthesisCore.ProsthesisConstants.ProsthesisCommand.Shutdown:
                return(new Shutdown(mContext));
            }
            return(this);
        }
Esempio n. 4
0
        private static void SendCommand(ProsthesisCore.ProsthesisConstants.ProsthesisCommand command)
        {
            if (mClient != null && mClient.Connected)
            {
                ProsthesisCommand cmd = new ProsthesisCommand();
                cmd.Command = command;

                mLogger.LogMessage(Logger.LoggerChannels.Events, string.Format("Sending command {0}", command));

                ProsthesisDataPacket packet = ProsthesisDataPacket.BoxMessage <ProsthesisCommand>(cmd);
                mClient.Send(packet.Bytes, 0, packet.Bytes.Length);
            }
        }
Esempio n. 5
0
        public override ProsthesisStateBase OnProsthesisCommand(ProsthesisCore.ProsthesisConstants.ProsthesisCommand command, TCP.ConnectionState from)
        {
            switch (command)
            {
            case ProsthesisCore.ProsthesisConstants.ProsthesisCommand.Shutdown:
                return(new Shutdown(this));

            default:
            {
                ProsthesisStateBase newState = mCurrentState.OnProsthesisCommand(command, from);
                if (newState != mCurrentState)
                {
                    ChangeState(newState);
                }
            }
            break;
            }

            return(this);
        }