pub struct Config {
pub plugin_settings: RwLock<HashMap<String, Value>>,
pub loaded_configs: RwLock<HashMap<String, UniqueDeviceConfig>>,
pub loaded_images: RwLock<HashMap<String, ImageCollection>>,
/* private fields */
}
Expand description
Struct to keep daemon settings
Fields§
§plugin_settings: RwLock<HashMap<String, Value>>
Currently loaded plugin settings
loaded_configs: RwLock<HashMap<String, UniqueDeviceConfig>>
Currently loaded device configs
loaded_images: RwLock<HashMap<String, ImageCollection>>
Currently loaded image collections
Implementations§
Source§impl Config
impl Config
Sourcepub async fn get(custom_config_path: Option<PathBuf>) -> Config
pub async fn get(custom_config_path: Option<PathBuf>) -> Config
Reads config and retrieves config struct
Sourcepub fn frame_rate(&self) -> u32
pub fn frame_rate(&self) -> u32
Pool rate, defaults to DEFAULT_FRAME_RATE if not set
Sourcepub fn reconnect_rate(&self) -> f32
pub fn reconnect_rate(&self) -> f32
Reconnect rate, defaults to DEFAULT_RECONNECT_TIME if not set
Sourcepub fn plugin_compatibility_checks(&self) -> bool
pub fn plugin_compatibility_checks(&self) -> bool
Plugin compatibility checks, defaults to true if not set
Sourcepub fn device_config_path(&self) -> PathBuf
pub fn device_config_path(&self) -> PathBuf
Device config path, defaults to [data_dir]/DEVICE_CONFIG_FOLDER or DEVICE_CONFIG_FOLDER if not set
Sourcepub fn plugin_path(&self) -> PathBuf
pub fn plugin_path(&self) -> PathBuf
Plugin folder path, defaults to [config_dir]/PLUGINS_FOLDER or PLUGINS_FOLDER if not set
Sourcepub fn font_path(&self) -> PathBuf
pub fn font_path(&self) -> PathBuf
Fonts folder path, defaults to [config_dir]/FONTS_FOLDER or FONTS_FOLDER if not set
Sourcepub fn plugin_settings_path(&self) -> PathBuf
pub fn plugin_settings_path(&self) -> PathBuf
Plugin settings file path, defaults to [data_dir]/PLUGINS_SETTINGS_FILE or PLUGINS_SETTINGS_FILE if not set
Sourcepub fn data_dir(&self) -> &PathBuf
pub fn data_dir(&self) -> &PathBuf
Data path, defaults to dirs::data_dir() if not set
Sourcepub fn config_dir(&self) -> &PathBuf
pub fn config_dir(&self) -> &PathBuf
Config path, defaults to dirs::config_dir() if not set
Sourcepub async fn load_plugin_settings(&self)
pub async fn load_plugin_settings(&self)
Loads plugin settings from file
Sourcepub async fn get_plugin_settings<T: PluginConfig + DeserializeOwned>(
&self,
) -> Option<T>
pub async fn get_plugin_settings<T: PluginConfig + DeserializeOwned>( &self, ) -> Option<T>
Retrieves plugin settings if it exists
Sourcepub async fn set_plugin_settings<T: PluginConfig + Serialize>(&self, value: T)
pub async fn set_plugin_settings<T: PluginConfig + Serialize>(&self, value: T)
Sets plugin settings
Sourcepub async fn write_plugin_settings(&self)
pub async fn write_plugin_settings(&self)
Writes plugin settings to file
Sourcepub async fn reload_device_config(
&self,
serial: &str,
) -> Result<(), ConfigError>
pub async fn reload_device_config( &self, serial: &str, ) -> Result<(), ConfigError>
Reloads device config for specified serial
Sourcepub async fn reload_device_configs(&self) -> Result<(), ConfigError>
pub async fn reload_device_configs(&self) -> Result<(), ConfigError>
Reloads all device configs
Sourcepub async fn save_device_config(&self, serial: &str) -> Result<(), ConfigError>
pub async fn save_device_config(&self, serial: &str) -> Result<(), ConfigError>
Saves device config for specified serial
Sourcepub async fn save_device_configs(&self) -> Result<(), ConfigError>
pub async fn save_device_configs(&self) -> Result<(), ConfigError>
Saves device configs for all serials
Sourcepub async fn get_device_config(
&self,
serial: &str,
) -> Option<UniqueDeviceConfig>
pub async fn get_device_config( &self, serial: &str, ) -> Option<UniqueDeviceConfig>
Retrieves device config for specified serial
Sourcepub async fn set_device_config(&self, serial: &str, config: DeviceConfig)
pub async fn set_device_config(&self, serial: &str, config: DeviceConfig)
Sets device config for specified serial
Sourcepub async fn get_all_device_configs(&self) -> Vec<UniqueDeviceConfig> ⓘ
pub async fn get_all_device_configs(&self) -> Vec<UniqueDeviceConfig> ⓘ
Gets an array of all device configs
Sourcepub async fn disable_device_config(&self, serial: &str) -> bool
pub async fn disable_device_config(&self, serial: &str) -> bool
Disables a device config, so it will not be loaded by default
Sourcepub async fn restore_device_config(&self, serial: &str) -> bool
pub async fn restore_device_config(&self, serial: &str) -> bool
Restores device config if it exists
Sourcepub async fn add_image(&self, serial: &str, image: String) -> Option<String>
pub async fn add_image(&self, serial: &str, image: String) -> Option<String>
Adds base64 image to device config image collection
Sourcepub async fn add_image_encode(
&self,
serial: &str,
image: DynamicImage,
) -> Option<String>
pub async fn add_image_encode( &self, serial: &str, image: DynamicImage, ) -> Option<String>
Encodes image to base64 and adds it to device config image collection
Sourcepub async fn get_images(
&self,
serial: &str,
) -> Option<HashMap<String, SDSerializedImage>>
pub async fn get_images( &self, serial: &str, ) -> Option<HashMap<String, SDSerializedImage>>
Gets images from device config
Sourcepub async fn remove_image(&self, serial: &str, identifier: &str) -> bool
pub async fn remove_image(&self, serial: &str, identifier: &str) -> bool
Removes image from device config
Sourcepub async fn sync_images(&self, serial: &str)
pub async fn sync_images(&self, serial: &str)
Syncs images with core
Sourcepub async fn get_image_collection(&self, serial: &str) -> ImageCollection
pub async fn get_image_collection(&self, serial: &str) -> ImageCollection
Retrieves image collection for device if device exists
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !Freeze for Config
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl !UnwindSafe for Config
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
Source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Source§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
Source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
Source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
Source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more