API Reference v9.2.0
DeviceStorageclass
Module: ZaberMotionAscii
Class providing access to device storage.
Requires at least Firmware 7.30.
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 deviceStorage = device.storageIndex
Methods
m
m
m
m
try await deviceStorage.getString(key, decode = false)Gets the device value stored with the provided key.
Arguments
| Name | Type | Description |
|---|---|---|
| key | String | Key to read the value of. |
| decode | Bool | Whether the stored value should be decoded. Only use this when reading values set by storage.set with "encode" true. |
Return Value
String Stored value.m
m
m
m
m
try await deviceStorage.setString(key, value, encode = false)Sets the device value stored at the provided key.
Arguments
| Name | Type | Description |
|---|---|---|
| key | String | Key to set the value at. |
| value | String | Value to set. |
| encode | Bool | Whether the stored value should be base64 encoded before being stored. This makes the string unreadable to humans using the ASCII protocol, however, values stored this way can be of any length and use non-ASCII and protocol reserved characters. |