Mike J. Chen | 6c92951 | 2011-08-15 11:59:47 -0700 | [diff] [blame] | 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 | |
| 24 | sp<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 | |
| 34 | status_t CommonTimeConfigService::dump(int fd, const Vector<String16>& args) { |
| 35 | return mTimeServer.dumpConfigInterface(fd, args); |
| 36 | } |
| 37 | |
| 38 | status_t CommonTimeConfigService::getMasterElectionPriority(uint8_t *priority) { |
| 39 | return mTimeServer.getMasterElectionPriority(priority); |
| 40 | } |
| 41 | |
| 42 | status_t CommonTimeConfigService::setMasterElectionPriority(uint8_t priority) { |
| 43 | return mTimeServer.setMasterElectionPriority(priority); |
| 44 | } |
| 45 | |
| 46 | status_t CommonTimeConfigService::getMasterElectionEndpoint( |
| 47 | struct sockaddr_storage *addr) { |
| 48 | return mTimeServer.getMasterElectionEndpoint(addr); |
| 49 | } |
| 50 | |
| 51 | status_t CommonTimeConfigService::setMasterElectionEndpoint( |
| 52 | const struct sockaddr_storage *addr) { |
| 53 | return mTimeServer.setMasterElectionEndpoint(addr); |
| 54 | } |
| 55 | |
| 56 | status_t CommonTimeConfigService::getMasterElectionGroupId(uint64_t *id) { |
| 57 | return mTimeServer.getMasterElectionGroupId(id); |
| 58 | } |
| 59 | |
| 60 | status_t CommonTimeConfigService::setMasterElectionGroupId(uint64_t id) { |
| 61 | return mTimeServer.setMasterElectionGroupId(id); |
| 62 | } |
| 63 | |
| 64 | status_t CommonTimeConfigService::getInterfaceBinding(String16& ifaceName) { |
| 65 | String8 tmp; |
| 66 | status_t ret = mTimeServer.getInterfaceBinding(tmp); |
| 67 | ifaceName = String16(tmp); |
| 68 | return ret; |
| 69 | } |
| 70 | |
| 71 | status_t CommonTimeConfigService::setInterfaceBinding(const String16& ifaceName) { |
| 72 | String8 tmp(ifaceName); |
| 73 | return mTimeServer.setInterfaceBinding(tmp); |
| 74 | } |
| 75 | |
| 76 | status_t CommonTimeConfigService::getMasterAnnounceInterval(int *interval) { |
| 77 | return mTimeServer.getMasterAnnounceInterval(interval); |
| 78 | } |
| 79 | |
| 80 | status_t CommonTimeConfigService::setMasterAnnounceInterval(int interval) { |
| 81 | return mTimeServer.setMasterAnnounceInterval(interval); |
| 82 | } |
| 83 | |
| 84 | status_t CommonTimeConfigService::getClientSyncInterval(int *interval) { |
| 85 | return mTimeServer.getClientSyncInterval(interval); |
| 86 | } |
| 87 | |
| 88 | status_t CommonTimeConfigService::setClientSyncInterval(int interval) { |
| 89 | return mTimeServer.setClientSyncInterval(interval); |
| 90 | } |
| 91 | |
| 92 | status_t CommonTimeConfigService::getPanicThreshold(int *threshold) { |
| 93 | return mTimeServer.getPanicThreshold(threshold); |
| 94 | } |
| 95 | |
| 96 | status_t CommonTimeConfigService::setPanicThreshold(int threshold) { |
| 97 | return mTimeServer.setPanicThreshold(threshold); |
| 98 | } |
| 99 | |
| 100 | status_t CommonTimeConfigService::getAutoDisable(bool *autoDisable) { |
| 101 | return mTimeServer.getAutoDisable(autoDisable); |
| 102 | } |
| 103 | |
| 104 | status_t CommonTimeConfigService::setAutoDisable(bool autoDisable) { |
| 105 | return mTimeServer.setAutoDisable(autoDisable); |
| 106 | } |
| 107 | |
| 108 | status_t CommonTimeConfigService::forceNetworklessMasterMode() { |
| 109 | return mTimeServer.forceNetworklessMasterMode(); |
| 110 | } |
| 111 | |
| 112 | }; // namespace android |