Jump to content

get weather data from pdk api


Mer

Recommended Posts

https://www.prepar3d.com/SDKv4/sdk/pdk_api/service_providers/group__weatherservice.htm

 

I need to access the functions made available by the above service through a C# console application

 

I tried using C++ code and making the dll aviailable in C#. My codes:

C++

extern "C" __declspec(dllexport) void __stdcall getPressure()
{
    printf("Reading global pressure :  ");
    CComPtr<IWeatherSystemV430> weatherSystem = PdkServices::GetWeatherSystem();
    printf("weather system ");
     float pressure = weatherSystem->GetGlobalBaroPressure();
    printf("%f", pressure);
}

 

 

C#


        [DllImport("CameraPDK.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern float getPressure();

         
        static void Main(string[] args)
        {
            Console.WriteLine("The global pressure is {0}",getPressure());

        }

 

But i get a system.accessviolation when the execution reaches GetGlobalPressure() function

 

Could anyone guide me on the right way to do it?

 

Thank you

 

Link to comment
https://forum.aerosoft.com/index.php?/topic/139323-get-weather-data-from-pdk-api/
Share on other sites

  • Deputy Sheriffs

I guess it would be better to ask this question in the Prepar3D developer forum:
https://www.prepar3d.com/forum/viewforum.php?f=54658&amp;sid=547a40256a09085215e808d02bb3f892

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy & Terms of Use