Example #1
0
        private void Run()
        {
            client = new SocketClient("Managed Data Request", System.Net.Dns.GetHostName(), 11000);

            client.MapClientEventToSimEvent(MyEvents.Brakes, "BRAKES");
            client.AddClientEventToNotificationGroup(MyGroups.One, MyEvents.Brakes);

            client.MapClientEventToSimEvent(MyEvents.ElevatorTrimSet, "ELEVATOR_TRIM_SET");
            client.AddClientEventToNotificationGroup(MyGroups.One, MyEvents.ElevatorTrimSet);

            client.MapClientEventToSimEvent(MyEvents.ElevTrimDown, "ELEV_TRIM_DN");
            client.AddClientEventToNotificationGroup(MyGroups.One, MyEvents.ElevTrimDown);

            client.MapClientEventToSimEvent(MyEvents.ElevTrimUp, "ELEV_TRIM_UP");
            client.AddClientEventToNotificationGroup(MyGroups.One, MyEvents.ElevTrimUp);

            client.SetNotificationGroupPriority(MyGroups.One, GroupPriority.Highest);

            client.AddToDataDefinition(MyDefinitions.One, "ELEVATOR TRIM INDICATOR", "Position", Datatype.Float32, 0f, Constants.Unused);
            client.AddToDataDefinition(MyDefinitions.One, "ELEVATOR TRIM POSITION", "Degrees", Datatype.Float32, 0f, Constants.Unused);
            client.RegisterStructToDataDefinition(MyDefinitions.One, typeof(Struct1));

            client.AddToDataDefinition(MyDefinitions.Two, "VELOCITY BODY Y", "Feet per second", Datatype.Float32, 0f, Constants.Unused);
            client.AddToDataDefinition(MyDefinitions.Two, "VELOCITY WORLD Y", "Feet per second", Datatype.Float32, 0f, Constants.Unused);
            client.AddToDataDefinition(MyDefinitions.Two, "VERTICAL SPEED", "Feet per second", Datatype.Float32, 0f, Constants.Unused);
            client.AddToDataDefinition(MyDefinitions.Two, "ELEVATOR TRIM POSITION", "Degrees", Datatype.Float32, 0f, Constants.Unused);
            client.RegisterStructToDataDefinition(MyDefinitions.Two, typeof(Struct2));

            client.RequestDataOnSimObject(MyRequests.Two, MyDefinitions.Two, Constants.ObjectIdUser, Period.Second, DataRequestFlag.Changed);

            //unchecked
            //{
            //	client.TransmitClientEvent (Constants.ObjectIdUser, MyEvents.ElevatorTrimSet, (uint)0, MyGroups.One, EventFlag.Default);
            //}

            while (running)
            {
                try
                {
                    // I really wish this call would return S_FALSE when no message exists
                    // instead it returns an error conditon that needs to be caught
                    var nextDispatch = client.GetNextDispatch();
                    OnReceiveFromServer(nextDispatch);
                }
                catch (Exception)
                {
                    Thread.Sleep(10);
                }
            }
        }
Example #2
0
 public override void MapEvent(SocketClient simConnect)
 {
     simConnect.MapClientEventToSimEvent(MyEvents.ThrottleSet, "THROTTLE_SET");
     simConnect.AddClientEventToNotificationGroup(MyGroups.Default, MyEvents.ThrottleSet);
 }
Example #3
0
 public override void MapEvent(SocketClient simConnect)
 {
     simConnect.MapClientEventToSimEvent(MyEvents.GearSet, "GEAR_SET");
     simConnect.AddClientEventToNotificationGroup(MyGroups.Default, MyEvents.GearSet);
 }
Example #4
0
 public override void MapEvent(SocketClient simConnect)
 {
     simConnect.MapClientEventToSimEvent(MyEvents.ElevatorTrimSet, "ELEVATOR_TRIM_SET");
     simConnect.AddClientEventToNotificationGroup(MyGroups.Default, MyEvents.ElevatorTrimSet);
 }
Example #5
0
 public override void MapEvent(SocketClient simConnect)
 {
     simConnect.MapClientEventToSimEvent(MyEvents.ParkingBreaks, "PARKING_BRAKES");
     simConnect.AddClientEventToNotificationGroup(MyGroups.Default, MyEvents.ParkingBreaks);
 }