Zaber Launcher Tutorials
Zaber Motion Library
Sample Projects
Virtual DeviceDropdown icon
About3D Viewer
AccountDropdown icon
Sign InSign Up
Zaber Motion LibraryGetting StartedHow-to Guides
API Reference
root
zaber_motion.ascii
AlertEventAllAxesAxisAxisGroupAxisIdentityAxisSettingsAxisStorageAxisTypeConnectionConversionFactorDeviceDeviceIdentityDeviceIODeviceIOInfoDeviceSettingsDeviceStorageDigitalOutputActionGetAxisSettingGetAxisSettingResultGetSettingGetSettingResultIoPortLabelIoPortTypeLockstepMeasurementSequenceMessageTypeOscilloscopeOscilloscopeCapturePropertiesOscilloscopeDataOscilloscopeDataSourceParamsetInfoPidTuningPvtPvtAxisDefinitionPvtAxisTypePvtBufferPvtCallActionPvtCancelAllOutputsScheduleActionPvtCancelOutputScheduleActionPvtCsvDataPvtIoPvtModePvtPartialCsvDataPvtPartialPointPvtPartialSequenceItemPvtPointPvtSequencePvtSequenceItemPvtSetAllAnalogOutputsActionPvtSetAllDigitalOutputsActionPvtSetAnalogOutputActionPvtSetDigitalOutputActionResponseServoTunerServoTuningParamServoTuningParamsetSetStateAxisResponseSetStateDeviceResponseSettingConstantsSimpleTuningSimpleTuningParamDefinitionStreamStreamAxisDefinitionStreamAxisTypeStreamBufferStreamIoStreamModeStreamsTransportTriggerTriggerActionTriggerConditionTriggerEnabledStateTriggerOperationTriggersTriggerStateUnknownResponseEventWarningFlagsWarnings
zaber_motion.binary
BinarySettingsCommandCodeConnectionDeviceDeviceIdentityDeviceSettingsDeviceTypeErrorCodeMessageReplyCodeReplyOnlyEventUnknownResponseEvent
zaber_motion.exceptions
MotionLibExceptionBinaryCommandFailedExceptionDataCommandFailedExceptionDataCommandTooLongExceptionDataDeviceAddressConflictExceptionDataDeviceDbFailedExceptionDataDeviceDbInnerErrorGCodeExecutionExceptionDataGCodeSyntaxExceptionDataInvalidPacketExceptionDataInvalidPvtPointInvalidResponseExceptionDataMovementFailedExceptionDataMovementInterruptedExceptionDataOperationFailedExceptionDataPvtExecutionExceptionDataPvtMovementFailedExceptionDataPvtMovementInterruptedExceptionDataSetDeviceStateExceptionDataSetPeripheralStateExceptionDataStreamExecutionExceptionDataStreamMovementFailedExceptionDataStreamMovementInterruptedExceptionData
zaber_motion.gcode
AxisDefinitionAxisMappingAxisTransformationDeviceDefinitionOfflineTranslatorTranslateMessageTranslateResultTranslatorTranslatorConfig
zaber_motion.microscopy
AutofocusAutofocusStatusCameraTriggerFilterChangerIlluminatorIlluminatorChannelMicroscopeMicroscopeConfigObjectiveChangerThirdPartyComponentsWdiAutofocusProviderWdiAutofocusProviderStatus
zaber_motion.product
ProcessProcessControllerProcessControllerModeProcessControllerSourceProcessControllerSourceSensor
zaber_motion
AxisAddressChannelAddressCyclicDirectionDeviceDbSourceDeviceDbSourceTypeDeviceDiscoveryResultDevicePortTypeFirmwareVersionLibraryLogOutputModeMeasurementNamedParameterRotationDirectionToolsUnitConversionDescriptorUnitsUnitTable
SupportBinary Protocol (Legacy)
© 2026 Zaber Technologies Inc.

API Reference v9.0.0

Connectionclass

Module: zaber_motion.binary

Class representing access to particular connection (serial port, TCP connection) using the legacy Binary protocol.

To use this type, add from zaber_motion.binary import Connection to the top of your source code.

Index

cConstants
DEFAULT_BAUD_RATE
TCP_PORT_CHAIN
TCP_PORT_DEVICE_ONLY
pProperties
interface_id
is_open
eEvents
disconnected
reply_only
unknown_response
mMethods
close()
detect_devices()
generic_command()
generic_command_multi_response()
generic_command_no_response()
get_device()
open_serial_port()
open_tcp()
renumber_devices()
__repr__()

Constants

c

DEFAULT_BAUD_RATE

Connection.DEFAULT_BAUD_RATE
int Default baud rate for serial connections.
Value
9600
c

TCP_PORT_CHAIN

Connection.TCP_PORT_CHAIN
int Commands sent over this port are forwarded to the device chain. The bandwidth may be limited as the commands are forwarded over a serial connection.
Value
55550
c

TCP_PORT_DEVICE_ONLY

Connection.TCP_PORT_DEVICE_ONLY
int Commands send over this port are processed only by the device and not forwarded to the rest of the chain. Using this port typically makes the communication faster.
Value
55551

Properties

p

interface_id

readonly
connection.interface_id
int The interface ID identifies thisConnection instance with the underlying library.
p

is_open

readonly
connection.is_open
bool Returns whether the connection is open. Does not guarantee that the subsequent requests will succeed.

Events

e

disconnected

connection.disconnected
Event invoked when connection is interrupted or closed.
Emitted Data
MotionLibException Error that caused disconnection.
e

reply_only

connection.reply_only
Event invoked when a reply-only command such as a move tracking message is received from a device.
Emitted Data
ReplyOnlyEvent Reply-only message received from the device.
e

unknown_response

connection.unknown_response
Event invoked when a response from a device cannot be matched to any known request.
Emitted Data
UnknownResponseEvent Reply that could not be matched to a request.

Methods

m

close()

async available
connection.close()
Close the connection.
m

detect_devices()

async available
connection.detect_devices(identify_devices = True)
Attempts to detect any devices present on this connection.
Arguments
NameTypeDescription
identify_devicesboolDetermines whether device identification should be performed as well.
Return Value
List[Device] Array of detected devices.
m

generic_command()

async available
connection.generic_command(device, command, data = 0, timeout = 0.0, check_errors = True)
Sends a generic Binary command to this connection. For more information please refer to the Binary Protocol Manual.
Arguments
NameTypeDescription
deviceintDevice address to send the command to. Use zero for broadcast.
commandCommandCodeCommand to send.
dataintOptional data argument to the command. Defaults to zero.
timeoutfloatNumber of seconds to wait for a response from the device. 0 or negative defaults to 0.5s.
check_errorsboolControls whether to throw an exception when the device rejects the command.
Return Value
Message A response to the command.
m

generic_command_multi_response()

async available
connection.generic_command_multi_response(command, data = 0, timeout = 0.0, check_errors = True)
Sends a generic Binary command to this connection and expects responses from one or more devices. Responses are returned in order of arrival. For more information please refer to the Binary Protocol Manual.
Arguments
NameTypeDescription
commandCommandCodeCommand to send.
dataintOptional data argument to the command. Defaults to zero.
timeoutfloatNumber of seconds to wait for all responses from the device chain. 0 or negative defaults to 0.5s.
check_errorsboolControls whether to throw an exception when any device rejects the command.
Return Value
List[Message] All responses to the command.
m

generic_command_no_response()

async available
connection.generic_command_no_response(device, command, data = 0)
Sends a generic Binary command to this connection without expecting a response. For more information please refer to the Binary Protocol Manual.
Arguments
NameTypeDescription
deviceintDevice address to send the command to. Use zero for broadcast.
commandCommandCodeCommand to send.
dataintOptional data argument to the command. Defaults to zero.
m

get_device()

connection.get_device(device_address)
Gets a Device class instance which allows you to control a particular device on this connection. Devices are numbered from 1.
Arguments
NameTypeDescription
device_addressintAddress of device intended to control. Address is configured for each device.
Return Value
Device Device instance.
s

open_serial_port()

async available
Connection.open_serial_port(port_name, baud_rate = DEFAULT_BAUD_RATE, use_message_ids = False)
Opens a serial port.
Arguments
NameTypeDescription
port_namestrName of the port to open.
baud_rateintOptional baud rate (defaults to 9600).
use_message_idsboolEnable use of message IDs (defaults to disabled). All your devices must be pre-configured to match.
Return Value
Connection An object representing the port.
s

open_tcp()

async available
Connection.open_tcp(host_name, port = TCP_PORT_CHAIN, use_message_ids = False)
Opens a TCP connection.
Arguments
NameTypeDescription
host_namestrHostname or IP address.
portintOptional port number (defaults to 55550).
use_message_idsboolEnable use of message IDs (defaults to disabled). All your devices must be pre-configured to match.
Return Value
Connection An object representing the connection.
m

renumber_devices()

async available
connection.renumber_devices()
Renumbers devices present on this connection. After renumbering, you must identify devices again.
Return Value
int Total number of devices that responded to the renumber.
m

__repr__()

connection.__repr__()
Returns a string that represents the connection.
Return Value
str A string that represents the connection.
Top