blob: 3b482c4b0a3ddc4df85297327a6ba39e4659c79f [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:fidl/fidl.dart';
import 'package:fidl_fuchsia_devicesettings/fidl.dart';
import 'package:fidl_fuchsia_sys/fidl.dart';
import '';
import '';
import 'package:settings_protos/audio.pb.dart';
import 'package:settings_protos/setting_store_legacy.dart';
/// A factory for accessing the default stores for the setting types.
class SettingStoreFactoryLegacy {
/// Used by stores that require access to fidl services.
final ServiceProvider _provider;
/// Passed into each store to access device settings.
final DeviceSettingsManagerProxy _deviceSettingsManagerService =
SettingStoreFactoryLegacy(this._provider) {
connectToService(_provider, _deviceSettingsManagerService.ctrl);
_deviceSettingsManagerService.ctrl.onConnectionError =
(ProxyError error) => _handleSettingsConnectionError(error: error));
/// Returns the setting store for [Audio].
SettingStoreLegacy<Audio> createAudioStore() {
return SettingStoreLegacy<Audio>(
_deviceSettingsManagerService, 'Audio', Audio());
/// Handles connection error to the settings service.
void _handleSettingsConnectionError({ProxyError error}) {
log.severe('Unable to connect to device settings service', error);