getSettings method
- String deviceId
Retrieves the current scanner settings from the device as a list of CommandData.
The deviceId
specifies the BLE device whose settings will be retrieved.
The method will return a list of CommandData, where each CommandData object contains the command name and its associated parameters, if any.
Be sure to first persist the settings by calling persistSettings
before fetching them.
Throws an exception if there is an error during the process or if fetching the settings fails.
Returns:
- A list of CommandData representing the current scanner settings.
Implementation
Future<List<CommandData>> getSettings(String deviceId) async {
try {
final result = await _commandExecutorsManager.sendCommand(
deviceId,
ScannerCommand(fetchSettings,
ledFeedback: false,
buzzerFeedback: false,
vibrationFeedback: false));
if (!result.succeeded) {
throw ("Error fetching settings for device $deviceId: ${result.response}");
}
return await _scannerSettingsCompressor
.getCompressedSettingsList(result.response);
} catch (e) {
_appLogger.error("Error getting settings for device $deviceId: $e");
rethrow;
}
}