• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# IGeofenceCallback
2
3
4## 概述
5
6定义地理围栏模块的回调函数
7
8用户在开启地理围栏功能前,需要先注册该回调函数。当地理围栏状态发生变化时,会通过回调函数进行上报。 详情可参考**ICellfenceInterface**。
9
10**起始版本:** 4.0
11
12**相关模块:**[HdiLpfenceGeofence](_hdi_lpfence_geofence.md)
13
14
15## 汇总
16
17
18### Public 成员函数
19
20| 名称 | 描述 |
21| -------- | -------- |
22| [OnGeofenceAddResultCb](#ongeofenceaddresultcb) ([in] struct [GeofenceResult](lpfence_geofence_result.md)[] res) | 定义添加地理围栏结果的回调函数。 |
23| [OnGeofenceRemoveResultCb](#ongeofenceremoveresultcb) ([in] struct [GeofenceResult](lpfence_geofence_result.md)[] res) | 定义删除地理围栏结果的回调函数。 |
24| [OnGeofenceTransitionCb](#ongeofencetransitioncb) ([in] int geofenceId, [in] struct [GeoLocationInfo](lpfence_geo_location_info.md) location, [in] unsigned char transition, [in] long timeStamp) | 定义地理围栏状态变化的回调函数。 |
25| [OnGetGeofenceSizeCb](#ongetgeofencesizecb) ([in] struct [GeofenceSize](lpfence_geofence_size.md) size) | 定义地理围栏使用信息的回调函数。 |
26| [OnGeofenceRequestCellDb](#ongeofencerequestcelldb) ([in] struct [RequestCellDb](lpfence_request_cell_db.md) req) | 定义请求基站离线数据库的回调函数。 |
27| [OnGetCurrentLocation](#ongetcurrentlocation) ([in] int locSource, [in] struct [GeoLocationInfo](lpfence_geo_location_info.md) location) | 定义获取设备最新位置信息的回调函数。 |
28| [OnGeofenceReset](#ongeofencereset) () | 定义低功耗围栏服务复位事件通知的回调函数。 |
29
30
31## 成员函数说明
32
33
34### OnGeofenceAddResultCb()
35
36```
37IGeofenceCallback::OnGeofenceAddResultCb ([in] struct GeofenceResult[] res)
38```
39
40**描述**
41
42定义添加地理围栏结果的回调函数。
43
44对每个地理围栏的添加结果,通过该回调函数进行上报。
45
46**起始版本:** 4.0
47
48**参数:**
49
50| 名称 | 描述 |
51| -------- | -------- |
52| res | 上报地理围栏添加结果。详见[GeofenceResult](lpfence_geofence_result.md)定义。 |
53
54**返回:**
55
56如果调用成功,则返回0。
57
58如果调用失败,则返回负值。
59
60
61### OnGeofenceRemoveResultCb()
62
63```
64IGeofenceCallback::OnGeofenceRemoveResultCb ([in] struct GeofenceResult[] res)
65```
66
67**描述**
68
69定义删除地理围栏结果的回调函数。
70
71对每个地理围栏的删除结果,通过该回调函数进行上报。
72
73**起始版本:** 4.0
74
75**参数:**
76
77| 名称 | 描述 |
78| -------- | -------- |
79| res | 上报地理围栏删除结果。详见[GeofenceResult](lpfence_geofence_result.md)定义。 |
80
81**返回:**
82
83如果调用成功,则返回0。
84
85如果调用失败,则返回负值。
86
87
88### OnGeofenceRequestCellDb()
89
90```
91IGeofenceCallback::OnGeofenceRequestCellDb ([in] struct RequestCellDb req)
92```
93
94**描述**
95
96定义请求基站离线数据库的回调函数。
97
98设备请求基站离线数据库时,会通过该回调函数进行上报。
99
100**起始版本:** 4.0
101
102**参数:**
103
104| 名称 | 描述 |
105| -------- | -------- |
106| req | 请求基站离线数据库数据结构。详见[RequestCellDb](lpfence_request_cell_db.md)定义。 |
107
108**返回:**
109
110如果调用成功,则返回0。
111
112如果调用失败,则返回负值。
113
114
115### OnGeofenceReset()
116
117```
118IGeofenceCallback::OnGeofenceReset ()
119```
120
121**描述**
122
123定义低功耗围栏服务复位事件通知的回调函数。
124
125低功耗围栏服务发生复位时会通过该回调函数进行事件上报。
126
127**起始版本:** 4.0
128
129**返回:**
130
131如果回调函数调用成功,则返回0。
132
133如果回调函数调用失败,则返回负值。
134
135
136### OnGeofenceTransitionCb()
137
138```
139IGeofenceCallback::OnGeofenceTransitionCb ([in] int geofenceId, [in] struct GeoLocationInfo location, [in] unsigned char transition, [in] long timeStamp )
140```
141
142**描述**
143
144定义地理围栏状态变化的回调函数。
145
146设备与地理围栏的状态关系发生变化时,会通过该回调函数进行上报。
147
148**起始版本:** 4.0
149
150**参数:**
151
152| 名称 | 描述 |
153| -------- | -------- |
154| geofenceId | 地理围栏id号。 |
155| location | 最新的位置坐标。详见[GeoLocationInfo](lpfence_geo_location_info.md)定义。 |
156| transition | 地理围栏变化的状态。详见[GeofenceTransition](_hdi_lpfence_geofence.md#geofencetransition)定义。 |
157| timeStamp | 时间戳。 |
158
159**返回:**
160
161如果调用成功,则返回0。
162
163如果调用失败,则返回负值。
164
165
166### OnGetCurrentLocation()
167
168```
169IGeofenceCallback::OnGetCurrentLocation ([in] int locSource, [in] struct GeoLocationInfo location )
170```
171
172**描述**
173
174定义获取设备最新位置信息的回调函数。
175
176请求获取设备最新位置信息时,会通过该回调函数进行上报。
177
178**起始版本:** 4.0
179
180**参数:**
181
182| 名称 | 描述 |
183| -------- | -------- |
184| locSource | 位置信息来源。详见[GeofenceLocSource](_hdi_lpfence_geofence.md#geofencelocsource)定义。 |
185| location | 最新位置信息。详见[GeoLocationInfo](lpfence_geo_location_info.md)定义。 |
186
187**返回:**
188
189如果调用成功,则返回0。
190
191如果调用失败,则返回负值。
192
193
194### OnGetGeofenceSizeCb()
195
196```
197IGeofenceCallback::OnGetGeofenceSizeCb ([in] struct GeofenceSize size)
198```
199
200**描述**
201
202定义地理围栏使用信息的回调函数。
203
204获取地理围栏使用信息时,会通过该回调函数进行上报。
205
206**起始版本:** 4.0
207
208**参数:**
209
210| 名称 | 描述 |
211| -------- | -------- |
212| size | 地理围栏使用信息。详见[GeofenceSize](lpfence_geofence_size.md)定义。 |
213
214**返回:**
215
216如果调用成功,则返回0。
217
218如果调用失败,则返回负值。
219