Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

advlib

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

advlib - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

lib/ble/data/gatt/services/members/google.js~

30

lib/ble/data/gatt/services/members/google.js

@@ -86,12 +86,26 @@ /**

eddystone.version = data.substr(2,2);
eddystone.batteryVoltage = parseInt(data.substr(4,4),16) + 'mV';
// TODO: export 8:8 fixed point representation interpreter to pdu
eddystone.temperature = parseInt(data.substr(8,4),16);
if(eddystone.temperature > 0x7fff) {
eddystone.temperature = 0x7fff - eddystone.temperature;
if(eddystone.version === '00') {
eddystone.batteryVoltage = parseInt(data.substr(4,4),16) + 'mV';
// TODO: export 8:8 fixed point representation interpreter to pdu
eddystone.temperature = parseInt(data.substr(8,4),16);
if(eddystone.temperature > 0x7fff) {
eddystone.temperature = 0x7fff - eddystone.temperature;
}
eddystone.temperature = (eddystone.temperature / 256) + 'C';
eddystone.advertisingCount = parseInt(data.substr(12,8),16);
eddystone.uptime = (parseInt(data.substr(20,8),16) / 10) + 's';
}
eddystone.temperature = (eddystone.temperature / 256) + 'C';
eddystone.advertisingCount = parseInt(data.substr(12,8),16);
eddystone.uptime = (parseInt(data.substr(20,8),16) / 10) + 's';
else if(eddystone.version === '01') {
eddystone.etlm = data.substr(4,24);
eddystone.salt = data.substr(28,4);
eddystone.mic = data.substr(32,4);
}
break;
// EID
case '30':
eddystone.type = 'EID';
eddystone.txPower = pdu.convertTxPower(data.substr(2,2));
eddystone.eid = data.substr(4,16);
break;
}

@@ -98,0 +112,0 @@

@@ -13,3 +13,3 @@ {

],
"version": "0.0.13",
"version": "0.0.14",
"engines": {

@@ -16,0 +16,0 @@ "node": ">=0.10.0"

@@ -10,3 +10,3 @@ advlib

This project was published in a scientific paper entitled [Low-Power Wireless Advertising Software Library for Distributed M2M and Contextual IoT](http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=true&arnumber=7389121) presented at the 2nd IEEE World Forum on Internet of Things (WF-IoT) in Milan, Italy on December 16th, 2015.
This project was published in a scientific paper entitled [Low-Power Wireless Advertising Software Library for Distributed M2M and Contextual IoT](http://reelyactive.com/science/reelyActive-IoT2015.pdf) presented at the [2nd IEEE World Forum on Internet of Things (WF-IoT)](http://wfiot2015.ieee-wf-iot.org/) in Milan, Italy on December 16th, 2015.

@@ -469,3 +469,3 @@

Supports Eddystone ([UID](#eddystone-uid), [URL](#eddystone-url) & [TLM](#eddystone-tlm)) and the [UriBeacon](#uribeacon) of the Physical Web.
Supports Eddystone ([UID](#eddystone-uid), [URL](#eddystone-url), [TLM](#eddystone-tlm) & [EID](#eddystone-eid)) and the [UriBeacon](#uribeacon) of the Physical Web.

@@ -600,3 +600,3 @@ ###### UriBeacon

For reference, the example serviceData.data is interpreted as follows, based on the [Eddystone-TLM specification](https://github.com/google/eddystone/tree/master/eddystone-tlm):
For reference, the example serviceData.data is interpreted as follows, based on the [Eddystone-TLM specification](https://github.com/google/eddystone/tree/master/eddystone-tlm), in this case [Unencrypted TLM](https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md):

@@ -606,3 +606,3 @@ | Byte(s) | Hex String | Description |

| 0 | 20 | Eddystone-TLM Frame Type |
| 1 | 00 | TLM Version |
| 1 | __00__ | TLM Version |
| 2-3 | 0bb8 | Battery Voltage (mV) |

@@ -628,3 +628,61 @@ | 4-5 | 1800 | Temperature (8:8 fixed point) |

Consider also the example of [Encrypted TLM](https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-encrypted.md):
| Byte(s) | Hex String | Description |
|--------:|:-------------------------|:-------------------------|
| 0 | 20 | Eddystone-TLM Frame Type |
| 1 | __01__ | TLM Version |
| 2-13 | 112233445566778899aabbcc | Encrypted TLM |
| 14-15 | 0123 | Salt |
| 16-17 | abcd | Message Integrity Check |
Which would add the following properties to advData:
serviceData: {
uuid: 'feaa',
data: '2001112233445566778899aabbcc0123abcd',
eddystone: {
type: "TLM",
version: "01",
etlm: "112233445566778899aabbcc",
salt: "0123",
mic: "abcd"
}
}
###### Eddystone-EID
Process Eddystone-EID data (UUID = 0xfeaa).
advlib.ble.data.gatt.services.members.process(advData);
This is best illustrated with an example using the following input:
advData: {
serviceData: {
uuid: "feaa",
data: "30001122334455667788"
}
}
For reference, the example serviceData.data is interpreted as follows, based on the [Eddystone-EID specification](https://github.com/google/eddystone/tree/master/eddystone-eid):
| Byte(s) | Hex String | Description |
|--------:|:-----------------|:----------------------------|
| 0 | 30 | Eddystone-EID Frame Type |
| 1 | 00 | Calibrated TxPower at 0m |
| 2-9 | 1122334455667788 | 8-byte Ephemeral Identifier |
Which would add the following properties to advData:
serviceData: {
uuid: "feaa",
data: "30001122334455667788",
eddystone: {
type: "EID",
txPower: "0dBm",
eid: "1122334455667788"
}
}
#### Standard Services

@@ -631,0 +689,0 @@

@@ -31,3 +31,3 @@ /**

};
var INPUT_DATA_EDDYSTONE_TLM = {
var INPUT_DATA_EDDYSTONE_TLM_V00 = {
serviceData: {

@@ -37,4 +37,17 @@ uuid: "feaa",

}
};
};
var INPUT_DATA_EDDYSTONE_TLM_V01 = {
serviceData: {
uuid: "feaa",
data: "2001112233445566778899aabbcc0123abcd"
}
};
var INPUT_DATA_EDDYSTONE_EID = {
serviceData: {
uuid: "feaa",
data: "30001122334455667788"
}
};
// Expected outputs for the scenario

@@ -77,3 +90,3 @@ var EXPECTED_DATA_URIBEACON = {

};
var EXPECTED_DATA_EDDYSTONE_TLM = {
var EXPECTED_DATA_EDDYSTONE_TLM_V00 = {
serviceData: {

@@ -92,2 +105,26 @@ uuid: 'feaa',

};
var EXPECTED_DATA_EDDYSTONE_TLM_V01 = {
serviceData: {
uuid: 'feaa',
data: '2001112233445566778899aabbcc0123abcd',
eddystone: {
type: "TLM",
version: "01",
etlm: "112233445566778899aabbcc",
salt: "0123",
mic: "abcd"
}
}
};
var EXPECTED_DATA_EDDYSTONE_EID = {
serviceData: {
uuid: 'feaa',
data: '30001122334455667788',
eddystone: {
type: "EID",
txPower: "0dBm",
eid: "1122334455667788"
}
}
};

@@ -112,7 +149,17 @@ describe('ble data gatt service member google', function() {

});
it('should parse BLE advertiser data Eddystone TLM', function() {
var advertiserData = INPUT_DATA_EDDYSTONE_TLM;
it('should parse BLE advertiser data Eddystone TLM v00', function() {
var advertiserData = INPUT_DATA_EDDYSTONE_TLM_V00;
google.process(advertiserData);
assert.deepEqual(advertiserData, EXPECTED_DATA_EDDYSTONE_TLM);
assert.deepEqual(advertiserData, EXPECTED_DATA_EDDYSTONE_TLM_V00);
});
it('should parse BLE advertiser data Eddystone TLM v01', function() {
var advertiserData = INPUT_DATA_EDDYSTONE_TLM_V01;
google.process(advertiserData);
assert.deepEqual(advertiserData, EXPECTED_DATA_EDDYSTONE_TLM_V01);
});
it('should parse BLE advertiser data Eddystone EID', function() {
var advertiserData = INPUT_DATA_EDDYSTONE_EID;
google.process(advertiserData);
assert.deepEqual(advertiserData, EXPECTED_DATA_EDDYSTONE_EID);
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc