Skip to content

Commit da7bfb2

Browse files
committed
get_remote_data() exposes NINA getRemoteData()
1 parent b11cf2a commit da7bfb2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
_START_SCAN_NETWORKS = const(0x36)
7171
_GET_FW_VERSION_CMD = const(0x37)
7272
_SEND_UDP_DATA_CMD = const(0x39)
73+
_GET_REMOTE_DATA_CMD = const(0x3A)
7374
_GET_TIME = const(0x3B)
7475
_GET_IDX_BSSID_CMD = const(0x3C)
7576
_GET_IDX_CHAN_CMD = const(0x3D)
@@ -847,6 +848,12 @@ def server_state(self, socket_num):
847848
resp = self._send_command_get_response(_GET_STATE_TCP_CMD, self._socknum_ll)
848849
return resp[0][0]
849850

851+
def get_remote_data(self, socket_num):
852+
"""Get the IP address and port of the remote host"""
853+
self._socknum_ll[0][0] = socket_num
854+
resp = self._send_command_get_response(_GET_REMOTE_DATA_CMD, self._socknum_ll, reply_params=2)
855+
return {"ip_addr": resp[0], "port": struct.unpack("<H", resp[1])[0]}
856+
850857
def set_esp_debug(self, enabled):
851858
"""Enable/disable debug mode on the ESP32. Debug messages will be
852859
written to the ESP32's UART."""

0 commit comments

Comments
 (0)