1# IGeofenceInterface
2
3
4## 概述
5
6定义接口用于添加围栏,删除围栏,设置围栏回调函数等。
7
8**起始版本:** 3.2
9
10**相关模块:**[HdiGeofence](_hdi_geofence.md)
11
12
13## 汇总
14
15
16### Public 成员函数
17
18| 名称 | 描述 |
19| -------- | -------- |
20| [SetGeofenceCallback](#setgeofencecallback) ([in] [IGeofenceCallback](interface_i_geofence_callback.md) callbackObj) | 设置地理围栏回调函数。 |
21| [AddGnssGeofence](#addgnssgeofence) ([in] struct [GeofenceInfo](_geofence_info.md) fence, [in] enum GeofenceEvent monitorEvent) | 添加一个地理围栏。 |
22| [DeleteGnssGeofence](#deletegnssgeofence) ([in] int fenceIndex) | 删除一个地理围栏。 |
23
24
25## 成员函数说明
26
27
28### AddGnssGeofence()
29
30```
31IGeofenceInterface::AddGnssGeofence ([in] struct GeofenceInfo fence, [in] enum GeofenceEvent monitorEvent )
32```
33
34**描述**
35
36
37添加一个地理围栏。
38
39**起始版本:** 3.2
40
41**参数:**
42
43| 名称 | 描述 |
44| -------- | -------- |
45| fence | 表示地理围栏的参数。详情参考[GeofenceInfo](_geofence_info.md)。 |
46| monitorEvent | 表示APP想要监控的地理围栏事件。详情参考[GeofenceEvent](_hdi_geofence.md#geofenceevent)。 |
47
48**返回:**
49
50返回0表示成功,返回负数表示失败。
51
52
53### DeleteGnssGeofence()
54
55```
56IGeofenceInterface::DeleteGnssGeofence ([in] int fenceIndex)
57```
58
59**描述**
60
61
62删除一个地理围栏。
63
64**起始版本:** 3.2
65
66**参数:**
67
68| 名称 | 描述 |
69| -------- | -------- |
70| fenceIndex | 表示地理围栏的编号。 |
71
72**返回:**
73
74返回0表示成功,返回负数表示失败。
75
76
77### SetGeofenceCallback()
78
79```
80IGeofenceInterface::SetGeofenceCallback ([in] IGeofenceCallback callbackObj)
81```
82
83**描述**
84
85
86设置地理围栏回调函数。
87
88**起始版本:** 3.2
89
90**参数:**
91
92| 名称 | 描述 |
93| -------- | -------- |
94| callback | 表示地理围栏的回调函数,GNSS驱动使用此回调上报地理围栏服务可用性, 上报地理围栏事件,上报地理围栏操作结果。详情参考[IGeofenceCallback](interface_i_geofence_callback.md)。 |
95
96**返回:**
97
98返回0表示成功,返回负数表示失败。
99