Бывают типы сообщений от приемника: AIR, ID, MSG
все имеющиеся типы сообщений SBS-1 можно посмотреть здесь http://adsbradar.ru/tekhnologiya/ascii-format-dannykh-sbs-dlya-ads-b
Расшифровка переменных в коде ниже:
Процедура ServerSend2All(stroka) - посылает сформированную строку по TCP IP:30003,
эту строку и нужно принять и декодировать потом уже в программном комплексе.
procedure ServerSendAir(nr:integer);
var stroka:string[255];
begin
DecimalSeparator:='.';
stroka:='AIR,0,0,'+inttostr(nr)+','+inttohex(planes[nr].AA,6)+','+inttostr(nr)+',' + ServerDateTimetostr(now)+',' + ServerDateTimetostr(now);
ServerSend2All(stroka);
end; //ServerSendAir
procedure ServerSendId(nr:integer);
var stroka:string[255];
begin
DecimalSeparator:='.';
stroka:='ID,0,0,'+inttostr(nr)+','+inttohex(planes[nr].AA,6)+','+inttostr(nr)+',' + ServerDateTimetostr(now)+',' + ServerDateTimetostr(now) + ',' + planes[nr].ident;
ServerSend2All(stroka);
end; //ServerSendId
procedure ServerSendMSG(nr:integer; Transtyp:integer);
var stroka:string[255];
ttyp:Integer;
begin
DecimalSeparator:='.';
// Transtyp - Тип сообщения, от которого зависит формат выходных данных
//1 = ID Message (1090ES DF17 or ELS DAP)
//2 = Surface Position Message (1090ES DF17)
//3 = Airborne Position Message (1090ES DF17)
//4 = Airborne Velocity Message (1090ES DF17)
//5 = Surveillance Altitude Message (DF4, DF20)
//6 = Surveillance ID (Squawk) Message (DF5, DF21)
//8 = All-Call Reply/TCAS Acquisition Squitter (DF11)
//1 IDMessage: Callsign
//2 Surface Position Message: Altitude, GroundSpeed, Track, Lat, Long ; ist track = heading ?
//3 Airborne Position Message: Altitude, Lat, Long, Alert, Emergency, SPI
//4 Airborne Velocity Message: GroundSpeed, Track, VerticalRate
//5 Surveillance Altitude Message: Altitude, Alert, SPI
//6 Surveillance ID (Squawk) Message: Altitude, Squawk, Alert, Emergency, SPI
//7 All-Call Reply: None at the moment
stroka:='MSG,'+inttostr(ttyp)+',0,'+inttostr(nr)+','+inttohex(planes[nr].AA,6)+','+inttostr(nr)+',';
stroka:=stroka + ServerDateTimetostr(now)+','; // 9 dt generated
stroka:=stroka + ServerDateTimetostr(now); // 10 dt logged
stroka:=stroka + ',';
if Transtyp=1 then stroka:=stroka + planes[nr].ident; //Field 11: Callsign
stroka:=stroka + ',';
if Transtyp in [2,3,5,6] then stroka:=stroka + inttostr(planes[nr].altitude); //Field 12: Altitude
stroka:=stroka + ',';
if Transtyp in [2,4] then stroka:=stroka + inttostr(round(planes[nr].speed)); //Field 13: GroundSpeed knoten
stroka:=stroka + ',';
//Угол курса по алгоритму inttostr(round(planes[nr].heading/rad)) заходил в отрицательное значение
//изменено
if Transtyp in [2,4] then stroka:=stroka + inttostr(round(planes[nr].heading/rad +360) mod 360); //Field 14: Track (ist das heading ??)
stroka:=stroka + ',';
if Transtyp in [2,3] then stroka:=stroka + floattostrF(planes[nr].latitude, ffFixed, 7, 4);//Field 15: Lat
stroka:=stroka + ',';
if Transtyp in [2,3] then stroka:=stroka + floattostrF(planes[nr].longitude, ffFixed, 7, 4);//Field 16: Long
stroka:=stroka + ',';
if Transtyp in [4] then stroka:=stroka + inttostr(planes[nr].steigen); //Field 17: VerticalRate ft/min
stroka:=stroka + ',';
if Transtyp in [6] then //mod3id: word = 12 bit wert
stroka:=stroka + inttookt(planes[nr].mod3id,3); //Field 18: Squawk oktal
stroka:=stroka + ',';
stroka:=stroka + '0';//Field 19: Alert
stroka:=stroka + ',';
stroka:=stroka + '0';//Field 20: Emergency
stroka:=stroka + ',';
stroka:=stroka + '0';//Field 21: SPI
stroka:=stroka + ',';
stroka:=stroka + '0';//Field 22: IsOnGround
ServerSend2All(stroka);
end; //ServerSendMSG
САМА процедура отправки в порт
procedure TfrmMain.ServerSend2All(nachricht:string);
var i : integer;
begin
nachricht := nachricht+chr($0d)+chr($0a); //<CR><LF>
if ServerSocket.Active then
begin
{Weiter an alle Teilnehmer}
with ServerSocket.Socket do begin
for i := 0 to ActiveConnections-1 do
Connections[I].SendText (Nachricht);
end; {with}
end;
end; //ServerSend2All