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.6 to 1.3.7

27

lib/minew.js
/**
* Copyright reelyActive 2015-2022
* Copyright reelyActive 2015-2023
* We believe in an open Internet of Things

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

const TAMPER_FRAME_LENGTH = 10;
const WATER_DETECTION_FRAME_LENGTH = 10;
const VIBRATION_FRAME_LENGTH = 14;

@@ -36,2 +37,3 @@ const MIN_INFO_FRAME_LENGTH = 9;

const TAMPER_OFFSET = 3;
const WATER_DETECTION_OFFSET = 3;
const PIR_MASK = 0x0001;

@@ -41,2 +43,3 @@ const VISIBLE_LIGHT_MASK = 0x01;

const TAMPER_MASK = 0x01;
const WATER_DETECTION_MASK = 0x01;
const MINEW_URI = "https://sniffypedia.org/Organization/Shenzhen_Minew_Technologies_Co_Ltd/";

@@ -80,2 +83,4 @@

return processTamper(buf);
case 0x21:
return processWaterDetection(buf);
}

@@ -251,2 +256,22 @@

/**
* Process water (leak) detection service data.
* @param {Object} data The raw service data as a Buffer.
* @return {Object} The processed tamper data as JSON.
*/
function processWaterDetection(data) {
let isInvalidLength = (data.length !== WATER_DETECTION_FRAME_LENGTH);
if(isInvalidLength) {
return null;
}
let batteryPercentage = data.readUInt8(BATTERY_PERCENTAGE_OFFSET);
let isLiquidDetected = ((data.readUInt8(WATER_DETECTION_OFFSET) &
WATER_DETECTION_MASK) === WATER_DETECTION_MASK);
return { batteryPercentage: batteryPercentage,
isLiquidDetected: [ isLiquidDetected ], uri: MINEW_URI };
}
module.exports.process = process;

2

package.json

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

],
"version": "1.3.6",
"version": "1.3.7",
"engines": {

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

@@ -71,5 +71,7 @@ advlib-ble-services

| Minew | S1 ([Tutorial](https://reelyactive.github.io/diy/minew-s1-config/)) | minew.js |
| Minew | MSP01 | minew.js |
| Minew | B10 ([Tutorial](https://reelyactive.github.io/diy/minew-b10-config/)) | minew.js |
| Minew | MSP01 ([Tutorial](https://reelyactive.github.io/diy/minew-msp01-config/)) | minew.js |
| Minew | MSV01 | minew.js |
| Minew | MBT01 | minew.js |
| Minew | MSL01 | minew.js |

@@ -88,5 +90,3 @@

[![Known Vulnerabilities](https://snyk.io/test/github/reelyactive/advlib-ble-services/badge.svg)](https://snyk.io/test/github/reelyactive/advlib-ble-services)
License

@@ -93,0 +93,0 @@ -------

@@ -7,22 +7,16 @@ Using reelyActive open source software securely

Observe best practices
----------------------
We are currently compiling an open source software security best practices document. Link to come.
Keep up to date
---------------
Unless otherwise specified, it is recommended to regularly update to the most recent version of this software package, and to review the security test results, ideally automating this process and including an alerting feature.
Unless otherwise specified, it is recommended to regularly update to the most recent version of this software package, and to review the security test results, including any [Dependabot alerts](https://docs.github.com/code-security/dependabot/dependabot-alerts) listed under the Security tab of this GitHub repository, ideally automating this process and including an alerting feature.
Observe the [vulnerabilities badge](README.md#security) on the project README page and follow the link to consult independent test results by [snyk.io](https://snyk.io) of the latest commit.
Disclose a vulnerability
------------------------
Should you discover a novel security issue or vulnerability, kindly __report your findings to security@reelyactive.com__, and provide sufficient detail to effectively address, if not resolve, the issue. Kindly also provide a means of contact should additional detail be required, _and also so we can return our thanks!_
Should you discover a novel security issue or vulnerability, kindly __report your findings privately__, either to __security@reelyactive.com__, or with the __Report a vulnerability__ feature under the Security tab of this GitHub repository.
Kindly provide sufficient detail to effectively address, if not resolve, the issue, as well as a means of contact should additional detail be required, _and so that we may return our thanks!_
These security guidelines were drafted by [the reelyActive team](https://www.reelyactive.com/team/) and we invite you to adapt them for your own projects under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).
/**
* Copyright reelyActive 2015-2022
* Copyright reelyActive 2015-2023
* We believe in an open Internet of Things

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

const INPUT_DATA_TAMPER = 'a1204501aabbccddeeff';
const INPUT_DATA_WATER_DETECTION = 'a1216301aabbccddeeff';

@@ -67,2 +68,7 @@

};
const EXPECTED_DATA_WATER_DETECTION = {
batteryPercentage: 99,
isLiquidDetected: [ true ],
uri: "https://sniffypedia.org/Organization/Shenzhen_Minew_Technologies_Co_Ltd/"
};

@@ -131,2 +137,8 @@

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