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
Lingkai Dong 2020-04-07 15:19:32 +01:00
parent 76b92b82e2
commit 8de604d485
7 changed files with 13 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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;

View File

@ -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
/** /**

View File

@ -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);

View File

@ -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(&params.minConnectionInterval, generic_access_service.ppcp, 2); memcpy(&params.minConnectionInterval, generic_access_service.ppcp, 2);
memcpy(&params.maxConnectionInterval, generic_access_service.ppcp + 2, 2); memcpy(&params.maxConnectionInterval, generic_access_service.ppcp + 2, 2);
memcpy(&params.slaveLatency, generic_access_service.ppcp + 4, 2); memcpy(&params.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, &params.minConnectionInterval, 2); memcpy(generic_access_service.ppcp, &params.minConnectionInterval, 2);
memcpy(generic_access_service.ppcp + 2, &params.maxConnectionInterval, 2); memcpy(generic_access_service.ppcp + 2, &params.maxConnectionInterval, 2);