diff --git a/docs/api.md b/docs/api.md
index 310d7eb..6f9a9f2 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -220,6 +220,8 @@ Device class interacts with a remote device.
* [.getAlias()](#Device+getAlias) ⇒ string
* [.getRSSI()](#Device+getRSSI) ⇒ number
* [.getTXPower()](#Device+getTXPower) ⇒ number
+ * [.getManufacturerData()](#Device+getManufacturerData) ⇒ Object.<string, any>
+ * [.getAdvertisingData()](#Device+getAdvertisingData) ⇒ Object.<string, any>
* [.isPaired()](#Device+isPaired) ⇒ boolean
* [.isConnected()](#Device+isConnected) ⇒ boolean
* [.pair()](#Device+pair)
@@ -266,6 +268,18 @@ Received Signal Strength Indicator of the remote device
### device.getTXPower() ⇒ number
Advertised transmitted power level.
+**Kind**: instance method of [Device
](#Device)
+
+
+### device.getManufacturerData() ⇒ Object.<string, any>
+Advertised transmitted manufacturer data.
+
+**Kind**: instance method of [Device
](#Device)
+
+
+### device.getAdvertisingData() ⇒ Object.<string, any>
+Advertised transmitted data.
+
**Kind**: instance method of [Device
](#Device)
diff --git a/src/Device.js b/src/Device.js
index 23154c6..8e0d04e 100644
--- a/src/Device.js
+++ b/src/Device.js
@@ -65,6 +65,22 @@ class Device extends EventEmitter {
return this.helper.prop('TxPower')
}
+ /**
+ * Advertised transmitted manufacturer data.
+ * @returns {Object.}
+ */
+ async getManufacturerData () {
+ return this.helper.prop('ManufacturerData')
+ }
+
+ /**
+ * Advertised transmitted data.
+ * @returns {Object.}
+ */
+ async getAdvertisingData () {
+ return this.helper.prop('AdvertisingData')
+ }
+
/**
* Indicates if the remote device is paired.
* @returns {boolean}
diff --git a/src/index.d.ts b/src/index.d.ts
index 9c4df75..2a4abe1 100644
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -39,6 +39,8 @@ declare namespace NodeBle {
getAddressType(): Promise;
getAlias(): Promise;
getRSSI(): Promise;
+ getManufacturerData(): Promise<{[key:string]:any}>;
+ getAdvertisingData(): Promise<{[key:string]:any}>;
isPaired(): Promise;
isConnected(): Promise;
pair(): Promise;
@@ -71,7 +73,7 @@ declare namespace NodeBle {
adapters(): Promise;
defaultAdapter(): Promise;
getAdapter(adapter: string): Promise;
- }
+ }
function createBluetooth(): {
destroy(): void;
diff --git a/test/Device.spec.js b/test/Device.spec.js
index 0679e03..6b30e4f 100644
--- a/test/Device.spec.js
+++ b/test/Device.spec.js
@@ -33,7 +33,8 @@ test('props', async () => {
Alias: '_alias_',
RSSI: 100,
TxPower: 50,
-
+ ManufacturerData: { 1: { signature: 'ay', value: { type: 'Buffer', data: Buffer.from('test') } } },
+ AdvertisingData: { 2: { signature: 'ay', value: { type: 'Buffer', data: Buffer.from('test') } } },
Paired: true,
Connected: true
}[value])))
@@ -44,6 +45,8 @@ test('props', async () => {
await expect(device.getAlias()).resolves.toEqual('_alias_')
await expect(device.getRSSI()).resolves.toEqual(100)
await expect(device.getTXPower()).resolves.toEqual(50)
+ await expect(device.getManufacturerData()).resolves.toMatchObject({ 1: { signature: 'ay', value: { type: 'Buffer', data: Buffer.from('test') } } })
+ await expect(device.getAdvertisingData()).resolves.toMatchObject({ 2: { signature: 'ay', value: { type: 'Buffer', data: Buffer.from('test') } } })
await expect(device.isConnected()).resolves.toEqual(true)
await expect(device.isPaired()).resolves.toEqual(true)