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.30 to 0.0.31

43

lib/ble/common/assignednumbers/companyidentifiercodes.js

@@ -1413,2 +1413,45 @@ var companyNames = {

"0583": "Code Blue Communications",
"0584": "Gira Giersiepen GmbH & Co. KG",
"0585": "Hearing Lab Technology",
"0586": "LEGRAND",
"0587": "Derichs GmbH",
"0588": "ALT-TEKNIK LLC",
"0589": "Star Technologies",
"058a": "START TODAY CO.,LTD.",
"058b": "Maxim Integrated Products",
"058c": "MERCK Kommanditgesellschaft auf Aktien",
"058d": "Jungheinrich Aktiengesellschaft",
"058e": "Oculus VR, LLC",
"058f": "HENDON SEMICONDUCTORS PTY LTD",
"0590": "Pur3 Ltd",
"0591": "Viasat Group S.p.A.",
"0592": "IZITHERM",
"0593": "Spaulding Clinical Research",
"0594": "Kohler Company",
"0595": "Inor Process AB",
"0596": "My Smart Blinds",
"0597": "RadioPulse Inc",
"0598": "rapitag GmbH",
"0599": "Lazlo326, LLC.",
"059a": "Teledyne Lecroy, Inc.",
"059b": "Dataflow Systems Limited",
"059c": "Macrogiga Electronics",
"059d": "Tandem Diabetes Care",
"059e": "Polycom, Inc.",
"059f": "Fisher & Paykel Healthcare",
"05a0": "RCP Software Oy",
"05a1": "Shanghai Xiaoyi Technology Co.,Ltd.",
"05a2": "ADHERIUM(NZ) LIMITED",
"05a3": "Axiomware Systems Incorporated",
"05a4": "O. E. M. Controls, Inc.",
"05a5": "Kiiroo BV",
"05a6": "Telecon Mobile Limited",
"05a7": "Sonos Inc",
"05a8": "Tom Allebrandi Consulting",
"05a9": "Monidor",
"05aa": "Tramex Limited",
"05ab": "Nofence AS",
"05ac": "GoerTek Dynaudio Co., Ltd.",
"05ad": "INIA",
"05ae": "CARMATE MFG.CO.,LTD",
"ffff": "(Reserved) Default Vendor ID"

@@ -1415,0 +1458,0 @@ };

11

lib/ble/common/assignednumbers/memberservices.js

@@ -255,5 +255,14 @@ var companyNames = {

"fe03": "Amazon Fulfillment Services, Inc",
"fe02": "Robert Bosch GmbH"
"fe02": "Robert Bosch GmbH",
"fe01": "Duracell U.S. Operations Inc.",
"fe00": "Amazon Fulfillment Services Inc.",
"fdff": "OSRAM GmbH",
"fdfe": "ADHERIUM(NZ) LIMITED",
"fdfd": "RecursiveSoft Inc.",
"fdfc": "Optrel AG",
"fdfb": "Tandem Diabetes Care",
"fdfa": "Tandem Diabetes Care"
};
module.exports.companyNames = companyNames;

@@ -19,2 +19,5 @@ /**

return;
case '02':
processPuckyActive(advertiserData);
return;
default:

@@ -54,2 +57,24 @@ return;

/**
* Parse puckyActive data.
* @param {Object} advertiserData The object containing all parsed data.
*/
function processPuckyActive(advertiserData) {
var puckyActive = {};
var data = advertiserData.manufacturerSpecificData.data;
var frameLength = parseInt(data.substr(2,2), 16) & 0x1f;
puckyActive.cyclicCount = parseInt(data.substr(2,1), 16) >> 1;
puckyActive.batteryVoltage = toBatteryVoltage(data.substr(6,2));
puckyActive.temperature = toTemperature(data.substr(8,2));
puckyActive.lightPercentage = toPercentage(data.substr(10,2));
puckyActive.capSensePercentage = toPercentage(data.substr(12,2));
puckyActive.magneticFieldX = toMagneticField(data.substr(14,4));
puckyActive.magneticFieldY = toMagneticField(data.substr(18,4));
puckyActive.magneticFieldZ = toMagneticField(data.substr(22,4));
advertiserData.manufacturerSpecificData.puckyActive = puckyActive;
}
/**
* Convert the given bytes to battery percentage.

@@ -103,2 +128,51 @@ * @param {String} bits The 6 bits of the battery level.

/**
* Convert the given byte to battery voltage.
* @param {String} byte The encoded battery voltage byte.
*/
function toBatteryVoltage(byte) {
var data = parseInt(byte, 16);
return 2 + (1.6 * data / 0xff);
}
/**
* Convert the given byte to temperature.
* @param {String} byte The encoded temperature byte.
*/
function toTemperature(byte) {
var data = parseInt(byte, 16);
return -40 + (data / 2);
}
/**
* Convert the given byte to a percentage.
* @param {String} byte The encoded byte (0x00 = 0%, 0xff = 100%).
*/
function toPercentage(byte) {
var data = parseInt(byte, 16);
return Math.round(100 * data / 0xff);
}
/**
* Convert the given two bytes to a signed value.
* @param {String} bytes The signed magnetic field bytes.
*/
function toMagneticField(bytes) {
var upper = parseInt(bytes.substr(0,2), 16);
var lower = parseInt(bytes.substr(2,2), 16);
if(upper > 127) {
upper = upper - 256;
}
return (upper * 256) + lower;
}
module.exports.process = process;

2

package.json

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

],
"version": "0.0.30",
"version": "0.0.31",
"engines": {

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

@@ -36,2 +36,3 @@ /**

var INPUT_DATA_NORBLE = '11ff830501cc1234567881f87faabbccdd17';
var INPUT_DATA_PUCKYACTIVE = '10ff8305022b1f736f9d03eab70a1b04e2';

@@ -136,2 +137,12 @@ // Expected outputs for the scenario

};
var EXPECTED_DATA_PUCKYACTIVE = {
cyclicCount: 1,
batteryVoltage: 2.7215686274509805,
temperature: 15.5,
lightPercentage: 62,
capSensePercentage: 1,
magneticFieldX: -5449,
magneticFieldY: 2587,
magneticFieldZ: 1250
};

@@ -271,2 +282,10 @@ describe('ble data manufacturerspecificdata', function() {

});
it('should convert ble advertiser data for puckyActive', function() {
var advertiserData = { manufacturerSpecificData: {} };
manufacturerspecificdata.process(INPUT_DATA_PUCKYACTIVE, CURSOR,
advertiserData);
assert.deepEqual(advertiserData.manufacturerSpecificData.puckyActive,
EXPECTED_DATA_PUCKYACTIVE);
});
});
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