Skip to content

Commit f084976

Browse files
change name for IAR
1 parent 15cef96 commit f084976

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

BLE_GAP/source/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static const DemoScanParam_t scanning_params[] = {
8686

8787
/* helper that gets the number of items in arrays */
8888
template<class T, size_t N>
89-
size_t size(const T (&)[N])
89+
size_t arraysize(const T (&)[N])
9090
{
9191
return N;
9292
}
@@ -107,7 +107,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
107107
_on_duration_end_id(0),
108108
_scan_count(0),
109109
_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) {
111111
_adv_handles[i] = ble::INVALID_ADVERTISING_HANDLE;
112112
}
113113
}
@@ -268,7 +268,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
268268
/* how many sets */
269269
uint8_t max_adv_set = std::min(
270270
_gap.getMaxAdvertisingSetNumber(),
271-
(uint8_t) size(_adv_handles)
271+
(uint8_t) arraysize(_adv_handles)
272272
);
273273

274274
/* one advertising set is reserved for legacy advertising */
@@ -315,7 +315,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
315315
/* set different name for each set */
316316
MBED_ASSERT(i < 9);
317317
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);
319319
error = adv_data_builder.setName(device_name);
320320
if (error) {
321321
print_error(error, "AdvertisingDataBuilder::setName() failed");
@@ -583,7 +583,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
583583

584584
/* switch between advertising and scanning when we go
585585
* 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))) {
587587
_set_index = 0;
588588
_is_in_scanning_mode = !_is_in_scanning_mode;
589589
}
@@ -618,7 +618,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
618618
void end_extended_advertising()
619619
{
620620
/* 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) {
622622
/* check if the set has been sucesfully created */
623623
if (_adv_handles[i] == ble::INVALID_ADVERTISING_HANDLE) {
624624
continue;
@@ -673,7 +673,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
673673
uint16_t duration_ms = _demo_duration.read_ms();
674674
uint8_t number_of_active_sets = 0;
675675

676-
for (uint8_t i = 0; i < size(_adv_handles); ++i) {
676+
for (uint8_t i = 0; i < arraysize(_adv_handles); ++i) {
677677
if (_adv_handles[i] != ble::INVALID_ADVERTISING_HANDLE) {
678678
if (_gap.isAdvertisingActive(_adv_handles[i])) {
679679
number_of_active_sets++;

0 commit comments

Comments
 (0)