【nRF52832】蓝牙广播中的参数详解(一)

本地设备名称

  • 完整本地名称(Complete Local Name):不能截断
  • 裁剪本地名称(Shortened Local Name):可以被截断,但必须是从名称的起始位置开始连续截取的字符

接口

设置设备名称

uint32_t sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len)

设备名称配置流程

在这里插入图片描述
在这里插入图片描述


外观

在这里插入图片描述

宏定义

在这里插入图片描述

接口定义

uint32_t sd_ble_gap_appearance_set(uint16_t appearance)

设置方法

在这里插入图片描述
在这里插入图片描述


Flags 在这里插入图片描述

  • 有限可发现模式有时间的限制,一般维持时间是30秒。
  • 一般发现模式没有时间限制,广播的间隔一般比有限可发现模式大。
  • 不支持BE/EDR:仅支持低功耗蓝牙,不支持传统蓝牙

发射功率等级

  • TX Power Level,长度1个字节,单位dBm

  • 4dB(最大)、0dB(默认)、-4dB、-8dB、-12dB、-16dB、-20dB、-30dB、-40dB(最小)

  • nRF51系列最小值-30dB

  • nRF52系列最小值-40dB
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    这里的发射功率等级指的是广播

  • 对于蓝牙主机来说,连接之后的发射功率继承扫描(scan)时的功率

  • 对于蓝牙从机来说,连接之后的发射功率继承广播(advertising)时的功率

设置发射功率

/**@brief Set the radio's transmit power.
 *
 * @param[in] role The role to set the transmit power for, see @ref BLE_GAP_TX_POWER_ROLES for
 *                 possible roles.
 * @param[in] handle   The handle parameter is interpreted depending on role:
 *                     - If role is @ref BLE_GAP_TX_POWER_ROLE_CONN, this value is the specific connection handle.
 *                     - If role is @ref BLE_GAP_TX_POWER_ROLE_ADV, the advertising set identified with the advertising handle,
 *                       will use the specified transmit power, and include it in the advertising packet headers if
 *                       @ref ble_gap_adv_properties_t::include_tx_power set.
 *                     - For all other roles handle is ignored.
 * @param[in] tx_power Radio transmit power in dBm (see note for accepted values).
 *
 * @note Supported tx_power values: -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +3dBm and +4dBm.
  * @note The initiator will have the same transmit power as the scanner.
 * @note When a connection is created it will inherit the transmit power from the initiator or
 *       advertiser leading to the connection.
 *
 * @retval ::NRF_SUCCESS Successfully changed the transmit power.
 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
 * @retval ::BLE_ERROR_INVALID_ADV_HANDLE Advertising handle not found.
 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
 */
SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(uint8_t role, uint16_t handle, int8_t tx_power));

学习交流,个人邮箱:imxyp9x@163.com


  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值