| // 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. |
| |
| module device_settings; |
| |
| enum Status { |
| OK, |
| ERR_NOT_SET, |
| ERR_INVALID_SETTING, |
| ERR_READ, |
| ERR_INCORRECT_TYPE, |
| ERR_UNKNOWN |
| }; |
| |
| enum ValueType { |
| INT, |
| STRING |
| }; |
| |
| |
| // Manager Interface used to mange settings |
| [ServiceName="device_settings::DeviceSettings"] |
| interface DeviceSettingsManager { |
| GetInteger(string key) => (int64 val, Status s); |
| |
| GetString(string key) => (string val, Status s); |
| |
| // Return false on database error and true on success. |
| SetInteger(string key, int64 val) => (bool result); |
| |
| // Return false on database error and true on success. |
| SetString(string key, string val) => (bool result); |
| |
| // watcher called when a settings changes |
| // Return Status::OK, Status::ERR_INVALID_SETTING or Status::ERR_UNKNOWN |
| Watch(string key, DeviceSettingsWatcher watcher) => (Status status); |
| }; |
| |
| // Watcher on battery status |
| interface DeviceSettingsWatcher { |
| OnChangeSettings(ValueType type); |
| }; |