function [iono] = parseNSTBiono(fid);
%---------------------------------------------------------
% parse NSTB message type 30 (iono)
% Ju-Yong Do,  Jan 22, 2009
%---------------------------------------------------------
% input  : NSTB file indicator
% output : Klobuchar message in "iono"
%=========================================================
%=========================================================
global rx option

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

%=========================================================
%read iono message
iono.rxtow   = fread(fid, 1, 'uint32')*1e-3;        %received time of msg (sec)
iono.alpha0  = fread(fid, 1, 'uint8')*2^-30;        %alpha0, amplitude coefficient (sec)
iono.alpha1  = fread(fid, 1, 'uint8')*2^-27/pi;     %alpha1, amplitude coefficient (sec/rad)
iono.alpha2  = fread(fid, 1, 'uint8')*2^-24/pi^2;   %alpha2, amplitude coefficient (sec/rad^2)
iono.alpha3  = fread(fid, 1, 'uint8')*2^-24/pi^3;   %alpha3, amplitude coefficient (sec/rad^3)
iono.beta0   = fread(fid, 1, 'uint8')*2^11;         %beta0, period coefficient (sec)
iono.beta1   = fread(fid, 1, 'uint8')*2^14/pi;      %beta1, period coefficient (sec/rad)
iono.beta2   = fread(fid, 1, 'uint8')*2^16/pi^2;    %beta2, period coefficient (sec/rad^2)
iono.beta3   = fread(fid, 1, 'uint8')*2^16/pi^3;    %beta3, period coefficient (sec/rad^3)

%stack up what's collected
rx.aiding.iono       = [rx.aiding.iono iono];
    
%=========================================================
% CRC test for sanity check
crcTestNSTB(fid, 9, 12, 2); %(fid,headLen,bodyLen,tailLen)

if option.plot,         
    disp('=======MESSAGE 30 IONOSPHERE=================================');
    disp(['tow= ',num2str(iono.tow),' sec']); 
end

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