Esempio n. 1
0
        void sc_OnRecvOpen(SimConnect sender, SIMCONNECT_RECV_OPEN data)
        {
            log.Info(string.Format("Connected to {0}\r\n    Simulator Version:\t{1}.{2}.{3}.{4}\r\n    SimConnect Version:\t{5}.{6}.{7}.{8}",
                                   data.szApplicationName, data.dwApplicationVersionMajor, data.dwApplicationVersionMinor, data.dwApplicationBuildMajor, data.dwApplicationBuildMinor,
                                   data.dwSimConnectVersionMajor, data.dwSimConnectVersionMinor, data.dwSimConnectBuildMajor, data.dwSimConnectBuildMinor));

            OnRaiseOpenEvent(new OpenEventArgs(data.szApplicationName));

            string simIdent = "MSFS";

            if (data.szApplicationName.Contains("Flight Simulator X"))
            {
                simIdent = "FSX";
            }
            else if (data.szApplicationName.Contains("ESP"))
            {
                simIdent = "ESP";
            }
            else if (data.szApplicationName.Contains("Prepar3D"))
            {
                simIdent = "P3D";
            }

            ffUdp = ForeFlightUdp.Instance;
            ffUdp.SetSimulator(simIdent);

            sc.RequestDataOnUserSimObject(Requests.UserPosition, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.DEFAULT, typeof(Position));
            sc.RequestDataOnSimObjectType(Requests.TrafficEnumerate, 200000, SIMCONNECT_SIMOBJECT_TYPE.AIRCRAFT & SIMCONNECT_SIMOBJECT_TYPE.HELICOPTER, typeof(TrafficInfo));

            sc.SubscribeToSystemEvent(Events.ObjectAdded, "ObjectAdded");
            sc.SubscribeToSystemEvent(Events.SixHz, "6Hz");
        }
Esempio n. 2
0
        void sc_OnRecvOpen(SimConnect sender, SIMCONNECT_RECV_OPEN data)
        {
            lstViewer.Items.Clear();
            UserPosition pos = new UserPosition();

            sc.RequestDataOnUserSimObject(
                RequestID.UserPosition,
                SIMCONNECT_PERIOD.VISUAL_FRAME,
                pos);
            sc.SubscribeToSystemEvent(EventIDs.AddObject, "ObjectAdded");
            sc.SubscribeToSystemEvent(EventIDs.RemoveObject, "ObjectRemoved");
            sc.RequestDataOnSimObjectType(RequestID.AIEnumerate, 200000, SIMCONNECT_SIMOBJECT_TYPE.AIRCRAFT, typeof(UserPosition));
        }
Esempio n. 3
0
        void sc_OnRecvOpen(SimConnect sender, SIMCONNECT_RECV_OPEN data)
        {
            log.Info(string.Format("Connected to {0}\r\n    Simulator Version:\t{1}.{2}.{3}.{4}\r\n    SimConnect Version:\t{5}.{6}.{7}.{8}",
                                   data.szApplicationName, data.dwApplicationVersionMajor, data.dwApplicationVersionMinor, data.dwApplicationBuildMajor, data.dwApplicationBuildMinor,
                                   data.dwSimConnectVersionMajor, data.dwSimConnectVersionMinor, data.dwSimConnectBuildMajor, data.dwSimConnectBuildMinor));

            IsConnected = true;

#if DEBUG
            sc.SubscribeToSystemEvent(Events.AddObject, "ObjectAdded");
#endif
            sc.SubscribeToSystemEvent(Events.RemoveObject, "ObjectRemoved");

            sc.Text(SIMCONNECT_TEXT_TYPE.PRINT_WHITE, 5.0f, Requests.DisplayText, appName + " is connected to " + Encoding.UTF8.GetString(Encoding.Default.GetBytes(data.szApplicationName)));

            //sc.RequestDataOnUserSimObject(Requests.UserPosition, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, 0, 10, typeof(LatLon)); // Request user position every 10 seconds
            sc.RequestDataOnUserSimObject(Requests.UserPosition, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, typeof(LatLon));
        }
Esempio n. 4
0
 void sc_OnRecvOpen(SimConnect sender, SIMCONNECT_RECV_OPEN data)
 {
     this.globeControl.Host.CameraControllers.Current = controller;
     sc.RequestDataOnUserSimObject(Requests.UserPositionOrienation, SIMCONNECT_PERIOD.SIM_FRAME, controller);
 }
Esempio n. 5
0
 private void sc_OnRecvOpen(SimConnect sender, SIMCONNECT_RECV_OPEN data)
 {
     OnRaiseOpenEvent(new OpenEventArgs(data.szApplicationName));
     sc.RequestDataOnUserSimObject(Requests.UserPosition, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, typeof(LatLon));
 }