Documentation for the Code¶
Faraday Module¶
-
class
faradayio.faraday.
Faraday
(serialPort=None)[source]¶ A class that enables transfer of data between computer and Faraday
This class interfaces a Faraday over a serial port. All it simply does is properly encode/decode SLIP packets.
-
_serialPort
¶ serial instance – Pyserial serial port instance.
-
receive
(length)[source]¶ Reads in data from a serial port (length bytes), decodes SLIP packets
A function which reads from the serial port and then uses the SlipLib module to decode the SLIP protocol packets. Each message received is added to a receive buffer in SlipLib which is then returned.
Parameters: length (int) – Length to receive with serialPort.read(length) Returns: An iterator of the receive buffer Return type: bytes
-
send
(msg)[source]¶ Encodes data to slip protocol and then sends over serial port
Uses the SlipLib module to convert the message data into SLIP format. The message is then sent over the serial port opened with the instance of the Faraday class used when invoking send().
Parameters: msg (bytes) – Bytes format message to send over serial port. Returns: Number of bytes transmitted over the serial port. Return type: int
-