FSUIPCClient.dll 3.0.6156.10
I'm struggling with the function 'UpdateExtendedPlaneIndentifiers()'. From the description (which is still version 2.0) I know that this might be a time consuming function, therefore it runs in a background thread to not block the UI-thread. The reference to the AITrafficServices is provided via the ParameterizedThreadStart.
The troubles that I'm faced with are that every now and then the extended identifier values are returned quite messy (e.g. for 'Type' I'm getting the tail number, or for the 'Model' I'm getting 'n/a'). The 'normal' values which are updated using the function RefreshAITrafficInformation() are all correct.
Both function calls, UpdateExtendedPlaneIndentifiers() and RefreshAITrafficInformation() are called in a loop which is executed once per second. Maybe there is a required sequence when calling these functions? Maybe the function UpdateExtendedPlaneIndentifiers() should only be called once? Is there any code snippet around which can be used for tests?
Here's the code:
private void AiTrafficThread(object obj)
{
var trafficServices = (AITrafficServices)obj;
while (true)
{
Thread.Sleep(1000);
if (stopAiTraffic) // set from 'outside' to regularly stop this thread
break;
if (isPaused) // if simulator is paused ...
continue;
trafficServices.RefreshAITrafficInformation();
trafficServices.UpdateExtendedPlaneIndentifiers(true, true, true, false);
// 'canProcessAi' is an AutoResetEvent object which allows to securely access
// the 'aiList' object from another thread
if (!canProcessAi.WaitOne(1000, false)) continue;
aiList.Clear();
foreach (var plane in trafficServices.AirbourneTraffic)
aiList.AddItem(CreateAiAircraftData(plane, true));
foreach (var plane in trafficServices.GroundTraffic)
aiList.AddItem(CreateAiAircraftData(plane, false));
canProcessAi.Set();
}
}
Thanks for any help.
Regards,
Urs