#!/usr/bin/octave-cli
## Paul Walko
## Finds packets in a binary data file

## Includes
pkg load signal;

## Global vars
#############################################
global proto_vars = -1;  # struct
global raw_data   = -1;  # array

#############################################
function loadFile(fileName, count)
	global preamble_proto;
	global raw_data;
	source "createPrototype.m"
	proto_vars = struct("preamble_proto", preamble_proto, "freq_sep", freq_sep, "samps_per_symb", samps_per_symb, "symb_span", symb_span, "gauss_taps", gauss_taps, "samp_rate", samp_rate, "symb_rate", symb_rate, "time_bw_prod", time_bw_prod);

	raw_data = read_complex_binary(fileName, count);
endfunction

function main(fileName = "channel37_3.dat")
	arg_list = argv();
	if length(arg_list) > 0
		fileName = arg_list{1};
	endif
	loadFile(fileName);

endfunction

main();
