I am using the SDK that comes with the latest IOT release and using the beacon_suota_button as the base.
I'd like to change from GAPM_STATIC_ADDR to GAPM_GEN_RSLV_ADDR.
#undef cfg_app_security / ************************************************************************** *隐私功能和本地设备的地址配置:* - app_cfg_addr_pub无隐私,公共bda * - app_cfg_addr_static没有隐私,随机静态BDA * - app_cfg_host_priv_rpa主机隐私,RPA,公共识别* - app_cfg_host_priv_nrpa主机隐私,nrpa(仅限不可连接)* - app_cfg_cntl_priv_rpa_pub控制器隐私,RPA或PUB,公共标识* - APP_CFG_CNTL_PRIV_RPA_RAND控制器隐私,RPA,公共标识**仅为隐私/寻址配置选择一个选项。************************************************************************** * / #define user_cfg_address_mode app_cfg_addr_static static const struct struct _configuration user_adv_conf = {/ ** *自己的BD地址源:*- GapM_Static_Addr:公共或私有静态地址根据设备地址配置* - Gapm_gen_rslv_addr:生成的可解析私有随机地址* - Gapm_gen_non_rslv_addr:生成的不可解析私有随机地址* / .addr_src = gapm_gen_rslv_addr,///广告的最小时间间隔.intv_min =MS_TO_BERSLOTS(BEACON_ADVERTISS_INTERVAL),// 687.5ms ///广告的最大时间间隔.INTV_MAX = MS_TO_BLESLOTS(BEACON_ADVERTISS_INTERVAL),// 687.5ms / ** *广告渠道地图:* - ADV_CHNL_37_EN:通道37的广告频道地图。* - ADV_CHNL_38_EN:通道38的广告频道地图。* - ADV_CHNL_39_EN:通道39的广告频道地图。* - ADV_ALL_CHNLS_EN:通道37,38和38和38的广告频道地图39. * / .channel_map = ADV_ALL_CHNLS_EN,/ ************************* *广告信息************************* * ///主机信息广告数据(GAPM_ADV_NON_CONN和GAPM_ADV_UNDIRECT)///广告模式:/// - GAP_NON_DISCOVERABLE:非可发现模式/// - GAP_GEN_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, };
This compiles and I can see the address changes every ~2-3 minutes, regardless of the number I set in renew_dur. Is my configuration wrong? (Also, what are the time unit for renew_dur? ms?
I have tried to
#define CFG_APP_SECURITY
and set
#定义USER_CFG_ADDRESS_MODEPP_CFG_CNTL_PRIV_RPA_RAND
它似乎运行好当调试器连接,but when loaded via SmartSnippets Toolbox, it will run for the first ~5 seconds and then dissapears from the scanner.
Are there other defines I need to change/enable?
Thank you,
Device:
Hi dlo,
Thanks for your question. Let me check it.
Did you try to set any other renew_dur? Additionally, did you to do the same with any of our SDK examples ( for instance ble_app_security)
Thanks, PM_Dialog
Thank you for the suggestion to look into BLE_APP_SECURITY example. I haven't found a solution to this yet, but I'll keep digging.
Thank you for your help.
This seems to have fixed it:
#定义USER_CFG_ADDRESS_MODEPP_CFG_HOST_PRIV_RPA
Hi dlo,
Thanks for your comment and accepting your working answer. Did you gigure your issue out by defining this macro?
Thanks, PM_Dialog
Thanks to your suggestion on looking at the ble_security example, I was able to see that it was using a macro, and following that macro I figured out that it can only take on a certain value, based on that I narrowed down what that define should have been set to.
Hi dlo,
Thanks for let us know! If you have any other question, please create a new forum thread.
Thanks, PM_Dialog