@@ -132,9 +132,9 @@ bool gatewayTransportInit(void)
132
132
(void )WiFi.begin (MY_ESP8266_SSID, MY_ESP8266_PASSWORD, 0 , MY_ESP8266_BSSID);
133
133
while (WiFi.status () != WL_CONNECTED) {
134
134
wait (500 );
135
- GATEWAY_DEBUG (PSTR (" . " ));
135
+ GATEWAY_DEBUG (PSTR (" GWT:TIN:CONNECTING... \n " ));
136
136
}
137
- GATEWAY_DEBUG (PSTR (" IP: %s\n " ), WiFi.localIP ().toString ().c_str ());
137
+ GATEWAY_DEBUG (PSTR (" GWT:TIN:IP= %s\n " ), WiFi.localIP ().toString ().c_str ());
138
138
#endif /* End of MY_ESP8266_SSID */
139
139
#elif defined(MY_GATEWAY_LINUX) /* Elif part of MY_GATEWAY_ESP8266 */
140
140
// Nothing to do here
@@ -147,12 +147,13 @@ bool gatewayTransportInit(void)
147
147
#else /* Else part of MY_IP_GATEWAY_ADDRESS && MY_IP_SUBNET_ADDRESS */
148
148
// Get IP address from DHCP
149
149
if (!Ethernet.begin (_ethernetGatewayMAC)) {
150
- GATEWAY_DEBUG (PSTR (" DHCP FAILURE... " ));
150
+ GATEWAY_DEBUG (PSTR (" !GWT:TIN: DHCP FAIL \n " ));
151
151
_w5100_spi_en (false );
152
152
return false ;
153
153
}
154
154
#endif /* End of MY_IP_GATEWAY_ADDRESS && MY_IP_SUBNET_ADDRESS */
155
- GATEWAY_DEBUG (PSTR (" IP: %" PRIu8 " .%" PRIu8 " .%" PRIu8 " .%" PRIu8 " \n " ), Ethernet.localIP ()[0 ],
155
+ GATEWAY_DEBUG (PSTR (" GWT:TIN:IP=%" PRIu8 " .%" PRIu8 " .%" PRIu8 " .%" PRIu8 " \n " ),
156
+ Ethernet.localIP ()[0 ],
156
157
Ethernet.localIP ()[1 ], Ethernet.localIP ()[2 ], Ethernet.localIP ()[3 ]);
157
158
// give the Ethernet interface a second to initialize
158
159
delay (1000 );
@@ -170,14 +171,14 @@ bool gatewayTransportInit(void)
170
171
#else
171
172
if (client.connect (_ethernetControllerIP, MY_PORT)) {
172
173
#endif /* End of MY_CONTROLLER_URL_ADDRESS */
173
- GATEWAY_DEBUG (PSTR (" Eth: connect \n " ));
174
+ GATEWAY_DEBUG (PSTR (" GWT:TIN:ETH OK \n " ));
174
175
_w5100_spi_en (false );
175
176
gatewayTransportSend (buildGw (_msgTmp, I_GATEWAY_READY).set (MSG_GW_STARTUP_COMPLETE));
176
177
_w5100_spi_en (true );
177
178
presentNode ();
178
179
} else {
179
180
client.stop ();
180
- GATEWAY_DEBUG (PSTR (" Eth: Failed to connect \n " ));
181
+ GATEWAY_DEBUG (PSTR (" !GWT:TIN:ETH FAIL \n " ));
181
182
}
182
183
#endif /* End of MY_USE_UDP */
183
184
#else /* Else part of MY_GATEWAY_CLIENT_MODE */
@@ -219,14 +220,14 @@ bool gatewayTransportSend(MyMessage &message)
219
220
#else
220
221
if (client.connect (_ethernetControllerIP, MY_PORT)) {
221
222
#endif /* End of MY_CONTROLLER_URL_ADDRESS */
222
- GATEWAY_DEBUG (PSTR (" Eth: connect \n " ));
223
+ GATEWAY_DEBUG (PSTR (" GWT:TPS:ETH OK \n " ));
223
224
_w5100_spi_en (false );
224
225
gatewayTransportSend (buildGw (_msgTmp, I_GATEWAY_READY).set (MSG_GW_STARTUP_COMPLETE));
225
226
_w5100_spi_en (true );
226
227
presentNode ();
227
228
} else {
228
229
// connecting to the server failed!
229
- GATEWAY_DEBUG (PSTR (" Eth: Failed to connect \n " ));
230
+ GATEWAY_DEBUG (PSTR (" !GWT:TPS:ETH FAIL \n " ));
230
231
_w5100_spi_en (false );
231
232
return false ;
232
233
}
@@ -262,7 +263,7 @@ bool _readFromClient(uint8_t i)
262
263
if (inChar == ' \n ' || inChar == ' \r ' ) {
263
264
// Add string terminator and prepare for the next message
264
265
inputString[i].string [inputString[i].idx ] = 0 ;
265
- GATEWAY_DEBUG (PSTR (" Client %" PRIu8 " : %s\n " ), i, inputString[i].string );
266
+ GATEWAY_DEBUG (PSTR (" GWT:RFC:C %" PRIu8 " ,MSG= %s\n " ), i, inputString[i].string );
266
267
inputString[i].idx = 0 ;
267
268
if (protocolParse (_ethernetMsg, inputString[i].string )) {
268
269
return true ;
@@ -274,7 +275,7 @@ bool _readFromClient(uint8_t i)
274
275
}
275
276
} else {
276
277
// Incoming message too long. Throw away
277
- GATEWAY_DEBUG (PSTR (" Client %" PRIu8 " : Message too long \n " ), i);
278
+ GATEWAY_DEBUG (PSTR (" !GWT:RFC:C %" PRIu8 " ,MSG TOO LONG \n " ), i);
278
279
inputString[i].idx = 0 ;
279
280
// Finished with this client's message. Next loop() we'll see if there's more to read.
280
281
break ;
@@ -292,7 +293,7 @@ bool _readFromClient(void)
292
293
if (inChar == ' \n ' || inChar == ' \r ' ) {
293
294
// Add string terminator and prepare for the next message
294
295
inputString.string [inputString.idx ] = 0 ;
295
- GATEWAY_DEBUG (PSTR (" Eth: %s\n " ), inputString.string );
296
+ GATEWAY_DEBUG (PSTR (" GWT:RFC:MSG= %s\n " ), inputString.string );
296
297
inputString.idx = 0 ;
297
298
if (protocolParse (_ethernetMsg, inputString.string )) {
298
299
return true ;
@@ -304,7 +305,7 @@ bool _readFromClient(void)
304
305
}
305
306
} else {
306
307
// Incoming message too long. Throw away
307
- GATEWAY_DEBUG (PSTR (" Eth: Message too long \n " ));
308
+ GATEWAY_DEBUG (PSTR (" !GWT:RFC:MSG TOO LONG \n " ));
308
309
inputString.idx = 0 ;
309
310
// Finished with this client's message. Next loop() we'll see if there's more to read.
310
311
break ;
@@ -331,7 +332,7 @@ bool gatewayTransportAvailable(void)
331
332
// GATEWAY_DEBUG(PSTR("UDP packet available. Size:%" PRIu8 "\n"), packet_size);
332
333
_ethernetServer.read (inputString.string , MY_GATEWAY_MAX_RECEIVE_LENGTH);
333
334
inputString.string [packet_size] = 0 ;
334
- GATEWAY_DEBUG (PSTR (" UDP packet received: %s\n " ), inputString.string );
335
+ GATEWAY_DEBUG (PSTR (" GWT:TSA: UDP MSG= %s\n " ), inputString.string );
335
336
_w5100_spi_en (false );
336
337
const bool ok = protocolParse (_ethernetMsg, inputString.string );
337
338
if (ok) {
@@ -347,13 +348,13 @@ bool gatewayTransportAvailable(void)
347
348
#else
348
349
if (client.connect (_ethernetControllerIP, MY_PORT)) {
349
350
#endif /* End of MY_CONTROLLER_URL_ADDRESS */
350
- GATEWAY_DEBUG (PSTR (" Eth: connect \n " ));
351
+ GATEWAY_DEBUG (PSTR (" GWT:TSA:ETH OK \n " ));
351
352
_w5100_spi_en (false );
352
353
gatewayTransportSend (buildGw (_msgTmp, I_GATEWAY_READY).set (MSG_GW_STARTUP_COMPLETE));
353
354
_w5100_spi_en (true );
354
355
presentNode ();
355
356
} else {
356
- GATEWAY_DEBUG (PSTR (" Eth: Failed to connect \n " ));
357
+ GATEWAY_DEBUG (PSTR (" !GWT:TSA:ETH FAIL \n " ));
357
358
_w5100_spi_en (false );
358
359
return false ;
359
360
}
@@ -372,14 +373,14 @@ bool gatewayTransportAvailable(void)
372
373
for (uint8_t i = 0 ; i < ARRAY_SIZE (clients); i++) {
373
374
if (!clients[i].connected ()) {
374
375
if (clientsConnected[i]) {
375
- GATEWAY_DEBUG (PSTR (" Client %" PRIu8 " disconnected \n " ), i);
376
+ GATEWAY_DEBUG (PSTR (" GWT:TSA:C %" PRIu8 " ,DISCONNECTED \n " ), i);
376
377
clients[i].stop ();
377
378
}
378
379
// check if there are any new clients
379
380
if (_ethernetServer.hasClient ()) {
380
381
clients[i] = _ethernetServer.available ();
381
382
inputString[i].idx = 0 ;
382
- GATEWAY_DEBUG (PSTR (" Client %" PRIu8 " connected \n " ), i);
383
+ GATEWAY_DEBUG (PSTR (" GWT:TSA:C %" PRIu8 " ,CONNECTED \n " ), i);
383
384
gatewayTransportSend (buildGw (_msgTmp, I_GATEWAY_READY).set (MSG_GW_STARTUP_COMPLETE));
384
385
// Send presentation of locally attached sensors (and node if applicable)
385
386
presentNode ();
@@ -391,7 +392,7 @@ bool gatewayTransportAvailable(void)
391
392
}
392
393
if (allSlotsOccupied && _ethernetServer.hasClient ()) {
393
394
// no free/disconnected spot so reject
394
- GATEWAY_DEBUG (PSTR (" No free slot available \n " ));
395
+ GATEWAY_DEBUG (PSTR (" !GWT:TSA:NO FREE SLOT \n " ));
395
396
EthernetClient c = _ethernetServer.available ();
396
397
c.stop ();
397
398
}
@@ -411,7 +412,7 @@ bool gatewayTransportAvailable(void)
411
412
if (client != newclient) {
412
413
client.stop ();
413
414
client = newclient;
414
- GATEWAY_DEBUG (PSTR (" Eth: connect \n " ));
415
+ GATEWAY_DEBUG (PSTR (" GWT:TSA:ETH OK \n " ));
415
416
_w5100_spi_en (false );
416
417
gatewayTransportSend (buildGw (_msgTmp, I_GATEWAY_READY).set (MSG_GW_STARTUP_COMPLETE));
417
418
_w5100_spi_en (true );
@@ -420,7 +421,7 @@ bool gatewayTransportAvailable(void)
420
421
}
421
422
if (client) {
422
423
if (!client.connected ()) {
423
- GATEWAY_DEBUG (PSTR (" Eth: disconnect \n " ));
424
+ GATEWAY_DEBUG (PSTR (" !GWT:TSA:ETH FAIL \n " ));
424
425
client.stop ();
425
426
} else {
426
427
if (_readFromClient ()) {
@@ -460,7 +461,7 @@ void gatewayTransportRenewIP(void)
460
461
return ;
461
462
}
462
463
if (Ethernet.maintain () & ~(0x06 )) {
463
- GATEWAY_DEBUG (PSTR (" IP was not renewed correctly \n " ));
464
+ GATEWAY_DEBUG (PSTR (" !GWT:TRC: IP RENEW FAIL \n " ));
464
465
/* Error occured -> IP was not renewed */
465
466
return ;
466
467
}
0 commit comments