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