2 * Copyright (C) 2012 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <utils/String8.h>
19 #include "common_time_config_service.h"
20 #include "common_time_server.h"
24 sp<CommonTimeConfigService> CommonTimeConfigService::instantiate(
25 CommonTimeServer& timeServer) {
26 sp<CommonTimeConfigService> ctcs = new CommonTimeConfigService(timeServer);
30 defaultServiceManager()->addService(ICommonTimeConfig::kServiceName, ctcs);
34 status_t CommonTimeConfigService::dump(int fd, const Vector<String16>& args) {
35 return mTimeServer.dumpConfigInterface(fd, args);
38 status_t CommonTimeConfigService::getMasterElectionPriority(uint8_t *priority) {
39 return mTimeServer.getMasterElectionPriority(priority);
42 status_t CommonTimeConfigService::setMasterElectionPriority(uint8_t priority) {
43 return mTimeServer.setMasterElectionPriority(priority);
46 status_t CommonTimeConfigService::getMasterElectionEndpoint(
47 struct sockaddr_storage *addr) {
48 return mTimeServer.getMasterElectionEndpoint(addr);
51 status_t CommonTimeConfigService::setMasterElectionEndpoint(
52 const struct sockaddr_storage *addr) {
53 return mTimeServer.setMasterElectionEndpoint(addr);
56 status_t CommonTimeConfigService::getMasterElectionGroupId(uint64_t *id) {
57 return mTimeServer.getMasterElectionGroupId(id);
60 status_t CommonTimeConfigService::setMasterElectionGroupId(uint64_t id) {
61 return mTimeServer.setMasterElectionGroupId(id);
64 status_t CommonTimeConfigService::getInterfaceBinding(String16& ifaceName) {
66 status_t ret = mTimeServer.getInterfaceBinding(tmp);
67 ifaceName = String16(tmp);
71 status_t CommonTimeConfigService::setInterfaceBinding(const String16& ifaceName) {
72 String8 tmp(ifaceName);
73 return mTimeServer.setInterfaceBinding(tmp);
76 status_t CommonTimeConfigService::getMasterAnnounceInterval(int *interval) {
77 return mTimeServer.getMasterAnnounceInterval(interval);
80 status_t CommonTimeConfigService::setMasterAnnounceInterval(int interval) {
81 return mTimeServer.setMasterAnnounceInterval(interval);
84 status_t CommonTimeConfigService::getClientSyncInterval(int *interval) {
85 return mTimeServer.getClientSyncInterval(interval);
88 status_t CommonTimeConfigService::setClientSyncInterval(int interval) {
89 return mTimeServer.setClientSyncInterval(interval);
92 status_t CommonTimeConfigService::getPanicThreshold(int *threshold) {
93 return mTimeServer.getPanicThreshold(threshold);
96 status_t CommonTimeConfigService::setPanicThreshold(int threshold) {
97 return mTimeServer.setPanicThreshold(threshold);
100 status_t CommonTimeConfigService::getAutoDisable(bool *autoDisable) {
101 return mTimeServer.getAutoDisable(autoDisable);
104 status_t CommonTimeConfigService::setAutoDisable(bool autoDisable) {
105 return mTimeServer.setAutoDisable(autoDisable);
108 status_t CommonTimeConfigService::forceNetworklessMasterMode() {
109 return mTimeServer.forceNetworklessMasterMode();
112 }; // namespace android