Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Set connection interval range only for scan response (#1545)
Browse files Browse the repository at this point in the history
* Connection interval fix

* Fix comment
  • Loading branch information
ravibhagavandas authored Nov 22, 2019
1 parent 390f975 commit fa856a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ typedef struct
BTGattAdvName_t ucName;
bool bSetScanRsp;
uint32_t ulAppearance;
uint32_t ulMinInterval; /**< Minimum Connection Interval. If set to 0, HAL implementation shall use vendor specific default values. */
uint32_t ulMaxInterval; /**< Maximum Connection Interval. If set to 0, HAL implementation shall use vendor specific default values. */
uint32_t ulMinInterval; /**< Minimum Connection Interval. If set to 0, minimum connection interval is not included in advertisement/scan response data. */
uint32_t ulMaxInterval; /**< Maximum Connection Interval. If set to 0, maximum connection interval is not included in advertisement/scan response data. */
uint8_t ucChannelMap;
uint8_t ucTxPower;
uint8_t ucTimeout;
Expand Down
25 changes: 22 additions & 3 deletions libraries/c_sdk/standard/ble/src/iot_ble_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@

#if ( IOT_BLE_ADVERTISING_UUID_SIZE == 2 )
#define BT_ADV_UUID_TYPE eBTuuidType16
#elif ( IOT_BLE_ADVERTISING_UUID_SIZE == 4 )
#define BT_ADV_UUID_TYPE eBTuuidType32
#else
#define BT_ADV_UUID_TYPE eBTuuidType128
#endif
Expand All @@ -69,6 +71,15 @@ static const BTUuid_t _serverUUID =
.ucType = eBTuuidType128,
.uu.uu128 = IOT_BLE_SERVER_UUID
};


/**
* @brief Contains parameters to be set in the scan response data.
*
* Note that total available data size in scan response
* is 31 bytes. Parameters are chosen below such that overall size
* does not exceed 31 bytes.
*/
static IotBleAdvertisementParams_t _scanRespParams =
{
.includeTxPower = true,
Expand All @@ -89,14 +100,22 @@ static IotBleAdvertisementParams_t _scanRespParams =
.pUUID2 = NULL
};

/**
* @brief Contains parameters to be set in the advertisement data.
*
* Note that total available data size in advertisement
* is 31 bytes. Parameters are chosen below such that overall size
* does not exceed 31 bytes.
*/

static IotBleAdvertisementParams_t _advParams =
{
.includeTxPower = true,
.name = { BTGattAdvNameShort, IOT_BLE_DEVICE_SHORT_LOCAL_NAME_SIZE},
.name = { BTGattAdvNameShort, IOT_BLE_DEVICE_SHORT_LOCAL_NAME_SIZE},
.setScanRsp = false,
.appearance = IOT_BLE_ADVERTISING_APPEARANCE,
.minInterval = IOT_BLE_ADVERTISING_CONN_INTERVAL_MIN,
.maxInterval = IOT_BLE_ADVERTISING_CONN_INTERVAL_MAX,
.minInterval = 0,
.maxInterval = 0,
.serviceDataLen = 0,
.pServiceData = NULL,
.manufacturerLen = 0,
Expand Down

0 comments on commit fa856a0

Please sign in to comment.