Rename emgauwa-lib to emgauwa-common

This commit is contained in:
Tobias Reisinger 2024-04-30 08:44:33 +02:00
parent 6340cfd5c7
commit 9bc75b9627
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
58 changed files with 135 additions and 100 deletions

View file

@ -5,7 +5,7 @@ edition = "2021"
authors = ["Tobias Reisinger <tobias@msrg.cc>"]
[dependencies]
emgauwa-lib = { path = "../emgauwa-lib" }
emgauwa-common = { path = "../emgauwa-common" }
actix = "0.13"

View file

@ -2,11 +2,11 @@ use std::sync::Arc;
use std::time::{Duration, Instant};
use actix::{Actor, Context, Handler, Message};
use emgauwa_lib::constants;
use emgauwa_lib::drivers::RelayDriver;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::models::Controller;
use emgauwa_lib::types::RelayStates;
use emgauwa_common::constants;
use emgauwa_common::drivers::RelayDriver;
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::models::Controller;
use emgauwa_common::types::RelayStates;
use futures::executor::block_on;
use sqlx::{Pool, Sqlite};
use tokio::sync::Notify;

View file

@ -1,10 +1,10 @@
use actix::Actor;
use emgauwa_lib::db;
use emgauwa_lib::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbSchedule};
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::models::{Controller, FromDbModel};
use emgauwa_lib::types::EmgauwaUid;
use emgauwa_lib::utils::{drop_privileges, init_logging};
use emgauwa_common::db;
use emgauwa_common::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbSchedule};
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::models::{Controller, FromDbModel};
use emgauwa_common::types::EmgauwaUid;
use emgauwa_common::utils::{drop_privileges, init_logging};
use rppal_pfd::PiFaceDigital;
use sqlx::pool::PoolConnection;
use sqlx::Sqlite;

View file

@ -2,11 +2,11 @@ use std::time::{Duration, Instant};
use actix::Addr;
use chrono::{Local, Timelike};
use emgauwa_lib::constants::RELAYS_RETRY_TIMEOUT;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::models::Controller;
use emgauwa_lib::types::{RelayStates, Weekday};
use emgauwa_lib::utils::printable_relay_states;
use emgauwa_common::constants::RELAYS_RETRY_TIMEOUT;
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::models::Controller;
use emgauwa_common::types::{RelayStates, Weekday};
use emgauwa_common::utils::printable_relay_states;
use futures::pin_mut;
use tokio::time;
use tokio::time::timeout;
@ -29,7 +29,7 @@ pub async fn run_relays_loop(app_state: Addr<AppState>) {
async fn run_relays(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
let notifier = &*app_state_get_controller_notifier(app_state).await?;
let mut last_weekday = emgauwa_lib::utils::get_weekday();
let mut last_weekday = emgauwa_common::utils::get_weekday();
let mut this = utils::app_state_get_this(app_state).await?;
let mut relay_states: RelayStates = Vec::new();
init_relay_states(&mut relay_states, &this);
@ -138,7 +138,7 @@ async fn check_weekday(
last_weekday: &mut Weekday,
changed: &mut bool,
) -> Result<(), EmgauwaError> {
let current_weekday = emgauwa_lib::utils::get_weekday();
let current_weekday = emgauwa_common::utils::get_weekday();
if current_weekday.ne(last_weekday) {
log::debug!("Weekday changed");
*last_weekday = current_weekday;

View file

@ -1,5 +1,5 @@
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::{drivers, settings};
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::{drivers, settings};
use rppal_pfd::PiFaceDigital;
use serde_derive::Deserialize;

View file

@ -1,9 +1,9 @@
use std::sync::Arc;
use actix::Addr;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::models::Controller;
use emgauwa_lib::types::RelayStates;
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::models::Controller;
use emgauwa_common::types::RelayStates;
use tokio::sync::Notify;
use crate::app_state;

View file

@ -1,9 +1,9 @@
use actix::Addr;
use emgauwa_lib::constants::WEBSOCKET_RETRY_TIMEOUT;
use emgauwa_lib::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbSchedule};
use emgauwa_lib::errors::{DatabaseError, EmgauwaError};
use emgauwa_lib::models::{Controller, Relay};
use emgauwa_lib::types::{ControllerWsAction, ScheduleUid};
use emgauwa_common::constants::WEBSOCKET_RETRY_TIMEOUT;
use emgauwa_common::db::{DbController, DbJunctionRelaySchedule, DbRelay, DbSchedule};
use emgauwa_common::errors::{DatabaseError, EmgauwaError};
use emgauwa_common::models::{Controller, Relay};
use emgauwa_common::types::{ControllerWsAction, ScheduleUid};
use futures::{future, pin_mut, SinkExt, StreamExt};
use sqlx::pool::PoolConnection;
use sqlx::{Pool, Sqlite};