Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
to a different source channel. (6)
NISWITCH_VAL_CHANNEL_NOT_AVAILABLE indicates that the driver cannot
create a path between the two channels because one of the channels is a
configuration channel and thus unavailable for external connections.
Note:
One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed.
'''
vi_ctype = visatype.ViSession(self._vi) # case S110
channel1_ctype = ctypes.create_string_buffer(channel1.encode(self._encoding)) # case C020
channel2_ctype = ctypes.create_string_buffer(channel2.encode(self._encoding)) # case C020
path_capability_ctype = visatype.ViInt32() # case S200
error_code = self._library.niSwitch_CanConnect(vi_ctype, channel1_ctype, channel2_ctype, None if path_capability_ctype is None else (ctypes.pointer(path_capability_ctype)))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return enums.PathCapability(path_capability_ctype.value)
Returns:
relay_position (enums.RelayPosition): Indicates whether the relay is open or closed. NISWITCH_VAL_OPEN 10
NIWITCH_VAL_CLOSED 11
Note:
One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed.
'''
vi_ctype = visatype.ViSession(self._vi) # case S110
relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020
relay_position_ctype = visatype.ViInt32() # case S200
error_code = self._library.niSwitch_GetRelayPosition(vi_ctype, relay_name_ctype, None if relay_position_ctype is None else (ctypes.pointer(relay_position_ctype)))
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return enums.RelayPosition(relay_position_ctype.value)
After the switch processes each entry in the scan list, it waits the
length of time you specify in the Scan Delay parameter and then asserts
a trigger on the line you specify with this parameter. Refer to the
scan_advanced_output topic in the NI Switches Help for
a list of valid values.
scan_delay (float): The minimum length of time you want the switch device to wait after it
creates a path until it asserts a trigger on the scan advanced output
line. The driver uses this value to set the Scan Delay attribute. The
scan delay is in addition to the settling time.The driver uses this
value to set the scan_delay attribute. Express this
value in seconds. Default value: 0.0 s
'''
if type(trigger_input) is not enums.TriggerInput:
raise TypeError('Parameter mode must be of type ' + str(enums.TriggerInput))
if type(scan_advanced_output) is not enums.ScanAdvancedOutput:
raise TypeError('Parameter mode must be of type ' + str(enums.ScanAdvancedOutput))
vi_ctype = visatype.ViSession(self._vi) # case S110
scan_delay_ctype = visatype.ViReal64(scan_delay) # case S150
trigger_input_ctype = visatype.ViInt32(trigger_input.value) # case S130
scan_advanced_output_ctype = visatype.ViInt32(scan_advanced_output.value) # case S130
error_code = self._library.niSwitch_ConfigureScanTrigger(vi_ctype, scan_delay_ctype, trigger_input_ctype, scan_advanced_output_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return
Args:
relay_name (str): Name of the relay. Default value: None Examples of valid relay names:
ch0, ab0, 1wire, hlselect Refer to Devices Overview for a list of valid
relay names for the switch module.
relay_action (enums.RelayAction): Specifies whether to open or close a given relay. Default value: Relay
Close Defined values: NISWITCH_VAL_OPEN_RELAY
NISWITCH_VAL_CLOSE_RELAY (Default Value)
Note:
One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed.
'''
if type(relay_action) is not enums.RelayAction:
raise TypeError('Parameter mode must be of type ' + str(enums.RelayAction))
vi_ctype = visatype.ViSession(self._vi) # case S110
relay_name_ctype = ctypes.create_string_buffer(relay_name.encode(self._encoding)) # case C020
relay_action_ctype = visatype.ViInt32(relay_action.value) # case S130
error_code = self._library.niSwitch_RelayControl(vi_ctype, relay_name_ctype, relay_action_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return
Note:
One or more of the referenced functions are not in the Python API for this driver.
Args:
scanlist (str): The scan list to use. The driver uses this value to set the Scan List
attribute. Default value: None
scan_mode (enums.ScanMode): Specifies how the switch module breaks existing connections when
scanning. The driver uses this value to set the Scan Mode attribute.
Refer to scan modes for more information. Default value: Break Before
Make
'''
if type(scan_mode) is not enums.ScanMode:
raise TypeError('Parameter mode must be of type ' + str(enums.ScanMode))
vi_ctype = visatype.ViSession(self._vi) # case S110
scanlist_ctype = ctypes.create_string_buffer(scanlist.encode(self._encoding)) # case C020
scan_mode_ctype = visatype.ViInt32(scan_mode.value) # case S130
error_code = self._library.niSwitch_ConfigureScanList(vi_ctype, scanlist_ctype, scan_mode_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return
scan_advanced_output_bus_line (enums.ScanAdvancedOutput): The trigger line to route the scan advanced output trigger from the
front or rear connector. Select ScanAdvancedOutput.NONE to break an existing
route. Default value: None Valid Values: ScanAdvancedOutput.NONE
ScanAdvancedOutput.TTL0 ScanAdvancedOutput.TTL1 ScanAdvancedOutput.TTL2
ScanAdvancedOutput.TTL3 ScanAdvancedOutput.TTL4 ScanAdvancedOutput.TTL5
ScanAdvancedOutput.TTL6 ScanAdvancedOutput.TTL7
Note:
One or more of the referenced values are not in the Python API for this driver. Enums that only define values, or represent True/False, have been removed.
invert (bool): If VI_TRUE, inverts the input trigger signal from falling to rising or
vice versa. Default value: VI_FALSE
'''
if type(scan_advanced_output_connector) is not enums.ScanAdvancedOutput:
raise TypeError('Parameter mode must be of type ' + str(enums.ScanAdvancedOutput))
if type(scan_advanced_output_bus_line) is not enums.ScanAdvancedOutput:
raise TypeError('Parameter mode must be of type ' + str(enums.ScanAdvancedOutput))
vi_ctype = visatype.ViSession(self._vi) # case S110
scan_advanced_output_connector_ctype = visatype.ViInt32(scan_advanced_output_connector.value) # case S130
scan_advanced_output_bus_line_ctype = visatype.ViInt32(scan_advanced_output_bus_line.value) # case S130
invert_ctype = visatype.ViBoolean(invert) # case S150
error_code = self._library.niSwitch_RouteScanAdvancedOutput(vi_ctype, scan_advanced_output_connector_ctype, scan_advanced_output_bus_line_ctype, invert_ctype)
errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
return