@@ -86,7 +86,7 @@ static const DemoScanParam_t scanning_params[] = {
86
86
87
87
/* helper that gets the number of items in arrays */
88
88
template <class T , size_t N>
89
- size_t size (const T (&)[N])
89
+ size_t arraysize (const T (&)[N])
90
90
{
91
91
return N;
92
92
}
@@ -107,7 +107,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
107
107
_on_duration_end_id (0 ),
108
108
_scan_count (0 ),
109
109
_blink_event (0 ) {
110
- for (uint8_t i = 0 ; i < size (_adv_handles); ++i) {
110
+ for (uint8_t i = 0 ; i < arraysize (_adv_handles); ++i) {
111
111
_adv_handles[i] = ble::INVALID_ADVERTISING_HANDLE;
112
112
}
113
113
}
@@ -268,7 +268,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
268
268
/* how many sets */
269
269
uint8_t max_adv_set = std::min (
270
270
_gap.getMaxAdvertisingSetNumber (),
271
- (uint8_t ) size (_adv_handles)
271
+ (uint8_t ) arraysize (_adv_handles)
272
272
);
273
273
274
274
/* one advertising set is reserved for legacy advertising */
@@ -315,7 +315,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
315
315
/* set different name for each set */
316
316
MBED_ASSERT (i < 9 );
317
317
char device_name[] = " Advertiser x" ;
318
- snprintf (device_name, size (device_name), " Advertiser %d" , i%10 );
318
+ snprintf (device_name, arraysize (device_name), " Advertiser %d" , i%10 );
319
319
error = adv_data_builder.setName (device_name);
320
320
if (error) {
321
321
print_error (error, " AdvertisingDataBuilder::setName() failed" );
@@ -583,7 +583,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
583
583
584
584
/* switch between advertising and scanning when we go
585
585
* through all the params in the array */
586
- if (_set_index >= (_is_in_scanning_mode ? size (scanning_params) : size (advertising_params))) {
586
+ if (_set_index >= (_is_in_scanning_mode ? arraysize (scanning_params) : arraysize (advertising_params))) {
587
587
_set_index = 0 ;
588
588
_is_in_scanning_mode = !_is_in_scanning_mode;
589
589
}
@@ -618,7 +618,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
618
618
void end_extended_advertising ()
619
619
{
620
620
/* iterate over the advertising handles */
621
- for (uint8_t i = 0 ; i < size (_adv_handles); ++i) {
621
+ for (uint8_t i = 0 ; i < arraysize (_adv_handles); ++i) {
622
622
/* check if the set has been sucesfully created */
623
623
if (_adv_handles[i] == ble::INVALID_ADVERTISING_HANDLE) {
624
624
continue ;
@@ -673,7 +673,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
673
673
uint16_t duration_ms = _demo_duration.read_ms ();
674
674
uint8_t number_of_active_sets = 0 ;
675
675
676
- for (uint8_t i = 0 ; i < size (_adv_handles); ++i) {
676
+ for (uint8_t i = 0 ; i < arraysize (_adv_handles); ++i) {
677
677
if (_adv_handles[i] != ble::INVALID_ADVERTISING_HANDLE) {
678
678
if (_gap.isAdvertisingActive (_adv_handles[i])) {
679
679
number_of_active_sets++;
0 commit comments