1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 #include <utils/String8.h> 18 19 #include "common_time_config_service.h" 20 #include "common_time_server.h" 21 22 namespace android { 23 instantiate(CommonTimeServer & timeServer)24sp<CommonTimeConfigService> CommonTimeConfigService::instantiate( 25 CommonTimeServer& timeServer) { 26 sp<CommonTimeConfigService> ctcs = new CommonTimeConfigService(timeServer); 27 if (ctcs == NULL) 28 return NULL; 29 30 defaultServiceManager()->addService(ICommonTimeConfig::kServiceName, ctcs); 31 return ctcs; 32 } 33 dump(int fd,const Vector<String16> & args)34status_t CommonTimeConfigService::dump(int fd, const Vector<String16>& args) { 35 return mTimeServer.dumpConfigInterface(fd, args); 36 } 37 getMasterElectionPriority(uint8_t * priority)38status_t CommonTimeConfigService::getMasterElectionPriority(uint8_t *priority) { 39 return mTimeServer.getMasterElectionPriority(priority); 40 } 41 setMasterElectionPriority(uint8_t priority)42status_t CommonTimeConfigService::setMasterElectionPriority(uint8_t priority) { 43 return mTimeServer.setMasterElectionPriority(priority); 44 } 45 getMasterElectionEndpoint(struct sockaddr_storage * addr)46status_t CommonTimeConfigService::getMasterElectionEndpoint( 47 struct sockaddr_storage *addr) { 48 return mTimeServer.getMasterElectionEndpoint(addr); 49 } 50 setMasterElectionEndpoint(const struct sockaddr_storage * addr)51status_t CommonTimeConfigService::setMasterElectionEndpoint( 52 const struct sockaddr_storage *addr) { 53 return mTimeServer.setMasterElectionEndpoint(addr); 54 } 55 getMasterElectionGroupId(uint64_t * id)56status_t CommonTimeConfigService::getMasterElectionGroupId(uint64_t *id) { 57 return mTimeServer.getMasterElectionGroupId(id); 58 } 59 setMasterElectionGroupId(uint64_t id)60status_t CommonTimeConfigService::setMasterElectionGroupId(uint64_t id) { 61 return mTimeServer.setMasterElectionGroupId(id); 62 } 63 getInterfaceBinding(String16 & ifaceName)64status_t CommonTimeConfigService::getInterfaceBinding(String16& ifaceName) { 65 String8 tmp; 66 status_t ret = mTimeServer.getInterfaceBinding(tmp); 67 ifaceName = String16(tmp); 68 return ret; 69 } 70 setInterfaceBinding(const String16 & ifaceName)71status_t CommonTimeConfigService::setInterfaceBinding(const String16& ifaceName) { 72 String8 tmp(ifaceName); 73 return mTimeServer.setInterfaceBinding(tmp); 74 } 75 getMasterAnnounceInterval(int * interval)76status_t CommonTimeConfigService::getMasterAnnounceInterval(int *interval) { 77 return mTimeServer.getMasterAnnounceInterval(interval); 78 } 79 setMasterAnnounceInterval(int interval)80status_t CommonTimeConfigService::setMasterAnnounceInterval(int interval) { 81 return mTimeServer.setMasterAnnounceInterval(interval); 82 } 83 getClientSyncInterval(int * interval)84status_t CommonTimeConfigService::getClientSyncInterval(int *interval) { 85 return mTimeServer.getClientSyncInterval(interval); 86 } 87 setClientSyncInterval(int interval)88status_t CommonTimeConfigService::setClientSyncInterval(int interval) { 89 return mTimeServer.setClientSyncInterval(interval); 90 } 91 getPanicThreshold(int * threshold)92status_t CommonTimeConfigService::getPanicThreshold(int *threshold) { 93 return mTimeServer.getPanicThreshold(threshold); 94 } 95 setPanicThreshold(int threshold)96status_t CommonTimeConfigService::setPanicThreshold(int threshold) { 97 return mTimeServer.setPanicThreshold(threshold); 98 } 99 getAutoDisable(bool * autoDisable)100status_t CommonTimeConfigService::getAutoDisable(bool *autoDisable) { 101 return mTimeServer.getAutoDisable(autoDisable); 102 } 103 setAutoDisable(bool autoDisable)104status_t CommonTimeConfigService::setAutoDisable(bool autoDisable) { 105 return mTimeServer.setAutoDisable(autoDisable); 106 } 107 forceNetworklessMasterMode()108status_t CommonTimeConfigService::forceNetworklessMasterMode() { 109 return mTimeServer.forceNetworklessMasterMode(); 110 } 111 112 }; // namespace android 113