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
Share on other sites

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