Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Diuc38

Members
  • Joined

  • Last visited

  1. Ok, I found my errors .... :rolleyes: It should be : mLogger->Info("Aircraft latitude : %f longitude : %f altitude : %f heading : %f speed : %f",pstruct1->latitude, pstruct1->longitude, pstruct1->altitude, pstruct1->heading, pstruct1->trueAirSpeed); Anyway, thank's a lot for you help Gregg_Seip... Ahhh, you answered when I was writting my post... Thank you
  2. Here it is , all my code: I use for my logging this library : CppLogLib_0_3_1 #include "stdafx.h" #include <iostream> #include <SimConnect\SimConnect.h> #include "CppLogLib_0_3_1\LogFile\Log.h" using namespace std; // Logger LogFile_t mLogger; // Inner int SimStartCounter; // Menu // Données à recueiller struct Struct1 { double altitude; double altitudeAboveGround; double latitude; double longitude; double heading; double trueAirSpeed; }; // Simconnect datas HANDLE hSimConnect; enum EVENT_ID { MAIN_MENU = 1, SIM_START } ; enum REQUEST_ID { SHOW_WINDOW, } ; enum DATA_DEFINE_ID { DEFINITION_1 } ; enum DATA_REQUEST_ID { REQUEST_1 } ; void SetupStructDefinitions() { SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Altitude","feet"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Alt Above Ground","feet"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Latitude","degrees"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Longitude","degrees"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Heading Degrees Magnetic","radians", SIMCONNECT_DATATYPE::SIMCONNECT_DATATYPE_FLOAT64, 0.0f, SIMCONNECT_UNUSED); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Airspeed True","knots"); } void onRecvOpen(SIMCONNECT_RECV_OPEN *pOpen) { mLogger->Info("OnRecvOpen : create menu entry..."); SimConnect_MenuAddItem(hSimConnect, "Live Tiles",MAIN_MENU,0); } void onRecvEvent(SIMCONNECT_RECV_EVENT *pEvent) { switch(pEvent->uEventID) { case MAIN_MENU : { mLogger->Info("OnRecvEvent : MAIN_MENU..."); break; } case SIM_START: { mLogger->Info("OnRecvEvent : SIM_START... [#%d]",SimStartCounter); if (SimStartCounter > 0) SimConnect_RequestDataOnSimObject(hSimConnect,REQUEST_1,DEFINITION_1,SIMCONNECT_OBJECT_ID_USER,SIMCONNECT_PERIOD_SECOND,0,0,5,0); SimStartCounter++; break; } } } void onRecvSimObjectData(SIMCONNECT_RECV_SIMOBJECT_DATA *pObjData) { switch (pObjData->dwRequestID) { case REQUEST_1: { Struct1 * pstruct1 = (Struct1*) &pObjData->dwData; mLogger->Info("Aircraft latitude : %f longitude : %f altitude : %f heading : %d speed : %d",pstruct1->latitude, pstruct1->longitude, pstruct1->altitude, pstruct1->heading, pstruct1->trueAirSpeed); break; } } } void CALLBACK DispatchProcedure(SIMCONNECT_RECV *pData, DWORD chData,void *pContext) { switch(pData->dwID) { case SIMCONNECT_RECV_ID_OPEN: { mLogger->Info("DispatchProcadure call : SIMCONNECT_RECV_ID_OPEN..."); onRecvOpen((SIMCONNECT_RECV_OPEN *) pData); break; } case SIMCONNECT_RECV_ID_EVENT: { mLogger->Info("DispatchProcadure call : SIMCONNECT_RECV_ID_EVENT..."); onRecvEvent((SIMCONNECT_RECV_EVENT *) pData); break; } case SIMCONNECT_RECV_ID_SIMOBJECT_DATA: { mLogger->Info("DispatchProcadure call : SIMCONNECT_RECV_ID_SIMOBJECTDATA..."); onRecvSimObjectData((SIMCONNECT_RECV_SIMOBJECT_DATA *) pData); break; } } } void __stdcall DLLStart(void) { SimStartCounter = 0; // BOOST_LOG_TRIVIAL(info) << "DLLStart"; const string LogName = "f:\\LiveTiles.log"; Logger::Init(LogName.c_str(), true, false); // this file (no path included) gets created in the current working directory. mLogger = Logger::GetLog(); // get the pointer through which logging takes place. if ( mLogger.get() == NULL || mLogger->IsProblem() ) // one can check for error conditions in the logger. { if ( mLogger.get() == NULL ) cout << "\n" << "Failed to initialize (open/create) the log file, " << LogName << endl; else cout << "\n" << mLogger->GetErrorMessage() << endl; } else { mLogger->Info("Log file, \"%s\", has been opened.", "LiveTiles.log"); mLogger->Info("DLLstart..."); } if (SUCCEEDED(SimConnect_Open(&hSimConnect,"LiveTiles_DLL",NULL,0,NULL,SIMCONNECT_OPEN_CONFIGINDEX_LOCAL))) { SetupStructDefinitions(); SimConnect_SubscribeToSystemEvent(hSimConnect, SIM_START, "SimStart"); SimConnect_CallDispatch(hSimConnect,DispatchProcedure,NULL); } } void __stdcall DLLStop(void) { // BOOST_LOG_TRIVIAL(info) << "DLLStop"; mLogger->Info("DLLStop..."); SimConnect_Close(hSimConnect); } Still looking for the problem...
  3. For funny values, this is what I've got : Even if I convert from rad to deg or deg to rad the heading value, I still have wrong heading ... When I run FSX, I'm using a low speed aircraft...
  4. Hello, I'm trying to read theses variables : - AIRSPEED TRUE and PLANE HEADING DEGREES TRUE. So , to do this I wrote this king of code : struct Struct1 { double altitude; double altitudeAboveGround; double latitude; double longitude; double heading; double trueAirSpeed; }; and SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Altitude","feet"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Alt Above Ground","feet"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Latitude","degrees"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Longitude","degrees"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Plane Heading Degrees Magnetic","radians"); SimConnect_AddToDataDefinition(hSimConnect,DEFINITION_1,"Airspeed True","knots"); like the RequestData sample from SimConnect SDK. When I run FSX, Altitude, Latitude and Longitude datas are correct, but heading and speed give me some funny values. Are my definitions wrong ? Or do I need to convert the heading and speed values ? Thank you for help... Davy

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.