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