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

node-red-contrib-jacdac

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-jacdac - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

37

dist/nodes/jacdac-reading/jacdac-reading.js

@@ -11,2 +11,19 @@ "use strict";

const filterRegister = filters_1.createRegisterFilter(config);
const sendRegister = (reg) => {
const { service: srv } = reg;
const { device: dev } = srv;
this.send({
payload: {
data: reg.objectValue,
deviceShortId: dev.shortId,
serviceIndex: srv.serviceIndex,
serviceName: srv.name,
registerName: reg.name,
// low-level info
deviceId: dev.deviceId,
serviceClass: srv.serviceClass,
registerCode: reg.code,
}
});
};
const { updates } = config;

@@ -18,22 +35,9 @@ const reportEvent = updates ? jacdac_ts_1.REPORT_UPDATE : jacdac_ts_1.REPORT_RECEIVE;

for (const srv of dev.services().filter(filterService)) {
this.log(`scanning service ${srv.name}`);
for (const reg of srv.registers().filter(filterRegister)) {
this.log(`registering register ${reg}`);
this.log(`registering register ${reg.name}`);
// register this register will automatically
// automatically have the bus
// refresh its value
reg.on(reportEvent, () => {
this.send({
payload: {
data: reg.objectValue,
deviceShortId: dev.shortId,
serviceIndex: srv.serviceIndex,
serviceName: srv.name,
registerName: reg.name,
// low-level info
deviceId: dev.deviceId,
serviceClass: srv.serviceClass,
registerCode: reg.code,
}
});
});
reg.on(reportEvent, sendRegister);
}

@@ -43,3 +47,2 @@ }

};
// we need to make sure that devices are streaming
bus_1.connectNode(this, registerDevice);

@@ -46,0 +49,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createRegisterFilter = exports.createEventFilter = exports.createServiceFilter = exports.createDeviceFilter = void 0;
const jacdac_ts_1 = require("jacdac-ts");
const bus_1 = require("./bus");

@@ -30,9 +31,14 @@ function createDeviceFilter(options) {

exports.createEventFilter = createEventFilter;
const defaultRegisters = [
jacdac_ts_1.SystemReg.Reading,
jacdac_ts_1.SystemReg.Value,
jacdac_ts_1.SystemReg.Intensity
];
function createRegisterFilter(options) {
const { register } = options;
return (reg) => !register
|| reg.code === parseInt(register, 16)
|| (reg.name && reg.name.toLocaleLowerCase() === register.toLocaleLowerCase());
return (reg) => (!register && defaultRegisters.indexOf(reg.code) > -1)
|| (register && reg.code === parseInt(register, 16))
|| (register && (reg.name && reg.name.toLocaleLowerCase() === register.toLocaleLowerCase()));
}
exports.createRegisterFilter = createRegisterFilter;
//# sourceMappingURL=filters.js.map
{
"name": "node-red-contrib-jacdac",
"version": "1.0.6",
"version": "1.0.7",
"description": "Microsoft Jacdac for node-red",

@@ -32,3 +32,3 @@ "keywords": [

"dependencies": {
"jacdac-ts": "^1.13.17",
"jacdac-ts": "^1.13.18",
"webusb": "^2.2.0"

@@ -35,0 +35,0 @@ },

Sorry, the diff of this file is not supported yet

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