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.1.0 to 0.1.1

21

lib/ble/data/gatt/services/members/minew.js
/**
* Copyright reelyActive 2017
* Copyright reelyActive 2017-2018
* We believe in an open Internet of Things

@@ -55,2 +55,7 @@ */

break;
case 8:
minew.batteryPercent = parseInt(data.substr(4,2),16);
minew.macAddress = toMAC(data.substr(6,12));
minew.name = hexToString(data.substr(18));
break;
default:

@@ -92,2 +97,16 @@ minew.frameType = type;

/**
* Convert the given hexadecimal string to an ASCII string.
* @param {String} name The hexadecimal string.
*/
function hexToString(hex) {
var name = '';
for(var cByte = 0; cByte < hex.length; cByte += 2) {
name += String.fromCharCode(parseInt(hex.substr(cByte, 2), 16));
}
return name;
}
module.exports.process = process;

2

package.json

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

],
"version": "0.1.0",
"version": "0.1.1",
"engines": {

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

@@ -778,3 +778,3 @@ advlib

Supports the Minew S1, E6 and i7 sensor beacons which send data within a service. Note that the service UUID __0xffe1__ does not appear to be a valid member service granted by the Bluetooth SIG.
Supports the Minew S1, E6, E8 and i7 sensor beacons which send data within a service. Note that the service UUID __0xffe1__ does not appear to be a valid member service granted by the Bluetooth SIG.

@@ -849,3 +849,3 @@ ###### S1 Temperature/Humidity Beacon

###### i7 Accelerometer Beacon
###### E8 and i7 Accelerometer Beacon

@@ -887,2 +887,36 @@ This is best illustrated with an example using the following input:

###### Minew Info Frame
This is best illustrated with an example using the following input:
advData: {
serviceData: {
uuid: "ffe1",
data: "a10864d739a03f23ac504c5553"
}
}
| Byte(s) | Hex String | Description |
|--------:|:-------------|:-------------------------|
| 0 | a1 | Frame type |
| 1 | 08 | Version number |
| 2 | 64 | Battery level in percent |
| 3-8 | d739a03f23ac | MAC address |
| 9-12 | 504c5553 | Name (in ASCII) |
Which would add the following property to advData:
serviceData: {
uuid: "ffe1",
data: "a1036400d70087fffe5705a03f23ac",
minew: {
frameType: "a1",
productModel: 8,
batteryPercent: 100,
macAddress: "ac:23:3f:a0:39:d7",
name: "PLUS"
}
}
#### Standard Services

@@ -889,0 +923,0 @@

/**
* Copyright reelyActive 2017
* Copyright reelyActive 2017-2018
* We believe in an open Internet of Things

@@ -31,2 +31,8 @@ */

};
var INPUT_DATA_A1_8 = {
serviceData: {
uuid: "ffe1",
data: "a10864d739a03f23ac504c5553"
}
};

@@ -76,2 +82,15 @@ // Expected outputs for the scenario

};
var EXPECTED_DATA_A1_8 = {
serviceData: {
uuid: "ffe1",
data: "a10864d739a03f23ac504c5553",
minew: {
frameType: "a1",
productModel: 8,
batteryPercent: 100,
macAddress: "ac:23:3f:a0:39:d7",
name: "PLUS"
}
}
};

@@ -97,2 +116,7 @@

});
it('should parse BLE advertiser data Minew frame A1 model 8', function() {
var advertiserData = INPUT_DATA_A1_8;
minew.process(advertiserData);
assert.deepEqual(advertiserData, EXPECTED_DATA_A1_8);
});
});
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