我使用的SDK与最新的物联网发布,并使用beacon_suota_button作为基础。
我想改变从GAPM_STATIC_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中设置的数字是多少。我的配置错误吗?(另外,续费的时间单位是多少?)女士吗?
我试过
#define cfg_app_security.
并设置
#define user_cfg_address_mode app_cfg_cntl_priv_rpa_rand.
当连接调试器时,它似乎运行正常,但当通过SmartSnippets工具箱加载时,它将运行第一个~5秒,然后从扫描仪中消失。
我是否需要更改/启用其他定义?
谢谢你!
设备:
嗨dlo,
谢谢你的问题。让我检查一下。
您是否尝试设置其他续费?另外,你是否对我们的SDK示例做了同样的事情(例如ble_app_security)
谢谢,PM_Dialog
感谢您建议查看BLE_APP_SECURITY示例。我还没有找到解决办法,但我会继续调查的。
谢谢你的帮助。
这似乎已经解决了它:
#定义USER_CFG_ADDRESS_MODE APP_CFG_HOST_PRIV_RPA
嗨dlo,
感谢您的评论,并接受您的工作答案。通过定义这个宏,你找到你的问题了吗?
谢谢,PM_Dialog
由于您对查看BLE_Security示例的建议,我能够看到它是使用宏,并跟随那个宏我认为它只能基于我缩小了应该定义的内容已被设置为。
嗨dlo,
谢谢你让我们知道!如果您有任何其他问题,请创建一个新的论坛帖子。
谢谢,PM_Dialog