mirror of https://github.com/ARMmbed/mbed-os.git
Rename ConnectionParams_t -> PreferredConnectionParams_t
For actual connections, full ConnectionParameters is used. But as per BLE specification, Generic Access Service can display preferred connection parameters which is a smaller subset and ConnectionParams_t matches exactly. Thus we rename/repurpose it to PreferredConnectionParams_t.pull/12730/head
parent
76b92b82e2
commit
8de604d485
|
@ -548,7 +548,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameters of a BLE connection.
|
* Preferred connection parameter display in Generic Access Service.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/**
|
/**
|
||||||
|
@ -592,7 +592,7 @@ public:
|
||||||
* @note maxConnectionInterval is in ms in the formulae above.
|
* @note maxConnectionInterval is in ms in the formulae above.
|
||||||
*/
|
*/
|
||||||
uint16_t connectionSupervisionTimeout;
|
uint16_t connectionSupervisionTimeout;
|
||||||
} ConnectionParams_t;
|
} PreferredConnectionParams_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign the event handler implementation that will be used by the gap
|
* Assign the event handler implementation that will be used by the gap
|
||||||
|
|
|
@ -75,7 +75,7 @@ class GenericGap :
|
||||||
using Gap::default_central_privacy_configuration;
|
using Gap::default_central_privacy_configuration;
|
||||||
|
|
||||||
typedef typename ble::whitelist_t whitelist_t;
|
typedef typename ble::whitelist_t whitelist_t;
|
||||||
typedef typename Gap::ConnectionParams_t ConnectionParams_t;
|
typedef typename Gap::PreferredConnectionParams_t PreferredConnectionParams_t;
|
||||||
|
|
||||||
// Imports from Gap
|
// Imports from Gap
|
||||||
#if BLE_ROLE_BROADCASTER
|
#if BLE_ROLE_BROADCASTER
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct GenericAccessService {
|
||||||
* Parameters Characteristic
|
* Parameters Characteristic
|
||||||
*/
|
*/
|
||||||
virtual ble_error_t get_peripheral_preferred_connection_parameters(
|
virtual ble_error_t get_peripheral_preferred_connection_parameters(
|
||||||
::Gap::ConnectionParams_t& parameters
|
::Gap::PreferredConnectionParams_t& parameters
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +74,7 @@ struct GenericAccessService {
|
||||||
* Parameters Characteristic
|
* Parameters Characteristic
|
||||||
*/
|
*/
|
||||||
virtual ble_error_t set_peripheral_preferred_connection_parameters(
|
virtual ble_error_t set_peripheral_preferred_connection_parameters(
|
||||||
const ::Gap::ConnectionParams_t& parameters
|
const ::Gap::PreferredConnectionParams_t& parameters
|
||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -73,7 +73,7 @@ static bool is_in_range(T value, T lower_bound, T higher_bound)
|
||||||
* timeout to be equal to 0xFFFF. When it is the case that value can be
|
* timeout to be equal to 0xFFFF. When it is the case that value can be
|
||||||
* interpreted as "non specific".
|
* interpreted as "non specific".
|
||||||
*/
|
*/
|
||||||
static bool is_preferred_connection_params_valid(const ::Gap::ConnectionParams_t *params)
|
static bool is_preferred_connection_params_valid(const ::Gap::PreferredConnectionParams_t *params)
|
||||||
{
|
{
|
||||||
if (params == NULL) {
|
if (params == NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -142,12 +142,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* @see ::GattServer::getPreferredConnectionParams
|
* @see ::GattServer::getPreferredConnectionParams
|
||||||
*/
|
*/
|
||||||
::Gap::ConnectionParams_t getPreferredConnectionParams();
|
::Gap::PreferredConnectionParams_t getPreferredConnectionParams();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ::GattServer::setPreferredConnectionParams
|
* @see ::GattServer::setPreferredConnectionParams
|
||||||
*/
|
*/
|
||||||
void setPreferredConnectionParams(const ::Gap::ConnectionParams_t& params);
|
void setPreferredConnectionParams(const ::Gap::PreferredConnectionParams_t& params);
|
||||||
|
|
||||||
#if 0 // Disabled until reworked and reintroduced to GattServer API
|
#if 0 // Disabled until reworked and reintroduced to GattServer API
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
#endif // Disabled until reworked and reintroduced to GattServer API
|
#endif // Disabled until reworked and reintroduced to GattServer API
|
||||||
|
|
||||||
virtual ble_error_t get_peripheral_preferred_connection_parameters(
|
virtual ble_error_t get_peripheral_preferred_connection_parameters(
|
||||||
::Gap::ConnectionParams_t& parameters
|
::Gap::PreferredConnectionParams_t& parameters
|
||||||
) {
|
) {
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
#if BLE_FEATURE_GATT_SERVER
|
||||||
parameters = gatt_server().getPreferredConnectionParams();
|
parameters = gatt_server().getPreferredConnectionParams();
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ble_error_t set_peripheral_preferred_connection_parameters(
|
virtual ble_error_t set_peripheral_preferred_connection_parameters(
|
||||||
const ::Gap::ConnectionParams_t& parameters
|
const ::Gap::PreferredConnectionParams_t& parameters
|
||||||
) {
|
) {
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
#if BLE_FEATURE_GATT_SERVER
|
||||||
gatt_server().setPreferredConnectionParams(parameters);
|
gatt_server().setPreferredConnectionParams(parameters);
|
||||||
|
|
|
@ -800,9 +800,9 @@ bool GattServer::isOnDataReadAvailable_() const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
::Gap::ConnectionParams_t GattServer::getPreferredConnectionParams()
|
::Gap::PreferredConnectionParams_t GattServer::getPreferredConnectionParams()
|
||||||
{
|
{
|
||||||
::Gap::ConnectionParams_t params = { 0 };
|
::Gap::PreferredConnectionParams_t params = { 0 };
|
||||||
memcpy(¶ms.minConnectionInterval, generic_access_service.ppcp, 2);
|
memcpy(¶ms.minConnectionInterval, generic_access_service.ppcp, 2);
|
||||||
memcpy(¶ms.maxConnectionInterval, generic_access_service.ppcp + 2, 2);
|
memcpy(¶ms.maxConnectionInterval, generic_access_service.ppcp + 2, 2);
|
||||||
memcpy(¶ms.slaveLatency, generic_access_service.ppcp + 4, 2);
|
memcpy(¶ms.slaveLatency, generic_access_service.ppcp + 4, 2);
|
||||||
|
@ -810,7 +810,7 @@ bool GattServer::isOnDataReadAvailable_() const
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GattServer::setPreferredConnectionParams(const ::Gap::ConnectionParams_t& params)
|
void GattServer::setPreferredConnectionParams(const ::Gap::PreferredConnectionParams_t& params)
|
||||||
{
|
{
|
||||||
memcpy(generic_access_service.ppcp, ¶ms.minConnectionInterval, 2);
|
memcpy(generic_access_service.ppcp, ¶ms.minConnectionInterval, 2);
|
||||||
memcpy(generic_access_service.ppcp + 2, ¶ms.maxConnectionInterval, 2);
|
memcpy(generic_access_service.ppcp + 2, ¶ms.maxConnectionInterval, 2);
|
||||||
|
|
Loading…
Reference in New Issue