Embedded32 API
    Preparing search index...

    J1939 Client Interface

    This is the primary SDK interface. All methods must be implemented by both JS and Python SDKs with identical semantics.

    interface IJ1939Client {
        connect(): Promise<void>;
        disconnect(): Promise<void>;
        getSourceAddress(): number;
        isConnected(): boolean;
        onPGN(pgn: number, handler: PGNHandler): () => void;
        requestPGN(pgn: number, destination?: number): Promise<void>;
        sendPGN(pgn: number, data: PGNData, destination?: number): Promise<void>;
    }

    Implemented by

    Index
    • Connect to the J1939 network Must be called before any other operations

      Returns Promise<void>

    • Disconnect from the J1939 network Cleans up resources and stops all listeners

      Returns Promise<void>

    • Get client's source address

      Returns number

    • Check if client is connected

      Returns boolean

    • Subscribe to a specific PGN Handler is called whenever a message with this PGN is received

      Parameters

      • pgn: number

        Parameter Group Number to subscribe to

      • handler: PGNHandler

        Callback invoked with decoded message

      Returns () => void

      Unsubscribe function

    • Request a PGN from the network Sends Request PGN (59904/0xEA00) asking for data

      Parameters

      • pgn: number

        Parameter Group Number to request

      • Optionaldestination: number

        Target address (default: 255 for broadcast)

      Returns Promise<void>

    • Send a PGN with data Encodes the data according to J1939 and transmits

      Parameters

      • pgn: number

        Parameter Group Number to send

      • data: PGNData

        Decoded data to encode and send

      • Optionaldestination: number

        Target address (default: 255 for broadcast)

      Returns Promise<void>