added images, calling all attack detection algos
This commit is contained in:
		
							parent
							
								
									0a45563c3f
								
							
						
					
					
						commit
						313b97f39a
					
				
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 38 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 34 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 34 KiB  | 
| 
						 | 
					@ -495,7 +495,8 @@
 | 
				
			||||||
                          <object class="GtkLabel" id="legend_label1">
 | 
					                          <object class="GtkLabel" id="legend_label1">
 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					                            <property name="visible">True</property>
 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					                            <property name="can-focus">False</property>
 | 
				
			||||||
                            <property name="label" translatable="yes">>6900V</property>
 | 
					                            <property name="label" translatable="yes">>65600V or 
 | 
				
			||||||
 | 
					< 65300</property>
 | 
				
			||||||
                          </object>
 | 
					                          </object>
 | 
				
			||||||
                          <packing>
 | 
					                          <packing>
 | 
				
			||||||
                            <property name="left-attach">1</property>
 | 
					                            <property name="left-attach">1</property>
 | 
				
			||||||
| 
						 | 
					@ -530,8 +531,8 @@
 | 
				
			||||||
                          <object class="GtkLabel">
 | 
					                          <object class="GtkLabel">
 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					                            <property name="visible">True</property>
 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					                            <property name="can-focus">False</property>
 | 
				
			||||||
                            <property name="label" translatable="yes"><6800V
 | 
					                            <property name="label" translatable="yes"><65600V
 | 
				
			||||||
<6300V</property>
 | 
					>65300V</property>
 | 
				
			||||||
                          </object>
 | 
					                          </object>
 | 
				
			||||||
                          <packing>
 | 
					                          <packing>
 | 
				
			||||||
                            <property name="left-attach">1</property>
 | 
					                            <property name="left-attach">1</property>
 | 
				
			||||||
| 
						 | 
					@ -761,6 +762,7 @@
 | 
				
			||||||
                          <object class="GtkLabel" id="legend_label3">
 | 
					                          <object class="GtkLabel" id="legend_label3">
 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					                            <property name="visible">True</property>
 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					                            <property name="can-focus">False</property>
 | 
				
			||||||
 | 
					                            <property name="label" translatable="yes">> 0.5</property>
 | 
				
			||||||
                          </object>
 | 
					                          </object>
 | 
				
			||||||
                          <packing>
 | 
					                          <packing>
 | 
				
			||||||
                            <property name="left-attach">1</property>
 | 
					                            <property name="left-attach">1</property>
 | 
				
			||||||
| 
						 | 
					@ -795,7 +797,7 @@
 | 
				
			||||||
                          <object class="GtkLabel">
 | 
					                          <object class="GtkLabel">
 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					                            <property name="visible">True</property>
 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					                            <property name="can-focus">False</property>
 | 
				
			||||||
                            <property name="label" translatable="yes">Normal</property>
 | 
					                            <property name="label" translatable="yes">< 0.5</property>
 | 
				
			||||||
                          </object>
 | 
					                          </object>
 | 
				
			||||||
                          <packing>
 | 
					                          <packing>
 | 
				
			||||||
                            <property name="left-attach">1</property>
 | 
					                            <property name="left-attach">1</property>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -326,7 +326,6 @@
 | 
				
			||||||
                <property name="can-focus">False</property>
 | 
					                <property name="can-focus">False</property>
 | 
				
			||||||
                <child>
 | 
					                <child>
 | 
				
			||||||
                  <object class="GtkBox" id="mlad">
 | 
					                  <object class="GtkBox" id="mlad">
 | 
				
			||||||
                    <property name="visible">True</property>
 | 
					 | 
				
			||||||
                    <property name="can-focus">False</property>
 | 
					                    <property name="can-focus">False</property>
 | 
				
			||||||
                    <property name="orientation">vertical</property>
 | 
					                    <property name="orientation">vertical</property>
 | 
				
			||||||
                    <child>
 | 
					                    <child>
 | 
				
			||||||
| 
						 | 
					@ -592,6 +591,7 @@
 | 
				
			||||||
                </child>
 | 
					                </child>
 | 
				
			||||||
                <child>
 | 
					                <child>
 | 
				
			||||||
                  <object class="GtkBox" id="mlfreq">
 | 
					                  <object class="GtkBox" id="mlfreq">
 | 
				
			||||||
 | 
					                    <property name="visible">True</property>
 | 
				
			||||||
                    <property name="can-focus">False</property>
 | 
					                    <property name="can-focus">False</property>
 | 
				
			||||||
                    <property name="orientation">vertical</property>
 | 
					                    <property name="orientation">vertical</property>
 | 
				
			||||||
                    <child>
 | 
					                    <child>
 | 
				
			||||||
| 
						 | 
					@ -629,7 +629,7 @@
 | 
				
			||||||
                          <object class="GtkLabel" id="legend_label2">
 | 
					                          <object class="GtkLabel" id="legend_label2">
 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					                            <property name="visible">True</property>
 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					                            <property name="can-focus">False</property>
 | 
				
			||||||
                            <property name="label" translatable="yes">Attack/Event</property>
 | 
					                            <property name="label" translatable="yes">Deviation > 0.5 mHz</property>
 | 
				
			||||||
                          </object>
 | 
					                          </object>
 | 
				
			||||||
                          <packing>
 | 
					                          <packing>
 | 
				
			||||||
                            <property name="left-attach">1</property>
 | 
					                            <property name="left-attach">1</property>
 | 
				
			||||||
| 
						 | 
					@ -664,7 +664,7 @@
 | 
				
			||||||
                          <object class="GtkLabel">
 | 
					                          <object class="GtkLabel">
 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					                            <property name="visible">True</property>
 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					                            <property name="can-focus">False</property>
 | 
				
			||||||
                            <property name="label" translatable="yes">Normal</property>
 | 
					                            <property name="label" translatable="yes">deviation < 0.5mHz</property>
 | 
				
			||||||
                          </object>
 | 
					                          </object>
 | 
				
			||||||
                          <packing>
 | 
					                          <packing>
 | 
				
			||||||
                            <property name="left-attach">1</property>
 | 
					                            <property name="left-attach">1</property>
 | 
				
			||||||
| 
						 | 
					@ -761,7 +761,6 @@
 | 
				
			||||||
                          <object class="GtkLabel" id="legend_label3">
 | 
					                          <object class="GtkLabel" id="legend_label3">
 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					                            <property name="visible">True</property>
 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					                            <property name="can-focus">False</property>
 | 
				
			||||||
                            <property name="label" translatable="yes">Attack/Event</property>
 | 
					 | 
				
			||||||
                          </object>
 | 
					                          </object>
 | 
				
			||||||
                          <packing>
 | 
					                          <packing>
 | 
				
			||||||
                            <property name="left-attach">1</property>
 | 
					                            <property name="left-attach">1</property>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,9 @@ struct vis_data{
 | 
				
			||||||
    GdkColor color;
 | 
					    GdkColor color;
 | 
				
			||||||
    OsmGpsMapImage *last_image; // TODO:
 | 
					    OsmGpsMapImage *last_image; // TODO:
 | 
				
			||||||
    GTimeVal last_update_time;
 | 
					    GTimeVal last_update_time;
 | 
				
			||||||
    LiveChartSerie *serie;
 | 
					    LiveChartSerie *serie_vol;
 | 
				
			||||||
 | 
					    LiveChartSerie *serie_freq;
 | 
				
			||||||
 | 
					    LiveChartSerie *serie_dfreq;
 | 
				
			||||||
    struct vis_data *next;
 | 
					    struct vis_data *next;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,6 @@ struct _UtData
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
UtData *utdata;
 | 
					UtData *utdata;
 | 
				
			||||||
LiveChartSerie *serie;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// global variables
 | 
					// global variables
 | 
				
			||||||
int curr_measurement;
 | 
					int curr_measurement;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,100 +37,139 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
    //printf("map_vis A: %Lf, B: %Lf,C: %Lf\n",A,B,C);
 | 
					    //printf("map_vis A: %Lf, B: %Lf,C: %Lf\n",A,B,C);
 | 
				
			||||||
    //gboolean green = kmeans(df);
 | 
					    //gboolean green = kmeans(df);
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    if (curr_measurement==0)
 | 
					    int i = 0, k = 0;
 | 
				
			||||||
    {
 | 
					    float freq,vol_magnitude,angle, dfreq;
 | 
				
			||||||
        int i = 0, k = 0;
 | 
					    unsigned char freq_fmt, anal_fmt, phas_fmt, polar_fmt;
 | 
				
			||||||
        float freq,vol_magnitude,angle, dfreq;
 | 
					    while (df!=NULL){
 | 
				
			||||||
        unsigned char freq_fmt, anal_fmt, phas_fmt, polar_fmt;
 | 
					        float lat;
 | 
				
			||||||
        while (df!=NULL){
 | 
					        float lon;
 | 
				
			||||||
            float lat;
 | 
					        loops++;
 | 
				
			||||||
            float lon;
 | 
					        printf("loops: %d\n", loops);
 | 
				
			||||||
            loops++;
 | 
					 | 
				
			||||||
            printf("loops: %d\n", loops);
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
            id = to_intconvertor(df->idcode);
 | 
					        id = to_intconvertor(df->idcode);
 | 
				
			||||||
            printf("id = %d\n",id);
 | 
					        printf("id = %d\n",id);
 | 
				
			||||||
            pthread_mutex_lock(&mutex_cfg);
 | 
					        pthread_mutex_lock(&mutex_cfg);
 | 
				
			||||||
            temp_cfg = cfgfirst;
 | 
					        temp_cfg = cfgfirst;
 | 
				
			||||||
            // Check for the IDCODE in Configuration Frame
 | 
					        // Check for the IDCODE in Configuration Frame
 | 
				
			||||||
            while(temp_cfg != NULL){
 | 
					        while(temp_cfg != NULL){
 | 
				
			||||||
                if(id == to_intconvertor(temp_cfg->idcode)){
 | 
					            if(id == to_intconvertor(temp_cfg->idcode)){
 | 
				
			||||||
                    cfg_match = 1;
 | 
					                cfg_match = 1;
 | 
				
			||||||
                    printf("Matched - id : %d\n",id);
 | 
					                printf("Matched - id : %d\n",id);
 | 
				
			||||||
                    freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
					                freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
				
			||||||
                    anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
					                anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
				
			||||||
                    phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
					                phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
				
			||||||
                    polar_fmt = temp_cfg->pmu[0]->fmt->polar;
 | 
					                polar_fmt = temp_cfg->pmu[0]->fmt->polar;
 | 
				
			||||||
                    break;	
 | 
					                break;	
 | 
				
			||||||
                } else {
 | 
					            } else {
 | 
				
			||||||
                    temp_cfg = temp_cfg->cfgnext;
 | 
					                temp_cfg = temp_cfg->cfgnext;
 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
	        pthread_mutex_unlock(&mutex_cfg);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // get data from df.
 | 
					 | 
				
			||||||
            if(freq_fmt == '1'){
 | 
					 | 
				
			||||||
                freq = decode_ieee_single(df->dpmu[i]->freq);
 | 
					 | 
				
			||||||
                printf("freq = %f\n",freq);
 | 
					 | 
				
			||||||
            }else{
 | 
					 | 
				
			||||||
                freq = to_intconvertor(df->dpmu[i]->freq)*1e-6+50;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            unsigned char first2bytes[2];
 | 
					 | 
				
			||||||
            strncpy(first2bytes, df->dpmu[i]->phasors[0], 2);
 | 
					 | 
				
			||||||
            unsigned char last2bytes[2];
 | 
					 | 
				
			||||||
            strncpy(last2bytes, df->dpmu[i]->phasors[0]+2, 2);
 | 
					 | 
				
			||||||
            vol_magnitude = to_intconvertor(first2bytes);
 | 
					 | 
				
			||||||
            float imaginary = to_intconvertor(last2bytes);
 | 
					 | 
				
			||||||
            printf("vol = %f imag = %f\n",vol_magnitude, imaginary);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            live_chart_serie_add(serie, freq);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // check lower layer details to get longitude and lattitude.
 | 
					 | 
				
			||||||
            // pthread_mutex_lock(&mutex_Lower_Layer_Details);
 | 
					 | 
				
			||||||
            // LLptr = LLfirst;
 | 
					 | 
				
			||||||
            // match = 0;
 | 
					 | 
				
			||||||
            // while(LLptr != NULL){
 | 
					 | 
				
			||||||
            //     printf("pmuid = %d\n",LLptr->pmuid);
 | 
					 | 
				
			||||||
            //     if(LLptr->pmuid == id){
 | 
					 | 
				
			||||||
            //         match = 1;
 | 
					 | 
				
			||||||
            //         lat = LLptr->latitude;
 | 
					 | 
				
			||||||
            //         lon = LLptr->longitude;
 | 
					 | 
				
			||||||
            //         printf("lat = %f; lon = %f\n",lat,lon);
 | 
					 | 
				
			||||||
            //         break;
 | 
					 | 
				
			||||||
            //     }
 | 
					 | 
				
			||||||
            //     LLptr = LLptr->next;
 | 
					 | 
				
			||||||
            // }
 | 
					 | 
				
			||||||
            // pthread_mutex_unlock(&mutex_Lower_Layer_Details);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            vis_ptr = vis_data_head;
 | 
					 | 
				
			||||||
            match = 0;
 | 
					 | 
				
			||||||
            while(vis_ptr != NULL){
 | 
					 | 
				
			||||||
                printf("vis_ptr->id = %d\n",vis_ptr->id);
 | 
					 | 
				
			||||||
                if(vis_ptr->id == id){
 | 
					 | 
				
			||||||
                    match = 1;
 | 
					 | 
				
			||||||
                    printf("Matched - id : %d\n",id);
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                vis_ptr = vis_ptr->next;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if(match == 1 && cfg_match == 1){
 | 
					 | 
				
			||||||
                printf("lat = %f, lon = %f, freq = %f\n",lat,lon,freq);
 | 
					 | 
				
			||||||
                if(parameters->g_last_image != 0){
 | 
					 | 
				
			||||||
                    osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                if (DTWvolDistance(df)){
 | 
					 | 
				
			||||||
                    parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
					 | 
				
			||||||
                }else{
 | 
					 | 
				
			||||||
                    parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            df = df->dnext;
 | 
					 | 
				
			||||||
            // i++;
 | 
					 | 
				
			||||||
            k++;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        pthread_mutex_unlock(&mutex_cfg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // get data from df.
 | 
				
			||||||
 | 
					        if(freq_fmt == '1'){
 | 
				
			||||||
 | 
					            freq = decode_ieee_single(df->dpmu[i]->freq);
 | 
				
			||||||
 | 
					            printf("freq = %f\n",freq);
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            freq = to_intconvertor(df->dpmu[i]->freq)*1e-6+50;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        unsigned char first2bytes[2];
 | 
				
			||||||
 | 
					        strncpy(first2bytes, df->dpmu[i]->phasors[0], 2);
 | 
				
			||||||
 | 
					        unsigned char last2bytes[2];
 | 
				
			||||||
 | 
					        strncpy(last2bytes, df->dpmu[i]->phasors[0]+2, 2);
 | 
				
			||||||
 | 
					        vol_magnitude = to_intconvertor(first2bytes);
 | 
				
			||||||
 | 
					        float imaginary = to_intconvertor(last2bytes);
 | 
				
			||||||
 | 
					        printf("vol = %f imag = %f\n",vol_magnitude, imaginary);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        vis_ptr = vis_data_head;
 | 
				
			||||||
 | 
					        match = 0;
 | 
				
			||||||
 | 
					        while(vis_ptr != NULL){
 | 
				
			||||||
 | 
					            printf("vis_ptr->id = %d\n",vis_ptr->id);
 | 
				
			||||||
 | 
					            if(vis_ptr->id == id){
 | 
				
			||||||
 | 
					                match = 1;
 | 
				
			||||||
 | 
					                printf("Matched - id : %d\n",id);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            vis_ptr = vis_ptr->next;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        lat = vis_ptr->lat;
 | 
				
			||||||
 | 
					        lon = vis_ptr->lon;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        live_chart_serie_add(vis_ptr->serie_freq, freq);
 | 
				
			||||||
 | 
					        live_chart_serie_add(vis_ptr->serie_vol, vol_magnitude);
 | 
				
			||||||
 | 
					        live_chart_serie_add(vis_ptr->serie_dfreq, dfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(match == 1 && cfg_match == 1){
 | 
				
			||||||
 | 
					            printf("lat = %f, lon = %f, freq = %f\n",lat,lon,freq);
 | 
				
			||||||
 | 
					            if(vis_ptr->last_image != 0){
 | 
				
			||||||
 | 
					                osm_gps_map_image_remove(parameters->util_map, vis_ptr->last_image);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(curr_measurement == 0){
 | 
				
			||||||
 | 
					                if(vol_magnitude > 65600 || vol_magnitude < 65300){
 | 
				
			||||||
 | 
					                    vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map, lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                }else{
 | 
				
			||||||
 | 
					                    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){
 | 
				
			||||||
 | 
					                    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);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }else if(curr_measurement == 2){
 | 
				
			||||||
 | 
					                if (dfreq < 0.5){
 | 
				
			||||||
 | 
					                    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);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }else if(curr_measurement == 3){
 | 
				
			||||||
 | 
					                if(algorithm==0 && dimmension == 0){
 | 
				
			||||||
 | 
					                    if (!attack_detect_vol(df)){
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }else{
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }else if (algorithm==0 && dimmension == 1){
 | 
				
			||||||
 | 
					                    if (!attack_detect_freq(df)){
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }else{
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }else if (algorithm==0 && dimmension == 2){
 | 
				
			||||||
 | 
					                    if (!attack_detect_freq_vol(df)){
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }else{
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }else if (algorithm==1 && dimmension == 0){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }else if (algorithm==1 && dimmension == 1){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }else if (algorithm==1 && dimmension == 2){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }else if (algorithm==2 && dimmension == 0){
 | 
				
			||||||
 | 
					                    if(!DTWvolDistance(df)){
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }else{
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }else if (algorithm==2 && dimmension == 1){
 | 
				
			||||||
 | 
					                    if(!DTWfreqDistance(df)){
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
 | 
				
			||||||
 | 
					                    }else{
 | 
				
			||||||
 | 
					                        vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }else if (algorithm==2 && dimmension == 2){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        df = df->dnext;
 | 
				
			||||||
 | 
					        // i++;
 | 
				
			||||||
 | 
					        k++;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    pthread_mutex_unlock(&mutex_on_TSB);
 | 
					    pthread_mutex_unlock(&mutex_on_TSB);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,10 +7,14 @@
 | 
				
			||||||
#include "livechart.h"
 | 
					#include "livechart.h"
 | 
				
			||||||
#include "connections.h"
 | 
					#include "connections.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO: change this when in production
 | 
				
			||||||
#define UI_fILE "./assets/utility_tools.ui"
 | 
					#define UI_fILE "./assets/utility_tools.ui"
 | 
				
			||||||
#define RED_IMAGE "./assets/red.png"
 | 
					#define RED_IMAGE "./assets/red.png"
 | 
				
			||||||
#define GREEN_IMAGE "./assets/green.png"
 | 
					#define GREEN_IMAGE "./assets/green.png"
 | 
				
			||||||
 | 
					#define YELLOW_IMAGE "./assets/yellow.png"
 | 
				
			||||||
 | 
					#define BLUE_IMAGE "./assets/blue.png"
 | 
				
			||||||
 | 
					#define GREY_IMAGE "./assets/grey.png"
 | 
				
			||||||
 | 
					#define PINK_IMAGE "./assets/pink.png"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// void change_image(OsmGpsMap *map, float lat, float lon, OsmGpsMapImage *image)
 | 
					// void change_image(OsmGpsMap *map, float lat, float lon, OsmGpsMapImage *image)
 | 
				
			||||||
// {
 | 
					// {
 | 
				
			||||||
| 
						 | 
					@ -132,9 +136,16 @@ void on_voltage_clicked(GtkButton *but, gpointer udata)
 | 
				
			||||||
    curr_measurement = 0;
 | 
					    curr_measurement = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_show(utdata->ml_vol);
 | 
					    gtk_widget_show(utdata->ml_vol);
 | 
				
			||||||
 | 
					    gtk_widget_show(utdata->graph_layoutvol);
 | 
				
			||||||
 | 
					    gtk_widget_show(utdata->swvol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_freq);
 | 
					    gtk_widget_hide(utdata->ml_freq);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_dfreq);
 | 
					    gtk_widget_hide(utdata->ml_dfreq);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_ad);
 | 
					    gtk_widget_hide(utdata->ml_ad);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutdfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swdfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_hide(utdata->algorithm);
 | 
					    gtk_widget_hide(utdata->algorithm);
 | 
				
			||||||
    gtk_widget_hide(utdata->dimmension);
 | 
					    gtk_widget_hide(utdata->dimmension);
 | 
				
			||||||
| 
						 | 
					@ -153,9 +164,17 @@ void on_frequency_clicked(GtkButton *but, gpointer udata)
 | 
				
			||||||
    curr_measurement = 1;
 | 
					    curr_measurement = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_show(utdata->ml_freq);
 | 
					    gtk_widget_show(utdata->ml_freq);
 | 
				
			||||||
 | 
					    gtk_widget_show(utdata->graph_layoutfreq);
 | 
				
			||||||
 | 
					    gtk_widget_show(utdata->swfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_vol);
 | 
					    gtk_widget_hide(utdata->ml_vol);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_dfreq);
 | 
					    gtk_widget_hide(utdata->ml_dfreq);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_ad);
 | 
					    gtk_widget_hide(utdata->ml_ad);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swdfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swvol);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutdfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutvol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_hide(utdata->algorithm);
 | 
					    gtk_widget_hide(utdata->algorithm);
 | 
				
			||||||
    gtk_widget_hide(utdata->dimmension);
 | 
					    gtk_widget_hide(utdata->dimmension);
 | 
				
			||||||
| 
						 | 
					@ -175,9 +194,16 @@ void on_dfreq_clicked(GtkButton *but, gpointer udata)
 | 
				
			||||||
    curr_measurement = 2;
 | 
					    curr_measurement = 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_show(utdata->ml_dfreq);
 | 
					    gtk_widget_show(utdata->ml_dfreq);
 | 
				
			||||||
 | 
					    gtk_widget_show(utdata->graph_layoutdfreq);
 | 
				
			||||||
 | 
					    gtk_widget_show(utdata->swdfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_vol);
 | 
					    gtk_widget_hide(utdata->ml_vol);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_freq);
 | 
					    gtk_widget_hide(utdata->ml_freq);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_ad);
 | 
					    gtk_widget_hide(utdata->ml_ad);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutvol);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swvol);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_hide(utdata->algorithm);
 | 
					    gtk_widget_hide(utdata->algorithm);
 | 
				
			||||||
| 
						 | 
					@ -210,6 +236,12 @@ void on_attack_detection_clicked(GtkButton *but, gpointer udata)
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_vol);
 | 
					    gtk_widget_hide(utdata->ml_vol);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_freq);
 | 
					    gtk_widget_hide(utdata->ml_freq);
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_dfreq);
 | 
					    gtk_widget_hide(utdata->ml_dfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swvol);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->swdfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutdfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutvol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    printf("Attack Detection\n");
 | 
					    printf("Attack Detection\n");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -234,6 +266,11 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    GdkPixbuf *g_red_image;
 | 
					    GdkPixbuf *g_red_image;
 | 
				
			||||||
    GdkPixbuf *g_green_image;
 | 
					    GdkPixbuf *g_green_image;
 | 
				
			||||||
 | 
					    GdkPixbuf *g_yellow_image;
 | 
				
			||||||
 | 
					    GdkPixbuf *g_blue_image;
 | 
				
			||||||
 | 
					    GdkPixbuf *g_pink_image;
 | 
				
			||||||
 | 
					    GdkPixbuf *g_grey_image;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    OsmGpsMapImage *g_last_image;
 | 
					    OsmGpsMapImage *g_last_image;
 | 
				
			||||||
    // -------------------
 | 
					    // -------------------
 | 
				
			||||||
    GtkBuilder *builder;
 | 
					    GtkBuilder *builder;
 | 
				
			||||||
| 
						 | 
					@ -268,7 +305,6 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    utdata->swvol = GTK_WIDGET(gtk_builder_get_object(builder, "swvol"));
 | 
					    utdata->swvol = GTK_WIDGET(gtk_builder_get_object(builder, "swvol"));
 | 
				
			||||||
    utdata->swfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swfreq"));
 | 
					    utdata->swfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swfreq"));
 | 
				
			||||||
    utdata->swdfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swdfreq"));
 | 
					    utdata->swdfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swdfreq"));
 | 
				
			||||||
    utdata->swad = GTK_WIDGET(gtk_builder_get_object(builder, "swad"));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_set_sensitive(utdata->voltage, FALSE);
 | 
					    gtk_widget_set_sensitive(utdata->voltage, FALSE);
 | 
				
			||||||
    gtk_widget_set_visible(utdata->algorithm, FALSE);
 | 
					    gtk_widget_set_visible(utdata->algorithm, FALSE);
 | 
				
			||||||
| 
						 | 
					@ -287,6 +323,7 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    g_red_image = gdk_pixbuf_new_from_file_at_size(RED_IMAGE, 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);
 | 
					    g_green_image = gdk_pixbuf_new_from_file_at_size(GREEN_IMAGE, 24, 24, NULL);
 | 
				
			||||||
 | 
					    g_grey_image = gdk_pixbuf_new_from_file_at_size(GREY_IMAGE, 24, 24, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    utdata->util_map = g_object_new(OSM_TYPE_GPS_MAP,
 | 
					    utdata->util_map = g_object_new(OSM_TYPE_GPS_MAP,
 | 
				
			||||||
                                    "map-source", OSM_GPS_MAP_SOURCE_OSMC_TRAILS,
 | 
					                                    "map-source", OSM_GPS_MAP_SOURCE_OSMC_TRAILS,
 | 
				
			||||||
| 
						 | 
					@ -297,14 +334,14 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    osm_gps_map_set_center_and_zoom(utdata->util_map, 15.4589, 75.0078, 10);
 | 
					    osm_gps_map_set_center_and_zoom(utdata->util_map, 15.4589, 75.0078, 10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO: add the points to window.
 | 
					    // 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.4589, 75.0078, g_red_image);
 | 
				
			||||||
    g_last_image = osm_gps_map_image_add(utdata->util_map, 15.518597, 74.925584, g_green_image);
 | 
					    // g_last_image = osm_gps_map_image_add(utdata->util_map, 15.518597, 74.925584, g_green_image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    curr_measurement = 0;
 | 
					    curr_measurement = 0;
 | 
				
			||||||
    algorithm = 0;
 | 
					    algorithm = 0;
 | 
				
			||||||
    dimmension = 0;
 | 
					    dimmension = 0;
 | 
				
			||||||
    myParameters parameters = {utdata->util_map, g_red_image, g_green_image, g_last_image};
 | 
					    myParameters parameters = {utdata->util_map, g_red_image, g_green_image, g_grey_image, g_last_image};
 | 
				
			||||||
    gpointer data = (gpointer)¶meters;
 | 
					    gpointer data = (gpointer)¶meters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_set_size_request(GTK_WIDGET(utdata->util_map), 600, 500);
 | 
					    gtk_widget_set_size_request(GTK_WIDGET(utdata->util_map), 600, 500);
 | 
				
			||||||
| 
						 | 
					@ -312,52 +349,93 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    gtk_container_add(utdata->map_layout, GTK_WIDGET(utdata->util_map));
 | 
					    gtk_container_add(utdata->map_layout, GTK_WIDGET(utdata->util_map));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // add live chart
 | 
					    // add live chart
 | 
				
			||||||
    serie = live_chart_serie_new("IIT", (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
					    // serie = live_chart_serie_new("IIT", (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
    // live_chart set color to the serie
 | 
					    // // live_chart set color to the serie
 | 
				
			||||||
    GdkRGBA color = getIndexColor(0);
 | 
					    // GdkRGBA color = getIndexColor(0);
 | 
				
			||||||
    live_chart_path_set_color(live_chart_serie_get_line(serie), &color);
 | 
					    // live_chart_path_set_color(live_chart_serie_get_line(serie), &color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // iterate over llptr and load the map_vis_head structure
 | 
					    // iterate over llptr and load the map_vis_head structure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // vis_data_head = (struct map_vis_head *)malloc(sizeof(struct vis_data));
 | 
					    // 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");
 | 
				
			||||||
 | 
					    live_chart_xaxis_set_tick_interval(config_vol->x_axis, 20);
 | 
				
			||||||
 | 
					    live_chart_xaxis_set_tick_length(config_vol->x_axis, 100);
 | 
				
			||||||
 | 
					    live_chart_yaxis_update_bounds(config_vol->y_axis, 1);
 | 
				
			||||||
 | 
					    live_chart_path_set_visible(config_vol->x_axis->lines, FALSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    LiveChartChart *chart_vol = live_chart_chart_new(config_vol);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    LiveChartConfig *config_freq = live_chart_config_new();
 | 
				
			||||||
 | 
					    live_chart_yaxis_set_unit(config_freq->y_axis, "mHz");
 | 
				
			||||||
 | 
					    live_chart_xaxis_set_tick_interval(config_freq->x_axis, 20);
 | 
				
			||||||
 | 
					    live_chart_xaxis_set_tick_length(config_freq->x_axis, 100);
 | 
				
			||||||
 | 
					    live_chart_yaxis_update_bounds(config_freq->y_axis, 1);
 | 
				
			||||||
 | 
					    live_chart_path_set_visible(config_freq->x_axis->lines, FALSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    LiveChartChart *chart_freq = live_chart_chart_new(config_freq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    LiveChartConfig *config_dfreq = live_chart_config_new();
 | 
				
			||||||
 | 
					    live_chart_yaxis_set_unit(config_dfreq->y_axis, "mHz");
 | 
				
			||||||
 | 
					    live_chart_xaxis_set_tick_interval(config_dfreq->x_axis, 20);
 | 
				
			||||||
 | 
					    live_chart_xaxis_set_tick_length(config_dfreq->x_axis, 100);
 | 
				
			||||||
 | 
					    live_chart_yaxis_update_bounds(config_dfreq->y_axis, 1);
 | 
				
			||||||
 | 
					    live_chart_path_set_visible(config_dfreq->x_axis->lines, FALSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    LiveChartChart *chart_dfreq = live_chart_chart_new(config_dfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // live_chart_chart_add_serie(chart, serie);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct Lower_Layer_Details *llptr = LLfirst;
 | 
					    struct Lower_Layer_Details *llptr = LLfirst;
 | 
				
			||||||
    struct vis_data * visptr = vis_data_head;
 | 
					    vis_data_head = (struct vis_data *)malloc(sizeof(struct vis_data));
 | 
				
			||||||
 | 
					    struct vis_data * temp_visptr = vis_data_head;
 | 
				
			||||||
    int index = 0;
 | 
					    int index = 0;
 | 
				
			||||||
    while (llptr != NULL)
 | 
					    while (llptr != NULL)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        visptr = (struct vis_data *)malloc(sizeof(struct vis_data));
 | 
					        printf("\ncat\n");
 | 
				
			||||||
        visptr->id = llptr->pmuid;
 | 
					        temp_visptr->id = llptr->pmuid;
 | 
				
			||||||
        visptr->lat = llptr->latitude;
 | 
					        temp_visptr->lat = llptr->latitude;
 | 
				
			||||||
        visptr->lon = llptr->longitude;
 | 
					        temp_visptr->lon = llptr->longitude;
 | 
				
			||||||
        visptr->last_image = osm_gps_map_image_add(utdata->util_map, llptr->latitude, llptr->longitude, g_red_image); // TODO: change the image
 | 
					        temp_visptr->last_image = osm_gps_map_image_add(utdata->util_map, llptr->latitude, llptr->longitude, g_grey_image); // TODO: change the image
 | 
				
			||||||
        visptr->serie = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
					
 | 
				
			||||||
        // live_chart set color to the serie
 | 
					        temp_visptr->serie_freq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
        GdkRGBA color = getIndexColor(index);
 | 
					        GdkRGBA color = getIndexColor(index);
 | 
				
			||||||
        live_chart_path_set_color(live_chart_serie_get_line(visptr->serie), &color);
 | 
					        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_freq), &color);
 | 
				
			||||||
        visptr->next = NULL;
 | 
					        live_chart_chart_add_serie(chart_freq, temp_visptr->serie_freq);
 | 
				
			||||||
        visptr = visptr->next;
 | 
					
 | 
				
			||||||
 | 
					        temp_visptr->serie_vol = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
 | 
					        live_chart_path_set_color(live_chart_serie_get_line(temp_visptr->serie_vol), &color);
 | 
				
			||||||
 | 
					        live_chart_chart_add_serie(chart_vol, temp_visptr->serie_vol);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        temp_visptr->serie_dfreq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
 | 
					        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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        temp_visptr->next = (struct vis_data *)malloc(sizeof(struct vis_data));
 | 
				
			||||||
 | 
					        temp_visptr = temp_visptr->next;
 | 
				
			||||||
        index++;
 | 
					        index++;
 | 
				
			||||||
        llptr = llptr->next;
 | 
					        llptr = llptr->next;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    temp_visptr->next = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    guint pid = g_timeout_add(20, (GSourceFunc)update_images, data);
 | 
					    guint pid = g_timeout_add(20, (GSourceFunc)update_images, data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    LiveChartConfig *config = live_chart_config_new();
 | 
					 | 
				
			||||||
    live_chart_yaxis_set_unit(config->y_axis, "mHz");
 | 
					 | 
				
			||||||
    live_chart_xaxis_set_tick_interval(config->x_axis, 20);
 | 
					 | 
				
			||||||
    live_chart_xaxis_set_tick_length(config->x_axis, 100);
 | 
					 | 
				
			||||||
    live_chart_yaxis_update_bounds(config->y_axis, 1);
 | 
					 | 
				
			||||||
    live_chart_path_set_visible(config->x_axis->lines, FALSE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    LiveChartChart *chart = live_chart_chart_new(config);
 | 
					 | 
				
			||||||
    live_chart_chart_add_serie(chart, serie);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // gtk_widget_set_hexpand(GTK_WIDGET(chart), TRUE);
 | 
					    // gtk_widget_set_hexpand(GTK_WIDGET(chart), TRUE);
 | 
				
			||||||
    // gtk_widget_set_vexpand(GTK_WIDGET(chart), TRUE);
 | 
					    // gtk_widget_set_vexpand(GTK_WIDGET(chart), TRUE);
 | 
				
			||||||
    gtk_widget_set_size_request(GTK_WIDGET(chart), 600, 150);
 | 
					    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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    gtk_container_add(utdata->graph_layoutvol, GTK_WIDGET(chart_vol));
 | 
				
			||||||
 | 
					    gtk_container_add(utdata->graph_layoutfreq, GTK_WIDGET(chart_freq));
 | 
				
			||||||
 | 
					    gtk_container_add(utdata->graph_layoutdfreq, GTK_WIDGET(chart_dfreq));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_container_add(utdata->graph_layoutvol, GTK_WIDGET(chart));
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -383,7 +461,8 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    gtk_widget_hide(utdata->ml_ad);
 | 
					    gtk_widget_hide(utdata->ml_ad);
 | 
				
			||||||
    gtk_widget_hide(utdata->swfreq);
 | 
					    gtk_widget_hide(utdata->swfreq);
 | 
				
			||||||
    gtk_widget_hide(utdata->swdfreq);
 | 
					    gtk_widget_hide(utdata->swdfreq);
 | 
				
			||||||
    gtk_widget_hide(utdata->swad);
 | 
					    gtk_widget_hide(utdata->graph_layoutdfreq);
 | 
				
			||||||
 | 
					    gtk_widget_hide(utdata->graph_layoutfreq);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_main();
 | 
					    gtk_main();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue