コード例 #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);
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
ファイル: WaitForBootup.cs プロジェクト: gjorban/ProsthesisPi
        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;
        }
コード例 #4
0
ファイル: ClientTest.cs プロジェクト: gjorban/ProsthesisPi
        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);
            }
        }
コード例 #5
0
ファイル: ClientTest.cs プロジェクト: gjorban/ProsthesisPi
 private static void OnTelemetryReceive(ProsthesisCore.Telemetry.ProsthesisTelemetry msg)
 {
     mTelemetryLogger.LogMessage(Logger.LoggerChannels.Telemetry, msg.ToString());
 }
コード例 #6
0
 public MotorControllerArduino(ProsthesisCore.Utility.Logger logger)
     : base(kArduinoID, logger)
 {
 }
コード例 #7
0
 private void OnArduinoStateChange(ArduinoCommunicationsLibrary.ArduinoCommsBase arduino, ProsthesisCore.Telemetry.ProsthesisTelemetry.DeviceState from, ProsthesisCore.Telemetry.ProsthesisTelemetry.DeviceState to)
 {
     if (to == ProsthesisCore.Telemetry.ProsthesisTelemetry.DeviceState.Fault)
     {
         RaiseFault(string.Format("AID {0} reported a fault.", arduino.ArduinoID));
     }
 }
コード例 #8
0
 public void UpdateSensorTelemetry(ProsthesisCore.Telemetry.ProsthesisTelemetry.ProsthesisSensorTelemetry sensorTelem)
 {
     if (sensorTelem != null)
     {
         mContext.UpdateSensorTelemetry(sensorTelem);
     }
 }
コード例 #9
0
 public void UpdateMotorTelemetry(ProsthesisCore.Telemetry.ProsthesisTelemetry.ProsthesisMotorTelemetry motorTelem)
 {
     if (motorTelem != null)
     {
         mContext.UpdateMotorTelemetry(motorTelem);
     }
 }
コード例 #10
0
 public override ProsthesisStateBase OnSocketMessage(ProsthesisCore.Messages.ProsthesisMessage message, TCP.ConnectionState state)
 {
     ProsthesisStateBase newState = mCurrentState.OnSocketMessage(message, state);
     if (newState != mCurrentState)
     {
         ChangeState(newState);
     }
     return this;
 }
コード例 #11
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;
        }
コード例 #12
0
 public SensorNodeArduino(ProsthesisCore.Utility.Logger logger)
     : base(kArduinoID, logger)
 {
 }
コード例 #13
0
 public virtual ProsthesisStateBase OnSocketMessage(ProsthesisCore.Messages.ProsthesisMessage message, TCP.ConnectionState state)
 {
     return this;
 }
コード例 #14
0
 public ArduinoCommsBase(string arduinoID, ProsthesisCore.Utility.Logger logger)
 {
     mArduinoID = arduinoID;
     mLogger = logger;
 }