CfgFunction.h File Reference

#include <gtk/gtk.h>
Include dependency graph for CfgFunction.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ConfigurationFrame
struct  ConfigurationChange

Functions

void header_frm_gen (int len)
void reconfig_cfg_CC ()
void show_pmu_details (GtkWidget *widget, gpointer udata)
int create_cfg ()

Variables

char * hdr_frame
char * markup1
struct ConfigurationFramecfg_info
struct ConfigurationChangenew_cfg_info

Function Documentation

int create_cfg (  ) 

Definition at line 454 of file CfgFunction.c.

References af, annmr, anunit, B_copy(), c2i(), c2li(), cfg2_frm, cfg2_frm_size, ConfigurationFrame::cfg_af, ConfigurationFrame::cfg_analog_channels, ConfigurationFrame::cfg_annmr_val, ConfigurationFrame::cfg_dataRate, ConfigurationFrame::cfg_dgnmr_val, ConfigurationFrame::cfg_digital_channels, ConfigurationFrame::cfg_fdf, cfg_info, ConfigurationFrame::cfg_pf, ConfigurationFrame::cfg_phasor_channels, ConfigurationFrame::cfg_phnmr_val, ConfigurationFrame::cfg_pmuID, ConfigurationFrame::cfg_pn, ConfigurationFrame::cfg_STNname, cfgcnt, chk, compute_CRC(), data_frm_size, data_rate, dgnmr, digunit, fdf, fnom, fracsec, frmt, i2c(), indx, j, li2c(), MAX_STRING_SIZE, num_pmu, pf, phnmr, phunit, pmu_id, pn, soc, t1, TB, temp, temp_1, temp_5, tim, and validation_result().

Referenced by final_cfg_create(), and main().

00455         {
00456                 int  j, indx = 0, a, x1;
00457                 char stn[16];
00458                 unsigned char cline[MAX_STRING_SIZE];
00459                 static const char filename_1[] = "cfg2.bin";
00460                 static const char filename_2[] = "change.bin";
00461                 FILE *file_1;
00462 
00463                 /* Open the 'cfg2.bin' file and read the last CFG frame */
00464                 file_1 = fopen (filename_1,"rb");
00465                 if (file_1 != NULL)                     /* If there is already configuration frame is present */
00466                 {
00467                         memset(cline,'\0',sizeof(cline));
00468                         fread(cline, sizeof(unsigned char), sizeof(cline), file_1); 
00469                         fclose(file_1);
00470 
00471                         /* Allocate the memory for ConfigurationFrame object */
00472                         cfg_info = malloc(sizeof(struct ConfigurationFrame));
00473                         cfg_info->cfg_STNname = malloc(16);
00474                         memset(cfg_info->cfg_STNname,'\0',16);
00475 
00476                         /* Get the CFG size & store globaly */
00477                         temp[0] = cline[2];
00478                         temp[1] = cline[3];
00479                         cfg2_frm_size = c2i(temp);
00480 
00481                         /* Get the PMU ID from CFG FRM & store globally */
00482                         temp[0] = cline[4];
00483                         temp[1] = cline[5];
00484                         pmu_id = c2i(temp);
00485                         cfg_info->cfg_pmuID = pmu_id;
00486 
00487                         /* Get the PMU ID from CFG FRM & store globally */
00488                         temp_1[0] = cline[14];
00489                         temp_1[1] = cline[15];
00490                         temp_1[2] = cline[16];
00491                         temp_1[3] = cline[17];
00492                         TB = c2li(temp_1);
00493 
00494                         /* Get the Station name from CFG FRM & store globally */
00495                         for(a=0; a<16; a++)
00496                         {
00497                                 stn[a] = cline[20+a];
00498                         }
00499                         strcpy(cfg_info->cfg_STNname, stn);
00500 
00501                         /* Get the FORMAT word from CFG FRM */
00502                         temp[0] = cline[38];
00503                         temp[1] = cline[39];
00504                         frmt = c2i(temp);
00505 
00506                         /* Initialize the frmt bits as in his appropriate global variable */
00507                         if(frmt == 15)
00508                         {
00509                                 fdf=1, af=1, pf=1, pn=1;
00510                         }
00511                         else if(frmt == 14)
00512                         {
00513                                 fdf=1, af=1, pf=1, pn=0;  
00514                         }
00515                         else if(frmt == 13)
00516                         {
00517                                 fdf=1, af=1, pf=0, pn=1;  
00518                         }
00519                         else if(frmt == 12)
00520                         {
00521                                 fdf=1, af=1, pf=0, pn=0;  
00522                         }
00523                         else if(frmt == 11)
00524                         {
00525                                 fdf=1, af=0, pf=1, pn=1;  
00526                         }
00527                         else if(frmt == 10)
00528                         {
00529                                 fdf=1, af=0, pf=1, pn=0;  
00530                         }
00531                         else if(frmt == 9)
00532                         {
00533                                 fdf=1, af=0, pf=0, pn=1;  
00534                         }
00535                         else if(frmt == 8)
00536                         {
00537                                 fdf=1, af=0, pf=0, pn=0;  
00538                         }
00539                         else if(frmt == 7)
00540                         {
00541                                 fdf=0, af=1, pf=1, pn=1;  
00542                         }
00543                         else if(frmt == 6)
00544                         {
00545                                 fdf=0, af=1, pf=1, pn=0;  
00546                         }
00547                         else if(frmt == 5)
00548                         {
00549                                 fdf=0, af=1, pf=0, pn=1;  
00550                         }
00551                         else if(frmt == 4)
00552                         {
00553                                 fdf=0, af=1, pf=0, pn=0;  
00554                         }
00555                         else if(frmt == 3)
00556                         {
00557                                 fdf=0, af=0, pf=1, pn=1;  
00558                         }
00559                         else if(frmt == 2)
00560                         {
00561                                 fdf=0, af=0, pf=1, pn=0;  
00562                         }
00563                         else if(frmt == 1)
00564                         {
00565                                 fdf=0, af=0, pf=0, pn=1;  
00566                         }
00567                         else
00568                         {
00569                                 fdf=0, af=0, pf=0, pn=0;  
00570                         }
00571 
00572                         /* Store FORMAT in global data structure */
00573                         cfg_info->cfg_fdf = fdf; 
00574                         cfg_info->cfg_af = af; 
00575                         cfg_info->cfg_pf = pf; 
00576                         cfg_info->cfg_pn = pn; 
00577 
00578                         /* Get the PHNMR from CFG FRM & store globally */
00579                         temp[0] = cline[40];
00580                         temp[1] = cline[41];
00581                         phnmr = c2i(temp);
00582                         cfg_info->cfg_phnmr_val = phnmr;
00583                         
00584                         /* Get the ANNMR from CFG FRM & store in globally */
00585                         temp[0] = cline[42];
00586                         temp[1] = cline[43];
00587                         annmr = c2i(temp);
00588                         cfg_info->cfg_annmr_val = annmr; 
00589 
00590                         /* Get the DGNMR from CFG FRM & store globally */
00591                         temp[0] = cline[44];
00592                         temp[1] = cline[45];
00593                         dgnmr = c2i(temp);
00594                         cfg_info->cfg_dgnmr_val = dgnmr;
00595 
00596                         /* To escape the some of fields in cfg frame */
00597                         indx = 46 + (16*phnmr) + (16*annmr) + (256*dgnmr) + (4*phnmr) + (4*annmr) + (4*dgnmr) + 2;
00598                         temp[0] = cline[indx++];
00599                         temp[1] = cline[indx++];
00600                         cfgcnt = c2i(temp);
00601 
00602                         /* Get the Data Rate from CFG FRM & store globally */
00603                         temp[0] = cline[indx++];
00604                         temp[1] = cline[indx++];
00605                         data_rate = c2i(temp);
00606                         cfg_info->cfg_dataRate = data_rate;
00607 
00608                         /* Seprate the Phasor Channels from CFG FRM & store globally */
00609                         cfg_info->cfg_phasor_channels = (char *)malloc((phnmr*16) * sizeof(char));
00610                         memset(cfg_info->cfg_phasor_channels, '\0', sizeof(cfg_info->cfg_phasor_channels));     
00611                         for(x1=0, indx=46; x1< (phnmr*16); x1++,indx++)
00612                         {
00613                                 cfg_info->cfg_phasor_channels[x1] = cline[indx]; 
00614                         }                       
00615                         
00616                         /* Seprate the Analog Channels from CFG FRM & store globally */
00617                         cfg_info->cfg_analog_channels = (char *)malloc((annmr*16) * sizeof(char));
00618                         memset(cfg_info->cfg_analog_channels, '\0', sizeof(cfg_info->cfg_analog_channels));     
00619                         for(x1=0, indx; x1< (annmr*16); x1++,indx++)
00620                         {
00621                                 cfg_info->cfg_analog_channels[x1] = cline[indx]; 
00622                         }                       
00623 
00624                         /* Seprate the Digital Channels from CFG FRM & store globally */
00625                         cfg_info->cfg_digital_channels = (char *)malloc((dgnmr*16*16) * sizeof(char));
00626                         memset(cfg_info->cfg_digital_channels, '\0', sizeof(cfg_info->cfg_digital_channels));   
00627                         for(x1=0, indx; x1< (dgnmr*16*16); x1++,indx++)
00628                         {
00629                                 cfg_info->cfg_digital_channels[x1] = cline[indx]; 
00630                         }                       
00631 
00632                         validation_result ("\tConfiguration Frame Objects are created.\t\n");
00633                 }
00634                 else            /* At the time of PMU Configuration setup or if CFG not present */
00635                 { 
00636                         /* Store FORMAT bits from global data structure */
00637                         fdf = cfg_info->cfg_fdf;
00638                         af  = cfg_info->cfg_af;
00639                         pf  = cfg_info->cfg_pf;
00640                         pn  = cfg_info->cfg_pn;
00641                         
00642                         if(fdf==1 && af==1 && pf==1 && pn==1)
00643                         {
00644                                 frmt = 15;
00645                         }
00646                         else if(fdf==1 && af==1 && pf==1 && pn==0)
00647                         {
00648                                 frmt = 14;
00649                         }
00650                         else if(fdf==1 && af==1 && pf==0 && pn==1)
00651                         {
00652                                 frmt = 13;
00653                         }
00654                         else if(fdf==1 && af==1 && pf==0 && pn==0)
00655                         {       
00656                                 frmt = 12;
00657                         }
00658                         else if(fdf==1 && af==0 && pf==1 && pn==1)
00659                         {
00660                                 frmt = 11;
00661                         }
00662                         else if(fdf==1 && af==0 && pf==1 && pn==0)
00663                         {
00664                                 frmt = 10;
00665                         }
00666                         else if(fdf==1 && af==0 && pf==0 && pn==1)
00667                         {
00668                                 frmt = 9;
00669                         }
00670                         else if(fdf==1 && af==0 && pf==0 && pn==0)
00671                         {
00672                                 frmt = 8;
00673                         }
00674                         else if(fdf==0 && af==1 && pf==1 && pn==1)
00675                         {
00676                                 frmt = 7;
00677                         }
00678                         else if(fdf==0 && af==1 && pf==1 && pn==0)
00679                         {
00680                                 frmt = 6;
00681                         }
00682                         else if(fdf==0 && af==1 && pf==0 && pn==1)
00683                         {
00684                                 frmt = 5;
00685                         }
00686                         else if(fdf==0 && af==1 && pf==0 && pn==0)
00687                         {
00688                                 frmt = 4;
00689                         }
00690                         else if(fdf==0 && af==0 && pf==1 && pn==1)
00691                         {
00692                                 frmt = 3;
00693                         }
00694                         else if(fdf==0 && af==0 && pf==1 && pn==0)
00695                         {
00696                                 frmt = 2;
00697                         }
00698                         else if(fdf==0 && af==0 && pf==0 && pn==1)
00699                         {
00700                                 frmt = 1;
00701                         }
00702                         else
00703                         {
00704                                 frmt = 0;
00705                         }
00706 
00707                         /* Accept Number of Phasor values in PHNMR */
00708                         phnmr = cfg_info->cfg_phnmr_val;
00709 
00710                         /* Accept Number of Phasor values in ANNMR */
00711                         annmr = cfg_info->cfg_annmr_val;
00712 
00713                         /* Accept Number of Phasor values in DGNMR */
00714                         dgnmr = cfg_info->cfg_dgnmr_val;
00715 
00716                         /* Calculate the total size of CFG Frame */
00717                         cfg2_frm_size = 54 + (16*phnmr) + (16*annmr) + (4*phnmr) + (4*annmr) + (4*dgnmr) + (256*dgnmr);
00718 
00719                         /* Calculate 4/8 bytes for each PHNMR & store globally */
00720                         if (pf == 0)
00721                         {
00722                                 data_frm_size = data_frm_size + (4*phnmr);
00723                         }
00724                         else
00725                         {
00726                                 data_frm_size = data_frm_size + (8*phnmr);
00727                         }
00728 
00729                         /* Calculate 2/4 bytes for each ANNMR & store globally */
00730                         if (af == 0) 
00731                         {
00732                                 data_frm_size = data_frm_size + (2*annmr);
00733                         }
00734                         else
00735                         {
00736                                 data_frm_size = data_frm_size + (4*annmr);
00737                         }
00738 
00739                         /* Calculate 2/4 bytes for both (FREQ + DFREQ) & store globally */
00740                         if (fdf == 0) 
00741                         {                               
00742                                 data_frm_size = data_frm_size + 4;
00743                         }
00744                         else 
00745                         {
00746                                 data_frm_size = data_frm_size + 8;
00747                         }
00748 
00749                         /* Calculate 2 bytes for each DGNMR & store globally */
00750                         data_frm_size = data_frm_size + (2*dgnmr);
00751 
00752                         /* Insert the fields in CFG Frame: sync word */
00753                         memset(cfg2_frm,'\0',sizeof(cfg2_frm));
00754                         cfg2_frm[indx++] = 0xAA; 
00755                         cfg2_frm[indx++] = 0x31; 
00756 
00757                         /* Insert frame size in CFG Frame */
00758                         i2c(cfg2_frm_size, temp);
00759                         B_copy(cfg2_frm, temp, indx, 2);
00760                         indx = indx + 2;
00761 
00762                         /* Insert user given PMU ID in CFG Frame  */
00763                         pmu_id = cfg_info->cfg_pmuID;
00764                         i2c(pmu_id, temp);
00765                         B_copy(cfg2_frm, temp, indx, 2);
00766                         indx = indx + 2;
00767 
00768                         /* Insert SOC value in CFG Frame */                             
00769                         soc = 0;
00770                         li2c(soc, temp_1);
00771                         B_copy(cfg2_frm, temp_1, indx, 4);
00772                         indx = indx + 4;
00773 
00774                         /* Insert the time quality fields & fraction of second value in CFG Frame, right now it is '00000000' */
00775                         li2c(fracsec, temp_1);
00776                         B_copy(cfg2_frm, temp_1, indx, 4);
00777                         indx = indx + 4;
00778 
00779                         /* Insert Time Base for calculating fraction of second in CFG Frame, here it is static 1000000μs */
00780                         li2c(TB, temp_1);
00781                         B_copy(cfg2_frm, temp_1, indx, 4);
00782                         indx = indx + 4;
00783          
00784                         /* Insert number of PMU in CFG Frame: Static "0001" */
00785                         i2c(num_pmu, temp);
00786                         B_copy(cfg2_frm, temp, indx, 2);
00787                         indx = indx + 2;
00788 
00789                         /* Insert the station name or PMU name in CFG Frame */
00790                         strncpy(temp_5, (const char *)cfg_info->cfg_STNname, 16);
00791                         B_copy(cfg2_frm, (unsigned char *)temp_5, indx, 16);
00792                         indx = indx + 16;
00793 
00794                         /* Again insert pmu id in CFG Frame */                                  
00795                         i2c(pmu_id, temp);
00796                         B_copy(cfg2_frm, temp, indx, 2);
00797                         indx = indx + 2;
00798 
00799                         /* Insert format word in CFG Frame */
00800                         i2c(frmt, temp);
00801                         B_copy(cfg2_frm, temp, indx, 2);
00802                         indx = indx + 2;
00803 
00804                         /* Insert number of phasor or PHNMR in CFG Frame */
00805                         i2c(phnmr, temp);
00806                         B_copy(cfg2_frm, temp, indx, 2);
00807                         indx = indx + 2;
00808 
00809                         /* Insert number of analog or ANNMR in CFG Frame */
00810                         i2c(annmr, temp);
00811                         B_copy(cfg2_frm, temp, indx, 2);
00812                         indx = indx + 2;
00813 
00814                         /* Insert number of Digital status word or DGNMR in CFG Frame */
00815                         i2c(dgnmr, temp);
00816                         B_copy(cfg2_frm, temp, indx, 2);
00817                         indx = indx + 2;
00818 
00819                         /* All channel names or CHNAM fields in CFG frame. */
00820                         /* Insert phasor channel names in CFG frame */
00821                         B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_phasor_channels, indx, 16*phnmr);
00822                         indx = indx + 16*phnmr;
00823 
00824                         /* Insert Digital channel names in CFG frame */
00825                         B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_analog_channels, indx, 16*annmr);
00826                         indx = indx + 16*annmr;
00827 
00828                         /* Insert Digital channel names in CFG frame */
00829                         B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_digital_channels, indx, 16*16*dgnmr);
00830                         indx = indx + 16*16*dgnmr;
00831 
00832                         /* Insert FACTOR VALUES for Phasor, Analog and Digital in CFG frame */
00833                         for(j=0; j<phnmr; j++)                  /* FACTOR VALUES for Phasor */
00834                         {
00835                                 li2c(phunit, temp_1);
00836                                 B_copy(cfg2_frm, temp_1, indx, 4);
00837                                 indx = indx + 4;
00838                         }
00839                         for(j=0; j<annmr; j++)                  /* FACTOR VALUES for Analog */
00840                         {
00841                                 li2c(anunit, temp_1);
00842                                 B_copy(cfg2_frm, temp_1, indx, 4);
00843                                 indx = indx + 4;
00844                         }
00845                         for(j=0; j< dgnmr; j++)                 /* FACTOR VALUES for Digital */
00846                         {
00847                                 li2c(digunit, temp_1);
00848                                 B_copy(cfg2_frm, temp_1, indx, 4);
00849                                 indx = indx + 4;
00850                         }
00851 
00852                         /* Insert normal frequency or fnom VALUE in CFG frame */
00853                         i2c(fnom, temp);
00854                         B_copy(cfg2_frm, temp, indx, 2);
00855                         indx = indx + 2;
00856 
00857                         /* Insert configuration count or cfgcnt VALUE in CFG frame */
00858                         i2c(cfgcnt, temp);
00859                         B_copy(cfg2_frm, temp, indx, 2);
00860                         indx = indx + 2;
00861 
00862                         /* Insert Data Rate in CFG frame */
00863                         data_rate = cfg_info->cfg_dataRate;
00864                         i2c(data_rate, temp);
00865                         B_copy(cfg2_frm, temp, indx, 2);
00866                         indx = indx + 2;
00867 
00868                         /* Insert current SOC value in CFG Frame */                             
00869                         time_t tm = time(NULL);
00870                         soc = tm;
00871                         li2c(soc, temp_1);
00872                         B_copy(cfg2_frm, temp_1, 6, 4);
00873 
00874                         /* Insert the time quality fields & fraction of second value in CFG Frame */
00875                         gettimeofday(&tim, NULL);
00876                         t1=tim.tv_sec+(tim.tv_usec/1000000.0);
00877                         fracsec = (t1-soc)*100000;
00878                         li2c(fracsec, temp_1);
00879                         B_copy(cfg2_frm, temp_1, 10, 4);
00880 
00881                         /* Calculation & insert the checksum VALUE of new CFG frame (up to now) */
00882                         chk = compute_CRC(cfg2_frm,indx);
00883                         cfg2_frm[indx++] = (chk >> 8) & ~(~0<<8);       /* CHKSUM high byte */
00884                         cfg2_frm[indx++] = (chk ) & ~(~0<<8);           /* CHKSUM low byte  */
00885 
00886                         /* Create/Open the 'cfg2.bin' file to Write the generated configuration frame */
00887                         file_1 = fopen (filename_1,"wb");
00888                         {   
00889                                 fwrite(cfg2_frm, sizeof(unsigned char), indx, file_1);
00890                         }
00891                         fclose (file_1);
00892 
00893                         /* Write the '0' in "change.bin" file to ensure that this is brand new configuration frame */
00894                         file_1 = fopen (filename_2,"w");
00895                         {   
00896                                 fprintf(file_1, "%s", "0");
00897                         }
00898                         fclose (file_1);
00899   
00900                         printf("\nCFG Frame size = %d, ", cfg2_frm_size);
00901                         printf("& Data Frame size = %d.\n\n", data_frm_size);
00902 
00903                         /* Print the Newly generated Configuration Frame */
00904                         printf("\n[");
00905                         for(j=0; j<indx; j++)
00906                         {
00907                                 printf("%x",cfg2_frm[j]);
00908                         }
00909                         printf("], %d\n", indx);
00910                 }
00911                 return 0;
00912         } /* end of function() */

Here is the call graph for this function:

Here is the caller graph for this function:

void header_frm_gen ( int  len  ) 

Definition at line 80 of file CfgFunction.c.

References B_copy(), chk, compute_CRC(), fracsec, hdr_frame, i, i2c(), indx, li2c(), MAX_STRING_SIZE, pmu_id, soc, t1, temp, temp_1, tim, and validation_result().

Referenced by validation_hdr_frm().

00081         {
00082                 /* local variables */
00083                 int i, indx = 0;
00084                 unsigned char header[MAX_STRING_SIZE];
00085                 static const char filename_1[] = "header.bin";
00086                 FILE *file_1;
00087         
00088                 memset(header, '\0', sizeof(header));
00089          
00090                 /* Insert the fields in Header Frame: sync word */
00091                 header[indx++] = 0xAA; 
00092                 header[indx++] = 0x001; 
00093         
00094                 /* Insert frame size in Header Frame */
00095                 i2c(0, temp);
00096                 B_copy(header, temp, indx, 2);
00097                 indx = indx + 2;
00098 
00099                 /* Insert user given PMU ID in Header Frame  */
00100                 i2c(pmu_id, temp);
00101                 B_copy(header, temp, indx, 2);
00102                 indx = indx + 2;
00103 
00104                 /* Insert current SOC value in Header Frame */                          
00105                 time_t tm = time(NULL);
00106                 soc = tm;
00107                 li2c(soc, temp_1);
00108                 B_copy(header, temp_1, indx, 4);
00109                 indx = indx + 4;
00110 
00111                 /* Insert the time quality fields & fraction of second value in Header Frame */
00112                 gettimeofday(&tim, NULL);
00113                 t1=tim.tv_sec+(tim.tv_usec/1000000.0);
00114                 fracsec = (t1-soc)*100000;
00115                 li2c(fracsec, temp_1);
00116                 B_copy(header, temp_1, indx, 4);
00117                 indx = indx + 4;
00118  
00119                 /* Insert the PMU Information given by user in Header Frame */                                  
00120                 for (i = 0; i < len; i++)
00121                 {
00122                         header[indx+i] = hdr_frame[i];
00123                 }
00124                 indx = indx + i;
00125 
00126                 /* Calculation & insert the checksum VALUE of Header frame (up to now) */
00127                 chk = compute_CRC(header,indx);
00128                 header[indx++] = (chk >> 8) & ~(~0<<8);         /* CHKSUM high byte */
00129                 header[indx++] = (chk ) & ~(~0<<8);             /* CHKSUM low byte */
00130 
00131                 /* Insert frame size in Header Frame */
00132                 header[2] = indx>>8;;
00133                 header[3] = indx;
00134 
00135                 file_1 = fopen (filename_1,"wb");
00136                 {   
00137                         /* Write the complete Header Frame into file */
00138                         fwrite(header, sizeof(unsigned char), indx, file_1);
00139                 }
00140                 fclose (file_1);
00141 
00142                 printf("\n-> Size of Header frame is %d Bytes.", indx);
00143                 validation_result ("\t\tHeadre Frame successfully generated.\t\t\n");
00144         }; /* end of header_frm_gen() */   

Here is the call graph for this function:

Here is the caller graph for this function:

void reconfig_cfg_CC (  ) 

Definition at line 157 of file CfgFunction.c.

References ConfigurationChange::add_remove_choice, annmr, anunit, B_copy(), cfg2_frm, cfg2_frm_size, ConfigurationFrame::cfg_af, ConfigurationFrame::cfg_analog_channels, ConfigurationFrame::cfg_annmr_val, ConfigurationFrame::cfg_dataRate, ConfigurationFrame::cfg_dgnmr_val, ConfigurationFrame::cfg_digital_channels, ConfigurationFrame::cfg_fdf, cfg_info, ConfigurationFrame::cfg_pf, ConfigurationFrame::cfg_phasor_channels, ConfigurationFrame::cfg_phnmr_val, ConfigurationFrame::cfg_STNname, cfgcnt, chk, compute_CRC(), data_frm_size, data_rate, ConfigurationChange::data_rate_choice, dgnmr, digunit, fnom, fracsec, frmt, global_data_frm_size, i2c(), indx, j, li2c(), ConfigurationChange::new_cfg_analog_channels, ConfigurationChange::new_cfg_annmr_val, new_cfg_info, ConfigurationChange::new_cfg_phasor_channels, ConfigurationChange::new_cfg_phnmr_val, ConfigurationChange::new_data_rate, num_pmu, old_data_rate, phnmr, phunit, pmu_id, soc, t1, TB, temp, temp_1, tim, and validation_result().

Referenced by final_cfg_update_call(), and validation_new_data_rate().

00158         {
00159                 /* local Variables*/
00160                 int old_data_rate, indx=2;                      
00161                 int j, global_frmt;        
00162                 unsigned char stn[16];
00163                 static const char filename_1[] = "cfg2.bin";
00164                 static const char filename_2[] = "change.bin";
00165                 FILE *file_1;
00166 
00167                 /* Get the Station name from CFG FRM */
00168                 memset(stn, '\0', 16);
00169                 strncpy((char *)stn, cfg_info->cfg_STNname, 16);
00170 
00171                 /* Get the FORMAT word from CFG FRM */
00172                 global_frmt = frmt;
00173 
00174                 /* Ask user's choice what type of modification he wants? */
00175                 if(new_cfg_info->add_remove_choice == 1)        /* Add more Phasor/Analog channels in existing CFG as per user's wish */
00176                 {
00177                         phnmr = cfg_info->cfg_phnmr_val + new_cfg_info->new_cfg_phnmr_val;
00178                         annmr = cfg_info->cfg_annmr_val + new_cfg_info->new_cfg_annmr_val;
00179                 }
00180                 else if(new_cfg_info->add_remove_choice == 2)   /* Remove Phasor/Analog channels from existing CFG as per user's wish */
00181                 {
00182                         phnmr = cfg_info->cfg_phnmr_val - new_cfg_info->new_cfg_phnmr_val;
00183                         annmr = cfg_info->cfg_annmr_val - new_cfg_info->new_cfg_annmr_val;
00184                 }
00185 
00186                 /* Calculate the size of new CFG Frame */
00187                 cfg2_frm_size = 0;
00188                 cfg2_frm_size = 54 + (16*phnmr) + (16*annmr) + (256*dgnmr) + (4*phnmr) + (4*annmr) + (4*dgnmr);
00189 
00190                 /* Calculate the corresponding data frame size */
00191                 global_data_frm_size = data_frm_size;
00192                 data_frm_size = 0;
00193                 data_frm_size = 18;
00194 
00195                 /* Calculate 4/8 bytes for each PHNMR */
00196                 if (cfg_info->cfg_pf == 0) 
00197                 {
00198                         data_frm_size = data_frm_size + (4*phnmr);
00199                 }
00200                 else 
00201                 {
00202                         data_frm_size = data_frm_size + (8*phnmr);
00203                 }
00204 
00205                 /* Calculate 2/4 bytes for each ANNMR */
00206                 if (cfg_info->cfg_af == 0) 
00207                 {
00208                         data_frm_size = data_frm_size + (2*annmr);
00209                 }
00210                 else 
00211                 {
00212                         data_frm_size = data_frm_size + (4*annmr);
00213                 }
00214 
00215                 /* Calculate 2/4 bytes for both (FREQ + DFREQ) */
00216                 if (cfg_info->cfg_fdf == 0) 
00217                 {                               
00218                         data_frm_size = data_frm_size + 4;
00219                 }
00220                 else 
00221                 {
00222                         data_frm_size = data_frm_size + 8;
00223                 }
00224 
00225                 /* Calculate 2 bytes for each DGNMR */
00226                 data_frm_size = data_frm_size + (2*dgnmr);
00227                 printf("\nCFG = %d, Data Frame = %d\n", cfg2_frm_size, data_frm_size);
00228 
00229                 /* Insert the fields in new CFG Frame: sync word */
00230                 memset(cfg2_frm,'\0',sizeof(cfg2_frm));
00231                 indx = 0;
00232                 cfg2_frm[indx++] = 0xAA; 
00233                 cfg2_frm[indx++] = 0x31; 
00234 
00235                 /* Insert frame size in new CFG Frame */
00236                 i2c(cfg2_frm_size, temp);
00237                 B_copy(cfg2_frm, temp, indx, 2);
00238                 indx = indx + 2;
00239 
00240                 /* Insert user given PMU ID in new CFG Frame  */
00241                 i2c(pmu_id, temp);
00242                 B_copy(cfg2_frm, temp, indx, 2);
00243                 indx = indx + 2;
00244 
00245                 /* Insert current SOC value in new CFG Frame */                         
00246                 soc = 0;
00247                 li2c(soc, temp_1);
00248                 B_copy(cfg2_frm, temp_1, indx, 4);
00249                 indx = indx + 4;
00250 
00251                 /* Insert the time quality fields & fraction of second value in new CFG Frame, here it is static "00000000" */
00252                 li2c(fracsec, temp_1);
00253                 B_copy(cfg2_frm, temp_1, indx, 4);
00254                 indx = indx + 4;
00255 
00256                 /* Insert Time Base for calculating fraction of second in new CFG Frame, here it is static 1000000μs */
00257                 li2c(TB, temp_1);
00258                 B_copy(cfg2_frm, temp_1, indx, 4);
00259                 indx = indx + 4;
00260                  
00261                 /* Insert number of PMU in new CFG Frame: static "0001" */
00262                 i2c(num_pmu, temp);
00263                 B_copy(cfg2_frm, temp, indx, 2);
00264                 indx = indx + 2;
00265 
00266                 /* Insert the station name or PMU name in new CFG Frame */
00267                 B_copy(cfg2_frm, stn, indx, 16);
00268                 indx = indx + 16;
00269 
00270                 /* Insert again pmu id in new CFG Frame */                                      
00271                 i2c(pmu_id, temp);
00272                 B_copy(cfg2_frm, temp, indx, 2);
00273                 indx = indx + 2;
00274 
00275                 /* Insert format word in new CFG Frame */
00276                 i2c(global_frmt, temp);
00277                 B_copy(cfg2_frm, temp, indx, 2);
00278                 indx = indx + 2;
00279 
00280                 /* Insert number of phasor or PHNMR in new CFG Frame */
00281                 i2c(phnmr, temp);
00282                 B_copy(cfg2_frm, temp, indx, 2);
00283                 indx = indx + 2;
00284 
00285                 /* Insert number of analog or ANNMR in new CFG Frame */
00286                 i2c(annmr, temp);
00287                 B_copy(cfg2_frm, temp, indx, 2);
00288                 indx = indx + 2;
00289 
00290                 /* Insert number of Digital status word or DGNMR in new CFG Frame */
00291                 i2c(dgnmr, temp);
00292                 B_copy(cfg2_frm, temp, indx, 2);
00293                 indx = indx + 2;
00294 
00295                 /* Insert NEW Phasor channel Names (if any) in new CFG frame */ 
00296                 if (new_cfg_info->add_remove_choice == 1)
00297                 {
00298                         /* First Insert old Phasor channels in new CFG frame */
00299                         B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_phasor_channels, indx, cfg_info->cfg_phnmr_val*16);
00300                         indx = indx + (cfg_info->cfg_phnmr_val*16);
00301 
00302                         if (new_cfg_info->new_cfg_phnmr_val > 0)
00303                         {
00304                                 /* Insert New Phasor channels (if any) in new CFG frame */
00305                                 B_copy(cfg2_frm, (unsigned char *)new_cfg_info->new_cfg_phasor_channels, indx, (new_cfg_info->new_cfg_phnmr_val*16));
00306                                 indx = indx + (new_cfg_info->new_cfg_phnmr_val*16);
00307                                 free(new_cfg_info->new_cfg_phasor_channels);
00308                         }
00309                         cfg_info->cfg_phnmr_val = cfg_info->cfg_phnmr_val + new_cfg_info->new_cfg_phnmr_val;
00310                         
00311                         /* First Insert old Analog channels in new CFG frame */
00312                         B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_analog_channels, indx, cfg_info->cfg_annmr_val*16);
00313                         indx = indx + (cfg_info->cfg_annmr_val*16);
00314                         if (new_cfg_info->new_cfg_annmr_val > 0)
00315                         {
00316                                 /* Insert New Analog channels (if any) in new CFG frame */
00317                                 B_copy(cfg2_frm, (unsigned char *)new_cfg_info->new_cfg_analog_channels, indx, (new_cfg_info->new_cfg_annmr_val*16));
00318                                 indx = indx + (new_cfg_info->new_cfg_annmr_val*16);
00319                                 free(new_cfg_info->new_cfg_analog_channels);
00320                         }
00321                         cfg_info->cfg_annmr_val = cfg_info->cfg_annmr_val + new_cfg_info->new_cfg_annmr_val;
00322                 }
00323 
00324                 /* Remove channel Names (from availables) from new CFG frame */ 
00325                 else if (new_cfg_info->add_remove_choice == 2)
00326                 {
00327                         /* Remove Phasor channels (if any) in new CFG frame */ 
00328                         cfg_info->cfg_phnmr_val = cfg_info->cfg_phnmr_val - new_cfg_info->new_cfg_phnmr_val;
00329                         B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_phasor_channels, indx, cfg_info->cfg_phnmr_val*16);
00330                         indx = indx + (cfg_info->cfg_phnmr_val*16);                     
00331                         
00332                         /* Remove Analog channels (if any) in new CFG frame */ 
00333                         cfg_info->cfg_annmr_val = cfg_info->cfg_annmr_val - new_cfg_info->new_cfg_annmr_val;
00334                         B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_analog_channels, indx, cfg_info->cfg_annmr_val*16);
00335                         indx = indx + (cfg_info->cfg_annmr_val*16);
00336                 }
00337 
00338                 /* Insert Digital channel Names in new CFG frame */
00339                 B_copy(cfg2_frm, (unsigned char *)cfg_info->cfg_digital_channels, indx, (cfg_info->cfg_dgnmr_val*256));
00340                 indx = indx + (cfg_info->cfg_dgnmr_val*256);
00341 
00342                 /* Insert FACTOR VALUES for Phasor, Analog and Digital in new CFG frame */
00343                 for(j=0; j<cfg_info->cfg_phnmr_val; j++)                /* FACTOR VALUES for Phasor */
00344                 {
00345                         li2c(phunit, temp_1);
00346                         B_copy(cfg2_frm, temp_1, indx, 4);
00347                         indx = indx + 4;
00348                 }
00349                 for(j=0; j<cfg_info->cfg_annmr_val; j++)                /* FACTOR VALUES for Analog */
00350                 {
00351                         li2c(anunit, temp_1);
00352                         B_copy(cfg2_frm, temp_1, indx, 4);
00353                         indx = indx + 4;
00354                 }
00355                 for(j=0; j<cfg_info->cfg_dgnmr_val; j++)                /* FACTOR VALUES for Digital */
00356                 {
00357                         li2c(digunit, temp_1);
00358                         B_copy(cfg2_frm, temp_1, indx, 4);
00359                         indx = indx + 4;
00360                 }
00361 
00362                 /* Insert normal frequency or fnom VALUE in new CFG frame */
00363                 i2c(fnom, temp);
00364                 B_copy(cfg2_frm, temp, indx, 2);
00365                 indx = indx + 2;
00366 
00367                 /* Data rate change? option for user */
00368                 old_data_rate = data_rate;
00369                 if (new_cfg_info->data_rate_choice == 1)
00370                 {
00371                         data_rate = new_cfg_info->new_data_rate;
00372                         cfg_info->cfg_dataRate = new_cfg_info->new_data_rate;                   
00373                         printf("\n-> Data Rate Changed = %d\n", data_rate);
00374                 }
00375                                         
00376                 /* Insert configuration count or cfgcnt VALUE in new CFG frame is any of addition or removal of channel happened??? */
00377                 if ((global_data_frm_size != data_frm_size) || (old_data_rate != data_rate)) 
00378                 {
00379                     cfgcnt = cfgcnt + 1;
00380                     printf("\n-> CFG COUNT incremented = %d\n", cfgcnt);
00381                     i2c(cfgcnt, temp);
00382                     B_copy(cfg2_frm, temp, indx, 2);
00383                     indx = indx + 2;
00384                 }
00385                 else
00386                 { 
00387                     i2c(cfgcnt, temp);
00388                     B_copy(cfg2_frm, temp, indx, 2);
00389                     indx = indx + 2;
00390                 }
00391 
00392                 /* Insert Data Rate VALUE in new CFG frame */
00393                 i2c(data_rate, temp);
00394                 B_copy(cfg2_frm, temp, indx, 2);
00395                 indx = indx + 2;
00396 
00397                 /* Insert current SOC value in new CFG Frame */                         
00398                 time_t tm = time(NULL);
00399                 soc = tm;
00400                 li2c(soc, temp_1);
00401                 B_copy(cfg2_frm, temp_1, 6, 4);
00402 
00403                 /* Insert the time quality fields & fraction of second value in new CFG Frame */
00404                 gettimeofday(&tim, NULL);
00405                 t1=tim.tv_sec+(tim.tv_usec/1000000.0);
00406                 fracsec = (t1-soc)*100000;
00407                 li2c(fracsec, temp_1);
00408                 B_copy(cfg2_frm, temp_1, 10, 4);
00409 
00410                 /* Calculation & insert the checksum VALUE of new CFG frame (up to now) */
00411                 chk = compute_CRC(cfg2_frm,indx);
00412                 cfg2_frm[indx++] = (chk >> 8) & ~(~0<<8);       /* CHKSUM high byte */
00413                 cfg2_frm[indx++] = (chk ) & ~(~0<<8);           /* CHKSUM low byte */
00414 
00415                 /* Open the 'cfg2.bin' file and overwrite new CFG frame if and only if when last two calculated data frame are not equal or data rate changed */ 
00416                 if ((global_data_frm_size != data_frm_size) || (old_data_rate != data_rate)) 
00417                 {
00418                         file_1 = fopen (filename_1,"wb");
00419                         {   
00420                                 fwrite(cfg2_frm, sizeof(unsigned char), indx, file_1);
00421                         }
00422                         fclose (file_1);
00423 
00424                         /* Write the word 5 in "change.bin" file to ensure that this is brand new configuration frame */
00425                         file_1 = fopen (filename_2,"w");
00426                         {   
00427                                 fprintf(file_1, "%s", "5");
00428                         }
00429                         fclose (file_1);
00430 
00431                         free(new_cfg_info);
00432                         validation_result ("Modification in Configuration frame successfully updated.");
00433                 }
00434                 else            /* If CFG is not modified */
00435                 {
00436                         validation_result ("No modification has been done in Configuration frame.");
00437                 }
00438 
00439                 printf("\n-> CFG Size = %d Bytes. And Data Frame = %d Bytes.\n\n[", cfg2_frm_size, data_frm_size);
00440                 for(j=0; j<indx; j++)
00441                 {
00442                         printf("%x",cfg2_frm[j]);
00443                 }
00444                 printf("], %d\n", indx);
00445         } /* end of reconfig_cfg_CC() */

Here is the call graph for this function:

Here is the caller graph for this function:

void show_pmu_details ( GtkWidget *  widget,
gpointer  udata 
)

Definition at line 921 of file CfgFunction.c.

References cfg2_frm_size, ConfigurationFrame::cfg_annmr_val, ConfigurationFrame::cfg_dataRate, ConfigurationFrame::cfg_dgnmr_val, cfg_info, ConfigurationFrame::cfg_phnmr_val, ConfigurationFrame::cfg_pmuID, ConfigurationFrame::cfg_STNname, cfgcnt, frmt, and markup1.

Referenced by main().

00922         {
00923                 /* local variables */
00924                 char tmpBuffer[30];
00925                 GtkWidget *new_window, *scrolled_window;
00926                 GtkWidget *label, *table, *close_but;
00927 
00928                 /* Create a new dialog window for the scrolled window to be packed into */                              
00929                 new_window = gtk_dialog_new ();
00930                 g_signal_connect (new_window, "destroy", G_CALLBACK (gtk_widget_destroy), new_window);
00931                 gtk_window_set_title (GTK_WINDOW (new_window), "PMU Simulator");
00932                 gtk_container_set_border_width (GTK_CONTAINER (new_window), 10);
00933                 gtk_widget_set_size_request (new_window, 400, 500);
00934                  
00935                 /* Create a new scrolled window */
00936                 scrolled_window = gtk_scrolled_window_new (NULL, NULL);
00937                 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
00938 
00939                 /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. GTK_POLICY_AUTOMATIC will automatically decide whether you need scrollbars,
00940                    whereas GTK_POLICY_ALWAYS will always leave the scrollbars there. The first one is the horizontal scrollbar, the second is vertical. */
00941                 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
00942 
00943                 /* The dialog window is created with a vbox packed into it */                                                           
00944                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(new_window)->vbox), scrolled_window, TRUE, TRUE, 0);
00945                 gtk_widget_show (scrolled_window);
00946 
00947                 /* Create a table of 14 by 2 squares. */
00948                 table = gtk_table_new (14, 2, FALSE);
00949             
00950                 /* Set the spacing to 35 on x and 25 on y */
00951                 gtk_table_set_row_spacings (GTK_TABLE (table), 35);
00952                 gtk_table_set_col_spacings (GTK_TABLE (table), 25);
00953             
00954                 /* Pack the table into the scrolled window */
00955                 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table);
00956                 gtk_widget_show (table);
00957 
00958                 /* Add a "OK" button to the bottom of the dialog */
00959                 close_but = gtk_button_new_with_label ("OK");
00960             
00961                 /* This simply creates a grid of toggle buttons on the table to demonstrate the scrolled window */
00962                 label = gtk_label_new (" ");
00963                 markup1 = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>PMU SERVER Details</b></span>");
00964                 gtk_label_set_markup (GTK_LABEL (label), markup1);
00965                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 0, 1);
00966                 gtk_widget_show (label);
00967                 g_free (markup1);
00968          
00969                 label = gtk_label_new ("Server Port                  ");
00970                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
00971                 gtk_widget_show (label);
00972          
00973                 label = gtk_label_new ("Protocol                     ");
00974                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
00975                 gtk_widget_show (label);
00976 
00977                 /* Open the file 'pdc.txt' in read mode */
00978                 FILE *file_1 = fopen ("PmuServer.txt","r");
00979                 if (file_1 != NULL)
00980                 {
00981                         char *p1, *p2;
00982 
00983                         /* If file is present initialize the global varialbes by details in file */
00984                         memset(tmpBuffer,'\0',30);
00985                         fgets (tmpBuffer, 30, file_1);
00986                         p1 = strtok (tmpBuffer," "); 
00987                         p2 = strtok (NULL," "); 
00988 
00989                         label = gtk_label_new (p1);
00990                         gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 1, 2);
00991                         gtk_widget_show (label);
00992 
00993                         label = gtk_label_new (p2);
00994                         gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 2, 3);
00995                         gtk_widget_show (label);
00996                 }
00997                 
00998                 label = gtk_label_new (" ");
00999                 markup1 = g_markup_printf_escaped ("<span foreground=\"#33AAFF\" font='12'><b>--------</b></span>");
01000                 gtk_label_set_markup (GTK_LABEL (label), markup1);
01001                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
01002                 gtk_widget_show (label);
01003                 g_free (markup1);
01004 
01005                 label = gtk_label_new (" ");
01006                 markup1 = g_markup_printf_escaped ("<span foreground=\"#33AAFF\" font='12'><b>--------</b></span>");
01007                 gtk_label_set_markup (GTK_LABEL (label), markup1);
01008                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 3, 4);
01009                 gtk_widget_show (label);
01010                 g_free (markup1);
01011 
01012 
01013                 /* This simply creates a grid of toggle buttons on the table to demonstrate the scrolled window */
01014                 label = gtk_label_new (" ");
01015                 markup1 = g_markup_printf_escaped ("<span foreground=\"#990033\" font='12'><b>PMU Configuration Details</b></span>");
01016                 gtk_label_set_markup (GTK_LABEL (label), markup1);
01017                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 2, 4, 5);
01018                 gtk_widget_show (label);
01019                 g_free (markup1);
01020          
01021                 label = gtk_label_new ("PMU ID                  ");
01022                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6);
01023                 gtk_widget_show (label);
01024          
01025                 label = gtk_label_new ("Station Name          ");
01026                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 6, 7);
01027                 gtk_widget_show (label);
01028 
01029                 label = gtk_label_new ("Number of Phasors");
01030                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 7, 8);
01031                 gtk_widget_show (label);
01032 
01033                 label = gtk_label_new ("Number of Analog ");
01034                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 8, 9);
01035                 gtk_widget_show (label);
01036          
01037                 label = gtk_label_new ("Digital Status Word");
01038                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 9, 10);
01039                 gtk_widget_show (label);
01040 
01041                 label = gtk_label_new ("Data Rate               ");
01042                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 10, 11);
01043                 gtk_widget_show (label);
01044 
01045                 label = gtk_label_new ("Format Word            ");
01046                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 11, 12);
01047                 gtk_widget_show (label);
01048 
01049                 label = gtk_label_new ("Configuration Count ");
01050                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 12, 13);
01051                 gtk_widget_show (label);
01052 
01053                 label = gtk_label_new ("CFG Frame Size     ");
01054                 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 13, 14);
01055                 gtk_widget_show (label);
01056          
01057 
01058                 memset(tmpBuffer,'\0',30);
01059                 sprintf(tmpBuffer,"%d",cfg2_frm_size);
01060                 label = gtk_label_new (tmpBuffer);
01061                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 13, 14);
01062                 gtk_widget_show (label);
01063 
01064                 memset(tmpBuffer,'\0',30);
01065                 sprintf(tmpBuffer,"%d",cfg_info->cfg_pmuID);
01066                 label = gtk_label_new (tmpBuffer);
01067                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 5, 6);
01068                 gtk_widget_show (label);
01069 
01070                 memset(tmpBuffer,'\0',30);
01071                 label = gtk_label_new (cfg_info->cfg_STNname);
01072                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 6, 7);
01073                 gtk_widget_show (label);
01074 
01075                 memset(tmpBuffer,'\0',30);
01076                 sprintf(tmpBuffer,"%d",frmt);
01077                 label = gtk_label_new (tmpBuffer);
01078                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 11, 12);
01079                 gtk_widget_show (label);
01080 
01081                 memset(tmpBuffer,'\0',30);
01082                 sprintf(tmpBuffer,"%d",cfg_info->cfg_phnmr_val);
01083                 label = gtk_label_new (tmpBuffer);
01084                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 7, 8);
01085                 gtk_widget_show (label);
01086                         
01087                 memset(tmpBuffer,'\0',30);
01088                 sprintf(tmpBuffer,"%d",cfg_info->cfg_annmr_val);
01089                 label = gtk_label_new (tmpBuffer);
01090                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 8, 9);
01091                 gtk_widget_show (label);
01092 
01093                 memset(tmpBuffer,'\0',30);
01094                 sprintf(tmpBuffer,"%d",cfg_info->cfg_dgnmr_val);
01095                 label = gtk_label_new (tmpBuffer);
01096                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 9, 10);
01097                 gtk_widget_show (label);
01098 
01099                 memset(tmpBuffer,'\0',30);
01100                 sprintf(tmpBuffer,"%d",cfgcnt);
01101                 label = gtk_label_new (tmpBuffer);
01102                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 12, 13);
01103                 gtk_widget_show (label);
01104 
01105                 memset(tmpBuffer,'\0',30);
01106                 sprintf(tmpBuffer,"%d",cfg_info->cfg_dataRate);
01107                 label = gtk_label_new (tmpBuffer);
01108                 gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 10, 11);
01109                 gtk_widget_show (label);
01110 
01111                 /* Signal handling for OK-button on dialog Window */
01112                 g_signal_connect_swapped (close_but, "clicked", G_CALLBACK (gtk_widget_destroy), new_window);
01113     
01114                 /* This makes it so the button is the default */
01115                 gtk_widget_set_can_default (close_but, TRUE);
01116                 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (new_window)->action_area), close_but, TRUE, TRUE, 0);
01117             
01118                 /* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
01119                 gtk_widget_grab_default (close_but);
01120                 gtk_widget_show (close_but);
01121 
01122                 /* Finally show the PMU Detailed window or new_window */
01123                 gtk_widget_show (new_window);
01124         };

Here is the caller graph for this function:


Variable Documentation

char* hdr_frame

Definition at line 38 of file CfgFunction.h.

Referenced by header_frm_gen(), and validation_hdr_frm().

char * markup1

Definition at line 38 of file CfgFunction.h.

Referenced by show_pmu_details().

Generated on Tue Jun 7 13:42:46 2011 for PMUSimulator by  doxygen 1.6.3