# aasanchez/ocpp16messages architecture

> Architecture diagram of the GitHub repository aasanchez/ocpp16messages, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aasanchez/ocpp16messages
- Repository: https://github.com/aasanchez/ocpp16messages

## Overview

##### Project type and purpose
- This is an open-source Go library (not a standalone application) that implements OCPP 1.6 messages.
- Purpose: Provide Go structs, constructors, validators and JSON marshalling/unmarshalling for OCPP 1.6 Authorize and BootNotification messages.
- Target audience: Go developers building EV charging station clients or central systems.

##### File structure
- Top-level files:
- go.mod, doc.go, README.md, Makefile, CI configs, etc.
- ocpp16messages.go likely contains package-level convenience functions
- Directories:
- /messages/authorize: request.go, confirmation.go, types/…, tests, docs, examples
- /messages/bootnotification: same pattern as authorize
- /shared/types: reusable types like CIString
- Pattern: each message type has its own sub-package with
– Request constructor
– Confirmation struct
– Nested types in types/
– Example tests demonstrating usage
- No transport layer here—network I/O is left to the integrator.

##### README for additional insights
- Describes OCPP and the two implemented messages.
- Shows usage: import message package, call Request(), marshal to JSON, send over a transport.

##### Detailed separation of components
- messages/authorize
- Request constructor
- Confirmation struct
- types (authorizationStatus, idTagInfo, idToken)
- messages/bootnotification
- Parallel structure
- shared/types
- CIString type and validation
- Top-level
- ocpp16messages.go (entry point)
- doc.go (package docs)

## Diagram (Mermaid)

```mermaid
flowchart TD
    ConsumerApp["Consumer Application"]:::external
    CentralSystem["Central System (OCPP Server)"]:::external
    Transport["Transport Layer (WebSocket/HTTP)"]:::infra
    JSONMarshaller["JSON Marshaller"]:::infra
    JSONUnmarshaller["JSON Unmarshaller"]:::infra

    subgraph "ocpp16messages Library"
        entry["ocpp16messages.go"]:::entry
        doc["doc.go"]:::docs

        subgraph "messages/authorize"
            authDoc["doc.go"]:::docs
            authReq["Request Constructor"]:::component
            authConf["Confirmation Struct"]:::component

            subgraph "types"
                typesDoc["doc.go"]:::docs
                authStatus["authorizationStatus"]:::type
                idTagInfo["idTagInfo"]:::type
                idToken["idToken"]:::type
                typesExample["example_test.go"]:::test
                typesAuthTest["authorization_status_test.go"]:::test
                typesInfoTest["idtaginfo_test.go"]:::test
                typesTokenTest["idtoken_test.go"]:::test
            end

            exReqTest["example_req_test.go"]:::test
            exConfTest["example_conf_test.go"]:::test
            reqTest["request_test.go"]:::test
            confTest["confirmation_test.go"]:::test
        end

        subgraph "messages/bootnotification"
            bootDoc["doc.go"]:::docs
            bootReq["Request Constructor"]:::component
            bootConf["Confirmation Struct"]:::component
            brExReq["example_req_test.go"]:::test
            brExConf["example_conf_test.go"]:::test
            brReqTest["request_test.go"]:::test
            brConfTest["confirmation_test.go"]:::test
        end

        subgraph "shared/types"
            stDoc["doc.go"]:::docs
            cistring["CIString Type"]:::type
            cistringEx["example_cistring_test.go"]:::test
            cistringTest["cistring_test.go"]:::test
        end
    end

    subgraph "Tooling & Config"
        goMod["go.mod"]:::config
        ci[".github/workflows/build.yml"]:::config
        lint["golangci.yml"]:::config
        cov["codecov.yml"]:::config
        sonar["sonar-project.properties"]:::config
        readme["README.md"]:::docs
        license["LICENSE"]:::docs
        makefile["Makefile"]:::docs
        gitignore[".gitignore"]:::docs
    end

    ConsumerApp -->|"calls Authorize.Request()"| authReq
    authReq -->|"uses shared types"| cistring
    authReq --> JSONMarshaller
    JSONMarshaller --> Transport
    Transport --> CentralSystem
    CentralSystem --> JSONUnmarshaller
    JSONUnmarshaller --> authConf
    authConf --> ConsumerApp

    ConsumerApp -->|"calls BootNotification.Request()"| bootReq
    bootReq -->|"uses shared types"| cistring
    bootReq --> JSONMarshaller
    JSONUnmarshaller --> bootConf
    bootConf --> ConsumerApp

    %% Click Events
    click entry "https://github.com/aasanchez/ocpp16messages/blob/main/ocpp16messages.go"
    click doc "https://github.com/aasanchez/ocpp16messages/blob/main/doc.go"
    click authReq "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/request.go"
    click authConf "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/confirmation.go"
    click authDoc "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/doc.go"
    click exReqTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/example_req_test.go"
    click exConfTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/example_conf_test.go"
    click reqTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/request_test.go"
    click confTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/confirmation_test.go"
    click typesDoc "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/doc.go"
    click authStatus "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/authorization_status.go"
    click idTagInfo "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/idtaginfo.go"
    click idToken "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/idtoken.go"
    click typesExample "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/example_test.go"
    click typesAuthTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/authorization_status_test.go"
    click typesInfoTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/idtaginfo_test.go"
    click typesTokenTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/authorize/types/idtoken_test.go"
    click bootReq "https://github.com/aasanchez/ocpp16messages/blob/main/messages/bootnotification/request.go"
    click bootConf "https://github.com/aasanchez/ocpp16messages/blob/main/messages/bootnotification/confirmation.go"
    click bootDoc "https://github.com/aasanchez/ocpp16messages/blob/main/messages/bootnotification/doc.go"
    click brExReq "https://github.com/aasanchez/ocpp16messages/blob/main/messages/bootnotification/example_req_test.go"
    click brExConf "https://github.com/aasanchez/ocpp16messages/blob/main/messages/bootnotification/example_conf_test.go"
    click brReqTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/bootnotification/request_test.go"
    click brConfTest "https://github.com/aasanchez/ocpp16messages/blob/main/messages/bootnotification/confirmation_test.go"
    click cistring "https://github.com/aasanchez/ocpp16messages/blob/main/shared/types/cistring.go"
    click stDoc "https://github.com/aasanchez/ocpp16messages/blob/main/shared/types/doc.go"
    click cistringEx "https://github.com/aasanchez/ocpp16messages/blob/main/shared/types/example_cistring_test.go"
    click cistringTest "https://github.com/aasanchez/ocpp16messages/blob/main/shared/types/cistring_test.go"
    click goMod "https://github.com/aasanchez/ocpp16messages/blob/main/go.mod"
    click ci "https://github.com/aasanchez/ocpp16messages/blob/main/.github/workflows/build.yml"
    click lint "https://github.com/aasanchez/ocpp16messages/blob/main/golangci.yml"
    click cov "https://github.com/aasanchez/ocpp16messages/blob/main/codecov.yml"
    click sonar "https://github.com/aasanchez/ocpp16messages/blob/main/sonar-project.properties"
    click readme "https://github.com/aasanchez/ocpp16messages/blob/main/README.md"
    click license "https://github.com/aasanchez/ocpp16messages/tree/main/LICENSE"
    click makefile "https://github.com/aasanchez/ocpp16messages/tree/main/Makefile"

    %% Styles
    classDef external fill:#d5f5e3,stroke:#1e8449,color:#1e8449;
    classDef infra fill:#f4f6f7,stroke:#95a5a6,color:#2c3e50;
    classDef library fill:#ebdef0,stroke:#8e44ad,color:#8e44ad;
    classDef pkg fill:#d6eaf8,stroke:#2874a6,color:#2874a6;
    classDef types fill:#fcf3cf,stroke:#b7950b,color:#b7950b;
    classDef component fill:#d5f5e3,stroke:#1e8449,color:#1e8449;
    classDef entry fill:#fadbd8,stroke:#c0392b,color:#c0392b;
    classDef docs fill:#fdebd0,stroke:#d35400,color:#d35400;
    classDef test fill:#f9ebea,stroke:#922b21,color:#922b21;
    classDef config fill:#e8f8f5,stroke:#1abc9c,color:#117a65;
```
