PySpin.System

class System(*args, **kwargs)

The system object is used to retrieve the list of interfaces and cameras available.

static GetInstance() SystemPtr

Return the singleton System instance, creating it on first call.

All cameras and interfaces are enumerated through this object. Call ReleaseInstance() when the application is done using the SDK.

Returns:

The singleton System object.

Return type:

SystemPtr

GetCameras(self, updateInterfaces=True, updateCameras=True) CameraList

Parameters

updateInterfaces: bool updateCameras: bool

Returns a list of cameras that are available on the system. This call returns both GigE Vision and Usb3 Vision cameras from all interfaces. The camera list object will reference count the cameras it returns. It is important that the camera list is destroyed or is cleared before calling system-> ReleaseInstance() or else the call to system-> ReleaseInstance() will result in an error message thrown that a reference to the camera is still held.

See: ReleaseInstance()

CameraList::Clear()

Args: updateInterfaces: Determines whether or not updateInterfaceList() is called before getting cameras from available interfaces on the system updateCameras: Determines whether or not UpdateCameras() is called before getting cameras from available interfaces on the system An CameraList object that contains a list of all cameras.

GetInterfaces(self, updateInterface=True) InterfaceList

Parameters

updateInterface: bool

Returns a list of interfaces available on the system. This call returns GigE and Usb2 and Usb3 interfaces. Note that on MacOS only active GigE interfaces will be stored in the returned InterfaceList.

See: UpdateInterfaceList()

Args: updateInterface: Determines whether or not UpdateInterfaceList() is called before getting available interfaces An InterfaceList object that contains a list of all interfaces.

GetLibraryVersion(self) LibraryVersion

Get current library version of Spinnaker.

A struct containing the current version of Spinnaker (major, minor, type, build).

GetLoggingEventPriorityLevel(self) Spinnaker::SpinnakerLogLevel

Retrieves the current logging event priority level.

Spinnaker uses multiple levels of logging: Fatal - failures that are non-recoverable without user intervention.

Error - failures that may or may not be recoverable without user intervention (use case dependent).

Warning - failures that are recoverable without user intervention.

Notice - information about events such as camera arrival and removal, initialization and deinitialization, starting and stopping image acquisition, and feature modification.

Info - information about recurring events that are generated regularly such as information on individual images.

Debug - information that can be used to troubleshoot the system.

See: SpinnakerLogLevel

Level The threshold level

GetProducers(self, updateProducers=True) ProducerList

Parameters

updateProducers: bool

Returns a list of producers available on the system. See: UpdateProducers()

Args: updateProducers: Determines whether or not UpdateProducers() is called before getting available producers An ProducerList object that contains a list of all producers.

GetTLNodeMap(self) INodeMap

Gets a reference to the Spinnaker Producer node map. The system must be initialized by a call to System::GetInstance() first before a node map reference can be successfully acquired.

A reference to the Spinnaker Producer INodeMap.

IsInUse(self) bool

Checks if the system is in use by any interface or camera objects.

Returns true if the system is in use and false otherwise.

RegisterEventHandler(self, evtHandlerToRegister, updateInterface=False)

Parameters

evtHandlerToRegister: Spinnaker::EventHandler & updateInterface: bool

Registers an event handler for the system

See: SystemEventHandler

InterfaceEventHandler

Args: evtHandlerToRegister: The event handler to register for the system updateInterface: Determines whether or not UpdateInterfaceList() is called before registering event for available interfaces on the system

RegisterLoggingEventHandler(self, handler)

Parameters

handler: Spinnaker::LoggingEventHandler &

Registers a logging event.

See: LoggingEventHandler

Args: handler: The logging event handler to register

ReleaseInstance(self)

This call releases the referenced instance of the System Singleton. After successfully releasing the System instance, the pointer returned by GetInstance() will be invalid. Once the final System instance is released, all remaining Spinnaker resources will be released. If the final System instance is released while an interface or camera reference is still held, this function will throw an error of type SPINNAKER_ERR_RESOURCE_IN_USE.

See: Error

GetInstance()

SendActionCommand(self, deviceKey, groupKey, groupMask, actionTime=0, requestAck=False, pResultSize=None, results=0)

Parameters

deviceKey: unsigned int groupKey: unsigned int groupMask: unsigned int actionTime: unsigned long long requestAck: bool pResultSize: unsigned int * results: Spinnaker::ActionCommandResult []

Broadcast an Action Command to all devices on system

param deviceKey:

The Action Command’s device key

param groupKey:

The Action Command’s group key

param groupMask:

The Action Command’s group mask

param actionTime:

(Optional) Time when to assert a future action. Zero means immediate action.

param pResultSize:

(Optional) The number of results in the results array. The value passed should be equal to the expected number of devices that acknowledge the command. Returns the number of received results. If this parameter is 0 or NULL, the function will return as soon as the command has been broadcasted.

param results:

(Optional) An Array with *pResultSize elements to hold the action command result status. The buffer is filled starting from index 0. If received results are less than expected number of devices that acknowledge the command, remaining results are not changed. If received results are more than expected number of devices that acknowledge the command, extra results are ignored and not appended to array. This parameter is ignored if pResultSize is 0. Thus this parameter can be NULL if pResultSize is 0 or NULL.

SetLoggingEventPriorityLevel(self, level)

Parameters

level: enum Spinnaker::SpinnakerLogLevel

Sets a threshold priority level for logging event. Logging events below such level will not trigger callbacks.

Spinnaker uses multiple levels of logging: Fatal - failures that are non-recoverable without user intervention.

Error - failures that may or may not be recoverable without user intervention (use case dependent).

Warning - failures that are recoverable without user intervention.

Notice - information about events such as camera arrival and removal, initialization and deinitialization, starting and stopping image acquisition, and feature modification.

Info - information about recurring events that are generated regularly such as information on individual images.

Debug - information that can be used to troubleshoot the system.

See: SpinnakerLogLevel

Args: level: The threshold level

UnregisterAllLoggingEventHandlers(self)

Unregisters all previously registered logging events.

UnregisterEventHandler(self, evtHandlerToUnregister)

Parameters

evtHandlerToUnregister: Spinnaker::EventHandler &

Unregisters an event handler for the system

See: SystemEventHandler

InterfaceEventHandler

Args: evtHandlerToUnregister: The event handler to unregister from the system

UnregisterLoggingEventHandler(self, handler)

Parameters

handler: Spinnaker::LoggingEventHandler &

Unregisters a logging event.

See: LoggingEventHandler

Args: handler: The logging event handler to unregister

UpdateCameras(self, updateInterfaces=True) bool

Parameters

updateInterfaces: bool

Updates the list of cameras on the system. Note that System::GetCameras() internally calls UpdateCameras() for each interface it enumerates. If the list changed between this call and the last time UpdateCameras was called then the return value will be true, otherwise it is false.

See: GetCameras()

Args: updateInterfaces: Determines whether or not UpdateInterfaceList() is called before updating cameras for available interfaces on the system True if cameras changed on interface and false otherwise.

UpdateInterfaceList(self)

Updates the list of interfaces on the system. If desired, local copies of InterfaceList should be updated by calling GetInterfaces.

See: GetInterfaces()

UpdateProducers(self, ctiPath='') bool

Parameters

ctiPath: Spinnaker::GenICam::gcstring

Updates the list of GenICam producers discoverable by the system given a producer library path. Only producers with the “cti” extension representing “Common Transport Interface” will be loaded. Spinnaker GenTL producer will be loaded by default.

Please see section “Working with GenICam GenTL Devices” in the Spinnaker C++ API Documentation for more information on GenTL producers.

Note: Only the Teledyne CoaXPress producer is supported at this time.

Producer loading will behave as follows: System loads all third party CTIs found in GENICAM_GENTL path when an empty path is provided

System loads a specific producer when the full path to producer is provided

System loads a specific producer based on GENICAM_GENTL paths when only the CTI file name is provided

param ctiPath:

The CTI file name or full path including the CTI file name to load in the system

True if new producers have loaded and false otherwise.