|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Interface Summary | |
|---|---|
| Dispatcher | Base interface for dispatchers. |
| SimConnectConstants | Contains all SimConnect constants not a part of an enumeration |
| Class Summary | |
|---|---|
| Messages | |
| SimConnect | SimConnect main communication class. |
| Version | Contains static reference to simconnect version number |
| Enum Summary | |
|---|---|
| ClientDataPeriod | The ClientDataPeriod enumeration type is used with the SimConnect.requestClientData(int, int, int, int, int)
call to specify how often data is to be sent to the client. |
| ClientDataType | AddToClientDataDefinition SizeOrType |
| DataType | The DataType enumeration type is used with the
SimConnect.addToClientDataDefinition(int, int, int, int)
call to specify the data type that the server should use to return
the specified data to the client. |
| FacilityListType | The FacilityListType enumeration type is used to
determine which type of facilities data is being requested or
returned. |
| NotificationPriority | Notification priorities. |
| SimConnectDataType | The SimConnectDataType enumeration type is used with the
SimConnect.addToClientDataDefinition(int, int, int, int)
call to specify the data type that the server should use to return
the specified data to the client. |
| SimConnectPeriod | The SimConnectPeriod enumeration type is used with the
SimConnect.requestDataOnSimObject(int, int, int, SimConnectPeriod)
call to specify how often data is to be sent to the client. |
| SimObjectType | The SimObjectType enumeration type is used with the
SimConnect.requestDataOnSimObject(int, int, int, SimConnectPeriod, int, int, int, int)
call to request information on specific or nearby objects. |
| TextResult | The TextResult enumeration type is used to specify which
event has occurred as a result of a call to SimConnect.text(int, float, int, String)
or SimConnect.menu(float, int, String, String, String[]). |
| TextType | The TextType enumeration type is used to specify
which type of text is to be displayed by the SimConnect.text(int, float, int, String)
function. |
| WeatherMode | The WeatherMode enumeration type is used to return the
current weather mode, when subscribed to the WeatherModeChanged
Event. |
This package contains main data structures to create and manage a jSimConnect connection. To handle responses and received data from the server, see classes in recv package.
SimConnect.requestResponseTimes(int) function that
does little logic (not implemented in jSimConnect) and the open function
that uses slightly differents arguments, but with the same packet header.
All integers sent, including headers, are in little-endian Intel format. The 16-bytes header consists of 4 integer :
The open packet has a slightly different format. It's format is the following:
| function | packet type ID/ | |
| Open | 0x1 | |
| QueryPerformanceCounter | 0x3 | |
| MapClientEventToSimEvent | 0x4 | |
| TransmitClientEvent | 0x5 | |
| SetSystemEventState | 0x6 | |
| AddClientEventToNotificationGroup | 0x07 | |
| RemoveClientEvent | 0x8 | |
| SetNotificationGroupPriority | 0x9 | |
| ClearNotificationGroup | 0xa | |
| RequestNotificationGroup | 0xb | |
| AddToDataDefinition | 0xc | |
| ClearDataDefinition | 0xd | |
| RequestDataOnSimObject | 0xe | |
| RequestDataOnSimObjectType | 0xf | |
| SetDataOnSimObject | 0x10 | |
| MapInputEventToClientEvent | 0x11 | |
| SetInputGroupPriority | 0x12 | |
| RemoveInputEvent | 0x13 | |
| ClearInputGroup | 0x14 | |
| SetInputGroupState | 0x15 | |
| RequestReservedKey | 0x16 | |
| SubscribeToSystemEvent | 0x17 | |
| UnsubscribeFromSystemEvent | 0x18 | |
| WeatherRequestInterpolatedObservation | 0x19 | |
| WeatherRequestObservationAtStation | 0x1A | |
| WeatherRequestObservationAtNearestStation | 0x1B | |
| WeatherCreateStation | 0x1C | |
| WeatherRemoveStation | 0x1D | |
| WeatherSetObservation | 0x1E | |
| WeatherSetModeServer | 0x1F | |
| WeatherSetModeTheme | 0x20 | |
| WeatherSetModeGlobal | 0x21 | |
| WeatherSetModeCustom | 0x22 | |
| WeatherSetDynamicUpdateRate | 0x23 | |
| WeatherRequestCloudState | 0x24 | |
| WeatherCreateThermal | 0x25 | |
| WeatherRemoveThermal | 0x26 | |
| AICreateParkedATCAircraft | 0x27 | |
| AICreateEnrouteATCAircraft | 0x28 | |
| AICreateNonATCAircraft | 0x29 | |
| AICreateSimulatedObject | 0x2A | |
| AIReleaseControl | 0x2B | |
| AIRemoveObject | 0x2C | |
| AISetAircraftFlightPlan | 0x2D | |
| ExecuteMissionAction | 0x2E | |
| CompleteCustomMissionAction | 0x2F | |
| CameraSetRelative6DOF | 0x30 | |
| MenuAddItem | 0x31 | |
| MenuDeleteItem | 0x32 | |
| MenuAddSubItem | 0x33 | |
| MenuDeleteSubItem | 0x34 | |
| RequestSystemState | 0x35 | |
| SetSystemState | 0x36 | |
| MapClientDataNameToID | 0x37 | |
| CreateClientData | 0x38 | |
| AddToClientDataDefinition | 0x39 | |
| ClearClientDataDefinition | 0x3A | |
| RequestClientData | 0x3B | |
| SetClientData | 0x3C | |
| FlightLoad | 0x3D | |
| FlightSave | 0x3E | |
| FlightPlanLoad | 0x3F | |
| Text | 0x40 | |
| SubscribeToFacilities | 0x41 | |
| UnSubscribeToFacilities | 0x42 | |
| RequestFacilitiesList | 0x43 |
All received packets are sent to the DispatchProc, so their format follow the definition of SIMCONNECT_RECV structure. The header is 12 bytes long and is similar to sent packets:
SimConnect use TCP/IP networking even when the application and FSX are
on the same machine, or in the same process (when client is launched
from DLL.xml). The server can be configured to listen on IPv4 or
IPv6 addresses, but the format of data transferred is the same.
When not port numbers are specified in server config file (SimConnect.XML),
it is chosen randomly (more frequently, unspecified port numbers in MS Windows
are chosen from 1024 and increasing at each request), but no
heuristic will work). If the scope in SimConnect.XML is defined to be local,
then the port number is posted in the registry database
in USER_ROOT\SOFTWARE\Microsoft Games\Flight Simulator\SimConnect_Port_IPv4
(or SimConnect_Port_IPv6 if used)
The SimConnect client library, although very simple, relies on non-portable
programming tricks: casting raw data array to structures, packing of
structures in memory, fixed endianness. These tricks are difficult, or
even impossible, to develop in strict OOP languages.
The managed implementation (C#) of the SimConnect library makes extensive
use of compiler-dependent instructions like explicit marshalling and structure
layout definitions. Such instructions are not available in the Java language.
To use java classes as data definitions, the programmer had to implement
all functions that transforms the content of classes from and to a byte array
(Standard serialization is NOT applicable). A useful API is
ByteBuffer that provides functions to read/write integers and
floating point numbers. Note that a ByteBuffer is big endian by default
ByteBuffer.order(). jSimConnect makes extensive use
of this class.
Another caveat is memory/cpu consumption. In the standard SimConnect implementation,
data from the network is directly casted to a pointer to a structure
of the right type. In jSimConnect, the data is wrapped first into
a temporary ByteBuffer, and then an instance of a subclass of RecvPacket
is constructed. Add endianness transformation, 5-6 method calls for
each field, and overhead of allocating 2 objects for each received packets.
The result is not so awful since a lot of optimization lies in the JVM. I'm
always surprised of the performance of some bloated java code ;-).
However, jSimConnect is reasonnably not intended to run on the same
machine as FSX, because the total overhead of using TCP/IP and complex
wrapping code just to communicate some data between two process.
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||