/** * Request SimObject data from a class. The class must be registered before using this method (see * {@link #registerClass(Class)}). See {@link SimConnect#requestDataOnSimObject(Enum, Enum, int, * SimConnectPeriod)} for more informations on this simconnect request. * * @param cl class to use. must be registered * @param objectId object ID, or {@link SimConnectConstants#OBJECT_ID_USER} for user aircraft * @param requestId forced request id * @param period period, see {@link SimConnectPeriod} * @param onlyWhenChanged set to true if you want to receive data only if it was changed * @return ID of request (here <code>requestId</code>) * @throws IOException simconnect error * @throws IllegalDataDefinition if this class was not registered */ public int requestSimObjectData( Class<?> cl, int requestId, int objectId, SimConnectPeriod period, boolean onlyWhenChanged) throws IOException, IllegalDataDefinition { if (!definitionIds.containsKey(cl)) throw new IllegalDataDefinition("Class not defined. call registerClass() first"); int defId = ((Integer) definitionIds.get(cl)).intValue(); int flags = onlyWhenChanged ? SimConnectConstants.DATA_REQUEST_FLAG_CHANGED : SimConnectConstants.DATA_REQUEST_FLAG_DEFAULT; simConnect.requestDataOnSimObject(requestId, defId, objectId, period, flags, 0, 0, 0); return requestId; }