Dear colleagues and Peter,
I want to obtain the full AI Traffic identity strings under the VB (Access-VBA).
I described below function in VB, but I could not obtain the "Final Result String".
I've checked some results in each steps.
(1) No error at Step 1.
(2) I could get the "Time_stamp". (Step2)
(3) No error at Step3.
(4) No error at Step4.
(5) I could escape this loop because time stamp value had been changed in this STEP.
(6) No error at Step5.
Then the result is blank.
In addition, ID_Long was quoted from the "TCAS table ID". The ID was confirmed by the
compareing the ID in the "Traffic Toolbox (FS2004 SDK)".
As the "Command_Type_Long", I substituted a value 1 (=Tail Number).
Thanks,
Regards, Telly
=========
Function AI_Detail_Read(Command_Type_Long As Long, ID_Long As Long)
Dim Result_Str As String
Dim signature As Long
Dim Time_Stamp As Long
Dim Time_Stamp2 As Long
signature = 0
'//////////////////////////////////////////////////////////////////////////
' (1) Write the selected command, from list below, to D004 (32-bit DWORD)
'//////////////////////////////////////////////////////////////////////////
booResult = FSUIPC_Write(&HD004&, 4, VarPtr(Command_Type_Long), dwResult)
booResult = FSUIPC_Process(dwResult)
'///////////////////////////////////////////////////
' (2) Read the timestamp at D008 (32-bit DWORD)
'///////////////////////////////////////////////////
booResult = FSUIPC_Read(&HD008&, 4, VarPtr(Time_Stamp), dwResult)
booResult = FSUIPC_Process(dwResult)
'/////////////////////////////////////////////////////////////////////////////////
' (3) Write the AI id (from the TCAS table, see earlier) to D00C (32-bit DWORD)
'/////////////////////////////////////////////////////////////////////////////////
booResult = FSUIPC_Write(&HD00C&, 4, VarPtr(ID_Long), dwResult)
booResult = FSUIPC_Process(dwResult)
'////////////////////////////////////////////////
' (4) Write a signature to D000 (32-bit DWORD)
'/////////////////////////////////////////////////
booResult = FSUIPC_Write(&HD000&, 4, VarPtr(signature), dwResult)
booResult = FSUIPC_Process(dwResult)
'///////////////////////////////////////////////////
' (5) Wait till the timestamp in D008 changes.
'///////////////////////////////////////////////////
Time_Stamp2 = Time_Stamp
Do Until Time_Stamp <> Time_Stamp2
booResult = FSUIPC_Read(&HD008&, 4, VarPtr(Time_Stamp2), dwResult)
booResult = FSUIPC_Process(dwResult)
Debug.Print "Timestamp2=" & Time_Stamp2 & " " & Now()
Loop
'//////////////////////////////////////////////////////////////////////////////
' (6) Read string result (up to 48 bytes including terminating zero) from D010
'//////////////////////////////////////////////////////////////////////////////
booResult = FSUIPC_Read(&HD010&, 48, VarPtr(Result_Str), dwResult)
booResult = FSUIPC_Process(dwResult)
'/////////////////////////
' Final Result Display
'/////////////////////////
MsgBox "Final Result= " & Result_Str
AI_Detail_Read = Result_Str
End Function
====