已合并
add perception adv #12487
cnhesai创建于 9月1日
add perception adv #12487
已合并
cnhesai创建于 9月1日
从已删除 :perception-adv合入到openharmony/communication_dsoftbusmaster
cnhesai
cnhesai
9月1日

新增 lane_hub perception 模块,包含 advertiser/scanner/manager,提供近场设备感知与广播能力。

变更范围:

  • core/bus_center/lnn/lane_hub/perception/ 新增 advertiser/scanner/manager
  • interfaces/inner_kits/lnn/lnn_perception.h 新增 inner_kit 接口
  • 新增 IPC 接口码及 standard 服务端 stub 处理
  • SDK bus_center proxy / client manager 适配
  • 广播管理器及广播类型结构体更新
  • 更新 lane_hub.gni / BUILD.gn 及测试 BUILD.gn

Co-Authored-By: Agent

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 cnhesai 的贡献)
openharmony_ciopenharmony_ci成员
9月1日 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
9月1日 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接。


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
9月1日 添加了label:dco检查成功
cnhesaicnhesai
9月1日 关联了issue:[新需求]: perception adv
cnhesaicnhesai
9月1日 强制推送  1 个提交:87bd1a03-add perception adv
此处折叠了374条消息 查看更多
xuhengxiang
xuhengxiang成员22 天前进行代码检视1
core/bus_center/lnn/lane_hub/perception/src/perception_advertiser.c
@@ -0,0 +319,4 @@
319+ if (ret != SOFTBUS_OK) {
320+ return ret;
321+ }
322+ if (!atomic_load(&g_advCtx.isAdvertising)) {
xuhengxiang
xuhengxiang22 天前评论:

PerceptionAdvStop 存在逻辑错误。当蓝牙关闭时,PerceptionAdvOnBtStateChanged 会将 isAdvertising 设为 false 但保留 currentType。此时调用 PerceptionAdvStop 会因 isAdvertising 为 false 而直接返回,不清理 currentType。当蓝牙重新打开时,会错误地恢复本应已停止的广播。

PerceptionAdvStop 不应仅依赖 isAdvertising 判断是否需要清理状态,应无论广播是否正在运行都清理 currentType 等期望状态,或者在蓝牙关闭时不修改 isAdvertising 而是使用单独的标志位记录底层状态。

likedislike
xuhengxiang
xuhengxiang成员22 天前进行代码检视1
core/bus_center/lnn/lane_hub/perception/src/perception_advertiser.c
@@ -0,0 +412,4 @@
412+void PerceptionAdvertiserDeinit(void)
413+{
414+ if (!atomic_load(&g_advInited)) {
415+ return;
xuhengxiang
xuhengxiang22 天前评论:

PerceptionAdvertiserDeinit 在持有 opLock 锁的情况下调用 SchedulerUnregisterBroadcaster。如果该函数是同步的并触发回调,或内部有同步等待逻辑,极易导致死锁。

在持有锁期间仅拷贝 bcId 并清理状态,释放锁后再调用 SchedulerUnregisterBroadcaster 进行反注册。

likedislike
xuhengxiang
xuhengxiang成员22 天前进行代码检视1
core/bus_center/lnn/lane_hub/perception/src/perception_advertiser.c
@@ -0,0 +354,4 @@
354+}
355+ 
356+void PerceptionAdvOnBtStateChanged(bool isBtOn)
357+{
xuhengxiang
xuhengxiang22 天前评论:

在函数 PerceptionAdvOnBtStateChanged 中,未检查 GetLooper 返回的 looper 是否为 NULL,可能导致程序崩溃。

在调用 GetLooper 后,应检查返回的 looper 是否为 NULL,以避免空指针解引用。

likedislike
xuhengxiang
xuhengxiang成员22 天前进行代码检视1
core/bus_center/lnn/lane_hub/perception/src/perception_advertiser.c
@@ -0,0 +354,4 @@
354+}
355+ 
356+void PerceptionAdvOnBtStateChanged(bool isBtOn)
357+{
xuhengxiang
xuhengxiang22 天前评论:

在函数 PerceptionAdvOnBtStateChanged 中,未检查 SoftBusMutexLock 的返回值,可能导致程序崩溃。

在调用 SoftBusMutexLock 后,应检查返回值是否为 SOFTBUS_OK,以避免在锁未成功获取时继续执行。

likedislike
xuhengxiang
xuhengxiang成员22 天前进行代码检视1
core/bus_center/lnn/lane_hub/perception/src/perception_advertiser.c
@@ -0,0 +410,4 @@
410+}
411+ 
412+void PerceptionAdvertiserDeinit(void)
413+{
xuhengxiang
xuhengxiang22 天前评论:

在函数 PerceptionAdvertiserDeinit 中,未释放 looper 资源,可能导致资源泄漏。

在函数结束前,应释放 looper 资源,以避免资源泄漏。

likedislike