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

@lessondesk/marker-protocol

Package Overview
Dependencies
Maintainers
6
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lessondesk/marker-protocol - npm Package Compare versions

Comparing version 3.0.12 to 3.0.13

54

dist/index.js

@@ -337,8 +337,13 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var MarkerProtocol = /*@__PURE__*/(function (EventEmitter$$1) {
function MarkerProtocol() {
function MarkerProtocol(debug) {
var this$1 = this;
if ( debug === void 0 ) debug = false;
EventEmitter$$1.call(this);
this.addMarker = function (port, serial) {
this.MARKER_JOIN = function (port, ref) {
var data = ref.data;
var ref$1 = data.marker;
var serial = ref$1.serial;
var header = Buffer.from([0xfd, 0xfd, 0xfd, 0x03, 0x02]);

@@ -368,15 +373,9 @@ var payload = Buffer.alloc(4);

this.markerIsTracked = function (serial) {
var ref = this$1.markers.filter(function (marker) { return marker.serial === serial; });
var marker = ref[0];
return marker;
};
this.updateMarker = function (markerToAdd) {
var marker = markerIsTracked(markerToAdd.serial);
var i = this$1.markers.findIndex(function (marker) { return marker.gtin === markerToAdd.gtin; });
if (!marker) {
if (i <= 0) {
this$1.markers.push(markerToAdd);
} else {
Object.assign(marker, markerToAdd);
this$1.markers[markerIndex] = Object.assign(this$1.markers[i], markerToAdd);
}

@@ -393,6 +392,2 @@ };

this.handleMarkerInfoResponse = function (packet) {
this$1.updateMarker(packet.data);
};
this.setAmpStateOn = function (port) {

@@ -417,23 +412,9 @@ port.write(Buffer.from([0xfd, 0xfd, 0xfd, 0x03, 0x01, 0x01]));

parser.on("data", function (packet) {
if (packet.type === Packets.MARKER_JOIN) {
console.log("\nReceived a marker join request, accepting...\n");
this$1.addMarker(port, packet.data.marker.serial);
this$1.emit("data", packet);
} else if (packet.type === Packets.MARKER_INFO) {
this$1.handleMarkerInfoResponse(packet);
this$1.emit("data", packet);
} else if (packet.type === Packets.MARKER_ADDED) {
var ref = packet.data.marker;
var serial = ref.serial;
this$1.markers.push({
serial: serial
});
this$1.emit("data", packet);
} else if (packet.type === Packets.AP_VERSION) {
this$1.emit('version-response', packet);
} else if (packet.type === Packets.AP_DUMP) {
this$1.emit("dump", packet);
} else {
this$1.emit("data", packet);
}
Object.keys(Packets).forEach(function (key) {
if (Packets[key] === packet.type) {
this$1.debug && console.log(key, packet);
this$1.emit(key, packet);
this$1[key] && this$1[key](port, packet);
}
});
});

@@ -447,2 +428,3 @@ this$1.on('list', function () { return this$1.markerDump(port); });

this.markers = [];
this.debug = debug;
SerialPort.list().then(this.openAccessPoint).catch(console.error);

@@ -449,0 +431,0 @@ }

{
"name": "@lessondesk/marker-protocol",
"version": "3.0.12",
"version": "3.0.13",
"description": "Lesson Desk Group marker protocol",

@@ -38,4 +38,5 @@ "source": "src/index.js",

"events": "^3.0.0",
"serialport": "^8.0.6",
"stream": "0.0.2"
}
}

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