diff --git a/iPDC/Makefile b/iPDC/Makefile index 5992cd9..bcd0144 100755 --- a/iPDC/Makefile +++ b/iPDC/Makefile @@ -49,31 +49,30 @@ LIBS = -lpthread LDLIBS=`pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0` CFLAGS=-g -I./inc -fcommon `pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0` -OBJECTS = ipdc.c recreate.o connections.o new_pmu_or_pdc.o parser.o dallocate.o align_sort.o ipdcGui.o attack_detection.o data_vis.o utility_tools.o Attack_detect.o - -CLEAN_OBJECTS = recreate.o connections.o new_pmu_or_pdc.o parser.o dallocate.o align_sort.o ipdcGui.o ~iPDC.xml - PROGRAM = iPDC +SOURCE_FILES = $(wildcard src/*.c) +OBJECT_FILES = $(patsubst src/%.c, bin/%.o, $(SOURCE_FILES)) +CLEAN_OBJECTS = $(wildcard bin/*.o) $(PROGRAM) -COMPILE = $(CC) +all: $(PROGRAM) -$(PROGRAM): $(OBJECTS) - $(CC) $(OBJECTS) $(LDLIBS) $(LIBS) -o $@ +$(PROGRAM): $(OBJECT_FILES) + $(CC) $(CFLAGS) $(OBJECT_FILES) -o $(PROGRAM) $(LDLIBS) + +bin/%.o: src/%.c + $(CC) $(CFLAGS) -c $< -o $@ -%.o: %.c - $(COMPILE) $(CFLAGS) -c $< install: $(PROGRAM) - gtk-builder-convert iPDC.glade iPDC.xml + gtk-builder-convert assets/iPDC.glade assets/iPDC.xml mkdir -p $(CREATE_DIR)iPDC/$ - cp -f $(FILE1) $(CREATE_DIR)iPDC/$(FILE1) - cp -f images/$(FILE2) $(CREATE_DIR)iPDC/$(FILE2) - cp -f images/$(FILE3) $(CREATE_DIR)iPDC/$(FILE3) - cp -f images/$(FILE4) $(CREATE_DIR)iPDC/$(FILE4) - cp -f images/$(FILE5) $(CREATE_DIR)iPDC/$(FILE5) - cp -f images/$(FILE6) $(DESKTOP_DIR)/$(FILE6) + cp -f assets/$(FILE1) $(CREATE_DIR)iPDC/$(FILE1) + cp -f assets/$(FILE2) $(CREATE_DIR)iPDC/$(FILE2) + cp -f assets/$(FILE3) $(CREATE_DIR)iPDC/$(FILE3) + cp -f assets/$(FILE4) $(CREATE_DIR)iPDC/$(FILE4) + cp -f assets/$(FILE5) $(CREATE_DIR)iPDC/$(FILE5) + cp -f assets/$(FILE6) $(DESKTOP_DIR)/$(FILE6) cp $(PROGRAM) $(INSTALL_PREFIX)bin/$(PROGRAM) -# rm -f $(CLEAN_OBJECTS) $(PROGRAM) uninstall: rm -f $(INSTALL_PREFIX)bin/$(PROGRAM) diff --git a/iPDC/bin/.iPDC_bin b/iPDC/bin/.iPDC_bin new file mode 100644 index 0000000..e69de29 diff --git a/iPDC/inc/map_vis.h b/iPDC/inc/map_vis.h index e69de29..a2c3d2a 100644 --- a/iPDC/inc/map_vis.h +++ b/iPDC/inc/map_vis.h @@ -0,0 +1,10 @@ +#include +#include +typedef struct{ + OsmGpsMap *util_map; + GdkPixbuf *g_red_image; + GdkPixbuf *g_green_image; + OsmGpsMapImage *g_last_image; +} myParameters; + +gboolean update_images(gpointer* pars); \ No newline at end of file diff --git a/iPDC/src/ipdc.c b/iPDC/src/ipdc.c index 76ee30d..9a058e6 100755 --- a/iPDC/src/ipdc.c +++ b/iPDC/src/ipdc.c @@ -50,7 +50,7 @@ #include "utility_tools.h" /* Common fixed path for storage of few common files */ -#define UI_fILE "../assets/iPDC.ui" +#define UI_fILE "./assets/iPDC.ui" //#define UI_fILE "/usr/local/share/iPDC/iPDC.xml" diff --git a/iPDC/src/map_vis.c b/iPDC/src/map_vis.c index db5ebab..b9064b4 100644 --- a/iPDC/src/map_vis.c +++ b/iPDC/src/map_vis.c @@ -5,12 +5,6 @@ #include "osm-gps-map.h" #include "Attack_detect.h" -typedef struct{ - OsmGpsMap *util_map; - GdkPixbuf *g_red_image; - GdkPixbuf *g_green_image; - OsmGpsMapImage *g_last_image; -} myParameters; gboolean update_images(gpointer* pars){ myParameters* parameters = (myParameters*) pars; @@ -42,7 +36,7 @@ gboolean update_images(gpointer* pars){ if (green){ parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image); }else{ - parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image); + parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_red_image); } } diff --git a/iPDC/src/utility_tools.c b/iPDC/src/utility_tools.c index e80b16e..51efac9 100644 --- a/iPDC/src/utility_tools.c +++ b/iPDC/src/utility_tools.c @@ -1,10 +1,12 @@ #include -#include "utility_tools.h" #include "align_sort.h" #include "parser.h" -#include "Attack_detect.h" +#include "osm-gps-map.h" +#include "map_vis.h" -#define UI_fILE "../assets/utility_tools.ui" +#define UI_fILE "./assets/utility_tools.ui" +#define RED_IMAGE "./assets/red.png" +#define GREEN_IMAGE "./assets/green.png" @@ -15,51 +17,6 @@ // osm_gps_map_image_add(map, lat, lon, image); // } -typedef struct{ - OsmGpsMap *util_map; - GdkPixbuf *g_red_image; - GdkPixbuf *g_green_image; - OsmGpsMapImage *g_last_image; -} myParameters; - -gboolean update_images(gpointer* pars){ - myParameters* parameters = (myParameters*) pars; - struct data_frame *df = TSB[0].first_data_frame; - if(parameters->g_green_image == NULL){ - return FALSE; - } - if (parameters->util_map == NULL){ - return FALSE; - } - if (df == NULL){ - return FALSE; - } - int freq = to_intconvertor(df->dpmu[0]->freq); - gboolean green =attack_detect(df,&START,&COUNT,&SUM_OF_FREQUENCY); - if(parameters->util_map != NULL){ - - // if(parameters->g_last_image != 0){ - // osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image); - // } - // if (freq > 300){ - // parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image); - // }else{ - // parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image); - // } - if(parameters->g_last_image != 0){ - osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image); - } - if (green){ - parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image); - }else{ - parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_red_image); - } - - } - gtk_widget_queue_draw(GTK_WIDGET(parameters->util_map)); - return TRUE; -} - void utility_tools(GtkButton *but, gpointer udata) { OsmGpsMap *util_map; @@ -76,8 +33,8 @@ void utility_tools(GtkButton *but, gpointer udata) g_warning("%s", error->message); g_free(error); } - g_red_image = gdk_pixbuf_new_from_file_at_size ("red.png", 24,24,NULL); - g_green_image = gdk_pixbuf_new_from_file_at_size ("green.png", 24,24,NULL); + g_red_image = gdk_pixbuf_new_from_file_at_size (RED_IMAGE, 24,24,NULL); + g_green_image = gdk_pixbuf_new_from_file_at_size (GREEN_IMAGE, 24,24,NULL); window = GTK_WIDGET(gtk_builder_get_object(builder, "util_window")); GtkContainer *map_container = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout"));