设为首页收藏本站

Discuz! Board

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 275|回复: 1
打印 上一主题 下一主题

求助各位大神!

[复制链接]

1

主题

2

帖子

17

积分

新手上路

Rank: 1

积分
17
跳转到指定楼层
楼主
施玮 发表于 2025-1-11 09:38:02 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
小弟最近在学习青风nRF52832,在蓝牙串口例程里面,有这样一个函数ret_code_t blcm_link_ctx_get(blcm_link_ctx_storage_t const * const p_link_ctx_storage,  uint16_t const conn_handle,  void** const pp_ctx_data)。出现在串口派发函数中的多个分支回调中,似乎是为了获取刷新p_client这个变量的值,并为它指定内存空间。追踪这个变量类型ble_nus_client_context_t,发现这个结构体只包含一个成员用来指示客户端主机是否开启通知使能。回过头对比按键通知历程,发现没有用到这个函数。进一步追查,发现LED按键服务结构体里似乎没有包含指向链接上下文指针的成员。
下面是这两个结构体(指向链接上下文指针的成员p_link_ctx_storage被粗体颜色标注):
//串口服务结构体struct ble_nus_s{    uint8_t                         uuid_type;          /**< UUID type for Nordic UART Service Base UUID. */    uint16_t                        service_handle;     /**< Handle of Nordic UART Service (as provided by the SoftDevice). */    ble_gatts_char_handles_t        tx_handles;         /**< Handles related to the TX characteristic (as provided by the SoftDevice). */    ble_gatts_char_handles_t        rx_handles;         /**< Handles related to the RX characteristic (as provided by the SoftDevice). */    blcm_link_ctx_storage_t * const p_link_ctx_storage; /**< Pointer to link context storage with handles of all current connections and its context. */    ble_nus_data_handler_t          data_handler;       /**< Event handler to be called for handling received data. */};


//LED按键服务结构体
struct ble_lbs_s
{
    uint16_t                    service_handle;      /**< Handle of LED Button Service (as provided by the BLE stack). */
    ble_gatts_char_handles_t    led_char_handles;    /**< Handles related to the LED Characteristic. */
    ble_gatts_char_handles_t    button_char_handles; /**< Handles related to the Button Characteristic. */
    uint8_t                     uuid_type;           /**< UUID type for the LED Button Service. */
    ble_lbs_led_write_handler_t led_write_handler;   /**< Event handler to be called when the LED Characteristic is written. */
};

小弟的问题是:
1.为什么在LED按键结构体内,就可以不需要这个成员?
2.这个“链接上下文”到底是什么意思呢?
3.blcm_link_ctx_get这个函数的作用及意义是什么呢?
4.以上相关细节对于产品级别开发,相较于简单的教学例程,有何必要性和重大作用?
希望各路大神们不吝赐教,如果这个问题比较无脑让大家见笑了

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

1

主题

2

帖子

17

积分

新手上路

Rank: 1

积分
17
沙发
 楼主| 施玮 发表于 2025-1-11 09:58:09 | 只看该作者
struct ble_nus_s
{
    uint8_t                                  uuid_type;         
    uint16_t                                service_handle;   
    ble_gatts_char_handles_t        tx_handles;   
    ble_gatts_char_handles_t        rx_handles;        
    blcm_link_ctx_storage_t *       const p_link_ctx_storage;
    ble_nus_data_handler_t          data_handler;      
};
回复 支持 反对

使用道具 举报

Archiver|手机版|小黑屋|Comsenz Inc.   

GMT+8, 2025-2-5 16:43 , Processed in 0.183493 second(s), 29 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表