Exemple #1
0
        private void Fire_HS(object o)
        {
            GameData_HS package = new GameData_HS();

            /** DRIVER INPUTS **/
            package.Throttle = Convert.ToByte(200 * Telemetry.m.Sim.Player.Pedals_Throttle);
            package.Brake    = Convert.ToByte(200 * Telemetry.m.Sim.Player.Pedals_Brake);
            package.Clutch   = Convert.ToByte(200 * Telemetry.m.Sim.Player.Pedals_Clutch);
            package.Steer    = Convert.ToByte(100 * (1 + Telemetry.m.Sim.Player.SteeringAngle));

            /** PITS SITUATION ETC **/
            package.PitLimiter  = (byte)((Telemetry.m.Sim.Drivers.Player.PitLimiter) ? 1 : 0);
            package.InPits      = (byte)((Telemetry.m.Sim.Drivers.Player.Pits) ? 1 : 0);
            package.PitRequired = 0;     // TODO;
            package.EngineStall = (byte)((Telemetry.m.Sim.Drivers.Player.RPM < 500) ? 1 : 0);


            /** DRIVING INFO **/
            package.Gear      = (byte)((Telemetry.m.Sim.Player.Gear == 255) ? 11 : GetGear());
            package.Position  = (byte)Telemetry.m.Sim.Drivers.Player.Position;
            package.Wheelslip = 0;     // TODO
            package.Cars      = (byte)Telemetry.m.Sim.Session.Cars;

            /** TRACK INFO **/
            package.Flag       = 0; // TODO
            package.Temp_Water = Convert.ToByte(Telemetry.m.Sim.Player.Engine_Temperature_Water);
            package.Temp_Oil   = Convert.ToByte(Telemetry.m.Sim.Player.Engine_Temperature_Oil);
            package.Temp_Track = Convert.ToByte(Telemetry.m.Sim.Session.TrackTemperature);


            /** MORE DRIVING **/
            package.Speed     = Convert.ToUInt16(Math.Round(Math.Abs(Telemetry.m.Sim.Player.Speed * 3.6)));
            package.RPM       = Convert.ToUInt16(Math.Round(Math.Max(0, rads_to_rpm * Telemetry.m.Sim.Player.Engine_RPM)));
            package.Engine_HP =
                Convert.ToUInt16(
                    Math.Round(Math.Max(0,
                                        Telemetry.m.Sim.Player.Engine_Torque * Telemetry.m.Sim.Player.Engine_RPM *
                                        rads_to_rpm / 5252)));
            package.MetersDriven = Convert.ToUInt16(Math.Max(0, Telemetry.m.Sim.Drivers.Player.MetersDriven));

            /** LIVE DRIVING TIMES **/
            package.Laptime_Current = 0; // TODO
            package.Gap_Front       = 0; // TODO
            package.Gap_Back        = 0; // TODO

            package.Wipers = 0;
            package.Lights = (byte)((Telemetry.m.Sim.Drivers.Player.HeadLights) ? 1 : 0);;
            //package.Ignition = (byte)((Telemetry.m.Sim.Player.i) ? 1 : 0); ;
            package.Ignition = (byte)((Telemetry.m.Sim.Drivers.Player.Ignition) ? 1 : 0);;
            package.Ignition = 1;
            package.Pause    = (byte)((Telemetry.m.Sim.Session.Time == PreviousTime) ? 1 : 0);
            PreviousTime     = Telemetry.m.Sim.Session.Time;

            // Send package
            SendPackage(DashboardPackages.PACK_GAMEDATA_HS, ByteMethods.ToBytes(package));
        }
Exemple #2
0
        private void Fire_HS(object o)
        {
            GameData_HS package = new GameData_HS();

                /** DRIVER INPUTS **/
                package.Throttle = Convert.ToByte(200*Telemetry.m.Sim.Player.Pedals_Throttle);
                package.Brake = Convert.ToByte(200*Telemetry.m.Sim.Player.Pedals_Brake);
                package.Clutch = Convert.ToByte(200*Telemetry.m.Sim.Player.Pedals_Clutch);
                package.Steer = Convert.ToByte(100*(1 + Telemetry.m.Sim.Player.SteeringAngle));

                /** PITS SITUATION ETC **/
                package.PitLimiter = (byte) ((Telemetry.m.Sim.Drivers.Player.PitLimiter) ? 1 : 0);
                package.InPits = (byte) ((Telemetry.m.Sim.Drivers.Player.Pits) ? 1 : 0);
                package.PitRequired = 0; // TODO;
                package.EngineStall = (byte) ((Telemetry.m.Sim.Drivers.Player.RPM < 500) ? 1 : 0);

                /** DRIVING INFO **/
                package.Gear = (byte) ((Telemetry.m.Sim.Player.Gear == 255) ? 11 : GetGear());
                package.Position = (byte) Telemetry.m.Sim.Drivers.Player.Position;
                package.Wheelslip = 0; // TODO
                package.Cars = (byte) Telemetry.m.Sim.Session.Cars;

                /** TRACK INFO **/
                package.Flag = 0; // TODO
                package.Temp_Water = Convert.ToByte(Telemetry.m.Sim.Player.Engine_Temperature_Water);
                package.Temp_Oil = Convert.ToByte(Telemetry.m.Sim.Player.Engine_Temperature_Oil);
                package.Temp_Track = Convert.ToByte(Telemetry.m.Sim.Session.TrackTemperature);

                /** MORE DRIVING **/
                package.Speed = Convert.ToUInt16(Math.Round(Math.Abs(Telemetry.m.Sim.Player.Speed*3.6)));
                package.RPM = Convert.ToUInt16(Math.Round(Math.Max(0, rads_to_rpm*Telemetry.m.Sim.Player.Engine_RPM)));
                package.Engine_HP =
                    Convert.ToUInt16(
                        Math.Round(Math.Max(0,
                                            Telemetry.m.Sim.Player.Engine_Torque*Telemetry.m.Sim.Player.Engine_RPM*
                                            rads_to_rpm/5252)));
                package.MetersDriven = Convert.ToUInt16(Math.Max(0, Telemetry.m.Sim.Drivers.Player.MetersDriven));

                /** LIVE DRIVING TIMES **/
                package.Laptime_Current = 0; // TODO
                package.Gap_Front = 0; // TODO
                package.Gap_Back = 0; // TODO

                package.Wipers = 0;
                package.Lights = (byte)((Telemetry.m.Sim.Drivers.Player.HeadLights) ? 1 : 0); ;
                //package.Ignition = (byte)((Telemetry.m.Sim.Player.i) ? 1 : 0); ;
                package.Ignition = (byte)((Telemetry.m.Sim.Drivers.Player.Ignition) ? 1 : 0); ;
                package.Ignition = 1;
                package.Pause = (byte)((Telemetry.m.Sim.Session.Time == PreviousTime) ? 1 : 0);
            PreviousTime = Telemetry.m.Sim.Session.Time;

                // Send package
                SendPackage(DashboardPackages.PACK_GAMEDATA_HS, ByteMethods.ToBytes(package));
        }
Exemple #3
0
        private void Fire_HS(object o)
        {
            try
            {

                //if (Telemetry.m.Sim.Drivers.Player.PitLimiter || Telemetry.m.Sim.Drivers.Player.Pits)
                //    return;
                GameData_HS package = new GameData_HS();

                /** DRIVER INPUTS **/
                package.Throttle = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Player.Pedals_Throttle,0,1));
                package.Brake = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Player.Pedals_Brake,0,1));
                package.Clutch = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Player.Pedals_Clutch,0,1));
                package.Steer = Convert.ToByte(100 * (1 + Limits(Telemetry.m.Sim.Player.SteeringAngle, -1, 1)));

                /** PITS SITUATION ETC **/
                package.PitLimiter = (byte)((Telemetry.m.Sim.Drivers.Player.PitLimiter) ? 1 : 0);
                package.InPits = (byte)((Telemetry.m.Sim.Drivers.Player.Pits) ? 1 : 0);
                package.PitRequired = 0; // TODO;
                package.EngineStall = (byte)((Telemetry.m.Sim.Drivers.Player.RPM < 500) ? 1 : 0);

                /** DRIVING INFO **/
                package.Gear = (byte)((Telemetry.m.Sim.Player.Gear == 255) ? 11 : GetGear());
                package.Position = (byte)Telemetry.m.Sim.Drivers.Player.Position;
                package.Wheelslip = 0; // TODO
                package.Cars = (byte)Telemetry.m.Sim.Session.Cars;

                /** TRACK INFO **/
                package.Flag = (byte)Flags.FLAG_Clear; // TODO

                //BLACK
                /*if (Telemetry.m.Sim.Drivers.Player.Flag_Black)
                    package.Flag = (byte)Flags.FLAG_Black;
                //BLUE
                if (Telemetry.m.Sim.Drivers.Player.Flag_Blue)
                    package.Flag = (byte)Flags.FLAG_Blue;

                //YELLOW
                package.FlagIntensity = YellowFlagIntensity();
                if (package.FlagIntensity != 0)
                    package.Flag = (byte)Flags.FLAG_Yellow;

                //FULLCOURSE
                if (Telemetry.m.Sim.Session.Flag_YellowFull)
                    package.Flag = (byte)Flags.FLAG_FullYellow;*/
                package.Flag = 0;
                //Console.WriteLine(((Flags) package.Flag).ToString() + " @ " + package.FlagIntensity);
                package.Temp_Water = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Engine_Temperature_Water,0,150) % 255);
                package.Temp_Oil = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Engine_Temperature_Oil,0,150) % 255);
                package.Temp_Track = Convert.ToByte(Limits(Telemetry.m.Sim.Session.TrackTemperature,0,50));

                /** MORE DRIVING **/
                package.Speed = Convert.ToUInt16(Math.Round(Math.Abs(Limits(Telemetry.m.Sim.Player.Speed,0,125) * 3.6)));
                package.RPM = Convert.ToUInt16(Math.Round(Limits(rads_to_rpm * Telemetry.m.Sim.Player.Engine_RPM, 0, 25000)));
                double torque = Limits(Telemetry.m.Sim.Player.Engine_Torque,-200,1000);
                if (double.IsNaN(torque) == false && double.IsInfinity(torque) == false && torque > -10000 && torque <= 100000)
                {
                    package.Engine_HP =
                        Convert.ToUInt16(
                            Math.Round(Math.Max(0,
                                                torque * Telemetry.m.Sim.Player.Engine_RPM *
                                                rads_to_rpm / 5252)));
                }
                package.MetersDriven = Convert.ToUInt16(Math.Max(0, Telemetry.m.Sim.Drivers.Player.MetersDriven));

                /** LIVE DRIVING TIMES **/
                package.Laptime_Current = 0; // TODO
                package.Gap_Front = (float)Splits.Split;
                if (float.IsNaN(package.Gap_Front) || float.IsInfinity(package.Gap_Front))
                    package.Gap_Front = 0;
                package.Gap_Back = 0; // TODO

                package.Wipers = 0;
                package.Lights = (byte)((Telemetry.m.Sim.Drivers.Player.HeadLights) ? 1 : 0); ;
                //package.Ignition = (byte)((Telemetry.m.Sim.Player.i) ? 1 : 0); ;
                package.Ignition = (byte)((Telemetry.m.Sim.Drivers.Player.Ignition) ? 1 : 0); ;
                package.Ignition = 1;
                package.Pause = 0;// (byte)((Telemetry.m.Sim.Session.Time == PreviousTime) ? 1 : 0);
                PreviousTime = Telemetry.m.Sim.Session.Time;

                // Send package
                SendPackage(DashboardPackages.PACK_GAMEDATA_HS, ByteMethods.ToBytes(package));
            }
            catch (Exception ex)
            {
            }
        }
Exemple #4
0
        private void Fire_HS(object o)
        {
            try
            {
                //if (Telemetry.m.Sim.Drivers.Player.PitLimiter || Telemetry.m.Sim.Drivers.Player.Pits)
                //    return;
                GameData_HS package = new GameData_HS();

                /** DRIVER INPUTS **/
                package.Throttle = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Player.Pedals_Throttle, 0, 1));
                package.Brake    = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Player.Pedals_Brake, 0, 1));
                package.Clutch   = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Player.Pedals_Clutch, 0, 1));
                package.Steer    = Convert.ToByte(100 * (1 + Limits(Telemetry.m.Sim.Player.SteeringAngle, -1, 1)));

                /** PITS SITUATION ETC **/
                package.PitLimiter  = (byte)((Telemetry.m.Sim.Drivers.Player.PitLimiter) ? 1 : 0);
                package.InPits      = (byte)((Telemetry.m.Sim.Drivers.Player.Pits) ? 1 : 0);
                package.PitRequired = 0; // TODO;
                package.EngineStall = (byte)((Telemetry.m.Sim.Drivers.Player.RPM < 500) ? 1 : 0);


                /** DRIVING INFO **/
                package.Gear      = (byte)((Telemetry.m.Sim.Player.Gear == 255) ? 11 : GetGear());
                package.Position  = (byte)Telemetry.m.Sim.Drivers.Player.Position;
                package.Wheelslip = 0; // TODO
                package.Cars      = (byte)Telemetry.m.Sim.Session.Cars;

                /** TRACK INFO **/
                package.Flag = (byte)Flags.FLAG_Clear; // TODO

                //BLACK

                /*if (Telemetry.m.Sim.Drivers.Player.Flag_Black)
                 *  package.Flag = (byte)Flags.FLAG_Black;
                 * //BLUE
                 * if (Telemetry.m.Sim.Drivers.Player.Flag_Blue)
                 *  package.Flag = (byte)Flags.FLAG_Blue;
                 *
                 * //YELLOW
                 * package.FlagIntensity = YellowFlagIntensity();
                 * if (package.FlagIntensity != 0)
                 *  package.Flag = (byte)Flags.FLAG_Yellow;
                 *
                 * //FULLCOURSE
                 * if (Telemetry.m.Sim.Session.Flag_YellowFull)
                 *  package.Flag = (byte)Flags.FLAG_FullYellow;*/
                package.Flag = 0;
                //Console.WriteLine(((Flags) package.Flag).ToString() + " @ " + package.FlagIntensity);
                package.Temp_Water = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Engine_Temperature_Water, 0, 150) % 255);
                package.Temp_Oil   = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Engine_Temperature_Oil, 0, 150) % 255);
                package.Temp_Track = Convert.ToByte(Limits(Telemetry.m.Sim.Session.TrackTemperature, 0, 50));


                /** MORE DRIVING **/
                package.Speed = Convert.ToUInt16(Math.Round(Math.Abs(Limits(Telemetry.m.Sim.Drivers.Player.Speed, 0, 125) * 3.6)));
                package.RPM   = Convert.ToUInt16(Math.Round(Limits(rads_to_rpm * Telemetry.m.Sim.Drivers.Player.RPM, 0, 25000)));
                double torque = Limits(Telemetry.m.Sim.Player.Engine_Torque, -200, 1000);
                if (double.IsNaN(torque) == false && double.IsInfinity(torque) == false && torque > -10000 && torque <= 100000)
                {
                    package.Engine_HP =
                        Convert.ToUInt16(
                            Math.Round(Math.Max(0,
                                                torque * Telemetry.m.Sim.Player.Engine_RPM *
                                                rads_to_rpm / 5252)));
                }
                if (Telemetry.m.Sim.Modules.DistanceOnLap)
                {
                    package.MetersDriven = Convert.ToUInt16(Math.Max(0, Telemetry.m.Sim.Drivers.Player.MetersDriven));
                }

                /** LIVE DRIVING TIMES **/
                package.Laptime_Current = 0; // TODO
                package.Gap_Front       = (float)Splits.Split;
                if (float.IsNaN(package.Gap_Front) || float.IsInfinity(package.Gap_Front))
                {
                    package.Gap_Front = 0;
                }
                if (package.Gap_Front >= 9.99f)
                {
                    package.Gap_Front = 9.99f;
                }
                package.Gap_Back = 0; // TODO

                package.Wipers = 0;
                package.Lights = (byte)((Telemetry.m.Sim.Drivers.Player.HeadLights) ? 1 : 0);;
                //package.Ignition = (byte)((Telemetry.m.Sim.Player.i) ? 1 : 0); ;
                package.Ignition = (byte)((Telemetry.m.Sim.Drivers.Player.Ignition) ? 1 : 0);;
                package.Ignition = 1;
                package.Pause    = 0;// (byte)((Telemetry.m.Sim.Session.Time == PreviousTime) ? 1 : 0);
                PreviousTime     = Telemetry.m.Sim.Session.Time;

                // Send package
                SendPackage(DashboardPackages.PACK_GAMEDATA_HS, ByteMethods.ToBytes(package));
            }
            catch (Exception ex)
            {
            }
        }