[OZAPRS] Packet disassembly help needed
Merv Joyce
mjoyce at bigpond.net.au
Sun Nov 21 14:54:46 EST 2004
Andrew,
The followingg routine is in Delphi (pascal) ... It should translate
pretty easily.
"TS" is an object for the "station" that owns this data. Parameter "S"
is everything
After the timestamp "HHMMSSz" . String "S" is 1-based array in pascal
(not 0-based).
Its not perfect, but its a start ..........
------------------------------------------------------------------------
--------------------------------- procedure GetCompPosit(s: string;
var N,E: LongInt);
var
nr,er: real;
b: integer;
function power(base,ex: real): real;
begin
if (Abs(Base)<0.000001)
then begin
Power := 0;
Exit;
end;
power := exp(ex*ln(abs(base)));
end;
begin
N := -1; E := -1;
if not (length(s)=13) then exit;
Try
TS.Symbol_Table := s[ 1];;
TS.Symbol_Index := s[10];
(* extract latitude *)
lat := 90.0 -
(((ord(s[2])-33)*91.0*91.0*91.0) +
((ord(s[3])-33)*91.0*91.0) +
((ord(s[4])-33)*91.0) +
((ord(s[5])-33)))/380926.0;
(* extract longitude *)
long := - 180.0 +
(((ord(s[6])-33)*91.0*91.0*91.0) +
((ord(s[7])-33)*91.0*91.0) +
((ord(s[8])-33)*91.0) +
((ord(s[9])-33)))/190463.0;
(* now calculate northing and easting *)
Calc_LL2NE(lat,long,map,nr,er);
N := round(nr);
E := round(er);
if not (s[11]=' ')
then begin
(* course/speed *)
b := ord(s[11])-33;
if b in [0..89]
then begin
TS.course := 4 * b;
TS.speed := 1.852 *
(power(1.08,(ord(S[12])-33))-1);
end
else begin
TS.course := 0.0;
TS.speed := 0.0;
end;
(* radio range *)
if s[11]='{'
then begin
(* range := 2 * power(1.08,(ord(S[12])-33)); *)
end;
(* and we ignore the decoding of the last char (c[13]) -
the T-byte *)
end;
TS.posit_when := w;
TS.posit_path := TS.path;
TS.posit_msg := TS.msg;
Except
on E: Exception do Application.MessageBox(PChar(E.Message),
'Exception Trap
during "APRS_Server:GetCompPosit"',
MB_OKCANCEL);
end;
end;
------------------------------------------------------------------------
---------------------------------
Merv Joyce (VK4ZE)
-----Original Message-----
From: ozaprs-bounces at marconi.ics.mq.edu.au
[mailto:ozaprs-bounces at marconi.ics.mq.edu.au] On Behalf Of vk4tec
Sent: Sunday, 21 November 2004 11:25
To: ozaprs
Subject: [OZAPRS] Packet disassembly help needed
Hi,
Does anyone have some perl code I can use to uncompress
VK4YBN>APRS,VK4RAI-3*,VK4GME-3*,WIDE:
@210039z/\G;Xt{68>+GzBob VK4YBN, 2004 Summer Challenge {UIV23N}
@ (Compressed with timestamp)
210039z (HHMMSSz)
/ (sym table)
\G;X (YYYY)
t{68 (XXXX)
> (symbol)
+Gz (csT)
Bob VK4YBN, 2004 Summer Challenge {UIV23N} (comment)
I need to be able to return the ascii value of a number as well.
and do powers of 91 calculations
Cheers Andy VK4TEC
_______________________________________________
ozaprs mailing list
ozaprs at marconi.ics.mq.edu.au
http://marconi.ics.mq.edu.au/cgi-bin/mailman/listinfo/ozaprs
_______________________________________________
ozaprs mailing list
ozaprs at marconi.ics.mq.edu.au
http://marconi.ics.mq.edu.au/cgi-bin/mailman/listinfo/ozaprs
More information about the Ozaprs
mailing list