本地设备名称
- 完整本地名称(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 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/7d942c17fc954a97ab203350ae2374d3.png)
- 有限可发现模式有时间的限制,一般维持时间是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