Embedded32 API
    Preparing search index...

    Module @embedded32/j1939

    @embedded32/j1939

    Educational SAE J1939 helpers for Embedded32: 29-bit ID parsing, a partial PGN catalog, message decoding, diagnostics subset, and CAN gateway bindings.

    Scope: This is a learning-oriented subset - not a complete or certified J1939 stack.

    npm install @embedded32/j1939 @embedded32/can
    
    import { parseJ1939Id, decodeJ1939, buildJ1939Id } from '@embedded32/j1939';

    const parsed = parseJ1939Id(0x18f00401);
    console.log(parsed.pgn, parsed.sa);

    const msg = decodeJ1939({
    id: 0x18f00401,
    data: [0, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70],
    extended: true,
    });
    console.log(msg.name);

    const id = buildJ1939Id({ priority: 6, pgn: 0xf004, sa: 0x00 });

    Full walkthrough: examples/j1939-basic.ts - npx tsx examples/j1939-basic.ts

    Export Role
    parseJ1939Id, buildJ1939Id 29-bit identifier math
    decodeJ1939, formatJ1939Message Frame → structured message
    getPGNInfo Catalog metadata for known PGNs
    J1939TransportProtocol Multi-packet subset (BAM/RTS - partial coverage)
    DiagnosticsManager DM1/DM2-oriented helpers
    J1939CANBinding Connect CAN traffic to a runtime message bus
    AddressClaimManager Address-claim teaching utilities
    • Node.js 18+
    • ESM imports
    • @embedded32/can when using CAN bindings or examples with frames

    None for parse/decode examples. SocketCAN optional when using J1939CANBinding with real interfaces.

    Decode functions are pure TypeScript and may be bundled for browser demos. SocketCAN and Node-only bindings are not browser-compatible.

    Error Fix
    unknown PGN / sparse decode PGN not in catalog - check getPGNInfo
    Wrong priority/SA Confirm hex ID (0x18F00401) and extended: true on frames
    Import J1939Id namespace Use parseJ1939Id / buildJ1939Id functions instead
    • @embedded32/can - frame transport
    • @embedded32/sim - ECUs that emit J1939 traffic
    • @embedded32/tools - simulate and j1939 monitor commands
    • @embedded32/sdk-js - application-level J1939 client

    Use @embedded32/j1939@1.0.0 with matching @embedded32/can@1.0.0. Transport and diagnostics APIs may expand in minor releases without breaking parse/decode.

    MIT © Mukesh Mani Tripathi

    AddressClaimManager
    DiagnosticsManager
    J1939CANBinding
    J1939PortImpl
    J1939TransportProtocol
    BAMMessage
    CTSMessage
    DecodedJ1939Message
    DecodedSPNValue
    DiagnosticTroubleCode
    DM1Message
    DM2Message
    EndOfMessageMessage
    IJ1939Port
    J1939DeviceInfo
    J1939Message
    J1939PortEvents
    J1939TxPayload
    LampStatus
    ParsedJ1939Id
    PGNInfo
    RTSMessage
    SPNInfo
    PGNCallback
    PGN
    PGN_DATABASE
    PGN_DM1
    PGN_DM2
    PGN_TP_BAM
    PGN_TP_CM
    PGN_TP_CT
    TP_CM
    buildJ1939Id
    decodeJ1939
    decodeSPNsFromFrame
    decodeSPNValue
    describeFMI
    filterByPGN
    filterBySA
    formatJ1939Message
    formatPGN
    formatSPNValue
    getAllPGNs
    getAllSPNs
    getPF
    getPGNInfo
    getPS
    getSPNInfo
    isPDU1
    parseBAM
    parseCTS
    parseEndOfMessage
    parseJ1939Id
    parseRTS
    validateSPNValue