Exemplo n.º 1
0
 public void UpdateBreakGasState(bool breakPressed, bool gasPressed)
 {
     if (breakPressed != prevBreakPressed)
     {
         if (breakPressed)
         {
             InputEmulator.KeyPress(DIK_DOWN_ARROW_SCAN);
         }
         else
         {
             InputEmulator.KeyRelease(DIK_DOWN_ARROW_SCAN);
         }
         prevBreakPressed = breakPressed;
     }
     //Gas
     if (gasPressed != prevGasPressed)
     {
         if (gasPressed)
         {
             InputEmulator.KeyPress(DIK_UP_ARROW_SCAN);
         }
         else
         {
             InputEmulator.KeyRelease(DIK_UP_ARROW_SCAN);
         }
         prevGasPressed = gasPressed;
     }
 }
Exemplo n.º 2
0
 public void UpdateBreakGasState(bool breakClicked, bool gasClicked)
 {
     if (breakClicked != prevBreakClicked)
     {
         if (breakClicked)
         {
             InputEmulator.KeyPress(ControlMapping["Brake"]);
         }
         else
         {
             InputEmulator.KeyRelease(ControlMapping["Brake"]);
         }
         prevBreakClicked = breakClicked;
     }
     //Gas
     if (gasClicked != prevGasClicked)
     {
         if (gasClicked)
         {
             InputEmulator.KeyPress(ControlMapping["Throttle"]);
         }
         else
         {
             InputEmulator.KeyRelease(ControlMapping["Throttle"]);
         }
         prevGasClicked = gasClicked;
     }
 }
Exemplo n.º 3
0
 /* Controller */
 public void InitializeJoyIfNeccessary()
 {
     if (!InputEmulator.IsJoyInitialized())
     {
         InputEmulator.InitJoy();
     }
 }
Exemplo n.º 4
0
 /* Controller */
 public void OnRemoteControlConnected()
 {
     if (!InputEmulator.IsJoyInitialized())
     {
         InputEmulator.InitJoy(ffbListener);
     }
 }
Exemplo n.º 5
0
        public void UpdateLights(int lightsState)
        {
            if (lightsState != prevLightsState)
            {
                prevLightsState = lightsState;

                switch (lightsState)
                {
                case 0:
                    InputEmulator.KeyClick(ControlMapping["HighBeam"]);
                    InputEmulator.KeyClick(ControlMapping["LightModes"]);
                    break;

                case 1:
                    InputEmulator.KeyClick(ControlMapping["LightModes"]);
                    break;

                case 2:
                    InputEmulator.KeyClick(ControlMapping["LightModes"]);
                    break;

                case 3:
                    InputEmulator.KeyClick(ControlMapping["HighBeam"]);
                    break;
                }
            }
        }
Exemplo n.º 6
0
 public void UpdateCruise(bool isCruise)
 {
     if (prevCruiseState != isCruise)
     {
         prevCruiseState = isCruise;
         InputEmulator.KeyClick(DIK_C_SCAN);
     }
 }
Exemplo n.º 7
0
 public void UpdateParkingBrake(bool isParkingBrakeEnabled)
 {
     if (prevParkingBreakState != isParkingBrakeEnabled)
     {
         prevParkingBreakState = isParkingBrakeEnabled;
         InputEmulator.KeyClick(DIK_SPACE_SCAN);
     }
 }
Exemplo n.º 8
0
        public void UpdateAccelerometerValue(double accelerometerValue)
        {
            int roughValue    = 16384 + (int)(accelerometerValue * 34 * SteeringSensitivity);
            int newXAxisValue = (int)(prevXAxisValue + 0.6 * (roughValue - prevXAxisValue));

            prevXAxisValue = newXAxisValue;
            InputEmulator.SetXAxis(newXAxisValue);
        }
Exemplo n.º 9
0
 public void UpdateParkingBrake(bool isParkingBrakeEnabled)
 {
     if (wasParkingBreakEnabled != isParkingBrakeEnabled)
     {
         wasParkingBreakEnabled = isParkingBrakeEnabled;
         InputEmulator.KeyClick(ControlMapping["ParkingBrake"]);
     }
 }
Exemplo n.º 10
0
 public void UpdateLiftingAxle(bool liftingAxle)
 {
     if (prevLiftingAxle != liftingAxle)
     {
         prevLiftingAxle = liftingAxle;
         InputEmulator.KeyClick(DIK_U_SCAN);
     }
 }
Exemplo n.º 11
0
 public void UpdateFlashingBeacon(bool flashingBeacon)
 {
     if (prevFlashingBeacon != flashingBeacon)
     {
         prevFlashingBeacon = flashingBeacon;
         InputEmulator.KeyClick(DIK_O_SCAN);
     }
 }
Exemplo n.º 12
0
 public void UpdateDiffBlock(bool diffBlock)
 {
     if (prevDiffBlock != diffBlock)
     {
         prevDiffBlock = diffBlock;
         InputEmulator.KeyClick(DIK_V_SCAN);
     }
 }
Exemplo n.º 13
0
 public void UpdateWipers(int wipersState)
 {
     if (prevWipersState != wipersState)
     {
         prevWipersState = wipersState;
         InputEmulator.KeyClick(DIK_P_SCAN);
     }
 }
Exemplo n.º 14
0
 public void UpdateCruise(bool isCruise)
 {
     if (prevCruise != isCruise)
     {
         prevCruise = isCruise;
         InputEmulator.KeyClick(ControlMapping["CruiseControl"]);
     }
 }
Exemplo n.º 15
0
        public void UpdateHorn(int hornState)
        {
            if (hornState != prevHornState)
            {
                switch (hornState)
                {
                case 2:
                    InputEmulator.KeyPress(ControlMapping["AirHorn"]);
                    break;

                case 1:
                    InputEmulator.KeyPress(ControlMapping["Horn"]);
                    break;

                default:
                    InputEmulator.KeyRelease(ControlMapping["Horn"]);
                    InputEmulator.KeyRelease(ControlMapping["AirHorn"]);
                    break;
                }
                prevHornState = hornState;
            }
        }
Exemplo n.º 16
0
        public void UpdateHorn(int hornState)
        {
            if (hornState != prevHornState)
            {
                switch (hornState)
                {
                case 2:
                    InputEmulator.KeyPress(DIK_N_SCAN);
                    break;

                case 1:
                    InputEmulator.KeyPress(DIK_H_SCAN);
                    break;

                default:
                    InputEmulator.KeyRelease(DIK_H_SCAN);
                    InputEmulator.KeyRelease(DIK_N_SCAN);
                    break;
                }
                prevHornState = hornState;
            }
        }
Exemplo n.º 17
0
        public void UpdateLights(bool lightsState)
        {
            if (telemetry == null)
            {
                return;
            }

            if (lightsState != prevLightsState)
            {
                prevLightsState = lightsState;

                var truck = telemetry.Truck;

                if (!truck.LightsParkingOn)
                {
                    InputEmulator.KeyClick(DIK_L_SCAN);
                }
                else if (!truck.LightsBeamLowOn)
                {
                    InputEmulator.KeyClick(DIK_L_SCAN);
                    if (truck.LightsBeamHighOn)
                    {
                        InputEmulator.KeyClick(DIK_K_SCAN);
                    }
                }
                else if (!truck.LightsBeamHighOn)
                {
                    InputEmulator.KeyClick(DIK_K_SCAN);
                }
                else
                {
                    InputEmulator.KeyClick(DIK_K_SCAN);
                    InputEmulator.KeyClick(DIK_L_SCAN);
                }
            }
        }
Exemplo n.º 18
0
 public void Release()
 {
     InputEmulator.ReleaseJoy();
 }
Exemplo n.º 19
0
 private void ClickEmergencySignal()
 {
     InputEmulator.KeyClick(DIK_F_SCAN);
 }
Exemplo n.º 20
0
 private void ClickRightTurnSignal()
 {
     InputEmulator.KeyClick(DIK_CLOSE_BRACKET_SCAN);
 }
Exemplo n.º 21
0
 private void ToggleEmergencySignal()
 {
     InputEmulator.KeyClick(ControlMapping["HazardLight"]);
 }
Exemplo n.º 22
0
 private void ToggleRightTurnSignal()
 {
     InputEmulator.KeyClick(ControlMapping["RightIndicator"]);
 }
Exemplo n.º 23
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     server.Shutdown();
     InputEmulator.ReleaseJoy();
 }
Exemplo n.º 24
0
 private void ClickLeftTurnSignal()
 {
     InputEmulator.KeyClick(DIK_OPEN_BRACKET_SCAN);
 }