API Reference v9.2.0

DeviceSettingsclass

Module: ZaberMotionAscii

Class providing access to various device settings and properties.

The following example illustrates how you can obtain an instance of this type:

import ZaberMotionAscii

let connection = try await Connection.openSerialPort(portName: "COM3")
let device = try connection.getDevice(deviceAddress: 1)
let deviceSettings = device.settings

Methods

m

canConvertNativeUnits()

throws
try deviceSettings.canConvertNativeUnits(setting)
Indicates if given setting can be converted from and to native units.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
Bool True if unit conversion can be performed.
m

convertFromNativeUnits()

throws
try deviceSettings.convertFromNativeUnits(setting, value, unit)
Convert arbitrary setting value from Zaber native units.
Arguments
NameTypeDescription
settingStringName of the setting.
valueDoubleValue of the setting in Zaber native units.
unitUnitsUnits to convert value to.
Return Value
Double Setting value.
m

convertToNativeUnits()

throws
try deviceSettings.convertToNativeUnits(setting, value, unit, round = false)
Convert arbitrary setting value to Zaber native units.
Arguments
NameTypeDescription
settingStringName of the setting.
valueDoubleValue of the setting in units specified by following argument.
unitUnitsUnits of the value.
roundBoolIf true, round the result to the device's native decimal places.
Return Value
Double Setting value.
m

get()

asyncthrows
try await deviceSettings.get(setting, unit = Units.native)
Returns any device setting or property. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
unitUnitsUnits of setting.
Return Value
Double Setting value.
m

getBool()

asyncthrows
try await deviceSettings.getBool(setting)
Returns any device setting or property as a boolean. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
Bool Setting value.
m

getDefault()

throws
try deviceSettings.getDefault(setting, unit = Units.native)
Returns the default value of a setting.
Arguments
NameTypeDescription
settingStringName of the setting.
unitUnitsUnits of setting.
Return Value
Double Default setting value.
m

getDefaultBool()

throws
try deviceSettings.getDefaultBool(setting)
Returns the default value of a setting as a boolean.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
Bool Default setting value.
m

getDefaultInt()

throws
try deviceSettings.getDefaultInt(setting)
Returns the default value of a setting as an integer.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
Int64 Default setting value.
m

getDefaultString()

throws
try deviceSettings.getDefaultString(setting)
Returns the default value of a setting as a string.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
String Default setting value.
m

getFromAllAxes()

asyncthrows
try await deviceSettings.getFromAllAxes(setting)
Gets the value of an axis scope setting for each axis on the device. Values may be NaN where the setting is not applicable.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
[Double] The setting values on each axis.
m

getInt()

asyncthrows
try await deviceSettings.getInt(setting)
Returns any device setting or property as an integer. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
Int64 Setting value.
m

getMany()

asyncthrows
try await deviceSettings.getMany(...settings)
Gets many setting values in as few device requests as possible.
Arguments
NameTypeDescription
...settings[GetSetting]The settings to read.
Return Value
[GetSettingResult] The setting values read.
m

getManyTyped()

asyncthrows
try await deviceSettings.getManyTyped(...settings)
Returns many device settings or properties in their native types in as few requests as possible. Note that specifying units will always return floating point values, even for settings that are natively integers. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
...settings[GetSetting]The settings to read.
Return Value
[GetSettingTypedResult] The setting values read.
m

getString()

asyncthrows
try await deviceSettings.getString(setting)
Returns any device setting or property as a string. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
String Setting value.
m

getSynchronized()

asyncthrows
try await deviceSettings.getSynchronized(...settings)
Gets many setting values in the same tick, ensuring their values are synchronized. Requires at least Firmware 7.35.
Arguments
NameTypeDescription
...settings[GetSetting]The settings to read.
Return Value
[GetSettingResult] The setting values read.
m

getTyped()

asyncthrows
try await deviceSettings.getTyped(setting, unit = Units.native)
Returns any device setting or property in its native type. Note that specifying units will cause settings that are otherwise integers to be returned as floats. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
unitUnitsUnits of setting to convert result to.
Return Value
TypedSetting Setting value.
m

getUnitConversionDescriptor()

throws
try deviceSettings.getUnitConversionDescriptor(setting)
Retrieves unit conversion descriptor for a setting, allowing unit conversion without a device. The descriptor can be used with the ConvertTo/FromNativeUnits methods of the UnitTable class.
Arguments
NameTypeDescription
settingStringName of the setting.
Return Value
UnitConversionDescriptor The unit conversion descriptor for the setting.
m

set()

asyncthrows
try await deviceSettings.set(setting, value, unit = Units.native)
Sets any device setting. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
valueDoubleValue of the setting.
unitUnitsUnits of setting.
m

setBool()

asyncthrows
try await deviceSettings.setBool(setting, value)
Sets any device setting as a boolean. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
valueBoolValue of the setting.
m

setInt()

asyncthrows
try await deviceSettings.setInt(setting, value)
Sets any device setting or property as an integer. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
valueInt64Value of the setting.
m

setString()

asyncthrows
try await deviceSettings.setString(setting, value)
Sets any device setting as a string. For more information refer to the ASCII Protocol Manual.
Arguments
NameTypeDescription
settingStringName of the setting.
valueStringValue of the setting.