Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions BLE_BatteryLevel/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -74,20 +74,20 @@ inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
16 changes: 8 additions & 8 deletions BLE_Beacon/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -74,20 +74,20 @@ inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
16 changes: 8 additions & 8 deletions BLE_Button/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -74,20 +74,20 @@ inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
2 changes: 1 addition & 1 deletion BLE_GAP/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
/* skip non discoverable device */
if (field.type != ble::adv_data_type_t::FLAGS ||
field.value.size() != 1 ||
!(field.value[0] & GapAdvertisingData::LE_GENERAL_DISCOVERABLE)) {
!ble::adv_data_flags_t(field.value[0]).getGeneralDiscoverable()) {
continue;
}

Expand Down
16 changes: 8 additions & 8 deletions BLE_GAP/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -74,20 +74,20 @@ inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
16 changes: 8 additions & 8 deletions BLE_GAPButton/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -74,20 +74,20 @@ inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
4 changes: 2 additions & 2 deletions BLE_GattClient/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class GattClientProcess : private mbed::NonCopyable<GattClientProcess>,
*
* @see GattClient::onServiceDiscoveryTermination
*/
void when_service_discovery_ends(Gap::Handle_t connection_handle)
void when_service_discovery_ends(ble::connection_handle_t connection_handle)
{
if (!_characteristics) {
printf("No characteristics discovered, end of the process.\r\n");
Expand Down Expand Up @@ -565,7 +565,7 @@ class GattClientProcess : private mbed::NonCopyable<GattClientProcess>,
}

GattClient *_client;
Gap::Handle_t _connection_handle;
ble::connection_handle_t _connection_handle;
DiscoveredCharacteristicNode *_characteristics;
DiscoveredCharacteristicNode *_it;
GattAttribute::Handle_t _descriptor_handle;
Expand Down
18 changes: 9 additions & 9 deletions BLE_GattClient/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const uint8_t *addr)
inline void print_address(const ble::address_t addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -80,27 +80,27 @@ inline void print_address(const uint8_t *addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);

if (!seeded) {
seeded = true;
/* use the address as a seed */
uint8_t* random_data = address;
uint8_t* random_data = address.data();
srand(*((unsigned int*)random_data));
}
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
18 changes: 9 additions & 9 deletions BLE_GattServer/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const uint8_t *addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -80,27 +80,27 @@ inline void print_address(const uint8_t *addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);

if (!seeded) {
seeded = true;
/* use the address as a seed */
uint8_t* random_data = address;
uint8_t* random_data = address.data();
srand(*((unsigned int*)random_data));
}
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
16 changes: 8 additions & 8 deletions BLE_HeartRate/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -74,20 +74,20 @@ inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
16 changes: 8 additions & 8 deletions BLE_LED/source/pretty_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline void print_error(ble_error_t error, const char* msg)
}

/** print device address to the terminal */
inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_address(const ble::address_t &addr)
{
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n",
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
Expand All @@ -74,20 +74,20 @@ inline void print_address(const BLEProtocol::AddressBytes_t &addr)
inline void print_mac_address()
{
/* Print out device MAC address to the console*/
BLEProtocol::AddressType_t addr_type;
BLEProtocol::AddressBytes_t address;
BLE::Instance().gap().getAddress(&addr_type, address);
ble::own_address_type_t addr_type;
ble::address_t address;
BLE::Instance().gap().getAddress(addr_type, address);
printf("DEVICE MAC ADDRESS: ");
print_address(address);
}

inline const char* phy_to_string(Gap::Phy_t phy) {
inline const char* phy_to_string(ble::phy_t phy) {
switch(phy.value()) {
case Gap::Phy_t::LE_1M:
case ble::phy_t::LE_1M:
return "LE 1M";
case Gap::Phy_t::LE_2M:
case ble::phy_t::LE_2M:
return "LE 2M";
case Gap::Phy_t::LE_CODED:
case ble::phy_t::LE_CODED:
return "LE coded";
default:
return "invalid PHY";
Expand Down
2 changes: 1 addition & 1 deletion BLE_LEDBlinker/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void characteristic_discovery(const DiscoveredCharacteristic *characteristicP) {
}
}

void discovery_termination(Gap::Handle_t connectionHandle) {
void discovery_termination(ble::connection_handle_t connectionHandle) {
printf("terminated SD for handle %u\r\n", connectionHandle);
if (trigger_led_characteristic) {
trigger_led_characteristic = false;
Expand Down
Loading