First Version

Dependencies:   EthernetInterface mbed-rtos mbed

Committer:
rebonatto
Date:
Mon Mar 07 19:20:49 2016 +0000
Revision:
3:94a128e0f316
Parent:
0:9df41090ba33
Vers?o est?vel com nova forma de aquisi??o de valores e limpeza de c?digo desnecess?rio.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rebonatto 0:9df41090ba33 1 /*
rebonatto 0:9df41090ba33 2 * Settings.cpp
rebonatto 0:9df41090ba33 3 *
rebonatto 0:9df41090ba33 4 * Created on:
rebonatto 0:9df41090ba33 5 * Author:
rebonatto 0:9df41090ba33 6 */
rebonatto 0:9df41090ba33 7
rebonatto 0:9df41090ba33 8 #include "Settings.h"
rebonatto 0:9df41090ba33 9
rebonatto 0:9df41090ba33 10 LocalFileSystem local("local");
rebonatto 0:9df41090ba33 11
rebonatto 0:9df41090ba33 12 char* Settings::m_ipaddress = NULL;
rebonatto 0:9df41090ba33 13 char* Settings::m_netmask = NULL;
rebonatto 0:9df41090ba33 14 char* Settings::m_gateway = NULL;
rebonatto 0:9df41090ba33 15 char* Settings::m_serverurl = NULL;
rebonatto 0:9df41090ba33 16 int Settings::m_dhcp = 0;
rebonatto 0:9df41090ba33 17 int Settings::m_module_number = 0;
rebonatto 0:9df41090ba33 18 int Settings::m_MaxChannels = 0;
rebonatto 0:9df41090ba33 19 int Settings::m_MaxOutlets = 0;
rebonatto 0:9df41090ba33 20 int Settings::m_FreqBase = 0;
rebonatto 0:9df41090ba33 21 int Settings::m_MaxHarmonics = 0;
rebonatto 0:9df41090ba33 22 int Settings::m_Samples = 0;
rebonatto 0:9df41090ba33 23 int Settings::m_EventLimit = 0;
rebonatto 0:9df41090ba33 24 int Settings::m_MBoxLength = 0;
rebonatto 0:9df41090ba33 25 int Settings::m_NumNeighbors = 0;
rebonatto 0:9df41090ba33 26 int Settings::m_PortTCP = 0;
rebonatto 0:9df41090ba33 27 int Settings::m_MaxTries = 0;
rebonatto 0:9df41090ba33 28 int Settings::m_DelayTry = 0;
rebonatto 0:9df41090ba33 29 int Settings::m_DelaySend = 0;
rebonatto 0:9df41090ba33 30
rebonatto 0:9df41090ba33 31
rebonatto 0:9df41090ba33 32 TCPSocketServer Settings::m_ServerSocket;
rebonatto 0:9df41090ba33 33 TCPSocketConnection Settings::m_Socket[NEIGHBORS];
rebonatto 0:9df41090ba33 34
rebonatto 0:9df41090ba33 35 float Settings::m_gain[NUMBER_OF_CHANNELS];
rebonatto 0:9df41090ba33 36 int Settings::m_offset[NUMBER_OF_CHANNELS];
rebonatto 0:9df41090ba33 37 float Settings::m_limit[NUMBER_OF_CHANNELS];
rebonatto 0:9df41090ba33 38 int Settings::m_outlet_number[NUMBER_OF_CHANNELS];
rebonatto 0:9df41090ba33 39 char Settings::m_purpose[NUMBER_OF_CHANNELS];
rebonatto 0:9df41090ba33 40 int Settings::m_outlet[NUMBER_OF_OUTLETS];
rebonatto 0:9df41090ba33 41 char *Settings::m_Neighbor[NEIGHBORS];
rebonatto 0:9df41090ba33 42
rebonatto 0:9df41090ba33 43 void Settings::LoadDefaults()
rebonatto 0:9df41090ba33 44 {
rebonatto 0:9df41090ba33 45 set_ServerUrl("192.168.1.26");
rebonatto 0:9df41090ba33 46
rebonatto 0:9df41090ba33 47 set_IpAddress("192.168.1.100");
rebonatto 0:9df41090ba33 48
rebonatto 0:9df41090ba33 49 set_Netmask("255.255.255.0");
rebonatto 0:9df41090ba33 50 set_Gateway("192.168.1.5");
rebonatto 0:9df41090ba33 51
rebonatto 0:9df41090ba33 52 set_Dhcp(1);
rebonatto 0:9df41090ba33 53
rebonatto 0:9df41090ba33 54 set_ModuleNumber(1);
rebonatto 0:9df41090ba33 55 set_MaxChannels(NUMBER_OF_CHANNELS);
rebonatto 0:9df41090ba33 56 set_MaxOutlets(NUMBER_OF_OUTLETS);
rebonatto 0:9df41090ba33 57 set_FreqBase(60);
rebonatto 0:9df41090ba33 58 set_MaxHarmonics(12);
rebonatto 0:9df41090ba33 59 set_Samples(256);
rebonatto 0:9df41090ba33 60 set_EventLimit(3);
rebonatto 0:9df41090ba33 61 set_MBoxLength(10);
rebonatto 0:9df41090ba33 62 set_NumNeighbors(3);
rebonatto 0:9df41090ba33 63 set_PortTCP(7890);
rebonatto 0:9df41090ba33 64 set_MaxTries(10);
rebonatto 0:9df41090ba33 65 set_DelayTry(500);
rebonatto 0:9df41090ba33 66 set_DelaySend(50);
rebonatto 0:9df41090ba33 67
rebonatto 0:9df41090ba33 68 int i;
rebonatto 0:9df41090ba33 69
rebonatto 0:9df41090ba33 70 for(i=0;i<get_MaxChannels();i++)
rebonatto 0:9df41090ba33 71 {
rebonatto 0:9df41090ba33 72 set_Gain(i,1);
rebonatto 0:9df41090ba33 73 set_Offset(i,2048);
rebonatto 0:9df41090ba33 74 set_Limit(i,2048);
rebonatto 0:9df41090ba33 75 set_OutletNumber(i,i/2);
rebonatto 0:9df41090ba33 76 set_Purpose(i,(i%2)?'d':'p');
rebonatto 0:9df41090ba33 77 }
rebonatto 0:9df41090ba33 78 for(i=0;i<get_MaxOutlets();i++)
rebonatto 0:9df41090ba33 79 {
rebonatto 0:9df41090ba33 80 set_Outlet(i,i+1);
rebonatto 0:9df41090ba33 81 }
rebonatto 0:9df41090ba33 82
rebonatto 0:9df41090ba33 83 set_Neighbor(0, "192.168.1.6");
rebonatto 0:9df41090ba33 84 set_Neighbor(1, "192.168.1.7");
rebonatto 0:9df41090ba33 85 set_Neighbor(2, "192.168.1.8");
rebonatto 0:9df41090ba33 86
rebonatto 0:9df41090ba33 87 /*
rebonatto 0:9df41090ba33 88 m_ServerSocket.bind(get_PortTCP()); // liga o serversocket a porta
rebonatto 0:9df41090ba33 89 printf("Settings Default: fez bind na porta %d\n", get_PortTCP());
rebonatto 0:9df41090ba33 90
rebonatto 0:9df41090ba33 91 for(i=0;i<get_NumNeighbors();i++){
rebonatto 0:9df41090ba33 92 m_Socket[i].connect(get_Neighbor(i), get_PortTCP()); // conecta os sockets de envio aos IPs dos vizinhos
rebonatto 0:9df41090ba33 93 printf("Settings Default: conectou socket com %s:%d\n", get_Neighbor(i), get_PortTCP());
rebonatto 0:9df41090ba33 94 }
rebonatto 0:9df41090ba33 95 */
rebonatto 0:9df41090ba33 96
rebonatto 0:9df41090ba33 97 }
rebonatto 0:9df41090ba33 98
rebonatto 0:9df41090ba33 99 void Settings::ReadFile()
rebonatto 0:9df41090ba33 100 {
rebonatto 0:9df41090ba33 101 int i;
rebonatto 0:9df41090ba33 102 FILE *f = fopen(FILENAME,"r");
rebonatto 0:9df41090ba33 103
rebonatto 0:9df41090ba33 104 if(f == NULL)
rebonatto 0:9df41090ba33 105 {
rebonatto 0:9df41090ba33 106 LoadDefaults();
rebonatto 0:9df41090ba33 107 WriteFile();
rebonatto 0:9df41090ba33 108 return;
rebonatto 0:9df41090ba33 109 }
rebonatto 0:9df41090ba33 110 char buf[50];
rebonatto 0:9df41090ba33 111 while(fgets(buf,50,f)!= NULL)
rebonatto 0:9df41090ba33 112 {
rebonatto 0:9df41090ba33 113 char* p = strchr(buf,'\n');
rebonatto 0:9df41090ba33 114 if(p)
rebonatto 0:9df41090ba33 115 {
rebonatto 0:9df41090ba33 116 if(isprint(*(p-1)) == 0) *(p-1) = '\0';
rebonatto 0:9df41090ba33 117 *p = '\0';
rebonatto 0:9df41090ba33 118 }
rebonatto 0:9df41090ba33 119 char **line;
rebonatto 0:9df41090ba33 120 int l = split(buf,"=",&line);
rebonatto 0:9df41090ba33 121 if(l!=2)continue;
rebonatto 0:9df41090ba33 122 if(!strcmp(line[0],"server"))
rebonatto 0:9df41090ba33 123 {
rebonatto 0:9df41090ba33 124 set_ServerUrl(line[1]);
rebonatto 0:9df41090ba33 125 }
rebonatto 0:9df41090ba33 126 if(!strcmp(line[0],"address"))
rebonatto 0:9df41090ba33 127 {
rebonatto 0:9df41090ba33 128 set_IpAddress(line[1]);
rebonatto 0:9df41090ba33 129 }
rebonatto 0:9df41090ba33 130 if(!strcmp(line[0],"netmask"))
rebonatto 0:9df41090ba33 131 {
rebonatto 0:9df41090ba33 132 set_Netmask(line[1]);
rebonatto 0:9df41090ba33 133 }
rebonatto 0:9df41090ba33 134 if(!strcmp(line[0],"gateway"))
rebonatto 0:9df41090ba33 135 {
rebonatto 0:9df41090ba33 136 set_Gateway(line[1]);
rebonatto 0:9df41090ba33 137 }
rebonatto 0:9df41090ba33 138 if(!strcmp(line[0],"dhcp"))
rebonatto 0:9df41090ba33 139 {
rebonatto 0:9df41090ba33 140 if(!strcmp(line[1],"false"))
rebonatto 0:9df41090ba33 141 set_Dhcp(0);
rebonatto 0:9df41090ba33 142 else
rebonatto 0:9df41090ba33 143 set_Dhcp(1);
rebonatto 0:9df41090ba33 144 }
rebonatto 0:9df41090ba33 145 if(!strcmp(line[0],"module"))
rebonatto 0:9df41090ba33 146 {
rebonatto 0:9df41090ba33 147 set_ModuleNumber(atoi(line[1]));
rebonatto 0:9df41090ba33 148 }
rebonatto 0:9df41090ba33 149
rebonatto 0:9df41090ba33 150 if(!strcmp(line[0],"FreqBase"))
rebonatto 0:9df41090ba33 151 {
rebonatto 0:9df41090ba33 152 set_FreqBase(atoi(line[1]));
rebonatto 0:9df41090ba33 153 }
rebonatto 0:9df41090ba33 154 if(!strcmp(line[0],"MaxChannels"))
rebonatto 0:9df41090ba33 155 {
rebonatto 0:9df41090ba33 156 set_MaxChannels(atoi(line[1]));
rebonatto 0:9df41090ba33 157 }
rebonatto 0:9df41090ba33 158 if(!strcmp(line[0],"MaxOutlets"))
rebonatto 0:9df41090ba33 159 {
rebonatto 0:9df41090ba33 160 set_MaxOutlets(atoi(line[1]));
rebonatto 0:9df41090ba33 161 }
rebonatto 0:9df41090ba33 162 if(!strcmp(line[0],"Samples"))
rebonatto 0:9df41090ba33 163 {
rebonatto 0:9df41090ba33 164 set_Samples(atoi(line[1]));
rebonatto 0:9df41090ba33 165 }
rebonatto 0:9df41090ba33 166 if(!strcmp(line[0],"EventLimit"))
rebonatto 0:9df41090ba33 167 {
rebonatto 0:9df41090ba33 168 set_EventLimit(atoi(line[1]));
rebonatto 0:9df41090ba33 169 }
rebonatto 0:9df41090ba33 170 if(!strcmp(line[0],"MBoxLength"))
rebonatto 0:9df41090ba33 171 {
rebonatto 0:9df41090ba33 172 set_MBoxLength(atoi(line[1]));
rebonatto 0:9df41090ba33 173 }
rebonatto 0:9df41090ba33 174
rebonatto 0:9df41090ba33 175 for(i=0;i<get_MaxChannels();i++)
rebonatto 0:9df41090ba33 176 {
rebonatto 0:9df41090ba33 177 char x[10];
rebonatto 0:9df41090ba33 178 sprintf(x,"gain%d",i);
rebonatto 0:9df41090ba33 179 if(!strcmp(line[0],x))
rebonatto 0:9df41090ba33 180 {
rebonatto 0:9df41090ba33 181 set_Gain(i,atof(line[1]));
rebonatto 0:9df41090ba33 182 }
rebonatto 0:9df41090ba33 183 sprintf(x,"offset%d",i);
rebonatto 0:9df41090ba33 184 if(!strcmp(line[0],x))
rebonatto 0:9df41090ba33 185 {
rebonatto 0:9df41090ba33 186 set_Offset(i,atoi(line[1]));
rebonatto 0:9df41090ba33 187 }
rebonatto 0:9df41090ba33 188 sprintf(x,"limit%d",i);
rebonatto 0:9df41090ba33 189 if(!strcmp(line[0],x))
rebonatto 0:9df41090ba33 190 {
rebonatto 0:9df41090ba33 191 set_Limit(i,atof(line[1]));
rebonatto 0:9df41090ba33 192 }
rebonatto 0:9df41090ba33 193 sprintf(x,"type%d",i);
rebonatto 0:9df41090ba33 194 if(!strcmp(line[0],x))
rebonatto 0:9df41090ba33 195 {
rebonatto 0:9df41090ba33 196 set_Purpose(i,line[1][0]);
rebonatto 0:9df41090ba33 197 set_OutletNumber(i,line[1][1]-'0');
rebonatto 0:9df41090ba33 198 }
rebonatto 0:9df41090ba33 199 }
rebonatto 0:9df41090ba33 200
rebonatto 0:9df41090ba33 201 for(i=0;i<get_MaxOutlets();i++)
rebonatto 0:9df41090ba33 202 {
rebonatto 0:9df41090ba33 203 char x[10];
rebonatto 0:9df41090ba33 204 sprintf(x,"outlet%d",i);
rebonatto 0:9df41090ba33 205 if(!strcmp(line[0],x))
rebonatto 0:9df41090ba33 206 {
rebonatto 0:9df41090ba33 207 set_Outlet(i,atoi(line[1]));
rebonatto 0:9df41090ba33 208 }
rebonatto 0:9df41090ba33 209 }
rebonatto 0:9df41090ba33 210 if(!strcmp(line[0],"MaxHarmonics"))
rebonatto 0:9df41090ba33 211 {
rebonatto 0:9df41090ba33 212 set_MaxHarmonics(atoi(line[1]));
rebonatto 0:9df41090ba33 213 }
rebonatto 0:9df41090ba33 214
rebonatto 0:9df41090ba33 215 if(!strcmp(line[0],"NumNeighbors"))
rebonatto 0:9df41090ba33 216 {
rebonatto 0:9df41090ba33 217 set_NumNeighbors(atoi(line[1]));
rebonatto 0:9df41090ba33 218 }
rebonatto 0:9df41090ba33 219
rebonatto 0:9df41090ba33 220 if(!strcmp(line[0],"TcpPort"))
rebonatto 0:9df41090ba33 221 {
rebonatto 0:9df41090ba33 222 set_PortTCP(atoi(line[1]));
rebonatto 0:9df41090ba33 223 //m_ServerSocket.bind(get_PortTCP()); // liga o serversocket a porta
rebonatto 0:9df41090ba33 224 }
rebonatto 0:9df41090ba33 225
rebonatto 0:9df41090ba33 226 for(i=0;i<get_NumNeighbors();i++)
rebonatto 0:9df41090ba33 227 {
rebonatto 0:9df41090ba33 228 char x[15];
rebonatto 0:9df41090ba33 229 sprintf(x,"Neighbor%d",i);
rebonatto 0:9df41090ba33 230 //printf("Vai buscar %d -> %s\n", i, x);
rebonatto 0:9df41090ba33 231 if(!strcmp(line[0],x))
rebonatto 0:9df41090ba33 232 {
rebonatto 0:9df41090ba33 233 // printf("Vai usar %d -> %s\n", i, line[1]);
rebonatto 0:9df41090ba33 234 set_Neighbor(i, line[1]) ;
rebonatto 0:9df41090ba33 235 //m_Socket[i].connect(get_Neighbor(i), get_PortTCP()); // conecta os sockets de envio aos IPs dos vizinhos
rebonatto 0:9df41090ba33 236 }
rebonatto 0:9df41090ba33 237 }
rebonatto 0:9df41090ba33 238
rebonatto 0:9df41090ba33 239 if(!strcmp(line[0],"MaxTries"))
rebonatto 0:9df41090ba33 240 {
rebonatto 0:9df41090ba33 241 set_MaxTries(atoi(line[1]));
rebonatto 0:9df41090ba33 242 //m_ServerSocket.bind(get_PortTCP()); // liga o serversocket a porta
rebonatto 0:9df41090ba33 243 }
rebonatto 0:9df41090ba33 244
rebonatto 0:9df41090ba33 245 if(!strcmp(line[0],"DelayTry"))
rebonatto 0:9df41090ba33 246 {
rebonatto 0:9df41090ba33 247 set_DelayTry(atoi(line[1]));
rebonatto 0:9df41090ba33 248 //m_ServerSocket.bind(get_PortTCP()); // liga o serversocket a porta
rebonatto 0:9df41090ba33 249 }
rebonatto 0:9df41090ba33 250
rebonatto 0:9df41090ba33 251 if(!strcmp(line[0],"DelaySend"))
rebonatto 0:9df41090ba33 252 {
rebonatto 0:9df41090ba33 253 set_DelaySend(atoi(line[1]));
rebonatto 0:9df41090ba33 254 //m_ServerSocket.bind(get_PortTCP()); // liga o serversocket a porta
rebonatto 0:9df41090ba33 255 }
rebonatto 0:9df41090ba33 256
rebonatto 0:9df41090ba33 257 //printf("Param=%s Value=%s\r\n",line[0],line[1]);
rebonatto 0:9df41090ba33 258 }
rebonatto 0:9df41090ba33 259
rebonatto 0:9df41090ba33 260 /*
rebonatto 0:9df41090ba33 261 m_ServerSocket.bind(get_PortTCP()); // liga o serversocket a porta
rebonatto 0:9df41090ba33 262 printf("Settings LoadFile: fez bind na porta %d\n", get_PortTCP());
rebonatto 0:9df41090ba33 263
rebonatto 0:9df41090ba33 264 for(i=0;i<get_NumNeighbors();i++){
rebonatto 0:9df41090ba33 265 m_Socket[i].connect(get_Neighbor(i), get_PortTCP()); // conecta os sockets de envio aos IPs dos vizinhos
rebonatto 0:9df41090ba33 266 printf("Settings LoadFile: conectou socket com %s:%d\n", get_Neighbor(i), get_PortTCP());
rebonatto 0:9df41090ba33 267 }
rebonatto 0:9df41090ba33 268 */
rebonatto 0:9df41090ba33 269
rebonatto 0:9df41090ba33 270 fclose(f);
rebonatto 0:9df41090ba33 271 }
rebonatto 0:9df41090ba33 272
rebonatto 0:9df41090ba33 273
rebonatto 0:9df41090ba33 274 void Settings::WriteFile()
rebonatto 0:9df41090ba33 275 {
rebonatto 0:9df41090ba33 276 FILE *f = fopen(FILENAME,"w");
rebonatto 0:9df41090ba33 277 int i;
rebonatto 0:9df41090ba33 278
rebonatto 0:9df41090ba33 279 if(f == NULL)
rebonatto 0:9df41090ba33 280 {
rebonatto 0:9df41090ba33 281 printf("Error creating settings file\r\n");
rebonatto 0:9df41090ba33 282 return;
rebonatto 0:9df41090ba33 283 }
rebonatto 0:9df41090ba33 284
rebonatto 0:9df41090ba33 285 fprintf(f,"server=%s\r\n",get_ServerUrl());
rebonatto 0:9df41090ba33 286 fprintf(f,"address=%s\r\n",get_IpAddress());
rebonatto 0:9df41090ba33 287 fprintf(f,"netmask=%s\r\n",get_Netmask());
rebonatto 0:9df41090ba33 288 fprintf(f,"gateway=%s\r\n",get_Gateway());
rebonatto 0:9df41090ba33 289
rebonatto 0:9df41090ba33 290 if(get_Dhcp())
rebonatto 0:9df41090ba33 291 fprintf(f,"dhcp=true\r\n");
rebonatto 0:9df41090ba33 292 else
rebonatto 0:9df41090ba33 293 fprintf(f,"dhcp=false\r\n");
rebonatto 0:9df41090ba33 294
rebonatto 0:9df41090ba33 295 fprintf(f,"module=%d\r\n",get_ModuleNumber());
rebonatto 0:9df41090ba33 296 fprintf(f,"MaxChannels=%d\r\n",get_MaxChannels());
rebonatto 0:9df41090ba33 297 fprintf(f,"MaxOutlets=%d\r\n",get_MaxOutlets());
rebonatto 0:9df41090ba33 298 fprintf(f,"FreqBase=%d\r\n",get_FreqBase());
rebonatto 0:9df41090ba33 299 fprintf(f,"Samples=%d\r\n",get_Samples());
rebonatto 0:9df41090ba33 300 fprintf(f,"EventLimit=%d\r\n",get_EventLimit());
rebonatto 0:9df41090ba33 301 fprintf(f,"MBoxLength=%d\r\n",get_MBoxLength());
rebonatto 0:9df41090ba33 302
rebonatto 0:9df41090ba33 303 for(i=0;i<get_MaxChannels();i++)
rebonatto 0:9df41090ba33 304 {
rebonatto 0:9df41090ba33 305 fprintf(f,"gain%d=%0.4f\r\n",i,get_Gain(i));
rebonatto 0:9df41090ba33 306 fprintf(f,"offset%d=%d\r\n",i,get_Offset(i));
rebonatto 0:9df41090ba33 307 fprintf(f,"limit%d=%0.4f\r\n",i,get_Limit(i));
rebonatto 0:9df41090ba33 308 fprintf(f,"type%d=%c%d\r\n",i,get_Purpose(i),get_OutletNumber(i));
rebonatto 0:9df41090ba33 309 }
rebonatto 0:9df41090ba33 310
rebonatto 0:9df41090ba33 311 for(i=0;i<get_MaxOutlets();i++)
rebonatto 0:9df41090ba33 312 {
rebonatto 0:9df41090ba33 313 fprintf(f,"outlet%d=%d\r\n",i,get_Outlet(i));
rebonatto 0:9df41090ba33 314 }
rebonatto 0:9df41090ba33 315 fprintf(f,"MaxHarmonics=%d\r\n",get_MaxHarmonics());
rebonatto 0:9df41090ba33 316
rebonatto 0:9df41090ba33 317 fprintf(f,"NumNeighbors=%d\r\n",get_NumNeighbors());
rebonatto 0:9df41090ba33 318 fprintf(f,"TcpPort=%d\r\n",get_PortTCP());
rebonatto 0:9df41090ba33 319 for(i=0;i<get_NumNeighbors();i++)
rebonatto 0:9df41090ba33 320 {
rebonatto 0:9df41090ba33 321 fprintf(f,"Neighbor%d=%s\r\n",i,get_Neighbor(i));
rebonatto 0:9df41090ba33 322 }
rebonatto 0:9df41090ba33 323 fprintf(f,"MaxTries=%d\r\n",get_MaxTries());
rebonatto 0:9df41090ba33 324 fprintf(f,"DelayTry=%d\r\n",get_DelayTry());
rebonatto 0:9df41090ba33 325 fprintf(f,"DelaySend=%d\r\n",get_DelaySend());
rebonatto 0:9df41090ba33 326
rebonatto 0:9df41090ba33 327 fclose(f);
rebonatto 0:9df41090ba33 328 }
rebonatto 0:9df41090ba33 329
rebonatto 0:9df41090ba33 330 void Settings::ShowValues()
rebonatto 0:9df41090ba33 331 {
rebonatto 0:9df41090ba33 332 printf("ServerUrl: %s\n", get_ServerUrl());
rebonatto 0:9df41090ba33 333 printf("IpAddress: %s\n", get_IpAddress());
rebonatto 0:9df41090ba33 334 printf("NetMask: %s\n", get_Netmask());
rebonatto 0:9df41090ba33 335 printf("Gateway: %s\n", get_Gateway());
rebonatto 0:9df41090ba33 336 printf("Dhcp: %d\n", get_Dhcp());
rebonatto 0:9df41090ba33 337 printf("ModuleNumber: %d\n", get_ModuleNumber() );
rebonatto 0:9df41090ba33 338 printf("FreqBase : %d\n", get_FreqBase() );
rebonatto 0:9df41090ba33 339 printf("Samples : %d\n" , get_Samples() );
rebonatto 0:9df41090ba33 340 printf("EventLimit : %d\n" , get_EventLimit() );
rebonatto 0:9df41090ba33 341 printf("MBoxLength : %d\n" , get_MBoxLength() );
rebonatto 0:9df41090ba33 342 printf("MaxChannels : %d\n", get_MaxChannels() );
rebonatto 0:9df41090ba33 343 printf("MaxOutlets : %d\n", get_MaxOutlets() );
rebonatto 0:9df41090ba33 344 printf("Per Channel\n");
rebonatto 0:9df41090ba33 345 int i;
rebonatto 0:9df41090ba33 346 for(i=0;i<get_MaxChannels();i++)
rebonatto 0:9df41090ba33 347 {
rebonatto 0:9df41090ba33 348 printf("Channel %d Gain %f Offset %d Limmit %f Outlet %d Purpose %c\n ", i, get_Gain(i), get_Offset(i), get_Limit(i), get_OutletNumber(i), get_Purpose(i));
rebonatto 0:9df41090ba33 349 }
rebonatto 0:9df41090ba33 350 printf("Per Outlet \n");
rebonatto 0:9df41090ba33 351 for(i=0;i<get_MaxOutlets();i++)
rebonatto 0:9df41090ba33 352 {
rebonatto 0:9df41090ba33 353 printf("Outlet %d Number %d \n ", i, get_Outlet(i));
rebonatto 0:9df41090ba33 354 }
rebonatto 0:9df41090ba33 355 printf("MaxHarmonics : %d\n", get_MaxHarmonics() );
rebonatto 0:9df41090ba33 356
rebonatto 0:9df41090ba33 357 printf("NumNeighbors : %d\n", get_NumNeighbors() );
rebonatto 0:9df41090ba33 358 for(i=0;i<get_NumNeighbors();i++)
rebonatto 0:9df41090ba33 359 {
rebonatto 0:9df41090ba33 360 printf("Neighbor %d Value %s \n ", i, get_Neighbor(i));
rebonatto 0:9df41090ba33 361 }
rebonatto 0:9df41090ba33 362 printf("TcpPort : %d\n", get_PortTCP() );
rebonatto 0:9df41090ba33 363 printf("MaxTries : %d\n", get_MaxTries() );
rebonatto 0:9df41090ba33 364 printf("DelayTry : %d\n", get_DelayTry() );
rebonatto 0:9df41090ba33 365 printf("DelaySend : %d\n", get_DelaySend() );
rebonatto 0:9df41090ba33 366 }