I found samples in the P3dLearning Centre for Custom Lights and Camera among others.
It would be really helpful if there was an example explaining how to invoke and use the Weather System Service. Could someone share such an example?
Thank you
example using p3d PDK Weather System Service
Re: example using p3d PDK Weather System Service
I tried to access the global Pressure value using the code below
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);
}
And invoking this from a C# project:
[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 receive an error at getPressure():
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Could anyone please guide?
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);
}
And invoking this from a C# project:
[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 receive an error at getPressure():
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Could anyone please guide?