Compare commits
No commits in common. "e48bdfe4c67d0ae55d28d9ab18204b791ae0cac8" and "1a80ce316d6832f64abf8033dc7db17126be53cf" have entirely different histories.
e48bdfe4c6
...
1a80ce316d
|
@ -646,14 +646,13 @@ void generate_data_frame()
|
||||||
else /* Insert Floating point Frequency & DFrequency values in data frame */
|
else /* Insert Floating point Frequency & DFrequency values in data frame */
|
||||||
{
|
{
|
||||||
/* For rendom values of FREQ & DFREQ */
|
/* For rendom values of FREQ & DFREQ */
|
||||||
freqF = (rand() % 5 + 1)*100;
|
freq_f = (rand() % 5 + 1)*100;
|
||||||
f2c(freqF, df_temp_1);
|
li2c(freq_f, df_temp_1);
|
||||||
B_copy(data_frm, df_temp_1, indx, 4);
|
B_copy(data_frm, df_temp_1, indx, 4);
|
||||||
indx = indx + 4;
|
indx = indx + 4;
|
||||||
|
|
||||||
float dfreqF = 0;
|
dfreq_f = (rand() % 5 + 1)*0.00639;
|
||||||
dfreqF = (rand() % 5 + 1)*0.00639;
|
i2c(dfreq_f, df_temp_1);
|
||||||
i2c(dfreqF, df_temp_1);
|
|
||||||
B_copy(data_frm, df_temp_1, indx, 4);
|
B_copy(data_frm, df_temp_1, indx, 4);
|
||||||
indx = indx + 4;
|
indx = indx + 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,11 @@
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
|
|
||||||
gboolean update_images(gpointer* pars){
|
gboolean update_images(gpointer* pars){
|
||||||
int match=0,id, cfg_match=0;
|
int match=0,id;
|
||||||
myParameters* parameters = (myParameters*) pars;
|
myParameters* parameters = (myParameters*) pars;
|
||||||
struct cfg_frame* temp_cfg;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&mutex_on_TSB);
|
pthread_mutex_lock(&mutex_on_TSB);
|
||||||
struct data_frame *df = TSB[MAXTSB-1].first_data_frame;
|
struct data_frame *df = TSB[0].first_data_frame;
|
||||||
struct Lower_Layer_Details *LLptr;
|
struct Lower_Layer_Details *LLptr;
|
||||||
|
|
||||||
if (df == NULL){
|
if (df == NULL){
|
||||||
|
@ -30,63 +29,48 @@ gboolean update_images(gpointer* pars){
|
||||||
{
|
{
|
||||||
int i = 0, k = 0;
|
int i = 0, k = 0;
|
||||||
float freq;
|
float freq;
|
||||||
unsigned char fmt;
|
|
||||||
while (df!=NULL){
|
while (df!=NULL){
|
||||||
float lat;
|
freq = to_intconvertor(df->dpmu[i]->freq)*0.001+50;
|
||||||
float lon;
|
live_chart_serie_add(serie, freq*1e-1);
|
||||||
loops++;
|
loops++;
|
||||||
printf("loops: %d\n", 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);
|
|
||||||
temp_cfg = cfgfirst;
|
|
||||||
// Check for the IDCODE in Configuration Frame
|
|
||||||
while(temp_cfg != NULL){
|
|
||||||
if(id == to_intconvertor(temp_cfg->idcode)){
|
|
||||||
cfg_match = 1;
|
|
||||||
printf("Matched - id : %d\n",id);
|
|
||||||
fmt = temp_cfg->pmu[0]->fmt->freq;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
temp_cfg = temp_cfg->cfgnext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&mutex_cfg);
|
|
||||||
if(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;
|
|
||||||
}
|
|
||||||
live_chart_serie_add(serie, freq);
|
|
||||||
|
|
||||||
pthread_mutex_lock(&mutex_Lower_Layer_Details);
|
|
||||||
LLptr = LLfirst;
|
LLptr = LLfirst;
|
||||||
match = 0;
|
match = 0;
|
||||||
while(LLptr != NULL){
|
while(LLptr != NULL){
|
||||||
printf("pmuid = %d\n",LLptr->pmuid);
|
printf("pmuid = %d\n",LLptr->pmuid);
|
||||||
if(LLptr->pmuid == id){
|
if(LLptr->pmuid == id){
|
||||||
match = 1;
|
match = 1;
|
||||||
float lat = LLptr->latitude;
|
|
||||||
float lon = LLptr->longitude;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LLptr = LLptr->next;
|
LLptr = LLptr->next;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mutex_Lower_Layer_Details);
|
|
||||||
|
|
||||||
if(match == 1 && cfg_match == 1){
|
if(match == 1){
|
||||||
|
float lat = 79.347312;
|
||||||
|
float lon = -69.439209;
|
||||||
|
float freq = to_intconvertor(df->dpmu[i]->freq)*0.001+50;
|
||||||
printf("lat = %f, lon = %f, freq = %f\n",lat,lon,freq);
|
printf("lat = %f, lon = %f, freq = %f\n",lat,lon,freq);
|
||||||
gboolean green =attack_detect(df,&START,&COUNT,&SUM_OF_FREQUENCY);
|
gboolean green =attack_detect(df,&START,&COUNT,&SUM_OF_FREQUENCY);
|
||||||
if(parameters->g_last_image != 0){
|
// if(parameters->g_last_image != 0){
|
||||||
osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image);
|
// // osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image);
|
||||||
}
|
// }
|
||||||
if (freq > 50.300){
|
if (freq > 50.300){
|
||||||
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
|
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
|
||||||
}else{
|
}else{
|
||||||
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
|
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_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);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
df = df->dnext;
|
df = df->dnext;
|
||||||
// i++;
|
// i++;
|
||||||
|
|
Loading…
Reference in New Issue