|
54 | 54 | # pylint: disable=bad-whitespace
|
55 | 55 | _SET_NET_CMD = const(0x10)
|
56 | 56 | _SET_PASSPHRASE_CMD = const(0x11)
|
57 |
| -_SET_AP_PASSPHRASE_CMD = const(0x19) |
58 | 57 | _SET_DEBUG_CMD = const(0x1A)
|
59 | 58 |
|
60 | 59 | _GET_CONN_STATUS_CMD = const(0x20)
|
@@ -629,22 +628,15 @@ def start_server(self, port, socket_num, conn_mode=TCP_MODE, ip=None): # pylint:
|
629 | 628 | if self._debug:
|
630 | 629 | print("*** starting server")
|
631 | 630 | self._socknum_ll[0][0] = socket_num
|
632 |
| - port_param = struct.pack('>H', port) |
633 |
| - if ip: # use the 4 arg version |
634 |
| - resp = self._send_command_get_response(_START_SERVER_TCP_CMD, |
635 |
| - (ip, |
636 |
| - port_param, |
637 |
| - self._socknum_ll[0], |
638 |
| - (conn_mode,))) |
639 |
| - else: # use the 3 arg version |
640 |
| - resp = self._send_command_get_response(_START_SERVER_TCP_CMD, |
641 |
| - (port_param, |
642 |
| - self._socknum_ll[0], |
643 |
| - (conn_mode,))) |
| 631 | + params = [struct.pack('>H', port), self._socknum_ll[0], (conn_mode,)] |
| 632 | + if ip: |
| 633 | + params.insert(0, ip) |
| 634 | + resp = self._send_command_get_response(_START_SERVER_TCP_CMD, params) |
| 635 | + |
644 | 636 | if resp[0][0] != 1:
|
645 | 637 | raise RuntimeError("Could not start server")
|
646 | 638 |
|
647 |
| - def get_server_state(self, socket_num): |
| 639 | + def server_state(self, socket_num): |
648 | 640 | """Get the state of the ESP32's internal reference server socket number"""
|
649 | 641 | self._socknum_ll[0][0] = socket_num
|
650 | 642 | resp = self._send_command_get_response(_GET_STATE_TCP_CMD, self._socknum_ll)
|
|
0 commit comments