function [issupporeted] = readFileInfoNSTB(filename);
%---------------------------------------------------------
% read file information from NSTB file name
% Ju-Yong Do,  Jan 15, 2009
%---------------------------------------------------------
% input  : NSTB file name
% output : file information
%=========================================================
%=========================================================
global rx option SEC_PER_DAY

%read recevier info from NSTB filename
delimiter       = find(filename=='_');
issupporeted    = 1;
if length(delimiter)==4,        
    info.sitename   = filename(1:delimiter(1)-1);                       %site name
    info.type       = filename(delimiter(1)+1:delimiter(2)-1);          %receiver type
    info.id         = hex2dec(filename(delimiter(2)+1:delimiter(3)-1)); %receiver identification number
    info.gpswk      = str2num(filename(delimiter(3)+1:delimiter(4)-1)); %gps week number
    info.dow        = str2num(filename(delimiter(4)+1:end));            %day of week
elseif length(delimiter)==3,
    info.sitename   = filename(1:delimiter(1)-1);                       %site name    
    info.type       = '';                                               %receiver type
    info.id         = hex2dec(filename(delimiter(1)+1:delimiter(2)-1)); %receiver identification number
    info.gpswk      = str2num(filename(delimiter(2)+1:delimiter(3)-1)); %gps week number
    info.dow        = str2num(filename(delimiter(3)+1:end));            %day of week
else
    disp([filename,' is in an unrecognized file format.']);
    issupporeted    = 0;
    return;
end
    
info.starttow   = info.dow*SEC_PER_DAY;         %start time of reception in time of week (second)
info.endtow     = info.starttow+SEC_PER_DAY-1;  %end time of reception in time of week (second)
% info.initpos    = getTruePosNSTB(info);       %initial position of receiver in XYZ (meter)
rx.info         = info;                         %return parsed file information

%=========================================================
%setup parsing time based on file and user input
option.starttow = mod(option.starttow,SEC_PER_DAY) + info.dow*SEC_PER_DAY;  %convert tod to tow
option.endtow   = mod(option.endtow,SEC_PER_DAY) + info.dow*SEC_PER_DAY;    %convert tod to tow
option.starttow = max(option.starttow, info.starttow);  %use later b.t. user tow and file tow
option.endtow   = min(option.endtow, info.endtow);      %use earlier b.t. user tow and file tow

%make a copy of filename printing friendly
option.fname4plot = filename; 
option.fname4plot(find(filename=='_'))=' ';

%display file information
disp('=============================================================');
disp(['  sitename: ',info.sitename]);
disp(['   rx type: ',info.type]);
disp(['     rx id: ',num2str(info.id)]);
disp(['     gpswk: ',num2str(info.gpswk)]);
disp([' day of wk: ',num2str(info.dow)]);
disp([' start tow: ',num2str(option.starttow)]);
disp(['   end tow: ',num2str(option.endtow)]);
disp('=============================================================');
%=========================================================
%=========================================================