Rename class that uses the network stream

This commit is contained in:
Kwabena W. Agyeman 2021-10-16 21:51:43 -07:00
parent 2603c12854
commit a2f016ba09
5 changed files with 9 additions and 9 deletions

View File

@ -195,11 +195,11 @@ Creates a slave implementation of the `rpc` library to communicate over a USB VC
Communication over USB is the most reliable and high speed way to connect an OpenMV Cam to a computer. However, as the OpenMV Cam has only one VCP port we recommend that you fully debug your script using the `rpc_usb_vcp_master` on your OpenMV using another `rpc` interface if possible as you will not be able to get error messages off the OpenMV Cam easily. For example, connecting the `rpc_usb_vcp_slave` to the `rpc_uart_master` on your OpenMV Cam at 115200 BPS over a USB-to-Serial adapter when debugging will make your life far easier. Alternatively, use the Ethernet or WiFi interface when debugging. Communication over USB is the most reliable and high speed way to connect an OpenMV Cam to a computer. However, as the OpenMV Cam has only one VCP port we recommend that you fully debug your script using the `rpc_usb_vcp_master` on your OpenMV using another `rpc` interface if possible as you will not be able to get error messages off the OpenMV Cam easily. For example, connecting the `rpc_usb_vcp_slave` to the `rpc_uart_master` on your OpenMV Cam at 115200 BPS over a USB-to-Serial adapter when debugging will make your life far easier. Alternatively, use the Ethernet or WiFi interface when debugging.
## rpc_wifi_or_ethernet_master(slave_ip, my_ip="", port=0x1DBA): ## rpc_network_master(slave_ip, my_ip="", port=0x1DBA):
Creates a master implementation of the `rpc` library to communicate over WiFi or Ethernet. `slave_ip` is the IPV4 address of the `rpc` slave device. `my_ip` can be `""` which binds the master to any interface adapter to communicate to the slave. If `my_ip` is not `""` then it should be an IP address on the same subnet as `slave_ip`. `port` is a free port to use for UDP and TCP traffic. Creates a master implementation of the `rpc` library to communicate over WiFi or Ethernet. `slave_ip` is the IPV4 address of the `rpc` slave device. `my_ip` can be `""` which binds the master to any interface adapter to communicate to the slave. If `my_ip` is not `""` then it should be an IP address on the same subnet as `slave_ip`. `port` is a free port to use for UDP and TCP traffic.
## rpc_wifi_or_ethernet_slave(my_ip="", port=0x1DBA): ## rpc_network_slave(my_ip="", port=0x1DBA):
Creates a slave implementation of the `rpc` library to communicate over WiFi or Ethernet. `my_ip` can be `""` which binds the slave to any interface adapter to communicate to the master. If `my_ip` is not `""` then it should be an IP address on the same subnet as the master. `port` is a free port to use for UDP and TCP traffic. Creates a slave implementation of the `rpc` library to communicate over WiFi or Ethernet. `my_ip` can be `""` which binds the slave to any interface adapter to communicate to the master. If `my_ip` is not `""` then it should be an IP address on the same subnet as the master. `port` is a free port to use for UDP and TCP traffic.

View File

@ -437,7 +437,7 @@ class rpc_usb_vcp_slave(rpc_slave):
if int(self.__ser.timeout) != 1: self.__ser.timeout = 1 # Changing this causes control transfers. if int(self.__ser.timeout) != 1: self.__ser.timeout = 1 # Changing this causes control transfers.
return self.__get_bytes(buff) return self.__get_bytes(buff)
class rpc_wifi_or_ethernet_master(rpc_master): class rpc_network_master(rpc_master):
def __valid_tcp_socket(self): # private def __valid_tcp_socket(self): # private
if self.__tcp__socket is None: if self.__tcp__socket is None:
@ -584,7 +584,7 @@ class rpc_wifi_or_ethernet_master(rpc_master):
except (socket.timeout, socket.error): self.__close_tcp_socket() except (socket.timeout, socket.error): self.__close_tcp_socket()
if l: raise OSError # Stop Stream. if l: raise OSError # Stop Stream.
class rpc_wifi_or_ethernet_slave(rpc_slave): class rpc_network_slave(rpc_slave):
def __valid_tcp_socket(self): # private def __valid_tcp_socket(self): # private
if self.__tcp__socket is None: if self.__tcp__socket is None:

View File

@ -36,7 +36,7 @@ sys.stdout.flush()
# * my_ip - IP address to bind to ("" to bind to all interfaces...) # * my_ip - IP address to bind to ("" to bind to all interfaces...)
# * port - Port to route traffic to. # * port - Port to route traffic to.
# #
# interface = rpc.rpc_wifi_or_ethernet_master(slave_ip="xxx.xxx.xxx.xxx", my_ip="", port=0x1DBA) # interface = rpc.rpc_network_master(slave_ip="xxx.xxx.xxx.xxx", my_ip="", port=0x1DBA)
############################################################## ##############################################################
# Call Back Handlers # Call Back Handlers

View File

@ -36,7 +36,7 @@ sys.stdout.flush()
# * my_ip - IP address to bind to ("" to bind to all interfaces...) # * my_ip - IP address to bind to ("" to bind to all interfaces...)
# * port - Port to route traffic to. # * port - Port to route traffic to.
# #
# interface = rpc.rpc_wifi_or_ethernet_master(slave_ip="xxx.xxx.xxx.xxx", my_ip="", port=0x1DBA) # interface = rpc.rpc_network_master(slave_ip="xxx.xxx.xxx.xxx", my_ip="", port=0x1DBA)
############################################################## ##############################################################
# Call Back Handlers # Call Back Handlers

View File

@ -34,7 +34,7 @@ sys.stdout.flush()
# * my_ip - IP address to bind to ("" to bind to all interfaces...) # * my_ip - IP address to bind to ("" to bind to all interfaces...)
# * port - Port to route traffic to. # * port - Port to route traffic to.
# #
# interface = rpc.rpc_wifi_or_ethernet_master(slave_ip="xxx.xxx.xxx.xxx", my_ip="", port=0x1DBA) # interface = rpc.rpc_network_master(slave_ip="xxx.xxx.xxx.xxx", my_ip="", port=0x1DBA)
# Uncomment the below lines to setup your OpenMV Cam for controlling over a UART (Serial / COM Port). # Uncomment the below lines to setup your OpenMV Cam for controlling over a UART (Serial / COM Port).
# #