@@ -762,7 +762,7 @@ AsyncClient &AsyncClient::operator=(const AsyncClient &other) {
762
762
return *this ;
763
763
}
764
764
765
- bool AsyncClient::operator ==(const AsyncClient &other) {
765
+ bool AsyncClient::operator ==(const AsyncClient &other) const {
766
766
return _pcb == other._pcb ;
767
767
}
768
768
@@ -930,7 +930,7 @@ int8_t AsyncClient::abort() {
930
930
return ERR_ABRT;
931
931
}
932
932
933
- size_t AsyncClient::space () {
933
+ size_t AsyncClient::space () const {
934
934
if ((_pcb != NULL ) && (_pcb->state == ESTABLISHED)) {
935
935
return tcp_sndbuf (_pcb);
936
936
}
@@ -1218,19 +1218,19 @@ void AsyncClient::setRxTimeout(uint32_t timeout) {
1218
1218
_rx_timeout = timeout;
1219
1219
}
1220
1220
1221
- uint32_t AsyncClient::getRxTimeout () {
1221
+ uint32_t AsyncClient::getRxTimeout () const {
1222
1222
return _rx_timeout;
1223
1223
}
1224
1224
1225
- uint32_t AsyncClient::getAckTimeout () {
1225
+ uint32_t AsyncClient::getAckTimeout () const {
1226
1226
return _ack_timeout;
1227
1227
}
1228
1228
1229
1229
void AsyncClient::setAckTimeout (uint32_t timeout) {
1230
1230
_ack_timeout = timeout;
1231
1231
}
1232
1232
1233
- void AsyncClient::setNoDelay (bool nodelay) {
1233
+ void AsyncClient::setNoDelay (bool nodelay) const {
1234
1234
if (!_pcb) {
1235
1235
return ;
1236
1236
}
@@ -1260,14 +1260,14 @@ void AsyncClient::setKeepAlive(uint32_t ms, uint8_t cnt) {
1260
1260
}
1261
1261
}
1262
1262
1263
- uint16_t AsyncClient::getMss () {
1263
+ uint16_t AsyncClient::getMss () const {
1264
1264
if (!_pcb) {
1265
1265
return 0 ;
1266
1266
}
1267
1267
return tcp_mss (_pcb);
1268
1268
}
1269
1269
1270
- uint32_t AsyncClient::getRemoteAddress () {
1270
+ uint32_t AsyncClient::getRemoteAddress () const {
1271
1271
if (!_pcb) {
1272
1272
return 0 ;
1273
1273
}
@@ -1279,7 +1279,7 @@ uint32_t AsyncClient::getRemoteAddress() {
1279
1279
}
1280
1280
1281
1281
#if LWIP_IPV6
1282
- ip6_addr_t AsyncClient::getRemoteAddress6 () {
1282
+ ip6_addr_t AsyncClient::getRemoteAddress6 () const {
1283
1283
if (!_pcb) {
1284
1284
ip6_addr_t nulladdr;
1285
1285
ip6_addr_set_zero (&nulladdr);
@@ -1288,7 +1288,7 @@ ip6_addr_t AsyncClient::getRemoteAddress6() {
1288
1288
return _pcb->remote_ip .u_addr .ip6 ;
1289
1289
}
1290
1290
1291
- ip6_addr_t AsyncClient::getLocalAddress6 () {
1291
+ ip6_addr_t AsyncClient::getLocalAddress6 () const {
1292
1292
if (!_pcb) {
1293
1293
ip6_addr_t nulladdr;
1294
1294
ip6_addr_set_zero (&nulladdr);
@@ -1297,15 +1297,15 @@ ip6_addr_t AsyncClient::getLocalAddress6() {
1297
1297
return _pcb->local_ip .u_addr .ip6 ;
1298
1298
}
1299
1299
#if ESP_IDF_VERSION_MAJOR < 5
1300
- IPv6Address AsyncClient::remoteIP6 () {
1300
+ IPv6Address AsyncClient::remoteIP6 () const {
1301
1301
return IPv6Address (getRemoteAddress6 ().addr );
1302
1302
}
1303
1303
1304
- IPv6Address AsyncClient::localIP6 () {
1304
+ IPv6Address AsyncClient::localIP6 () const {
1305
1305
return IPv6Address (getLocalAddress6 ().addr );
1306
1306
}
1307
1307
#else
1308
- IPAddress AsyncClient::remoteIP6 () {
1308
+ IPAddress AsyncClient::remoteIP6 () const {
1309
1309
if (!_pcb) {
1310
1310
return IPAddress (IPType::IPv6);
1311
1311
}
@@ -1314,7 +1314,7 @@ IPAddress AsyncClient::remoteIP6() {
1314
1314
return ip;
1315
1315
}
1316
1316
1317
- IPAddress AsyncClient::localIP6 () {
1317
+ IPAddress AsyncClient::localIP6 () const {
1318
1318
if (!_pcb) {
1319
1319
return IPAddress (IPType::IPv6);
1320
1320
}
@@ -1325,14 +1325,14 @@ IPAddress AsyncClient::localIP6() {
1325
1325
#endif
1326
1326
#endif
1327
1327
1328
- uint16_t AsyncClient::getRemotePort () {
1328
+ uint16_t AsyncClient::getRemotePort () const {
1329
1329
if (!_pcb) {
1330
1330
return 0 ;
1331
1331
}
1332
1332
return _pcb->remote_port ;
1333
1333
}
1334
1334
1335
- uint32_t AsyncClient::getLocalAddress () {
1335
+ uint32_t AsyncClient::getLocalAddress () const {
1336
1336
if (!_pcb) {
1337
1337
return 0 ;
1338
1338
}
@@ -1343,14 +1343,14 @@ uint32_t AsyncClient::getLocalAddress() {
1343
1343
#endif
1344
1344
}
1345
1345
1346
- uint16_t AsyncClient::getLocalPort () {
1346
+ uint16_t AsyncClient::getLocalPort () const {
1347
1347
if (!_pcb) {
1348
1348
return 0 ;
1349
1349
}
1350
1350
return _pcb->local_port ;
1351
1351
}
1352
1352
1353
- IPAddress AsyncClient::remoteIP () {
1353
+ IPAddress AsyncClient::remoteIP () const {
1354
1354
#if ESP_IDF_VERSION_MAJOR < 5
1355
1355
return IPAddress (getRemoteAddress ());
1356
1356
#else
@@ -1363,11 +1363,11 @@ IPAddress AsyncClient::remoteIP() {
1363
1363
#endif
1364
1364
}
1365
1365
1366
- uint16_t AsyncClient::remotePort () {
1366
+ uint16_t AsyncClient::remotePort () const {
1367
1367
return getRemotePort ();
1368
1368
}
1369
1369
1370
- IPAddress AsyncClient::localIP () {
1370
+ IPAddress AsyncClient::localIP () const {
1371
1371
#if ESP_IDF_VERSION_MAJOR < 5
1372
1372
return IPAddress (getLocalAddress ());
1373
1373
#else
@@ -1380,53 +1380,53 @@ IPAddress AsyncClient::localIP() {
1380
1380
#endif
1381
1381
}
1382
1382
1383
- uint16_t AsyncClient::localPort () {
1383
+ uint16_t AsyncClient::localPort () const {
1384
1384
return getLocalPort ();
1385
1385
}
1386
1386
1387
- uint8_t AsyncClient::state () {
1387
+ uint8_t AsyncClient::state () const {
1388
1388
if (!_pcb) {
1389
1389
return 0 ;
1390
1390
}
1391
1391
return _pcb->state ;
1392
1392
}
1393
1393
1394
- bool AsyncClient::connected () {
1394
+ bool AsyncClient::connected () const {
1395
1395
if (!_pcb) {
1396
1396
return false ;
1397
1397
}
1398
1398
return _pcb->state == ESTABLISHED;
1399
1399
}
1400
1400
1401
- bool AsyncClient::connecting () {
1401
+ bool AsyncClient::connecting () const {
1402
1402
if (!_pcb) {
1403
1403
return false ;
1404
1404
}
1405
1405
return _pcb->state > CLOSED && _pcb->state < ESTABLISHED;
1406
1406
}
1407
1407
1408
- bool AsyncClient::disconnecting () {
1408
+ bool AsyncClient::disconnecting () const {
1409
1409
if (!_pcb) {
1410
1410
return false ;
1411
1411
}
1412
1412
return _pcb->state > ESTABLISHED && _pcb->state < TIME_WAIT;
1413
1413
}
1414
1414
1415
- bool AsyncClient::disconnected () {
1415
+ bool AsyncClient::disconnected () const {
1416
1416
if (!_pcb) {
1417
1417
return true ;
1418
1418
}
1419
1419
return _pcb->state == CLOSED || _pcb->state == TIME_WAIT;
1420
1420
}
1421
1421
1422
- bool AsyncClient::freeable () {
1422
+ bool AsyncClient::freeable () const {
1423
1423
if (!_pcb) {
1424
1424
return true ;
1425
1425
}
1426
1426
return _pcb->state == CLOSED || _pcb->state > ESTABLISHED;
1427
1427
}
1428
1428
1429
- bool AsyncClient::canSend () {
1429
+ bool AsyncClient::canSend () const {
1430
1430
return space () > 0 ;
1431
1431
}
1432
1432
@@ -1453,7 +1453,7 @@ const char *AsyncClient::errorToString(int8_t error) {
1453
1453
}
1454
1454
}
1455
1455
1456
- const char *AsyncClient::stateToString () {
1456
+ const char *AsyncClient::stateToString () const {
1457
1457
switch (state ()) {
1458
1458
case 0 : return " Closed" ;
1459
1459
case 1 : return " Listen" ;
@@ -1660,11 +1660,11 @@ void AsyncServer::setNoDelay(bool nodelay) {
1660
1660
_noDelay = nodelay;
1661
1661
}
1662
1662
1663
- bool AsyncServer::getNoDelay () {
1663
+ bool AsyncServer::getNoDelay () const {
1664
1664
return _noDelay;
1665
1665
}
1666
1666
1667
- uint8_t AsyncServer::status () {
1667
+ uint8_t AsyncServer::status () const {
1668
1668
if (!_pcb) {
1669
1669
return 0 ;
1670
1670
}
0 commit comments