function [waas] = parseNSTBwaas(fid);
%---------------------------------------------------------
% parse NSTB message type 5 (GEO/WAAS message)
% Ju-Yong Do,  Jan 14, 2009
%---------------------------------------------------------
% input  : NSTB file indicator
% output : WAAS message in "waas"
%=========================================================
%=========================================================
global rx option

%read header
receiverId  = fread(fid, 1, 'uint16');
gpsweek     = fread(fid, 1, 'uint16');      %time of validity
waas.tow    = fread(fid, 1, 'uint32')*1e-3; %time of validity in time of week (ms->sec)
waas.nummsg = fread(fid, 1, '*uint8');      %number of messages

%=========================================================
%read WAAS message
for i=1:waas.nummsg
    waas.prn(i) = fread(fid, 1, '*uint8');      %prn number
    waas.msg(i,:)= fread(fid, 32, '*uint8');    %waas message
end

%stack up what's collected
rx.aiding.waas     = [rx.aiding.waas waas];

%=========================================================
% CRC test for sanity check
crcTestNSTB(fid, 10, 33*double(waas.nummsg), 2); %(fid,headLen,bodyLen,tailLen)

if option.plot, 
    disp('=======MESSAGE 5 GEO/WAAS====================================');
    disp(['tow= ',num2str(waas.tow),' sec, prn= ',num2str(waas.prn),', ', num2str(waas.nummsg),' messages']); 
end


return
%=========================================================
%=========================================================
