LCOV - code coverage report
Current view: top level - core - j1939.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-10-20 13:34:58 Functions: 100.0 % 1 1
Branches: 100.0 % 2 2

             Branch data     Line data    Source code
       1                 :             : // SPDX-License-Identifier: MIT
       2                 :             : #ifndef J1939_H
       3                 :             : #define J1939_H
       4                 :             : 
       5                 :             : #include <cstdint>
       6                 :             : 
       7                 :             : /** Extract an 18-bit PGN from a normalized 29-bit ID explicitly interpreted as J1939.
       8                 :             :  * Priority and source address are excluded. PDU1 also excludes destination address.
       9                 :             :  * Both data-page bits are retained; this does not validate the J1939 protocol.
      10                 :             :  */
      11                 :         130 : inline std::uint32_t ExtractJ1939Pgn(std::uint32_t canId) {
      12                 :         130 :     const std::uint32_t pf = (canId >> 16U) & 0xFFU;
      13                 :         130 :     const std::uint32_t pgn = (canId >> 8U) & 0x3FFFFU;
      14         [ +  + ]:         130 :     return pf < 240U ? pgn & 0x3FF00U : pgn;
      15                 :             : }
      16                 :             : 
      17                 :             : #endif /* J1939_H */
        

Generated by: LCOV version 2.0-1