jacdac-ts
Advanced tools
Comparing version 1.30.8 to 1.30.9
{ | ||
"name": "jacdac-ts", | ||
"version": "1.30.8", | ||
"version": "1.30.9", | ||
"description": "JavaScript/TypeScript library to interact with Jacdac devices", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -38,4 +38,6 @@ import { Packet } from "./packet" | ||
ControlReg, | ||
SRV_WIFI, | ||
SystemCmd, | ||
SystemReg, | ||
WifiReg, | ||
} from "../../jacdac-spec/dist/specconstants" | ||
@@ -165,2 +167,14 @@ import { jdpack, jdunpack } from "./pack" | ||
function toIP(buffer: Uint8Array): string { | ||
if (!buffer) return undefined | ||
if (buffer.length === 4) | ||
return `${buffer[0]}.${buffer[1]}.${buffer[2]}.${buffer[3]}` | ||
else return toHex(buffer, ".") | ||
} | ||
function toMAC(buffer: Uint8Array) { | ||
const hex = toHex(buffer, ":") | ||
return hex | ||
} | ||
export function decodeMember( | ||
@@ -186,3 +200,19 @@ service: jdspec.ServiceSpec, | ||
if (member.isFloat && (size == 4 || size == 8)) { | ||
if ( | ||
service?.classIdentifier === SRV_WIFI && | ||
pktInfo.kind === "ro" && | ||
pktInfo.identifier === WifiReg.IpAddress && | ||
offset == 0 | ||
) { | ||
value = pkt.data | ||
humanValue = toIP(pkt.data) | ||
} else if ( | ||
service?.classIdentifier === SRV_WIFI && | ||
pktInfo.kind === "const" && | ||
pktInfo.identifier === WifiReg.Eui48 && | ||
offset == 0 | ||
) { | ||
value = pkt.data | ||
humanValue = toMAC(pkt.data) | ||
} else if (member.isFloat && (size == 4 || size == 8)) { | ||
if (size == 4) numValue = pkt.getNumber(NumberFormat.Float32LE, offset) | ||
@@ -189,0 +219,0 @@ else numValue = pkt.getNumber(NumberFormat.Float64LE, offset) |
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 not supported yet
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
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 not supported yet
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45673212
214799