ARMmbed / mbed-os-example-ble

BLE demos using mbed OS and mbed cli
Apache License 2.0
134 stars 118 forks source link

Add supported features example #359

Closed paul-szczepanek-arm closed 3 years ago

paul-szczepanek-arm commented 3 years ago

Add examples that shows supported feature on the board.

paul-szczepanek-arm commented 3 years ago

@idea--list

paul-szczepanek-arm commented 3 years ago

Are you objecting to the private function or the indentation? I just refactored the repetitive print into a private function for exactly that - readability. The indentation is there for the same reason.

paul-szczepanek-arm commented 3 years ago

That's what the result looks like:

List of optional BLE features that are supported/unsupported by this board:
+ LE_ENCRYPTION feature supported
- CONNECTION_PARAMETERS_REQUEST_PROCEDURE feature not supported
- EXTENDED_REJECT_INDICATION feature not supported
- SLAVE_INITIATED_FEATURES_EXCHANGE feature not supported
- SLAVE_INITIATED_FEATURES_EXCHANGE feature not supported
- LE_PING feature not supported
- LE_DATA_PACKET_LENGTH_EXTENSION feature not supported
- LL_PRIVACY feature not supported
- EXTENDED_SCANNER_FILTER_POLICIES feature not supported
- LE_2M_PHY feature not supported
- STABLE_MODULATION_INDEX_TRANSMITTER feature not supported
- STABLE_MODULATION_INDEX_RECEIVER feature not supported
- LE_CODED_PHY feature not supported
- LE_EXTENDED_ADVERTISING feature not supported
- LE_PERIODIC_ADVERTISING feature not supported
- CHANNEL_SELECTION_ALGORITHM_2 feature not supported
- LE_POWER_CLASS feature not supported

I added the - and + so it's easy to see the enabled features.

pan- commented 3 years ago

@idea--list Is the print format not readable ? Would this be better:

if (supported) { 
     printf( "+ %s feature supported\r\n", feature_name);
} else { 
     printf( "- %s feature not supported\r\n", feature_name);
}
paul-szczepanek-arm commented 3 years ago

@idea--list may I merge this or do you have further comments?

idea--list commented 3 years ago

@idea--list may I merge this or do you have further comments?

I do not have further comments, you can merge it.