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
 private static void OnTelemetryReceive(ProsthesisCore.Telemetry.ProsthesisTelemetry msg)
 {
     mTelemetryLogger.LogMessage(Logger.LoggerChannels.Telemetry, msg.ToString());
 }
 public MotorControllerArduino(ProsthesisCore.Utility.Logger logger)
     : base(kArduinoID, logger)
 {
 }
 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));
     }
 }
 public void UpdateSensorTelemetry(ProsthesisCore.Telemetry.ProsthesisTelemetry.ProsthesisSensorTelemetry sensorTelem)
 {
     if (sensorTelem != null)
     {
         mContext.UpdateSensorTelemetry(sensorTelem);
     }
 }
 public void UpdateMotorTelemetry(ProsthesisCore.Telemetry.ProsthesisTelemetry.ProsthesisMotorTelemetry motorTelem)
 {
     if (motorTelem != null)
     {
         mContext.UpdateMotorTelemetry(motorTelem);
     }
 }
 public override ProsthesisStateBase OnSocketMessage(ProsthesisCore.Messages.ProsthesisMessage message, TCP.ConnectionState state)
 {
     ProsthesisStateBase newState = mCurrentState.OnSocketMessage(message, state);
     if (newState != mCurrentState)
     {
         ChangeState(newState);
     }
     return this;
 }
        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;
        }
Esempio n. 12
0
 public SensorNodeArduino(ProsthesisCore.Utility.Logger logger)
     : base(kArduinoID, logger)
 {
 }
Esempio n. 13
0
 public virtual ProsthesisStateBase OnSocketMessage(ProsthesisCore.Messages.ProsthesisMessage message, TCP.ConnectionState state)
 {
     return this;
 }
Esempio n. 14
0
 public ArduinoCommsBase(string arduinoID, ProsthesisCore.Utility.Logger logger)
 {
     mArduinoID = arduinoID;
     mLogger = logger;
 }