| // Copyright 2017 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. |
| library fuchsia.devicesettings; |
| |
| enum Status : uint8 { |
| ok = 1; |
| errNotSet = 2; |
| errInvalidSetting = 3; |
| errRead = 4; |
| errIncorrectType = 5; |
| errUnknown = 6; |
| }; |
| |
| enum ValueType : uint8 { |
| number = 1; |
| text = 2; |
| }; |
| |
| /// Manager interface used to manage settings |
| [Discoverable] |
| protocol DeviceSettingsManager { |
| GetInteger(string key) -> (int64 val, Status s); |
| |
| GetString(string key) -> (string val, Status s); |
| |
| /// Returns false on database error and true on success. |
| SetInteger(string key, int64 val) -> (bool result); |
| |
| /// Returns false on database error and true on success. |
| SetString(string key, string val) -> (bool result); |
| |
| /// Register a watcher to be called when a setting changes |
| /// Returns Status::ok, Status::errInvalidSetting or Status::errUnknown |
| Watch(string key, DeviceSettingsWatcher watcher) -> (Status s); |
| }; |
| |
| /// A watcher for device settings changes |
| protocol DeviceSettingsWatcher { |
| OnChangeSettings(ValueType type); |
| }; |