Communication¶
ComBase¶
-
class
Communication.ComBase.
ComBase
[source]¶ - Inherit
QThread
- Description
Base communication class used as inheritance class for other more complex com classes.
Implement signal communication with superior task and start, close methods.
-
connect_to_device
()[source]¶ - Raises
NotImplementedError – Python way of saying this method is virtual.
-
get_data
()[source]¶ - Raises
NotImplementedError – Python way of saying this method is virtual.
SerialCom¶
-
class
Communication.SerialCom.
SerialCom
(port, bauds=921600)[source]¶ - Inherit
ComBase
- Description
Handle communication with device via serial port (COM).
- Parameters
- Raises
OSError – COM port does not exist.
– COM port is not a str.
– Baud rate is not a int.
ValueError – Baud rate is not in range 300 - 921600.
-
static
check_baud_rate
(bauds)[source]¶ - Description
Check if baud is an int in range of 300 - 921600.
- Parameters
bauds (int) – Baud rate.
- Raises
ValueError – Baud rate is not in range 300 - 921600.
TypeError – Baud rate is not an integer.
SocketClient¶
-
class
Communication.SocketClient.
SocketClient
(address='192.168.1.100', port=80)[source]¶ - Inherit
ComBase
- Description
Handle direct communication with car via Wi-Fi.
- Parameters
- Raises
OSError – IP address is invalid.
TypeError – Port is not a int.
ValueError – Port is not i range 1 - 65536.
-
static
check_port
(port)[source]¶ - Description
Check if port is int in range 1 - 65535.
- Parameters
port (int) – Communication port.
- Raises
ValueError – Port is not in range of 1 - 65535.
TypeError – Port is not an int.
-
connect_to_device
()[source]¶ - Description
Establish serial communication with server via Wi-Fi.
Send information about connection status.
- Raises
WindowsError – A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
-
get_data
()[source]¶ - Description
Receive data from device and send signal containing data as a byte array.
Whenever one of the following errors raise, method will try to resolve problem by reconnecting.
- Raises
WindowsError – Unable to reach network.
AttributeError – SocketClient was not set properly.