我正在使用最新的物联网发布以及使用BeaCon_Suota_Button作为基础的SDK。
我想从GapM_Static_Addr到GapM_GEN_RSLV_ADDR更改为GAPM_GEN_RSLV_ADDR。
和#undef CFG_APP_SECURITY / *************************************** * Privacy Capabilities and address configuration of local device: * - APP_CFG_ADDR_PUB No Privacy, Public BDA * - APP_CFG_ADDR_STATIC No Privacy, Random Static BDA * - APP_CFG_HOST_PRIV_RPA Host Privacy, RPA, Public Identity * - APP_CFG_HOST_PRIV_NRPA Host Privacy, NRPA (non-connectable ONLY) * - APP_CFG_CNTL_PRIV_RPA_PUB Controller Privacy, RPA or PUB, Public Identity * - APP_CFG_CNTL_PRIV_RPA_RAND Controller Privacy, RPA, Public Identity * * Select only one option for privacy / addressing configuration. ************************************************************************** */ #define USER_CFG_ADDRESS_MODE APP_CFG_ADDR_STATIC static const struct advertise_configuration user_adv_conf = { /** * Own BD address source of the device: * - GAPM_STATIC_ADDR: Public or Private Static Address according to device address configuration * - GAPM_GEN_RSLV_ADDR: Generated resolvable private random address * - GAPM_GEN_NON_RSLV_ADDR: Generated non-resolvable private random address */ .addr_src = GAPM_GEN_RSLV_ADDR, /// Minimum interval for advertising .intv_min = MS_TO_BLESLOTS(BEACON_ADVERTISING_INTERVAL), // 687.5ms /// Maximum interval for advertising .intv_max = MS_TO_BLESLOTS(BEACON_ADVERTISING_INTERVAL), // 687.5ms /** * Advertising channels map: * - ADV_CHNL_37_EN: Advertising channel map for channel 37. * - ADV_CHNL_38_EN: Advertising channel map for channel 38. * - ADV_CHNL_39_EN: Advertising channel map for channel 39. * - ADV_ALL_CHNLS_EN: Advertising channel map for channel 37, 38 and 39. */ .channel_map = ADV_ALL_CHNLS_EN, /************************* * Advertising information ************************* */ /// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT) /// Advertising mode : /// - GAP_NON_DISCOVERABLE: Non discoverable mode /// - GAP_GEN_DISCOVERABLE: General discoverable mode /// - GAP_LIM_DISCOVERABLE: Limited discoverable mode /// - GAP_BROADCASTER_MODE: Broadcaster mode .mode = GAP_GEN_DISCOVERABLE, /// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT) /// - ADV_ALLOW_SCAN_ANY_CON_ANY: Allow both scan and connection requests from anyone /// - ADV_ALLOW_SCAN_WLST_CON_ANY: Allow both scan req from White List devices only and /// connection req from anyone /// - ADV_ALLOW_SCAN_ANY_CON_WLST: Allow both scan req from anyone and connection req /// from White List devices only /// - ADV_ALLOW_SCAN_WLST_CON_WLST: Allow scan and connection requests from White List /// devices only .adv_filt_policy = ADV_ALLOW_SCAN_ANY_CON_ANY, /// Direct address information (GAPM_ADV_DIRECT/GAPM_ADV_DIRECT_LDC) /// (used only if reconnection address isn't set or privacy disabled) /// BD Address of device .peer_addr = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6}, /// Direct address information (GAPM_ADV_DIRECT/GAPM_ADV_DIRECT_LDC) /// (used only if reconnection address isn't set or privacy disabled) /// Address type of the device 0=public/1=private random .peer_addr_type = 0, }; static const struct gapm_configuration user_gapm_conf = { /// Device Role: Central, Peripheral, Observer, Broadcaster or All roles. (@see enum gap_role) .role = GAP_ROLE_PERIPHERAL, /// Maximal MTU .max_mtu = 247, /// Device Address Type /// - GAPM_CFG_ADDR_PUBLIC: Device Address is a Public Static address /// - GAPM_CFG_ADDR_PRIVATE: Device Address is a Private Static address /// - GAPM_CFG_ADDR_PRIVACY: Device Address generated using Privacy feature .addr_type = GAPM_CFG_ADDR_PRIVACY, /*********************** * Privacy configuration *********************** */ /// Private static address // NOTE: The address shall comply with the following requirements: // - the two most significant bits of the address shall be equal to 1, // - all the remaining bits of the address shall NOT be equal to 1, // - all the remaining bits of the address shall NOT be equal to 0. // In case the {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} null address is used, a // random static address will be automatically generated. .addr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /// Duration before regenerate device address when privacy is enabled. .renew_dur = 50000, /// Device IRK used for resolvable random BD address generation (LSB first) .irk = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, /**************************** * ATT database configuration **************************** */ /// Attribute database configuration (@see enum gapm_att_cfg_flag) /// 7 6 5 4 3 2 1 0 /// +-----+-----+----+-----+-----+----+----+----+ /// | DBG | RFU | SC | PCP | APP_PERM |NAME_PERM| /// +-----+-----+----+-----+-----+----+----+----+ /// - Bit [0-1]: Device Name write permission requirements for peer device (@see gapm_write_att_perm) /// - Bit [2-3]: Device Appearance write permission requirements for peer device (@see gapm_write_att_perm) /// - Bit [4] : Slave Preferred Connection Parameters present /// - Bit [5] : Service change feature present in GATT attribute database. /// - Bit [6] : Reserved /// - Bit [7] : Enable Debug Mode .att_cfg = GAPM_MASK_ATT_SVC_CHG_EN, /// GAP service start handle .gap_start_hdl = 0, /// GATT service start handle .gatt_start_hdl = 0, /************************************************** * Data packet length extension configuration (4.2) ************************************************** */ /// Maximal MPS .max_mps = 0, /// Maximal Tx octets .max_txoctets = 251, /// Maximal Tx time .max_txtime = 2120, };
此编译和我可以每〜2-3分钟看到地址更改,无论我在Renew_dur中设置的号码。我的配置错误吗?(此外,renew_dur的时间单位是什么?MS?
我试过
#定义CFG_应用程序_安全性
和集合
#定义用户\u CFG\u地址\u模式应用\u CFG\u CNTL\u PRV\u RPA\u RAND
当调试器连接时似乎运行OK,但在通过SmartSnippets工具箱加载时,它将为第一个〜5秒运行,然后从扫描仪消失。
还有其他定义我需要更改/启用吗?
谢谢,
设备:
嗨DLO,
谢谢你的问题。我来检查一下。
你有没有尝试设置任何其他续订?此外,您是否与我们的任何SDK示例(例如BLE_APP_SECURITY)进行同样的操作
谢谢,PM_DIALOG.
感谢您建议查看BLE_APP_SECURY示例。我还没有找到解决方案,但我会继续挖掘。
感谢您的帮助。
这似乎解决了这个问题:
#define user_cfg_address_mode app_cfg_host_priv_rpa.
嗨DLO,
感谢您的评论并接受您的工作答案。您是否通过定义此宏来绘制您的问题?
谢谢,PM_DIALOG.
多亏了您关于查看ble_安全示例的建议,我能够看到它使用了一个宏,根据该宏,我发现它只能具有某个值,基于此,我缩小了该定义应设置的范围。
嗨DLO,
谢谢你让我们知道!如果您有任何其他问题,请创建一个新的论坛线程。
谢谢,PM_DIALOG.