Line 71... |
Line 71... |
71 |
public void powerUp() {
|
71 |
public void powerUp() {
|
72 |
this.simStatus = 0;
|
72 |
this.simStatus = 0;
|
73 |
this.fsx.requestAudioSelData();
|
73 |
this.fsx.requestAudioSelData();
|
74 |
}
|
74 |
}
|
75 |
|
75 |
|
76 |
public override void MapEvents(FSXObject fsx) {
|
76 |
public override void FsxInit() { }
|
77 |
|
77 |
|
78 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM1_TRANSMIT_SELECT, "COM1_TRANSMIT_SELECT");
|
- |
|
79 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM2_TRANSMIT_SELECT, "COM2_TRANSMIT_SELECT");
|
- |
|
80 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.COM_RECEIVE_ALL_TOGGLE, "COM_RECEIVE_ALL_TOGGLE");
|
- |
|
81 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_VOR1_IDENT_TOGGLE, "RADIO_VOR1_IDENT_TOGGLE");
|
- |
|
82 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_VOR2_IDENT_TOGGLE, "RADIO_VOR2_IDENT_TOGGLE");
|
- |
|
83 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.MARKER_SOUND_TOGGLE, "MARKER_SOUND_TOGGLE");
|
- |
|
84 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_DME1_IDENT_TOGGLE, "RADIO_DME1_IDENT_TOGGLE");
|
- |
|
85 |
fsx.hSimConnect.MapClientEventToSimEvent(FSXObject.EVENT_ID.RADIO_ADF_IDENT_TOGGLE, "RADIO_ADF_IDENT_TOGGLE");
|
- |
|
86 |
|
78 |
public override void MapEvents() {
|
87 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "COM TRANSMIT:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
88 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "COM TRANSMIT:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
89 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "COM RECIEVE ALL", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
90 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "NAV SOUND:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
91 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "NAV SOUND:2", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
92 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "MARKER SOUND", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
93 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "DME SOUND", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
94 |
fsx.hSimConnect.AddToDataDefinition(FSXObject.DEFINITIONS.AUDIOSEL_DATA, "ADF SOUND:1", "Number", SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
|
- |
|
95 |
fsx.hSimConnect.RegisterDataDefineStruct<FSXObject.AudioSel_Data>(FSXObject.DEFINITIONS.AUDIOSEL_DATA);
|
- |
|
96 |
|
79 |
|
97 |
}
|
80 |
}
|
98 |
|
81 |
|
99 |
public override void FsxEvent(FSXObject fsx, SIMCONNECT_RECV_SIMOBJECT_DATA data) {
|
82 |
public override void FsxEvent(SIMCONNECT_RECV_SIMOBJECT_DATA data) {
|
100 |
|
83 |
|
101 |
if (data.dwRequestID == (uint)FSXObject.DATA_REQUESTS.AVIONICS) {
|
84 |
if (data.dwRequestID == (uint)FSXObject.DATA_REQUESTS.AVIONICS) {
|
102 |
FSXObject.Avionics_Data avionics = (FSXObject.Avionics_Data)data.dwData[0];
|
85 |
FSXObject.Avionics_Data avionics = (FSXObject.Avionics_Data)data.dwData[0];
|
103 |
this.avionicsMaster = avionics.avionics_master;
|
86 |
this.avionicsMaster = avionics.avionics_master;
|
104 |
if (!this.avionicsMaster) {
|
87 |
if (!this.avionicsMaster) {
|
Line 116... |
Line 99... |
116 |
return;
|
99 |
return;
|
117 |
|
100 |
|
118 |
if (data.dwRequestID != (uint)FSXObject.DATA_REQUESTS.AUDIOSEL_REQ)
|
101 |
if (data.dwRequestID != (uint)FSXObject.DATA_REQUESTS.AUDIOSEL_REQ)
|
119 |
return;
|
102 |
return;
|
120 |
|
103 |
|
- |
|
104 |
|
121 |
FSXObject.AudioSel_Data audioseldata = (FSXObject.AudioSel_Data)data.dwData[0];
|
105 |
FSXObject.AudioSel_Data audioseldata = (FSXObject.AudioSel_Data)data.dwData[0];
|
122 |
this.setLed(0, audioseldata.com1);
|
106 |
this.setLed(0, audioseldata.com1);
|
123 |
this.setLed(1, audioseldata.com2);
|
107 |
this.setLed(1, audioseldata.com2);
|
124 |
this.setLed(2, audioseldata.comb);
|
108 |
this.setLed(2, audioseldata.comb);
|
125 |
this.setLed(3, audioseldata.vor1);
|
109 |
this.setLed(3, audioseldata.vor1);
|
Line 129... |
Line 113... |
129 |
this.setLed(7, audioseldata.adf);
|
113 |
this.setLed(7, audioseldata.adf);
|
130 |
|
114 |
|
131 |
this.UpdateDisplay();
|
115 |
this.UpdateDisplay();
|
132 |
}
|
116 |
}
|
133 |
|
117 |
|
134 |
public override void FsxReady(FSXObject fsx) {
|
118 |
public override void FsxReady() {
|
135 |
fsx.hSimConnect.RequestDataOnSimObject(
|
- |
|
136 |
FSXObject.DATA_REQUESTS.AUDIOSEL_REQ,
|
- |
|
137 |
FSXObject.DEFINITIONS.AUDIOSEL_DATA,
|
- |
|
138 |
fsx.simdata.objectid,
|
- |
|
139 |
SIMCONNECT_PERIOD.SIM_FRAME,
|
- |
|
140 |
SIMCONNECT_DATA_REQUEST_FLAG.CHANGED,
|
- |
|
141 |
0, 0, 0);
|
- |
|
- |
|
119 |
|
142 |
}
|
120 |
}
|
143 |
|
121 |
|
144 |
public override void SimButtons(FSXObject fsx) {
|
122 |
public override void SimButtons() {
|
145 |
if (this.simStatus != 0)
|
123 |
if (this.simStatus != 0)
|
146 |
return;
|
124 |
return;
|
147 |
|
125 |
|
148 |
this.updateInput();
|
126 |
this.updateInput();
|
149 |
|
127 |
|
150 |
for (int i = 0; i <= 7; i++) {
|
128 |
for (int i = 0; i <= 7; i++) {
|
151 |
if (timers[i].Enabled) // Wait for the debounce before processing again
|
129 |
if (timers[i].Enabled) // Wait for the debounce before processing again
|
152 |
continue;
|
130 |
continue;
|
153 |
|
131 |
|
154 |
if (NITPanels.readBit(this.buttonStatus, i)) { // Check an audio button is pressed
|
132 |
if (NITPanels.readBit(this.buttonStatus, i)) { // Check an audio button is pressed
|
155 |
fsx.AudioSelButton(i); // and if so, send of the audio select event
|
133 |
this.fsx.AudioSelButton(i); // and if so, send of the audio select event
|
156 |
timers[i].Enabled = true; // and start up a timer to debounce the button
|
134 |
timers[i].Enabled = true; // and start up a timer to debounce the button
|
157 |
}
|
135 |
}
|
158 |
}
|
136 |
}
|
159 |
}
|
137 |
}
|
160 |
|
138 |
|