1/* * Copyright (C) 2012 The Android Open Source Project
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *      http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef ANDROID_COMMON_TIME_CONFIG_SERVICE_H
17#define ANDROID_COMMON_TIME_CONFIG_SERVICE_H
18
19#include <sys/socket.h>
20#include <common_time/ICommonTimeConfig.h>
21
22namespace android {
23
24class String16;
25class CommonTimeServer;
26
27class CommonTimeConfigService : public BnCommonTimeConfig {
28  public:
29    static sp<CommonTimeConfigService> instantiate(CommonTimeServer& timeServer);
30
31    virtual status_t dump(int fd, const Vector<String16>& args);
32
33    virtual status_t getMasterElectionPriority(uint8_t *priority);
34    virtual status_t setMasterElectionPriority(uint8_t priority);
35    virtual status_t getMasterElectionEndpoint(struct sockaddr_storage *addr);
36    virtual status_t setMasterElectionEndpoint(const struct sockaddr_storage *addr);
37    virtual status_t getMasterElectionGroupId(uint64_t *id);
38    virtual status_t setMasterElectionGroupId(uint64_t id);
39    virtual status_t getInterfaceBinding(String16& ifaceName);
40    virtual status_t setInterfaceBinding(const String16& ifaceName);
41    virtual status_t getMasterAnnounceInterval(int *interval);
42    virtual status_t setMasterAnnounceInterval(int interval);
43    virtual status_t getClientSyncInterval(int *interval);
44    virtual status_t setClientSyncInterval(int interval);
45    virtual status_t getPanicThreshold(int *threshold);
46    virtual status_t setPanicThreshold(int threshold);
47    virtual status_t getAutoDisable(bool *autoDisable);
48    virtual status_t setAutoDisable(bool autoDisable);
49    virtual status_t forceNetworklessMasterMode();
50
51  private:
52    explicit CommonTimeConfigService(CommonTimeServer& timeServer)
53        : mTimeServer(timeServer) { }
54    CommonTimeServer& mTimeServer;
55
56};
57
58};  // namespace android
59
60#endif  // ANDROID_COMMON_TIME_CONFIG_SERVICE_H
61