工具与软件:
我最近将 BLE 堆栈更新到了1.5.2。 这样做之后、当有限可发现标志设置为 DEFAULT_DISCOVERY_MODE 时、我的广播所需的时间超过30.72秒。 通过将参数(TGAP_LIM_ADV_TIMEOUT)设置为30、我的器件只广播30秒。 但是、我 在升级之前不需要设置此变量。 是否存在标志未按预期工作的原因?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具与软件:
我最近将 BLE 堆栈更新到了1.5.2。 这样做之后、当有限可发现标志设置为 DEFAULT_DISCOVERY_MODE 时、我的广播所需的时间超过30.72秒。 通过将参数(TGAP_LIM_ADV_TIMEOUT)设置为30、我的器件只广播30秒。 但是、我 在升级之前不需要设置此变量。 是否存在标志未按预期工作的原因?
不用担心! 我将其定义为有限发现、然后在我的 advertData 中使用该标志。
#define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_LIMITED ... static uint8 advertData[] = { // Flags; this sets the device to use limited discoverable // mode (advertises for 30 seconds at a time) instead of general // discoverable mode (advertises indefinitely) 0x02, // length of this data GAP_ADTYPE_FLAGS, DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED, .... }
有限的可发现长度变化
您好!
在未 设置 TGAP_LIM_ADV_TIMEOUT 参数的情况下、它广播了大约3分钟。 根据上面的链接、有限发现值(GAP_ADTYPE_FLAGS_LIMITED)似乎不匹配。 我应该从哪里找到正确的值?
您好!
基于 gap.h 文件:
/** * @defgroup GAP_PARAMETER_ID_DEFINES GAP Parameter IDs * Used in place of gapParamIDs_t. * @{ */ // Timers #define TGAP_GEN_DISC_ADV_MIN 0 //!< Minimum time to remain advertising, when in Discoverable mode (mSec). Setting this parameter to 0 turns off the timeout (default). #define TGAP_LIM_ADV_TIMEOUT 1 //!< Maximum time to remain advertising, when in Limited Discoverable mode. In seconds (default 180 seconds) #define TGAP_GEN_DISC_SCAN 2 //!< Minimum time to perform scanning, when performing General Discovery proc (mSec) #define TGAP_LIM_DISC_SCAN 3 //!< Minimum time to perform scanning, when performing Limited Discovery proc (mSec) #define TGAP_CONN_EST_ADV_TIMEOUT 4 //!< Advertising timeout, when performing Connection Establishment proc (mSec) #define TGAP_CONN_PARAM_TIMEOUT 5 //!< Link Layer connection parameter update notification timer, connection parameter update proc (mSec)
您是否可以尝试调用以下 API 来将其设置为30秒?
您好!
是的,使用这种类型的呼叫适用于我正在寻找的时间名人堂。 然而,我 只是想澄清, simpleBLEPeripheral.c 中的评论可能是误导,因为它实际上会广告180秒,而不是30.72 ,正确吗?
// Limited discoverable mode advertises for 30.72s, and then stops // General discoverable mode advertises indefinitely #if defined ( CC2540_MINIDK ) #define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_LIMITED #else #define DEFAULT_DISCOVERABLE_MODE GAP_ADTYPE_FLAGS_GENERAL #endif // defined ( CC2540_MINIDK ) // Minimum connection interval (units of 1.25ms, 80=100ms) if automatic parameter update request is enabled