organized into directories

This commit is contained in:
karthikmv 2022-10-02 21:42:04 +05:30
parent f5f8eb0fef
commit b0c97d889e
6 changed files with 35 additions and 75 deletions

View File

@ -49,31 +49,30 @@ LIBS = -lpthread
LDLIBS=`pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0` 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` 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 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) $(PROGRAM): $(OBJECT_FILES)
$(CC) $(OBJECTS) $(LDLIBS) $(LIBS) -o $@ $(CC) $(CFLAGS) $(OBJECT_FILES) -o $(PROGRAM) $(LDLIBS)
bin/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.c
$(COMPILE) $(CFLAGS) -c $<
install: $(PROGRAM) install: $(PROGRAM)
gtk-builder-convert iPDC.glade iPDC.xml gtk-builder-convert assets/iPDC.glade assets/iPDC.xml
mkdir -p $(CREATE_DIR)iPDC/$ mkdir -p $(CREATE_DIR)iPDC/$
cp -f $(FILE1) $(CREATE_DIR)iPDC/$(FILE1) cp -f assets/$(FILE1) $(CREATE_DIR)iPDC/$(FILE1)
cp -f images/$(FILE2) $(CREATE_DIR)iPDC/$(FILE2) cp -f assets/$(FILE2) $(CREATE_DIR)iPDC/$(FILE2)
cp -f images/$(FILE3) $(CREATE_DIR)iPDC/$(FILE3) cp -f assets/$(FILE3) $(CREATE_DIR)iPDC/$(FILE3)
cp -f images/$(FILE4) $(CREATE_DIR)iPDC/$(FILE4) cp -f assets/$(FILE4) $(CREATE_DIR)iPDC/$(FILE4)
cp -f images/$(FILE5) $(CREATE_DIR)iPDC/$(FILE5) cp -f assets/$(FILE5) $(CREATE_DIR)iPDC/$(FILE5)
cp -f images/$(FILE6) $(DESKTOP_DIR)/$(FILE6) cp -f assets/$(FILE6) $(DESKTOP_DIR)/$(FILE6)
cp $(PROGRAM) $(INSTALL_PREFIX)bin/$(PROGRAM) cp $(PROGRAM) $(INSTALL_PREFIX)bin/$(PROGRAM)
# rm -f $(CLEAN_OBJECTS) $(PROGRAM)
uninstall: uninstall:
rm -f $(INSTALL_PREFIX)bin/$(PROGRAM) rm -f $(INSTALL_PREFIX)bin/$(PROGRAM)

0
iPDC/bin/.iPDC_bin Normal file
View File

View File

@ -0,0 +1,10 @@
#include<gtk/gtk.h>
#include<osm-gps-map.h>
typedef struct{
OsmGpsMap *util_map;
GdkPixbuf *g_red_image;
GdkPixbuf *g_green_image;
OsmGpsMapImage *g_last_image;
} myParameters;
gboolean update_images(gpointer* pars);

View File

@ -50,7 +50,7 @@
#include "utility_tools.h" #include "utility_tools.h"
/* Common fixed path for storage of few common files */ /* 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" //#define UI_fILE "/usr/local/share/iPDC/iPDC.xml"

View File

@ -5,12 +5,6 @@
#include "osm-gps-map.h" #include "osm-gps-map.h"
#include "Attack_detect.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){ gboolean update_images(gpointer* pars){
myParameters* parameters = (myParameters*) pars; myParameters* parameters = (myParameters*) pars;
@ -42,7 +36,7 @@ gboolean update_images(gpointer* pars){
if (green){ if (green){
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_green_image);
}else{ }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);
} }
} }

View File

@ -1,10 +1,12 @@
#include<gtk/gtk.h> #include<gtk/gtk.h>
#include "utility_tools.h"
#include "align_sort.h" #include "align_sort.h"
#include "parser.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); // 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) void utility_tools(GtkButton *but, gpointer udata)
{ {
OsmGpsMap *util_map; OsmGpsMap *util_map;
@ -76,8 +33,8 @@ void utility_tools(GtkButton *but, gpointer udata)
g_warning("%s", error->message); g_warning("%s", error->message);
g_free(error); g_free(error);
} }
g_red_image = gdk_pixbuf_new_from_file_at_size ("red.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.png", 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")); window = GTK_WIDGET(gtk_builder_get_object(builder, "util_window"));
GtkContainer *map_container = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout")); GtkContainer *map_container = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout"));