Subversion Repositories group.NITPanels

Rev

Rev 3 | Rev 5 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 4
Line 66... Line 66...
66
        }
66
        }
67
 
67
 
68
        private void SimConnect_InitDataRequest() {
68
        private void SimConnect_InitDataRequest() {
69
            try {
69
            try {
70
 
70
 
71
                foreach (NITDevice device in panels.devices) {
-
 
72
                    if (device.isOpen())
-
 
73
                        device.MapEvents();
71
                fsx.MapEvents();
74
                }
-
 
75
 
-
 
76
 
-
 
77
 
-
 
78
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM1_SWAP_FREQ, "COM_STBY_RADIO_SWAP");
-
 
79
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV1_SWAP_FREQ, "NAV1_RADIO_SWAP");
-
 
80
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM_RADIO_WHOLE_INC, "COM_RADIO_WHOLE_INC");
-
 
81
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM_RADIO_WHOLE_DEC, "COM_RADIO_WHOLE_DEC");
-
 
82
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM_RADIO_FRACT_INC, "COM_RADIO_FRACT_INC");
-
 
83
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM_RADIO_FRACT_DEC, "COM_RADIO_FRACT_DEC");
-
 
84
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV1_RADIO_WHOLE_INC, "NAV1_RADIO_WHOLE_INC");
-
 
85
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV1_RADIO_WHOLE_DEC, "NAV1_RADIO_WHOLE_DEC");
-
 
86
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV1_RADIO_FRACT_INC, "NAV1_RADIO_FRACT_INC");
-
 
87
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV1_RADIO_FRACT_DEC, "NAV1_RADIO_FRACT_DEC");
-
 
88
 
-
 
89
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM2_SWAP_FREQ, "COM2_RADIO_SWAP");
-
 
90
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV2_SWAP_FREQ, "NAV2_RADIO_SWAP");
-
 
91
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM2_RADIO_WHOLE_INC, "COM2_RADIO_WHOLE_INC");
-
 
92
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM2_RADIO_WHOLE_DEC, "COM2_RADIO_WHOLE_DEC");
-
 
93
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM2_RADIO_FRACT_INC, "COM2_RADIO_FRACT_INC");
-
 
94
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM2_RADIO_FRACT_DEC, "COM2_RADIO_FRACT_DEC");
-
 
95
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV2_RADIO_WHOLE_INC, "NAV2_RADIO_WHOLE_INC");
-
 
96
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV2_RADIO_WHOLE_DEC, "NAV2_RADIO_WHOLE_DEC");
-
 
97
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV2_RADIO_FRACT_INC, "NAV2_RADIO_FRACT_INC");
-
 
98
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.NAV2_RADIO_FRACT_DEC, "NAV2_RADIO_FRACT_DEC");
-
 
99
 
-
 
100
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM1_TRANSMIT_SELECT, "COM1_TRANSMIT_SELECT");
-
 
101
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM2_TRANSMIT_SELECT, "COM2_TRANSMIT_SELECT");
-
 
102
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM_RECEIVE_ALL_TOGGLE, "COM_RECEIVE_ALL_TOGGLE");
-
 
103
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_VOR1_IDENT_TOGGLE, "RADIO_VOR1_IDENT_TOGGLE");
-
 
104
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_VOR2_IDENT_TOGGLE, "RADIO_VOR2_IDENT_TOGGLE");
-
 
105
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.MARKER_SOUND_TOGGLE, "MARKER_SOUND_TOGGLE");
-
 
106
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_DME1_IDENT_TOGGLE, "RADIO_DME1_IDENT_TOGGLE");
-
 
107
                fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_ADF_IDENT_TOGGLE, "RADIO_ADF_IDENT_TOGGLE");
-
 
108
 
-
 
109
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "COM TRANSMIT:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
110
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "COM TRANSMIT:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
111
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "COM RECIEVE ALL", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
112
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "NAV SOUND:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
113
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "NAV SOUND:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
114
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "MARKER SOUND", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
115
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "DME SOUND", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
116
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "ADF SOUND:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
117
                fsx.hSimConnect.RegisterDataDefineStruct<FSXObject.AudioSel_Data>(FSXObject.DEFINITIONS.AUDIOSEL_DATA);
-
 
118
 
-
 
119
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AIRCRAFT, "Atc Type", "", SIMCONNECT_DATATYPE.STRING32, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
120
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AIRCRAFT, "ATC Model", "", SIMCONNECT_DATATYPE.STRING32, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
121
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AIRCRAFT, "ATC ID", "", SIMCONNECT_DATATYPE.STRING32, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
122
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AIRCRAFT, "Title", "", SIMCONNECT_DATATYPE.STRING128, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
123
                fsx.hSimConnect.RegisterDataDefineStruct<FSXObject.Aircraft_Data>(FSXObject.DEFINITIONS.AIRCRAFT);
-
 
124
 
-
 
125
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AVIONICS, "Avionics Master Switch", "bool", SIMCONNECT_DATATYPE.INT32, 0, SimConnect.SIMCONNECT_UNUSED);
-
 
126
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AVIONICS, "Com Status:1", "Enum", SIMCONNECT_DATATYPE.FLOAT64, 0, SimConnect.SIMCONNECT_UNUSED);
-
 
127
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AVIONICS, "Com Status:2", "Enum", SIMCONNECT_DATATYPE.FLOAT64, 0, SimConnect.SIMCONNECT_UNUSED);
-
 
128
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AVIONICS, "Nav Available:1", "bool", SIMCONNECT_DATATYPE.INT32, 0, SimConnect.SIMCONNECT_UNUSED);
-
 
129
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AVIONICS, "Nav Available:2", "bool", SIMCONNECT_DATATYPE.INT32, 0, SimConnect.SIMCONNECT_UNUSED);
-
 
130
                fsx.hSimConnect.RegisterDataDefineStruct<FSXObject.Avionics_Data>(FSXObject.DEFINITIONS.AVIONICS);
-
 
131
 
-
 
132
                // NavComm1 Frequencies
-
 
133
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM1_DATA, "Com Active Frequency:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
134
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM1_DATA, "Com Standby Frequency:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
135
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM1_DATA, "Nav Active Frequency:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
136
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM1_DATA, "Nav Standby Frequency:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
137
                fsx.hSimConnect.RegisterDataDefineStruct<FSXObject.NavCom_Data>(FSXObject.DEFINITIONS.NAVCOM1_DATA);
-
 
138
 
-
 
139
                // NavComm2 Frequencies
-
 
140
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM2_DATA, "Com Active Frequency:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
141
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM2_DATA, "Com Standby Frequency:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
142
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM2_DATA, "Nav Active Frequency:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
143
                fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.NAVCOM2_DATA, "Nav Standby Frequency:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
-
 
144
                fsx.hSimConnect.RegisterDataDefineStruct<FSXObject.NavCom_Data>(FSXObject.DEFINITIONS.NAVCOM2_DATA);
-
 
145
 
72
 
146
                fsx.hSimConnect.OnRecvOpen += new SimConnect.RecvOpenEventHandler(SimConnect_OnRecvOpen);
73
                fsx.hSimConnect.OnRecvOpen += new SimConnect.RecvOpenEventHandler(SimConnect_OnRecvOpen);
147
                fsx.hSimConnect.OnRecvQuit += new SimConnect.RecvQuitEventHandler(SimConnect_OnRecvQuit);
74
                fsx.hSimConnect.OnRecvQuit += new SimConnect.RecvQuitEventHandler(SimConnect_OnRecvQuit);
148
                fsx.hSimConnect.OnRecvException += new SimConnect.RecvExceptionEventHandler(SimConnect_OnRecvException);
75
                fsx.hSimConnect.OnRecvException += new SimConnect.RecvExceptionEventHandler(SimConnect_OnRecvException);
149
                fsx.hSimConnect.OnRecvSimobjectData += new SimConnect.RecvSimobjectDataEventHandler(SimConnect_OnRecvSimObjectData);
76
                fsx.hSimConnect.OnRecvSimobjectData += new SimConnect.RecvSimobjectDataEventHandler(SimConnect_OnRecvSimObjectData);
Line 171... Line 98...
171
            Log("SimConnect Exception: " + (uint)(data.dwException));
98
            Log("SimConnect Exception: " + (uint)(data.dwException));
172
        }
99
        }
173
 
100
 
174
        // Automatic updates on various variables. Set through InitFsxReady
101
        // Automatic updates on various variables. Set through InitFsxReady
175
        private void SimConnect_OnRecvSimObjectData(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA data) {
102
        private void SimConnect_OnRecvSimObjectData(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA data) {
176
            if (data.dwRequestID == (uint)FSXObject.DATA_REQUESTS.AUDIOSEL_REQ)
-
 
177
                MainForm.NITMessageBox("Debug", "AudioSel data");
-
 
178
 
-
 
179
            foreach (NITDevice device in panels.devices) {
103
            foreach (NITDevice device in panels.devices) {
180
                if (device.isOpen()) {
104
                if (device.isOpen()) {
181
                    device.FsxEvent(data);
105
                    device.FsxEvent(data);
182
                }
106
                }
183
            } 
107
            }