Compare commits
3 Commits
e077810a72
...
ce3edbb69d
Author | SHA1 | Date |
---|---|---|
karthikmurakonda | ce3edbb69d | |
karthikmurakonda | 6a733aa270 | |
karthikmurakonda | a8faacf61f |
|
@ -897,44 +897,6 @@
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=1 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkColorButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="rgba">rgb(253,0,0)</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">IITdh</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
@ -974,39 +936,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=1 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkColorButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="rgba">rgb(253,0,0)</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">IITdh</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
@ -1050,39 +980,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=1 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkColorButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="rgba">rgb(253,0,0)</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">IITdh</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
|
|
@ -932,12 +932,6 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -1123,7 +1117,7 @@
|
|||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Voltage Magnitude</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="2"/>
|
||||
<attribute name="scale" value="1"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
|
@ -41,6 +41,9 @@ struct _UtData
|
|||
GtkWidget *swad;
|
||||
GtkWidget *maplabel;
|
||||
GtkWidget *graphlabel;
|
||||
GtkWidget *gl1;
|
||||
GtkWidget *gl2;
|
||||
GtkWidget *gl3;
|
||||
};
|
||||
|
||||
UtData *utdata;
|
||||
|
|
|
@ -1315,12 +1315,12 @@ void add_pmu (GtkButton *but, gpointer udata)
|
|||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 4, 5);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new ("x-co-ordinate");
|
||||
label = gtk_label_new ("lattitude");
|
||||
gtk_misc_set_alignment (GTK_MISC(label),0,0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new ("y-co-ordinate");
|
||||
label = gtk_label_new ("longitude");
|
||||
gtk_misc_set_alignment (GTK_MISC(label),0,0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 6, 7);
|
||||
gtk_widget_show (label);
|
||||
|
@ -2339,7 +2339,7 @@ void view_setup_file (char *filename)
|
|||
|
||||
/* Create a table of ? by 2 squares */
|
||||
rowCount = dDevices + sDevices + 15;
|
||||
table = gtk_table_new (rowCount, 5, FALSE);
|
||||
table = gtk_table_new (rowCount, 7, FALSE);
|
||||
|
||||
/* set the spacing to 10 on x and 10 on y */
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 8);
|
||||
|
@ -2441,7 +2441,7 @@ void view_setup_file (char *filename)
|
|||
|
||||
sprintf(buff, "Measurement Received From Total : %d Devices", sDevices);
|
||||
label = gtk_label_new (buff);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 5, 8, 9 );
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 7, 8, 9 );
|
||||
gtk_widget_show (label);
|
||||
|
||||
rowi = 9;
|
||||
|
@ -2463,11 +2463,20 @@ void view_setup_file (char *filename)
|
|||
gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new ("Lattitude");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 4, 5, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new ("Longitude");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 5, 6, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
||||
rowi = rowi+1;
|
||||
}
|
||||
|
||||
label = gtk_hseparator_new();
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 5, rowi, rowi+1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 7, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
rowi = rowi+1;
|
||||
|
@ -2493,16 +2502,26 @@ void view_setup_file (char *filename)
|
|||
gtk_table_attach_defaults (GTK_TABLE (table), label, 2, 3, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
d1 = strtok (NULL,"\n");
|
||||
d1 = strtok (NULL,",");
|
||||
label = gtk_label_new (d1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 3, 4, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
d1 = strtok (NULL,",");
|
||||
label = gtk_label_new (d1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 4, 5, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
d1 = strtok (NULL,"\n");
|
||||
label = gtk_label_new (d1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 5, 6, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
rowi = rowi + 1;
|
||||
}
|
||||
|
||||
label = gtk_hseparator_new();
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 5, rowi, rowi+1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 7, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
rowi = rowi+1;
|
||||
|
@ -2511,7 +2530,7 @@ void view_setup_file (char *filename)
|
|||
label = gtk_label_new (" ");
|
||||
markup = g_markup_printf_escaped ("<span foreground=\"#0000FF\" font='11'>Destination Devices</span>");
|
||||
gtk_label_set_markup (GTK_LABEL (label), markup);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 5, rowi, rowi+1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 7, rowi, rowi+1);
|
||||
gtk_widget_show (label);
|
||||
g_free (markup);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "Kmeans2.h"
|
||||
|
||||
|
||||
// debug
|
||||
int loops = 0;
|
||||
|
||||
gboolean update_images(gpointer* pars){
|
||||
|
@ -71,9 +70,10 @@ gboolean update_images(gpointer* pars){
|
|||
// get data from df.
|
||||
if(freq_fmt == '1'){
|
||||
freq = decode_ieee_single(df->dpmu[i]->freq);
|
||||
// printf("freq = %f\n",freq);
|
||||
printf("freq = %f\n",freq);
|
||||
}else{
|
||||
freq = to_intconvertor(df->dpmu[i]->freq)*1e-6+50;
|
||||
freq = to_intconvertor(df->dpmu[i]->freq)*1e-3+50;
|
||||
printf("freq = %f\n",freq);
|
||||
}
|
||||
|
||||
unsigned char first2bytes[2];
|
||||
|
@ -116,7 +116,7 @@ gboolean update_images(gpointer* pars){
|
|||
vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_green_image);
|
||||
}
|
||||
}else if(curr_measurement == 1){
|
||||
if (freq > 300){
|
||||
if (freq > 50.3){
|
||||
vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
|
||||
}else{
|
||||
vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
|
||||
|
|
|
@ -163,7 +163,6 @@ int add_PMU(char pmuid[], char ip[], char port[], char protocol[], char latitude
|
|||
temp_pmu->request_cfg_frame = 0;
|
||||
temp_pmu->latitude = atof(latitude);
|
||||
temp_pmu->longitude = atof(longitude);
|
||||
printf(" lat = %f long = %f\n",temp_pmu->latitude,temp_pmu->longitude);
|
||||
temp_pmu->next = NULL;
|
||||
temp_pmu->prev = NULL;
|
||||
|
||||
|
|
|
@ -689,8 +689,12 @@ void write_cfg_to_file()
|
|||
fprintf(fp1,"%d",temp_pmu->port);
|
||||
fputc(',',fp1);
|
||||
fprintf(fp1,"%s",temp_pmu->protocol);
|
||||
fputc(',',fp1);
|
||||
fprintf(fp1,"%f",temp_pmu->latitude);
|
||||
fputc(',',fp1);
|
||||
fprintf(fp1,"%f",temp_pmu->longitude);
|
||||
fputc('\n',fp1);
|
||||
|
||||
|
||||
temp_pmu = temp_pmu->next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -632,7 +632,7 @@ void init_cfgparser(unsigned char st[]){
|
|||
|
||||
void recreate_Connection_Table() {
|
||||
|
||||
char line[40],*ip,*port,*protocol,*id;
|
||||
char line[40],*ip,*port,*protocol,*id, *latitude, *longitude;
|
||||
char *rline = NULL, *d1;
|
||||
int err, tempi;
|
||||
FILE *f;
|
||||
|
@ -689,7 +689,9 @@ void recreate_Connection_Table() {
|
|||
id = strtok (rline,",");
|
||||
ip = strtok (NULL,",");
|
||||
port = strtok (NULL,",");
|
||||
protocol = strtok (NULL,"\n");
|
||||
protocol = strtok (NULL,",");
|
||||
latitude = strtok (NULL,",");
|
||||
longitude = strtok (NULL,"\n");
|
||||
protocol[3] = '\0';
|
||||
printf("|\t%d\t|%s\t|\t%d\t|\t%s\t|\n",atoi(id),ip,atoi(port),protocol);
|
||||
|
||||
|
@ -706,6 +708,8 @@ void recreate_Connection_Table() {
|
|||
strcpy(temp_pmu->ip,ip);
|
||||
temp_pmu->port = atoi(port);
|
||||
strcpy(temp_pmu->protocol,protocol);
|
||||
temp_pmu->latitude = atof(latitude);
|
||||
temp_pmu->longitude = atof(longitude);
|
||||
temp_pmu->data_transmission_off = 0;
|
||||
temp_pmu->pmu_remove = 0;
|
||||
temp_pmu->request_cfg_frame = 0;
|
||||
|
|
|
@ -16,14 +16,6 @@
|
|||
#define GREY_IMAGE "./assets/grey.png"
|
||||
#define PINK_IMAGE "./assets/pink.png"
|
||||
|
||||
// void change_image(OsmGpsMap *map, float lat, float lon, OsmGpsMapImage *image)
|
||||
// {
|
||||
// if (g_last_image)
|
||||
// osm_gps_map_image_remove(map, g_last_image);
|
||||
// osm_gps_map_image_add(map, lat, lon, image);
|
||||
// }
|
||||
|
||||
// on closing the window kill the g_timeout_add
|
||||
|
||||
GdkRGBA getIndexColor(int index){
|
||||
GdkRGBA color;
|
||||
|
@ -306,7 +298,6 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
utdata->attack_detection = GTK_WIDGET(gtk_builder_get_object(builder, "attack_detection"));
|
||||
utdata->algorithm = GTK_WIDGET(gtk_builder_get_object(builder, "algorithm"));
|
||||
utdata->dimmension = GTK_WIDGET(gtk_builder_get_object(builder, "dimmension"));
|
||||
// utdata->util_map = GTK_WIDGET(gtk_builder_get_object(builder, "util_map"));
|
||||
utdata->map_layout = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout"));
|
||||
utdata->graph_layoutvol = GTK_CONTAINER(gtk_builder_get_object(builder, "graph_layoutvol"));
|
||||
utdata->graph_layoutfreq = GTK_CONTAINER(gtk_builder_get_object(builder, "graph_layoutfreq"));
|
||||
|
@ -322,6 +313,9 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
utdata->swdfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swdfreq"));
|
||||
utdata->maplabel = GTK_WIDGET(gtk_builder_get_object(builder, "maplabel"));
|
||||
utdata->graphlabel = GTK_WIDGET(gtk_builder_get_object(builder, "graphlabel"));
|
||||
utdata->gl1 = GTK_WIDGET(gtk_builder_get_object(builder, "gl1"));
|
||||
utdata->gl2 = GTK_WIDGET(gtk_builder_get_object(builder, "gl2"));
|
||||
utdata->gl3 = GTK_WIDGET(gtk_builder_get_object(builder, "gl3"));
|
||||
|
||||
gtk_widget_set_sensitive(utdata->voltage, FALSE);
|
||||
gtk_widget_set_visible(utdata->algorithm, FALSE);
|
||||
|
@ -350,9 +344,6 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
// TODO: centering the map
|
||||
osm_gps_map_set_center_and_zoom(utdata->util_map, 15.4589, 75.0078, 10);
|
||||
|
||||
// TODO: add the points to window.
|
||||
// g_last_image = osm_gps_map_image_add(utdata->util_map, 15.4589, 75.0078, g_red_image);
|
||||
// g_last_image = osm_gps_map_image_add(utdata->util_map, 15.518597, 74.925584, g_green_image);
|
||||
|
||||
|
||||
curr_measurement = 0;
|
||||
|
@ -365,15 +356,6 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
|
||||
gtk_container_add(utdata->map_layout, GTK_WIDGET(utdata->util_map));
|
||||
|
||||
// add live chart
|
||||
// serie = live_chart_serie_new("IIT", (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
|
||||
// // live_chart set color to the serie
|
||||
// GdkRGBA color = getIndexColor(0);
|
||||
// live_chart_path_set_color(live_chart_serie_get_line(serie), &color);
|
||||
|
||||
// iterate over llptr and load the map_vis_head structure
|
||||
|
||||
// vis_data_head = (struct map_vis_head *)malloc(sizeof(struct vis_data));
|
||||
|
||||
LiveChartConfig *config_vol = live_chart_config_new();
|
||||
live_chart_yaxis_set_unit(config_vol->y_axis, "V");
|
||||
|
@ -403,11 +385,6 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
|
||||
LiveChartChart *chart_dfreq = live_chart_chart_new(config_dfreq);
|
||||
|
||||
|
||||
|
||||
|
||||
// live_chart_chart_add_serie(chart, serie);
|
||||
|
||||
struct Lower_Layer_Details *llptr = LLfirst;
|
||||
vis_data_head = (struct vis_data *)malloc(sizeof(struct vis_data));
|
||||
struct vis_data * temp_visptr = vis_data_head;
|
||||
|
@ -433,6 +410,25 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_dfreq), &color);
|
||||
live_chart_chart_add_serie(chart_dfreq, temp_visptr->serie_dfreq);
|
||||
|
||||
// create a grid with gtkcolorbutton and gtklabel
|
||||
GtkWidget *grid = gtk_grid_new();
|
||||
GtkWidget *color_button = gtk_color_button_new_with_rgba(&color);
|
||||
gtk_grid_attach(GTK_GRID(grid), color_button, 0, 0, 1, 1);
|
||||
gchar *label_text = g_strdup_printf("%d", llptr->pmuid);
|
||||
gtk_grid_attach(GTK_GRID(grid), gtk_label_new(label_text), 1, 0, 1, 1);
|
||||
// TODO: customise the line color
|
||||
gtk_box_pack_start(GTK_BOX(utdata->gl1), grid, FALSE, FALSE, 0);
|
||||
GtkWidget *grid2 = gtk_grid_new();
|
||||
GtkWidget *color_button2 = gtk_color_button_new_with_rgba(&color);
|
||||
gtk_grid_attach(GTK_GRID(grid2), color_button2, 0, 0, 1, 1);
|
||||
gtk_grid_attach(GTK_GRID(grid2), gtk_label_new(label_text), 1, 0, 1, 1);
|
||||
gtk_box_pack_start(GTK_BOX(utdata->gl2), grid2, FALSE, FALSE, 0);
|
||||
GtkWidget *grid3 = gtk_grid_new();
|
||||
GtkWidget *color_button3 = gtk_color_button_new_with_rgba(&color);
|
||||
gtk_grid_attach(GTK_GRID(grid3), color_button3, 0, 0, 1, 1);
|
||||
gtk_grid_attach(GTK_GRID(grid3), gtk_label_new(label_text), 1, 0, 1, 1);
|
||||
gtk_box_pack_start(GTK_BOX(utdata->gl3), grid3, FALSE, FALSE, 0);
|
||||
|
||||
temp_visptr->next = (struct vis_data *)malloc(sizeof(struct vis_data));
|
||||
temp_visptr = temp_visptr->next;
|
||||
index++;
|
||||
|
@ -445,6 +441,7 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
|
||||
// gtk_widget_set_hexpand(GTK_WIDGET(chart), TRUE);
|
||||
// gtk_widget_set_vexpand(GTK_WIDGET(chart), TRUE);
|
||||
|
||||
gtk_widget_set_size_request(GTK_WIDGET(chart_freq), 600, 150);
|
||||
gtk_widget_set_size_request(GTK_WIDGET(chart_vol), 600, 150);
|
||||
gtk_widget_set_size_request(GTK_WIDGET(chart_dfreq), 600, 150);
|
||||
|
@ -453,20 +450,8 @@ void utility_tools(GtkButton *but, gpointer udata)
|
|||
gtk_container_add(utdata->graph_layoutfreq, GTK_WIDGET(chart_freq));
|
||||
gtk_container_add(utdata->graph_layoutdfreq, GTK_WIDGET(chart_dfreq));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
g_signal_connect(utdata->util_window, "destroy", G_CALLBACK(on_window_destroy), GUINT_TO_POINTER(pid));
|
||||
|
||||
// //g_last_image = osm_gps_map_image_add(util_map,15.4589, 75.0078, g_red_image);
|
||||
// g_last_image = osm_gps_map_image_add(utdata->util_map,15.518597, 74.925584, g_green_image);
|
||||
// myParameters parameters = {utdata->util_map, g_red_image, g_green_image, g_last_image};
|
||||
// gpointer data = (gpointer) ¶meters;
|
||||
// guint pid = g_timeout_add(20, (GSourceFunc) update_images, data);
|
||||
// gtk_widget_set_vexpand(GTK_WIDGET(utdata->util_map), TRUE);
|
||||
// gtk_widget_set_hexpand(GTK_WIDGET(utdata->util_map), TRUE);
|
||||
gtk_widget_show_all(utdata->util_window);
|
||||
|
||||
gtk_widget_hide(utdata->algorithm);
|
||||
|
|
Loading…
Reference in New Issue