LEPINE Jean-philippe 95687 Posted November 19, 2017 at 03:39 PM Posted November 19, 2017 at 03:39 PM Hello, I wrote a Java application which already set P3D frequencies and XPNDR code from an external simulator data. I would like to set transponder mode and ident but it seems I need to send those commands directly to vPilot (they are not implemented in P3D). My add-on already has communication with SimConnect. I saw on vPilot docomeentation plugins sytem, but they only seem to be accessible for C/C#/C++ applications. My question is : is there a way for my application to send those events to vPilot using SimConnect or something else ? Thank you in advance Best regards Jean-phuilippe Link to comment Share on other sites More sharing options...
Ross Carlson Posted November 19, 2017 at 05:06 PM Posted November 19, 2017 at 05:06 PM Transponder mode and ident can be set via either FSUIPC using the Squawkbox offsets, or via SimConnect using the Squawkbox client data area. vPilot reads the Squawkbox client data area via SimConnect in order to set transponder mode and trigger ident. If you use FSUIPC to set the Squawkbox offsets, FSUIPC will automatically copy the values to the Squawkbox client data area, so you can use either method and it will work with vPilot. Let me know if you need details on the byte layout of the FSUIPC offsets or the Squawkbox client data area. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
LEPINE Jean-philippe 95687 Posted November 19, 2017 at 07:11 PM Author Posted November 19, 2017 at 07:11 PM Hi Ross, Thank you very much. My application has access to SimConnect, not to FSUIPC. Unfortunately, I don't know anything about Squawkbox client data area, and how to interract with it though SimConnect commands. If you could detail it for me, and give me a small example, it would be very kind. Thank you very much Best regards Jean-philippe Link to comment Share on other sites More sharing options...
Ross Carlson Posted November 19, 2017 at 09:16 PM Posted November 19, 2017 at 09:16 PM Here's the code that vPilot uses to create the Squawkbox client data area, map data definitions to specific offsets within the data area, and request that SimConnect send events when those values change: private void ConfigureSquawkBoxClientDataAccess() { mSimConnect.MapClientDataNameToID("SquawkBox Data", ClientData.SquawkBox); mSimConnect.CreateClientData(ClientData.SquawkBox, 128, SIMCONNECT_CREATE_CLIENT_DATA_FLAG.DEFAULT); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxRunning, 0, 1, 0.0f, 0); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxConnected, 1, 1, 0.0f, 0); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxTransponderMode, 17, 1, 0.0f, 0); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxTransponderIdent, 19, 1, 0.0f, 0); mSimConnect.RequestClientData(ClientData.SquawkBox, DataRequests.SquawkBoxTransponderMode, DataDefinitions.SquawkBoxTransponderMode, SIMCONNECT_CLIENT_DATA_PERIOD.ON_SET, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0); mSimConnect.RequestClientData(ClientData.SquawkBox, DataRequests.SquawkBoxTransponderIdent, DataDefinitions.SquawkBoxTransponderIdent, SIMCONNECT_CLIENT_DATA_PERIOD.ON_SET, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0); mSimConnect.SetClientData(ClientData.SquawkBox, DataDefinitions.SquawkBoxRunning, SIMCONNECT_CLIENT_DATA_SET_FLAG.DEFAULT, 0, (byte)1); } The last line there shows how vPilot sets the SquawkBoxRunning byte (offset 0) to 1 to indicate that Squawkbox is now running. (Even though it's vPilot, not squawkbox.) I later set the SquawkBoxConnected value (offset 1) to 1 or 0 when the user connects or disconnects to/from the network. Note that your code would not create the client data area ... only the pilot client (vPilot, in this case) should do that. You would do all the above *except* CreateClientData(). To indicate that the user is squawking mode C: mSimConnect.SetClientData(ClientData.SquawkBox, DataDefinitions.SquawkBoxTransponderMode, SIMCONNECT_CLIENT_DATA_SET_FLAG.DEFAULT, 0, (byte)0); (Yes, a value of zero means mode C is on, and a value of 1 means the transponder is in standby.) To indicate that the user is squawking ident: mSimConnect.SetClientData(ClientData.SquawkBox, DataDefinitions.SquawkBoxTransponderIdent, SIMCONNECT_CLIENT_DATA_SET_FLAG.DEFAULT, 0, (byte)1); vPilot will automatically set the ident value back to 0 when it sees it change to a 1. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
LEPINE Jean-philippe 95687 Posted November 19, 2017 at 10:33 PM Author Posted November 19, 2017 at 10:33 PM Great ! Thank you very much Ross. I'll implement ASAP. Cheers ! Jean-philippe Link to comment Share on other sites More sharing options...
LEPINE Jean-philippe 95687 Posted November 20, 2017 at 10:52 AM Author Posted November 20, 2017 at 10:52 AM Hi Ross, I implemented today. I have the mode C / STDBY toggle working perfectly. However, the IDENT doesn't work (I don't get button turning to green in vPilot GUI). My Java SimConnect client uses custom commands, but if it works for MODE, why it shouldn't work for IDENT ? Below is a sample of my code, only to show you I don't do anything different for MODE and IDENT. Do you have an idea ? argSc.mapClientDataNameToID("SquawkBox Data", CLIENT_DATA_SQUAWKBOX); argSc.addToClientDataDefinition(SQUAWKBOX_TRANSPONDER_MODE, 17, 1, 0.0f, 0); argSc.addToClientDataDefinition(SQUAWKBOX_TRANSPONDER_IDENT, 19, 1, 0.0f, 0); /** * Set vPilot transponder mode. * @param argMode 0 = mode C, 1 = STDBY (int32). * @throws IOException */ public static void setXpndrMode(int argMode) throws IOException { byte[] data = {0}; data[0] = (byte)argMode; sc.setClientData(CLIENT_DATA_SQUAWKBOX, SQUAWKBOX_TRANSPONDER_MODE, data); } /** * Toggle vPilot transponder IDENT. * @throws IOException */ public static void toggleXpndrIdent() throws IOException { byte[] data = {0}; data[0] = (byte)1; sc.setClientData(CLIENT_DATA_SQUAWKBOX, SQUAWKBOX_TRANSPONDER_IDENT, data); } Best regards, Jean-philippe Link to comment Share on other sites More sharing options...
Ross Carlson Posted November 20, 2017 at 02:20 PM Posted November 20, 2017 at 02:20 PM Were you connected to the network at the time you tested? vPilot will only squawk ident if you're connected. You must also be squawking mode C for ident to work. In any case, vPilot should be toggling the byte back to zero as soon as it sees it change to a one. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
LEPINE Jean-philippe 95687 Posted November 20, 2017 at 03:30 PM Author Posted November 20, 2017 at 03:30 PM Hello Ross, I ran a new test, connected and on mode C... it is working perfectly. Thank you so much for your kind help. Sorry I am not an active vPilot user, that's why I didn't know I needed to be connected and on C mode to IDENT. I implement this function mostly for other users of my application, I need to take all use cases into account. Thanks again for the great and quick support. Cheers ! Jean-philippe Link to comment Share on other sites More sharing options...
Ross Carlson Posted November 20, 2017 at 05:01 PM Posted November 20, 2017 at 05:01 PM Great, glad you got it working. What application are you referring to? I'm curious about it. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
LEPINE Jean-philippe 95687 Posted November 20, 2017 at 07:57 PM Author Posted November 20, 2017 at 07:57 PM It is a bridge between Aerowinx PSX and P3D. It is not released yet (Beta test phase now). It uses P3D as a scenery generator to display aircraft environment which is missing in PSX (only a very basic scenery is implemented). The position data is updated at 72Hz and sent to P3D. I also send PSX frequencies and transponder data to P3D and vPilot (mode C and IDENT). Best regards, Jean-philippe Link to comment Share on other sites More sharing options...
Ross Carlson Posted November 20, 2017 at 08:44 PM Posted November 20, 2017 at 08:44 PM Ahh, very nice. I've considered using PSX for my sim a few times in the past, but I ended up going with ProSim 737 mainly due to the wide variety of hardware options for the 737. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
LEPINE Jean-philippe 95687 Posted December 16, 2017 at 09:35 AM Author Posted December 16, 2017 at 09:35 AM Hi Ross, I have one more request. I would like to trigger the vPilot PTT function from PSX through SimConnect. I think it should be declared this way (below example for the XPNRD mode) ? mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxTransponderMode, 17, 1, 0.0f, 0); Could you detail for me the AddToClientDataDefinition parameters to be used for the PTT function ? In general, would you have a docomeentation detailing all the offsets used by vPilot in order to avoid asking you for every function ? Best regards, Jean-philippe Link to comment Share on other sites More sharing options...
Ross Carlson Posted December 16, 2017 at 05:27 PM Posted December 16, 2017 at 05:27 PM vPilot does not read the PTT offset. All the ones I use are listed in my earlier post. There is currently no way to control the PTT externally. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
LEPINE Jean-philippe 95687 Posted December 19, 2017 at 03:11 PM Author Posted December 19, 2017 at 03:11 PM Hello, No joy. Anyway thanks for the answer. Best regards, Jean-philippe Link to comment Share on other sites More sharing options...
Jason Winn Posted October 21, 2020 at 06:46 AM Posted October 21, 2020 at 06:46 AM Hi Ross, I'm a novice with the SimConnect API, but am attempting to do essentially what has been done above (I'm working on a hardware transponder and not using any layers like FSUIPC). I'm receiving the dreaded 'exception 3' when I use: simConnect.MapClientDataNameToID("SquawkBox Data", SQUAWKBOX.CLIENT_DATA); simConnect.AddToClientDataDefinition(SQUAWKBOX_CLIENT_DATA.SQUAWKBOX_TRANSPONDER_MODE, 17, 1, 0); as my setup, and send the transponder mode event via: simconnect.SetClientData(SQUAWKBOX.CLIENT_DATA, SQUAWKBOX_CLIENT_DATA.SQUAWKBOX_TRANSPONDER_MODE, 0, (byte)argMode); In my limited understanding, I take this to mean SimConnect is not recognizing the ID I'm passing to it.. are there any checklist items I might've overlooked here in my setup? Appreciate the help in advance! -Jason Link to comment Share on other sites More sharing options...
Ross Carlson Posted October 21, 2020 at 03:24 PM Posted October 21, 2020 at 03:24 PM The method signatures you're using are different than what I have in C#. I doubt that's the problem, but here are mine for comparison: mSimConnect.MapClientDataNameToID("SquawkBox Data", ClientData.SquawkBox); mSimConnect.CreateClientData(ClientData.SquawkBox, 128, SIMCONNECT_CREATE_CLIENT_DATA_FLAG.DEFAULT); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxRunning, 0, 1, 0.0f, 0); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxConnected, 1, 1, 0.0f, 0); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxTransponderMode, 17, 1, 0.0f, 0); mSimConnect.AddToClientDataDefinition(DataDefinitions.SquawkBoxTransponderIdent, 19, 1, 0.0f, 0); mSimConnect.SetClientData(ClientData.SquawkBox, DataDefinitions.SquawkBoxTransponderMode, SIMCONNECT_CLIENT_DATA_SET_FLAG.DEFAULT, 0, (byte)(modeC ? 0 : 1)); Other than that, your code looks right to me. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
Jason Winn Posted October 21, 2020 at 07:45 PM Posted October 21, 2020 at 07:45 PM Wouldn't you believe it.. my SimConnect DLL was an old version. I had too readily dismissed the discrepancies in function signatures. Things are working perfectly now. Sorry for bugging you - and thanks! Link to comment Share on other sites More sharing options...
Ross Carlson Posted October 21, 2020 at 07:52 PM Posted October 21, 2020 at 07:52 PM Excellent ... I'm glad it was an easy fix. Developer: vPilot, VRC, vSTARS, vERAM, VAT-Spy Senior Controller, Boston Virtual ARTCC Link to comment Share on other sites More sharing options...
Recommended Posts