eric7.MicroPython.MicroPythonWebreplSocket
Module implementing a websocket class to be connect to the MicroPython webrepl
interface.
Global Attributes
Classes
Functions
MicroPythonWebreplSocket
    Class implementing a websocket client to be connected to the MicroPython webrepl
    interface.
Signals
- readyRead()
- 
emitted to signal the availability of data
Derived from
QWebSocket
Class Attributes
Class Methods
Methods
| MicroPythonWebreplSocket | Constructor | 
| __textDataReceived | Private slot handling a received text message. | 
| connectToDevice | Public method to connect to the given host and port. | 
| disconnect | Public method to disconnect the websocket. | 
| hasTimedOut | Public method to check, if the last 'readUntil()' has timed out. | 
| isConnected | Public method to check the connected state of the websocket. | 
| login | Public method to login to the webrepl console of the device. | 
| readAll | Public method to read all available data. | 
| readUntil | Public method to read data until an expected sequence is found (default: \n) or a specific size is exceeded. | 
| setTimeout | Public method to set the socket timeout value. | 
| timeout |  | 
| waitForConnected | Public method to wait for the websocket being connected. | 
| writeTextMessage | Public method write some text data to the webrepl server of the connected device. | 
Static Methods
MicroPythonWebreplSocket (Constructor)
MicroPythonWebreplSocket(timeout=10000, parent=None)
        Constructor
- timeout (int)
- 
timout in milliseconds to be set
- parent (QObject)
- 
reference to the parent object
MicroPythonWebreplSocket.__textDataReceived
__textDataReceived(strMessage)
        Private slot handling a received text message.
- strMessage (str)
- 
received text message
MicroPythonWebreplSocket.connectToDevice
connectToDevice(host, port)
        Public method to connect to the given host and port.
- host (str)
- 
host name or IP address
- port (int)
- 
port number
- Return:
- 
flag indicating success and an error message
- Return Type:
- 
tuple of (bool, str)
MicroPythonWebreplSocket.disconnect
disconnect()
        Public method to disconnect the websocket.
MicroPythonWebreplSocket.hasTimedOut
hasTimedOut()
        Public method to check, if the last 'readUntil()' has timed out.
- Return:
- 
flag indicating a timeout
- Return Type:
- 
bool
MicroPythonWebreplSocket.isConnected
isConnected()
        Public method to check the connected state of the websocket.
- Return:
- 
flag indicating the connected state
- Return Type:
- 
bool
MicroPythonWebreplSocket.login
login(password)
        Public method to login to the webrepl console of the device.
- password (str)
- 
password
- Return:
- 
flag indicating a successful login and an error indication
- Return Type:
- 
tuple of (bool, str)
MicroPythonWebreplSocket.readAll
readAll(timeout=0)
        Public method to read all available data.
- timeout (int (optional))
- 
timeout in milliseconds (0 for no timeout)
            (defaults to 0)
- Return:
- 
received data
- Return Type:
- 
bytes
MicroPythonWebreplSocket.readUntil
readUntil(expected=b"\n", size=None, timeout=0)
        Public method to read data until an expected sequence is found
        (default: \n) or a specific size is exceeded.
- expected (bytes)
- 
expected bytes sequence
- size (int (optional))
- 
maximum data to be read (defaults to None)
- timeout (int (optional))
- 
timeout in milliseconds (0 for configured default)
            (defaults to 0)
- Return:
- 
bytes read from the device including the expected sequence
- Return Type:
- 
bytes
MicroPythonWebreplSocket.setTimeout
setTimeout(timeout)
        Public method to set the socket timeout value.
- timeout (int)
- 
timout in milliseconds to be set
MicroPythonWebreplSocket.timeout
timeout()
MicroPythonWebreplSocket.waitForConnected
waitForConnected()
        Public method to wait for the websocket being connected.
- Return:
- 
flag indicating the connect result
- Return Type:
- 
bool
MicroPythonWebreplSocket.writeTextMessage
writeTextMessage(data)
        Public method write some text data to the webrepl server of the connected
        device.
- data (bytes)
- 
text data to be sent