• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
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 CONSTANT_DEFINITION_H
17 #define CONSTANT_DEFINITION_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace Location {
23 // error type
24 const int ERROR_PERMISSION_NOT_GRANTED = 0x0100;
25 const int ERROR_SWITCH_UNOPEN = 0x0101;
26 const int SESSION_START = 0x0002;
27 const int SESSION_STOP = 0x0003;
28 const int SUCCESS_CALLBACK = 0;
29 const int FAIL_CALLBACK = 1;
30 const int COMPLETE_CALLBACK = 2;
31 const int32_t PARAM0 = 0;
32 const int32_t PARAM1 = 1;
33 const int32_t PARAM2 = 2;
34 const int32_t PARAM3 = 3;
35 const size_t RESULT_SIZE = 2;
36 const int DEFAULT_TIMEOUT_30S = 30000;
37 const int STATE_OPEN = 1;
38 const int STATE_CLOSE = 0;
39 const int32_t PER_USER_RANGE = 100000;
40 const int PRIVACY_TYPE_OTHERS = 0;
41 const int PRIVACY_TYPE_STARTUP = 1;
42 const int PRIVACY_TYPE_CORE_LOCATION = 2;
43 const int32_t UNKNOW_USER_ID = -1;
44 const int32_t SUBSCRIBE_TIME = 5;
45 const int32_t DEFAULT_TIME_INTERVAL = 30 * 60; // app receive location every 30 minutes in frozen state
46 const int32_t REQUESTS_NUM_MAX = 1;
47 const std::string FEATURE_SWITCH_PROP = "ro.config.locator_background";
48 const std::string TIME_INTERVAL_PROP = "ro.config.locator_background.timeInterval";
49 const std::string PROC_NAME = "system";
50 
51 enum {
52     SCENE_UNSET = 0x0300,
53     SCENE_NAVIGATION = 0x0301,
54     SCENE_TRAJECTORY_TRACKING = 0x0302,
55     SCENE_CAR_HAILING = 0x0303,
56     SCENE_DAILY_LIFE_SERVICE = 0x0304,
57     SCENE_NO_POWER = 0x0305
58 };
59 
60 enum {
61     PRIORITY_UNSET = 0x0200,
62     PRIORITY_ACCURACY = 0x0201,
63     PRIORITY_LOW_POWER = 0x0202,
64     PRIORITY_FAST_FIRST_FIX = 0x0203
65 };
66 
67 typedef struct {
68     int reportingPeriodSec;
69     bool wakeUpCacheQueueFull;
70 } CachedGnssLocationsRequest;
71 
72 typedef struct {
73     int scenario;
74     std::string command;
75 } LocationCommand;
76 
77 typedef struct {
78     double latitude;
79     double longitude;
80     double radius;
81     double expiration;
82 } GeoFence;
83 
84 typedef struct {
85     int priority;
86     int scenario;
87     GeoFence geofence;
88 } GeofenceRequest;
89 
90 typedef struct {
91     std::string locale;
92     double latitude;
93     double longitude;
94     int maxItems;
95 } ReverseGeocodeRequest;
96 } // namespace Location
97 } // namespace OHOS
98 #endif // CONSTANT_DEFINITION_H
99