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

jacdac-ts

Package Overview
Dependencies
Maintainers
1
Versions
497
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jacdac-ts - npm Package Compare versions

Comparing version 1.0.15 to 1.0.16

dist/types/logparser.d.ts

4

dist/types/bus.d.ts

@@ -7,3 +7,3 @@ import { Packet } from "./packet";

sendPacketAsync: (p: Packet) => Promise<void>;
disconnectAsync: () => Promise<void>;
disconnectAsync?: () => Promise<void>;
}

@@ -74,3 +74,3 @@ export interface PacketEventEmitter {

sendPacketAsync(p: Packet): Promise<void>;
disconnect(): Promise<void>;
disconnectAsync(): Promise<void>;
/**

@@ -77,0 +77,0 @@ * Gets the current list of known devices on the bus

@@ -12,2 +12,3 @@ export * from './constants';

export * from './sensor';
export * from './logparser';
export * from './pretty';

@@ -12,7 +12,1 @@ import { Packet } from "./packet";

export declare function printPacket(pkt: Packet, opts?: Options): string;
export interface ParsedFrame {
timestamp: number;
data: Uint8Array;
info?: string;
}
export declare function parseLog(logcontents: string): ParsedFrame[];
{
"name": "jacdac-ts",
"version": "1.0.15",
"version": "1.0.16",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -7,5 +7,5 @@ # JACDAC TypeScript

The rest of this page is meant developing the jacdac-ts library.
The rest of this page is for developers of the jacdac-ts library.
## Devevelop setup
## Developer setup

@@ -12,0 +12,0 @@ ### Setup

@@ -9,3 +9,3 @@ import { Packet } from "./packet";

sendPacketAsync: (p: Packet) => Promise<void>;
disconnectAsync: () => Promise<void>;
disconnectAsync?: () => Promise<void>;
}

@@ -111,3 +111,3 @@

disconnect(): Promise<void> {
disconnectAsync(): Promise<void> {
if (this._gcInterval) {

@@ -117,3 +117,4 @@ clearInterval(this._gcInterval);

}
return this.options.disconnectAsync()
return (this.options?.disconnectAsync() || Promise.resolve())
.then(() => { this.emit("disconnect") })

@@ -120,0 +121,0 @@ }

@@ -12,2 +12,3 @@ export * from './constants'

export * from './sensor'
export * from './logparser'
export * from './pretty'

@@ -225,53 +225,1 @@ import * as U from "./utils"

}
export interface ParsedFrame {
timestamp: number
data: Uint8Array
info?: string
}
export function parseLog(logcontents: string) {
const res: ParsedFrame[] = []
let frameBytes = []
let lastTime = 0
for (let ln of logcontents.split(/\r?\n/)) {
let m = /^JD (\d+) ([0-9a-f]+)/i.exec(ln)
if (m) {
res.push({
timestamp: parseInt(m[1]),
data: U.fromHex(m[2])
})
continue
}
m = /^([\d\.]+),Async Serial,.*(0x[A-F0-9][A-F0-9])/.exec(ln)
if (!m)
continue
const tm = parseFloat(m[1])
if (lastTime && tm - lastTime > 0.1) {
res.push({
timestamp: lastTime * 1000,
data: new Uint8Array(frameBytes),
info: "timeout"
})
frameBytes = []
lastTime = 0
}
lastTime = tm
if (ln.indexOf("framing error") > 0) {
if (frameBytes.length > 0)
res.push({
timestamp: lastTime * 1000,
data: new Uint8Array(frameBytes),
})
frameBytes = []
lastTime = 0
} else {
frameBytes.push(parseInt(m[2]))
}
}
return res
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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