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.settingsRelated Guides:
Index
Methods
m
m
try deviceSettings.convertFromNativeUnits(setting, value, unit)Convert arbitrary setting value from Zaber native units.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| value | Double | Value of the setting in Zaber native units. |
| unit | Units | Units to convert value to. |
Return Value
Double Setting value.m
try deviceSettings.convertToNativeUnits(setting, value, unit, round = false)Convert arbitrary setting value to Zaber native units.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| value | Double | Value of the setting in units specified by following argument. |
| unit | Units | Units of the value. |
| round | Bool | If true, round the result to the device's native decimal places. |
Return Value
Double Setting value.m
try await deviceSettings.get(setting, unit = Units.native)Returns any device setting or property. For more information refer to the ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| unit | Units | Units of setting. |
Return Value
Double Setting value.m
try await deviceSettings.getBool(setting)Returns any device setting or property as a boolean. For more information refer to the ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
Return Value
Bool Setting value.m
try deviceSettings.getDefault(setting, unit = Units.native)Returns the default value of a setting.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| unit | Units | Units of setting. |
Return Value
Double Default setting value.m
m
m
m
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
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
Return Value
[Double] The setting values on each axis.m
try await deviceSettings.getInt(setting)Returns any device setting or property as an integer. For more information refer to the ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
Return Value
Int64 Setting value.m
try await deviceSettings.getMany(...settings)Gets many setting values in as few device requests as possible.
Arguments
| Name | Type | Description |
|---|---|---|
| ...settings | [GetSetting] | The settings to read. |
Return Value
[GetSettingResult] The setting values read.m
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
| Name | Type | Description |
|---|---|---|
| ...settings | [GetSetting] | The settings to read. |
Return Value
[GetSettingTypedResult] The setting values read.m
try await deviceSettings.getString(setting)Returns any device setting or property as a string. For more information refer to the ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
Return Value
String Setting value.m
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
| Name | Type | Description |
|---|---|---|
| ...settings | [GetSetting] | The settings to read. |
Return Value
[GetSettingResult] The setting values read.m
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
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| unit | Units | Units of setting to convert result to. |
Return Value
TypedSetting Setting value.m
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
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
Return Value
UnitConversionDescriptor The unit conversion descriptor for the setting.m
try await deviceSettings.set(setting, value, unit = Units.native)Sets any device setting. For more information refer to the ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| value | Double | Value of the setting. |
| unit | Units | Units of setting. |
m
try await deviceSettings.setBool(setting, value)Sets any device setting as a boolean. For more information refer to the ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| value | Bool | Value of the setting. |
m
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
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| value | Int64 | Value of the setting. |
m
try await deviceSettings.setString(setting, value)Sets any device setting as a string. For more information refer to the ASCII Protocol Manual.
Arguments
| Name | Type | Description |
|---|---|---|
| setting | String | Name of the setting. |
| value | String | Value of the setting. |