@@ -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" );
@@ -601,7 +601,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
601
601
602
602
/* switch between advertising and scanning when we go
603
603
* through all the params in the array */
604
- if (_set_index >= (_is_in_scanning_mode ? size (scanning_params) : size (advertising_params))) {
604
+ if (_set_index >= (_is_in_scanning_mode ? arraysize (scanning_params) : arraysize (advertising_params))) {
605
605
_set_index = 0 ;
606
606
_is_in_scanning_mode = !_is_in_scanning_mode;
607
607
}
@@ -636,7 +636,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
636
636
void end_extended_advertising ()
637
637
{
638
638
/* iterate over the advertising handles */
639
- for (uint8_t i = 0 ; i < size (_adv_handles); ++i) {
639
+ for (uint8_t i = 0 ; i < arraysize (_adv_handles); ++i) {
640
640
/* check if the set has been sucesfully created */
641
641
if (_adv_handles[i] == ble::INVALID_ADVERTISING_HANDLE) {
642
642
continue ;
@@ -691,7 +691,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
691
691
uint16_t duration_ms = _demo_duration.read_ms ();
692
692
uint8_t number_of_active_sets = 0 ;
693
693
694
- for (uint8_t i = 0 ; i < size (_adv_handles); ++i) {
694
+ for (uint8_t i = 0 ; i < arraysize (_adv_handles); ++i) {
695
695
if (_adv_handles[i] != ble::INVALID_ADVERTISING_HANDLE) {
696
696
if (_gap.isAdvertisingActive (_adv_handles[i])) {
697
697
number_of_active_sets++;
0 commit comments