Skip to content
Open
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
33 changes: 33 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,39 @@ None
Serial.println(address);


```

### `BLE.address(uint8_t* address)`

Query the Bluetooth® address of the Bluetooth® Low Energy device.

#### Syntax

```
uint8_t address[6];
BLE.address(address)

```

#### Parameters

None

#### Returns
- The **Bluetooth® address** of the Bluetooth® Low Energy device (as a array of byte).

#### Example

```arduino

uint8_t address[6];
BLE.address(address);

Serial.print(“Local address is: “);
for(int i=0;i<6;i++)
Serial.print(address[i], HEX);


```

### `BLE.rssi()`
Expand Down
6 changes: 6 additions & 0 deletions src/BLEDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ String BLEDevice::address() const
return result;
}

void BLEDevice::address(uint8_t* address) const
{
memcpy( address, _address, sizeof(_address) );
}


bool BLEDevice::hasLocalName() const
{
return (localName().length() > 0);
Expand Down
1 change: 1 addition & 0 deletions src/BLEDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class BLEDevice {
virtual bool disconnect();

virtual String address() const;
virtual void address(uint8_t* address) const;

bool hasLocalName() const;

Expand Down