1cf69771bSopenharmony_ci/*
2cf69771bSopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd.
3cf69771bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4cf69771bSopenharmony_ci * you may not use this file except in compliance with the License.
5cf69771bSopenharmony_ci * You may obtain a copy of the License at
6cf69771bSopenharmony_ci *
7cf69771bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8cf69771bSopenharmony_ci *
9cf69771bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10cf69771bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11cf69771bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12cf69771bSopenharmony_ci * See the License for the specific language governing permissions and
13cf69771bSopenharmony_ci * limitations under the License.
14cf69771bSopenharmony_ci */
15cf69771bSopenharmony_ci
16cf69771bSopenharmony_ci#ifndef SERVICES_INCLUDE_TIME_COMMON_H
17cf69771bSopenharmony_ci#define SERVICES_INCLUDE_TIME_COMMON_H
18cf69771bSopenharmony_ci
19cf69771bSopenharmony_ci#include <stdint.h>
20cf69771bSopenharmony_ci
21cf69771bSopenharmony_ci#include "errors.h"
22cf69771bSopenharmony_ci#include "time_hilog.h"
23cf69771bSopenharmony_ci
24cf69771bSopenharmony_cinamespace OHOS {
25cf69771bSopenharmony_cinamespace MiscServices {
26cf69771bSopenharmony_ci#define TIME_SERVICE_NAME "TimeService"
27cf69771bSopenharmony_ci
28cf69771bSopenharmony_cistruct TimerPara {
29cf69771bSopenharmony_ci    int timerType;
30cf69771bSopenharmony_ci    int64_t windowLength;
31cf69771bSopenharmony_ci    uint64_t interval;
32cf69771bSopenharmony_ci    bool disposable;
33cf69771bSopenharmony_ci    int flag;
34cf69771bSopenharmony_ci};
35cf69771bSopenharmony_ci
36cf69771bSopenharmony_cienum TimeModule {
37cf69771bSopenharmony_ci    TIME_MODULE_SERVICE_ID = 0x04,
38cf69771bSopenharmony_ci};
39cf69771bSopenharmony_ci// time error offset, used only in this file.
40cf69771bSopenharmony_ciconstexpr ErrCode TIME_ERR_OFFSET = ErrCodeOffset(SUBSYS_SMALLSERVICES, TIME_MODULE_SERVICE_ID);
41cf69771bSopenharmony_ci
42cf69771bSopenharmony_cienum TimeError {
43cf69771bSopenharmony_ci    E_TIME_OK = 0,
44cf69771bSopenharmony_ci    E_TIME_SA_DIED = TIME_ERR_OFFSET,
45cf69771bSopenharmony_ci    E_TIME_READ_PARCEL_ERROR,
46cf69771bSopenharmony_ci    E_TIME_WRITE_PARCEL_ERROR,
47cf69771bSopenharmony_ci    E_TIME_PUBLISH_FAIL,
48cf69771bSopenharmony_ci    E_TIME_TRANSACT_ERROR,
49cf69771bSopenharmony_ci    E_TIME_DEAL_FAILED,
50cf69771bSopenharmony_ci    E_TIME_PARAMETERS_INVALID,
51cf69771bSopenharmony_ci    E_TIME_SET_RTC_FAILED,
52cf69771bSopenharmony_ci    E_TIME_NOT_FOUND,
53cf69771bSopenharmony_ci    E_TIME_NULLPTR,
54cf69771bSopenharmony_ci    E_TIME_NO_PERMISSION,
55cf69771bSopenharmony_ci    E_TIME_NOT_SYSTEM_APP,
56cf69771bSopenharmony_ci    E_TIME_NO_TIMER_ADJUST,
57cf69771bSopenharmony_ci    E_TIME_NTP_UPDATE_FAILED,
58cf69771bSopenharmony_ci    E_TIME_NTP_NOT_UPDATE,
59cf69771bSopenharmony_ci    E_TIME_ACCOUNT_NOT_MATCH,
60cf69771bSopenharmony_ci    E_TIME_ACCOUNT_ERROR,
61cf69771bSopenharmony_ci};
62cf69771bSopenharmony_ci
63cf69771bSopenharmony_cienum DatabaseType {
64cf69771bSopenharmony_ci    NOT_STORE = 0,
65cf69771bSopenharmony_ci    STORE,
66cf69771bSopenharmony_ci};
67cf69771bSopenharmony_ci} // namespace MiscServices
68cf69771bSopenharmony_ci} // namespace OHOS
69cf69771bSopenharmony_ci#endif // SERVICES_INCLUDE_TIME_COMMON_H