#include "network.h"
#include "DataPacker.h"
#include <vector>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <cstdlib>


// TEST DATA
// lds_id	line 	drop sch lineinfo	system_key	sch_seq glo_seq		count	freeway	Dir	ca_pm	lds_name		
// 1203103	50	13	13	13	1123005873	24148	1357650		19	55	S	6.88	MACARTHU1 
FEP_LINE_LDS * load_lines(int *size, const char * fName)
{
	FEP_LINE_LDS *lines = (FEP_LINE_LDS *) calloc(sizeof(FEP_LINE_LDS), 1);
	*size = 1;
	lines[0].lineNum = 50;
	lines[0].lds.push_back(1203103);
	lines[0].ldsIndex.push_back(0);
	lines[0].ldsNum = 1;
	lines[0].count = 19;
	lines[0].schedule = 13;
	lines[0].globalSeq = 1357650;
	lines[0].schedleSeq = 24148;
	return lines;	
}

// TEST DATA
//FWY	Dir     POSTMI	LDS_ID	VDS_ID	LOOP_ID LOC    LANE LOOP_LOC      	PARAMICS_NAME  PARAMICS_LANE    
//55	S	6.88	1203103	1203104	1203105	QU	1	QUEUE      	55s6.88ora   	0

//55	S	6.88	1203103	1203104	1203106	DM	2	DEMAND     	55s6.88ora   	0

//55	S	6.88	1203103	1203104	1203107	PA	3	PASSAGE    	55s6.88ora   	0

//55	S	6.88	1203103	1203108	1203109	HV	1	SD_1       	?            	0

//55	S	6.88	1203103	1203110	1203111	ML	1	ML_1       	55s6.88ml    	4

//55	S	6.88	1203103	1203110	1203112	ML	2	ML_2       	55s6.88ml    	3

//55	S	6.88	1203103	1203110	1203113	ML	3	ML_3       	55s6.88ml    	2

//55	S	6.88	1203103	1203110	1203114	ML	4	ML_4       	55s6.88ml    	1
STATION * load_lds(const char * fName)
{
	/* Read loop meta data */
	STATION *lds_map = (STATION *) calloc(sizeof(STATION), 1);
	lds_map[0].lds = 1203103;
	lds_map[0].line_num = 50;
	lds_map[0].drop = 13;
	lds_map[0].num = 1;

   LOOP *loop = new LOOP;
   loop->loopID = 1203113;
   loop->loop_loc = "ML_3";
   loop->vol = 40;
   loop->occ = 10;
   loop->spd = 10;
   
   lds_map[0].loops.push_back(loop);
   
	// Init Loop dataPack
	lds_map[0].length = lds_map[0].num * 2 + CONTROL_DATA_LEN;

   lds_map[0].dataPack = DataPacker::packData(&lds_map[0]);

	lds_map[0].pos = 0;

	lds_map[0].MlTotVol = 150;
	lds_map[0].OppTotVol = 150;

	return lds_map;
}
