Skip to main content

ocpp_service/
state.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Kevin Vavelin, Codetics (https://codetics.fr)
3
4use std::sync::Arc;
5
6use ocpp_core::MessageIdGenerator;
7use tokio::sync::watch;
8
9use crate::auth::Authenticator;
10use crate::config::Config;
11use crate::db::Db;
12use crate::hub::Hub;
13
14pub struct AppState {
15    pub cfg: Config,
16    pub db: Db,
17    pub hub: Hub,
18    pub auth: Authenticator,
19    pub ids: MessageIdGenerator,
20    /// Time zones of stations (tariff conditions use local time).
21    pub zones: crate::tz::Zones,
22    /// Flips to `true` on shutdown; sessions close their connections.
23    pub shutdown: watch::Receiver<bool>,
24}
25
26pub type App = Arc<AppState>;