AUBO SDK  0.26.0
Loading...
Searching...
No Matches
arcs::common_interface::Serial Class Reference

#include <serial.h>

Public Member Functions

 Serial ()
 
virtual ~Serial ()
 
int serialOpen (const std::string &device, int baud, float stop_bits, int even, const std::string &serial_name="serial_0")
 Open TCP/IP ethernet communication serial
 
int serialClose (const std::string &serial_name="serial_0")
 Close TCP/IP serial communication Close down the serial connection to the server.
 
int serialReadByte (const std::string &variable, const std::string &serial_name="serial_0")
 Reads a number of bytes from the serial.
 
int serialReadByteList (int number, const std::string &variable, const std::string &serial_name="serial_0")
 Reads a number of bytes from the serial.
 
int serialReadString (const std::string &variable, const std::string &serial_name="serial_0", const std::string &prefix="", const std::string &suffix="", bool interpret_escape=false)
 Reads all data from the serial and returns the data as a string.
 
int serialSendByte (char value, const std::string &serial_name="serial_0")
 Sends a byte to the server Sends the byte through the serial.
 
int serialSendInt (int value, const std::string &serial_name="serial_0")
 Sends an int (int32_t) to the server Sends the int through the serial.
 
int serialSendLine (const std::string &str, const std::string &serial_name="serial_0")
 Sends a string with a newline character to the server Sends the string <str> through the serial in ASCII coding, appending a newline at the end.
 
int serialSendString (const std::string &str, const std::string &serial_name="serial_0")
 Sends a string to the server Sends the string <str> through the serial in ASCII coding.
 
int serialSendAllString (bool is_check, const std::vector< char > &str, const std::string &serial_name="serial_0")
 

Protected Attributes

void * d_
 

Detailed Description

Definition at line 16 of file serial.h.

Constructor & Destructor Documentation

◆ Serial()

arcs::common_interface::Serial::Serial ( )

◆ ~Serial()

virtual arcs::common_interface::Serial::~Serial ( )
virtual

Member Function Documentation

◆ serialClose()

int arcs::common_interface::Serial::serialClose ( const std::string &  serial_name = "serial_0")

Close TCP/IP serial communication Close down the serial connection to the server.

Parameters
serial_name
Returns
Python function prototype
serialClose(self: pyaubo_sdk.Serial, arg0: str) -> int
Lua function prototype
serialClose(serial_name: string) -> nil

◆ serialOpen()

int arcs::common_interface::Serial::serialOpen ( const std::string &  device,
int  baud,
float  stop_bits,
int  even,
const std::string &  serial_name = "serial_0" 
)

Open TCP/IP ethernet communication serial

Parameters
device
baud
stop_bits
even
serial_name
Returns
Python function prototype
serialOpen(self: pyaubo_sdk.Serial, arg0: str, arg1: int, arg2: float, arg3: int, arg4: str) -> int
Lua function prototype
serialOpen(device: string, baud: number, stop_bits: number, even: number, serial_name: string) -> nil

◆ serialReadByte()

int arcs::common_interface::Serial::serialReadByte ( const std::string &  variable,
const std::string &  serial_name = "serial_0" 
)

Reads a number of bytes from the serial.

Bytes are in network byte order. A maximum of 30 values can be read in one command.

Parameters
variable
serial_name
Returns
Python function prototype
serialReadByte(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
Lua function prototype
serialReadByte(variable: string, serial_name: string) -> number

◆ serialReadByteList()

int arcs::common_interface::Serial::serialReadByteList ( int  number,
const std::string &  variable,
const std::string &  serial_name = "serial_0" 
)

Reads a number of bytes from the serial.

Bytes are in network byte order. A maximum of 30 values can be read in one command. A list of numbers read (list of ints, length=number+1)

Parameters
numberNumber of bytes to read
variable
serial_nameSerial port name
Returns
Return value
Python function prototype
serialReadByteList(self: pyaubo_sdk.Serial, arg0: int, arg1: str, arg2: str) -> int
Lua function prototype
serialReadByteList(number: number, variable: string, serial_name: string) -> number

◆ serialReadString()

int arcs::common_interface::Serial::serialReadString ( const std::string &  variable,
const std::string &  serial_name = "serial_0",
const std::string &  prefix = "",
const std::string &  suffix = "",
bool  interpret_escape = false 
)

Reads all data from the serial and returns the data as a string.

Bytes are in network byte order.

The optional parameters "prefix" and "suffix", can be used to express what is extracted from the serial. The "prefix" specifies the start of the substring (message) extracted from the serial. The data up to the end of the "prefix" will be ignored and removed from the serial. The "suffix" specifies the end of the substring (message) extracted from the serial. Any remaining data on the serial, after the "suffix", will be preserved. E.g. if the serial server sends a string "noise>hello<", the controller can receive the "hello" by calling this script function with the prefix=">" and suffix="<". By using the "prefix" and "suffix" it is also possible send multiple string to the controller at once, because the suffix defines where the message ends. E.g. sending ">hello<>world<"

Parameters
variable
serial_name
prefix
suffix
interpret_escape
Returns
Python function prototype
serialReadString(self: pyaubo_sdk.Serial, arg0: str, arg1: str, arg2: str, arg3: str, arg4: bool) -> int
Lua function prototype
serialReadString(variable: string, serial_name: string, prefix: string, suffix: string, interpret_escape: boolean) -> number

◆ serialSendAllString()

int arcs::common_interface::Serial::serialSendAllString ( bool  is_check,
const std::vector< char > &  str,
const std::string &  serial_name = "serial_0" 
)

Parameters
is_checkWhether to check
strArray of strings
serial_nameSerial port name
Returns
Return value
Python function prototype
serialSendAllString(self: pyaubo_sdk.Serial, arg0: bool, arg1: List[str], arg2: str) -> int
Lua function prototype
serialSendAllString(is_check: boolean, str: table, serial_name: string) -> nil

◆ serialSendByte()

int arcs::common_interface::Serial::serialSendByte ( char  value,
const std::string &  serial_name = "serial_0" 
)

Sends a byte to the server Sends the byte through the serial.

Expects no response. Can be used to send special ASCII characters; 10 is newline, 2 is start of text, 3 is end of text.

Parameters
value
serial_name
Returns
Python function prototype
serialSendByte(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
Lua function prototype
serialSendByte(value: string, serial_name: string) -> nil

◆ serialSendInt()

int arcs::common_interface::Serial::serialSendInt ( int  value,
const std::string &  serial_name = "serial_0" 
)

Sends an int (int32_t) to the server Sends the int through the serial.

Send in network byte order. Expects no response.

Parameters
value
serial_name
Returns
Python function prototype
serialSendInt(self: pyaubo_sdk.Serial, arg0: int, arg1: str) -> int
Lua function prototype
serialSendInt(value: number, serial_name: string) -> nil

◆ serialSendLine()

int arcs::common_interface::Serial::serialSendLine ( const std::string &  str,
const std::string &  serial_name = "serial_0" 
)

Sends a string with a newline character to the server Sends the string <str> through the serial in ASCII coding, appending a newline at the end.

Expects no response.

Parameters
str
serial_name
Returns
Python function prototype
serialSendLine(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
Lua function prototype
serialSendLine(str: string, serial_name: string) -> nil

◆ serialSendString()

int arcs::common_interface::Serial::serialSendString ( const std::string &  str,
const std::string &  serial_name = "serial_0" 
)

Sends a string to the server Sends the string <str> through the serial in ASCII coding.

Expects no response.

Parameters
str
serial_name
Returns
Python function prototype
serialSendString(self: pyaubo_sdk.Serial, arg0: str, arg1: str) -> int
Lua function prototype
serialSendString(str: string, serial_name: string) -> nil

Member Data Documentation

◆ d_

void* arcs::common_interface::Serial::d_
protected

Definition at line 390 of file serial.h.


The documentation for this class was generated from the following file: