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

advlib-ble-services

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

advlib-ble-services - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

29

lib/minew.js

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

const ILLUMINANCE_FRAME_LENGTH = 11;
const TAMPER_FRAME_LENGTH = 10;
const VIBRATION_FRAME_LENGTH = 14;

@@ -34,5 +35,7 @@ const MIN_INFO_FRAME_LENGTH = 9;

const ILLUMINANCE_OFFSET = 3;
const TAMPER_OFFSET = 3;
const PIR_MASK = 0x0001;
const VISIBLE_LIGHT_MASK = 0x01;
const VIBRATION_MASK = 0x01;
const TAMPER_MASK = 0x01;
const MINEW_URI = "https://sniffypedia.org/Organization/Shenzhen_Minew_Technologies_Co_Ltd/";

@@ -74,2 +77,4 @@

return processIlluminance(buf);
case 0x20:
return processTamper(buf);
}

@@ -200,5 +205,5 @@

// TODO: Include timestamp? Units?
// TODO: Include timestamp?
return { batteryPercentage: batteryPercentage,
isVibration: isVibration, uri: MINEW_URI };
isMotionDetected: [ isVibration ], uri: MINEW_URI };
}

@@ -226,2 +231,22 @@

/**
* Process tamper service data.
* @param {Object} data The raw service data as a Buffer.
* @return {Object} The processed tamper data as JSON.
*/
function processTamper(data) {
let isInvalidLength = (data.length !== TAMPER_FRAME_LENGTH);
if(isInvalidLength) {
return null;
}
let batteryPercentage = data.readUInt8(BATTERY_PERCENTAGE_OFFSET);
let isTamper = ((data.readUInt8(TAMPER_OFFSET) & TAMPER_MASK) ===
TAMPER_MASK);
return { batteryPercentage: batteryPercentage,
isContactDetected: [ !isTamper ], uri: MINEW_URI };
}
module.exports.process = process;

2

package.json

@@ -18,3 +18,3 @@ {

],
"version": "1.3.3",
"version": "1.3.4",
"engines": {

@@ -21,0 +21,0 @@ "node": ">=6.0.0"

@@ -56,2 +56,21 @@ advlib-ble-services

Supported Devices
-----------------
The following is a _non-exhaustive_ list of devices supported by __advlib-ble-services__.
| Manufacturer | Model/Device | /lib file |
|:-------------|:-------------------------|:-------------------------|
| Various | Heart rate monitor | gatt.js |
| Various | Eddystone beacon | eddystone.js |
| Various | Android phone (contact tracing) | exposurenotification.js |
| Apple | iPhone (contact tracing) | exposurenotification.js |
| Wiliot | Pixel | wiliot.js |
| Minew | E8S ([Tutorial](https://reelyactive.github.io/diy/minew-e8-config/)) | minew.js |
| Minew | S1 ([Tutorial](https://reelyactive.github.io/diy/minew-s1-config/)) | minew.js |
| Minew | MSP01 | minew.js |
| Minew | MSV01 | minew.js |
| Minew | MBT01 | minew.js |
Contributing

@@ -58,0 +77,0 @@ ------------

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

const INPUT_DATA_ILLUMINANCE = 'a119640ab4aabbccddeeff';
const INPUT_DATA_TAMPER = 'a1204501aabbccddeeff';

@@ -53,3 +54,3 @@

batteryPercentage: 50,
isVibration: true,
isMotionDetected: [ true ],
uri: "https://sniffypedia.org/Organization/Shenzhen_Minew_Technologies_Co_Ltd/"

@@ -62,2 +63,7 @@ };

};
const EXPECTED_DATA_TAMPER = {
batteryPercentage: 69,
isContactDetected: [ false ],
uri: "https://sniffypedia.org/Organization/Shenzhen_Minew_Technologies_Co_Ltd/"
};

@@ -120,2 +126,8 @@

// Test the process function with valid tamper data
it('should handle valid tamper data as input', function() {
assert.deepEqual(service.process(INPUT_DATA_TAMPER),
EXPECTED_DATA_TAMPER);
});
});
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