1e41f4b71Sopenharmony_ci# ICellfenceCallback 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## 概述 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci定义基站围栏模块的回调函数 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci用户在开启基站围栏功能前,需要先注册该回调函数。当基站围栏状态发生变化时,会通过回调函数进行上报。 详情可参考[ICellfenceInterface](interface_i_cellfence_interface.md)。 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci**起始版本:** 4.0 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci**相关模块:**[HdiLpfenceCellfence](_hdi_lpfence_cellfence.md) 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## 汇总 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci### Public 成员函数 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci| 名称 | 描述 | 21e41f4b71Sopenharmony_ci| -------- | -------- | 22e41f4b71Sopenharmony_ci| [OnCellfenceChanged](#oncellfencechanged) ([in] struct [CellfenceStatus](_cellfence_status.md) fences) | 定义基站围栏状态变化通知的回调函数。 | 23e41f4b71Sopenharmony_ci| [OnGetCellfenceSizeCb](#ongetcellfencesizecb) ([in] struct [CellfenceSize](_cellfence_size.md) size) | 定义基站围栏使用信息的回调函数。 | 24e41f4b71Sopenharmony_ci| [OnCellfenceReset](#oncellfencereset) () | 定义低功耗围栏服务复位事件通知的回调函数。 | 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci## 成员函数说明 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci### OnCellfenceChanged() 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci``` 33e41f4b71Sopenharmony_ciICellfenceCallback::OnCellfenceChanged ([in] struct CellfenceStatus fences) 34e41f4b71Sopenharmony_ci``` 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci**描述** 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci定义基站围栏状态变化通知的回调函数。 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci设备与基站围栏的状态关系发生变化时,会通过该回调函数进行上报。 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci**起始版本:** 4.0 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci**参数:** 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci| 名称 | 描述 | 48e41f4b71Sopenharmony_ci| -------- | -------- | 49e41f4b71Sopenharmony_ci| fences | 上报基站围栏变化的状态。详见[CellfenceStatus](_cellfence_status.md)定义。 | 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci**返回:** 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci如果回调函数上报数据成功,则返回0。 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci如果回调函数上报数据失败,则返回负值。 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci### OnCellfenceReset() 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci``` 61e41f4b71Sopenharmony_ciICellfenceCallback::OnCellfenceReset () 62e41f4b71Sopenharmony_ci``` 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ci**描述** 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci定义低功耗围栏服务复位事件通知的回调函数。 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci低功耗围栏服务发生复位时会通过该回调函数进行事件上报。 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci**起始版本:** 4.0 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci**返回:** 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ci如果回调函数调用成功,则返回0。 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ci如果回调函数调用失败,则返回负值。 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci### OnGetCellfenceSizeCb() 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci``` 83e41f4b71Sopenharmony_ciICellfenceCallback::OnGetCellfenceSizeCb ([in] struct CellfenceSize size) 84e41f4b71Sopenharmony_ci``` 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci**描述** 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci定义基站围栏使用信息的回调函数。 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ci获取基站围栏使用信息时,会通过该回调函数进行上报。 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ci**起始版本:** 4.0 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci**参数:** 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci| 名称 | 描述 | 98e41f4b71Sopenharmony_ci| -------- | -------- | 99e41f4b71Sopenharmony_ci| size | 基站围栏使用信息。详见[CellfenceSize](_cellfence_size.md)定义。 | 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ci**返回:** 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ci如果回调函数上报数据成功,则返回0。 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci如果回调函数上报数据失败,则返回负值。 106