set_serial_paramT_set_serial_paramSetSerialParamSetSerialParamset_serial_param (Operator)

Name

set_serial_paramT_set_serial_paramSetSerialParamSetSerialParamset_serial_param — Set the parameters of a serial device.

Signature

set_serial_param( : : SerialHandle, BaudRate, DataBits, FlowControl, Parity, StopBits, TotalTimeOut, InterCharTimeOut : )

Herror T_set_serial_param(const Htuple SerialHandle, const Htuple BaudRate, const Htuple DataBits, const Htuple FlowControl, const Htuple Parity, const Htuple StopBits, const Htuple TotalTimeOut, const Htuple InterCharTimeOut)

void SetSerialParam(const HTuple& SerialHandle, const HTuple& BaudRate, const HTuple& DataBits, const HTuple& FlowControl, const HTuple& Parity, const HTuple& StopBits, const HTuple& TotalTimeOut, const HTuple& InterCharTimeOut)

void HSerial::SetSerialParam(const HTuple& BaudRate, const HTuple& DataBits, const HString& FlowControl, const HString& Parity, const HTuple& StopBits, const HTuple& TotalTimeOut, const HTuple& InterCharTimeOut) const

void HSerial::SetSerialParam(Hlong BaudRate, Hlong DataBits, const HString& FlowControl, const HString& Parity, Hlong StopBits, Hlong TotalTimeOut, Hlong InterCharTimeOut) const

void HSerial::SetSerialParam(Hlong BaudRate, Hlong DataBits, const char* FlowControl, const char* Parity, Hlong StopBits, Hlong TotalTimeOut, Hlong InterCharTimeOut) const

void HSerial::SetSerialParam(Hlong BaudRate, Hlong DataBits, const wchar_t* FlowControl, const wchar_t* Parity, Hlong StopBits, Hlong TotalTimeOut, Hlong InterCharTimeOut) const   (Windows only)

static void HOperatorSet.SetSerialParam(HTuple serialHandle, HTuple baudRate, HTuple dataBits, HTuple flowControl, HTuple parity, HTuple stopBits, HTuple totalTimeOut, HTuple interCharTimeOut)

void HSerial.SetSerialParam(HTuple baudRate, HTuple dataBits, string flowControl, string parity, HTuple stopBits, HTuple totalTimeOut, HTuple interCharTimeOut)

void HSerial.SetSerialParam(int baudRate, int dataBits, string flowControl, string parity, int stopBits, int totalTimeOut, int interCharTimeOut)

def set_serial_param(serial_handle: HHandle, baud_rate: Union[int, str], data_bits: Union[int, str], flow_control: str, parity: str, stop_bits: Union[int, str], total_time_out: Union[int, str], inter_char_time_out: Union[int, str]) -> None

Description

set_serial_paramset_serial_paramSetSerialParamSetSerialParamSetSerialParamset_serial_param can be used to set the parameters of a serial device. The parameter BaudRateBaudRateBaudRateBaudRatebaudRatebaud_rate determines the input and output speed of the device. It should be noted that not all devices support all possible speeds. The number of sent and received data bits is set with DataBitsDataBitsDataBitsDataBitsdataBitsdata_bits. The parameter FlowControlFlowControlFlowControlFlowControlflowControlflow_control determines if and what kind of data flow control should be used. Software control ('xon_xoff'"xon_xoff""xon_xoff""xon_xoff""xon_xoff""xon_xoff") and hardware control ('cts_rts'"cts_rts""cts_rts""cts_rts""cts_rts""cts_rts" and 'dtr_dsr'"dtr_dsr""dtr_dsr""dtr_dsr""dtr_dsr""dtr_dsr") can be used. Multiple values can be set separated by a space within one string (e.g. 'cts_rts dtr_dsr'"cts_rts dtr_dsr""cts_rts dtr_dsr""cts_rts dtr_dsr""cts_rts dtr_dsr""cts_rts dtr_dsr"). If and what kind of parity check of the transmitted data should be performed can be determined by ParityParityParityParityparityparity. The number of stop bits sent is set with StopBitsStopBitsStopBitsStopBitsstopBitsstop_bits. Finally, two timeout for reading from the serial device can be set. The parameter TotalTimeOutTotalTimeOutTotalTimeOutTotalTimeOuttotalTimeOuttotal_time_out determines the maximum time, which may pass in read_serialread_serialReadSerialReadSerialReadSerialread_serial until the first character arrives, independent of the actual number of characters requested. The parameter InterCharTimeOutInterCharTimeOutInterCharTimeOutInterCharTimeOutinterCharTimeOutinter_char_time_out determines the time which may pass between the reading of individual characters, if multiple characters are requested with read_serialread_serialReadSerialReadSerialReadSerialread_serial. If one of the timeouts is set to -1, the system waits an arbitrary amount of time for the arrival of characters. If both timeouts are set to 0 the system doesn't wait and returns the available or none characters. Thus, on Windows systems, a total timeout of TotalTimeOutTotalTimeOutTotalTimeOutTotalTimeOuttotalTimeOuttotal_time_out + n InterCharTimeOutInterCharTimeOutInterCharTimeOutInterCharTimeOutinterCharTimeOutinter_char_time_out results if n characters are to be read. On Unix-like systems, only one of the two timeouts can be set. Thus, if both timeouts are passed larger than -1, only the total timeout is used. The unit of both timeouts is milliseconds. It should be noted, however, that the timeout is specified in increments of one tenths of a second on Unix-like systems, i.e., the minimum timeout that has any effect is 100. For each parameter, the current values can be left in effect by passing 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged".

Execution Information

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters

SerialHandleSerialHandleSerialHandleSerialHandleserialHandleserial_handle (input_control, state is modified)  serial HSerial, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Serial interface handle.

BaudRateBaudRateBaudRateBaudRatebaudRatebaud_rate (input_control)  integer HTupleUnion[int, str]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Speed of the serial interface.

Default value: 'unchanged' "unchanged" "unchanged" "unchanged" "unchanged" "unchanged"

List of values: 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200, 153600, 230400, 307200, 460800, 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged"

DataBitsDataBitsDataBitsDataBitsdataBitsdata_bits (input_control)  integer HTupleUnion[int, str]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Number of data bits of the serial interface.

Default value: 'unchanged' "unchanged" "unchanged" "unchanged" "unchanged" "unchanged"

List of values: 5, 6, 7, 8, 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged"

FlowControlFlowControlFlowControlFlowControlflowControlflow_control (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of flow control of the serial interface.

Default value: 'unchanged' "unchanged" "unchanged" "unchanged" "unchanged" "unchanged"

List of values: 'cts_rts dtr_dsr xon_xoff'"cts_rts dtr_dsr xon_xoff""cts_rts dtr_dsr xon_xoff""cts_rts dtr_dsr xon_xoff""cts_rts dtr_dsr xon_xoff""cts_rts dtr_dsr xon_xoff", 'cts_rts dtr_dsr'"cts_rts dtr_dsr""cts_rts dtr_dsr""cts_rts dtr_dsr""cts_rts dtr_dsr""cts_rts dtr_dsr", 'cts_rts xon_xoff'"cts_rts xon_xoff""cts_rts xon_xoff""cts_rts xon_xoff""cts_rts xon_xoff""cts_rts xon_xoff", 'cts_rts'"cts_rts""cts_rts""cts_rts""cts_rts""cts_rts", 'dtr_dsr xon_xoff'"dtr_dsr xon_xoff""dtr_dsr xon_xoff""dtr_dsr xon_xoff""dtr_dsr xon_xoff""dtr_dsr xon_xoff", 'dtr_dsr'"dtr_dsr""dtr_dsr""dtr_dsr""dtr_dsr""dtr_dsr", 'none'"none""none""none""none""none", 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged", 'xon_xoff'"xon_xoff""xon_xoff""xon_xoff""xon_xoff""xon_xoff"

ParityParityParityParityparityparity (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Parity of the serial interface.

Default value: 'unchanged' "unchanged" "unchanged" "unchanged" "unchanged" "unchanged"

List of values: 'even'"even""even""even""even""even", 'none'"none""none""none""none""none", 'odd'"odd""odd""odd""odd""odd", 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged"

StopBitsStopBitsStopBitsStopBitsstopBitsstop_bits (input_control)  integer HTupleUnion[int, str]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Number of stop bits of the serial interface.

Default value: 'unchanged' "unchanged" "unchanged" "unchanged" "unchanged" "unchanged"

List of values: 1, 2, 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged"

TotalTimeOutTotalTimeOutTotalTimeOutTotalTimeOuttotalTimeOuttotal_time_out (input_control)  integer HTupleUnion[int, str]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Total timeout of the serial interface in ms.

Default value: 'unchanged' "unchanged" "unchanged" "unchanged" "unchanged" "unchanged"

Suggested values: -1, 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged"

InterCharTimeOutInterCharTimeOutInterCharTimeOutInterCharTimeOutinterCharTimeOutinter_char_time_out (input_control)  integer HTupleUnion[int, str]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Inter-character timeout of the serial interface in ms.

Default value: 'unchanged' "unchanged" "unchanged" "unchanged" "unchanged" "unchanged"

Suggested values: -1, 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 'unchanged'"unchanged""unchanged""unchanged""unchanged""unchanged"

Result

If the parameters are correct and the parameters of the device could be set, the operator set_serial_paramset_serial_paramSetSerialParamSetSerialParamSetSerialParamset_serial_param returns the value TRUE. Otherwise an exception is raised.

Possible Predecessors

open_serialopen_serialOpenSerialOpenSerialOpenSerialopen_serial, get_serial_paramget_serial_paramGetSerialParamGetSerialParamGetSerialParamget_serial_param

Possible Successors

read_serialread_serialReadSerialReadSerialReadSerialread_serial, write_serialwrite_serialWriteSerialWriteSerialWriteSerialwrite_serial

See also

get_serial_paramget_serial_paramGetSerialParamGetSerialParamGetSerialParamget_serial_param

Module

Foundation