use crate::Error;
use crate::frame_tv_api::FrameTvApi;
use crate::frame_tv_impl::{FrameTvImpl, Transport};
use crate::types::{
ArtImage, ArtImageThumbnail, DeviceInfo, DisplayBrightness, DisplayColorTemp, DisplayRotation,
Matte, MotionSensitivity, MotionTimer, PhotoFilter, RemoteControlButton, SlideshowConfig,
UploadedArtImage,
};
pub struct FrameTv(pub(crate) FrameTvImpl<Transport>);
impl FrameTv {
pub fn is_persistent(&self) -> bool {
self.0.transport.is_persistent()
}
pub async fn reconnect(&self) -> Result<(), Error> {
self.0.transport.reconnect().await
}
pub async fn is_connected(&self) -> bool {
self.0.transport.is_connected().await
}
pub async fn send_keepalive(&self) {
self.0.transport.send_keepalive().await;
}
}
#[inherent::inherent]
impl FrameTvApi for FrameTv {
pub async fn get_uploaded_art_images(&self) -> Result<Vec<UploadedArtImage>, Error> {
self.0.get_uploaded_art_images().await
}
pub async fn get_art_image_info(&self, content_id: &str) -> Result<UploadedArtImage, Error> {
self.0.get_art_image_info(content_id).await
}
pub async fn get_selected_art_image(&self) -> Result<UploadedArtImage, Error> {
self.0.get_selected_art_image().await
}
pub async fn select_art_image_by_id(&self, content_id: &str) -> Result<(), Error> {
self.0.select_art_image_by_id(content_id).await
}
pub async fn upload_art_image(&self, image: ArtImage) -> Result<UploadedArtImage, Error> {
self.0.upload_art_image(image).await
}
pub async fn upload_and_select_art_image(
&self,
image: ArtImage,
) -> Result<UploadedArtImage, Error> {
self.0.upload_and_select_art_image(image).await
}
pub async fn delete_uploaded_art_images(&self, content_ids: &[&str]) -> Result<(), Error> {
self.0.delete_uploaded_art_images(content_ids).await
}
pub async fn get_art_image_thumbnail(
&self,
content_id: &str,
) -> Result<ArtImageThumbnail, Error> {
self.0.get_art_image_thumbnail(content_id).await
}
pub async fn set_art_image_favorite(
&self,
content_id: &str,
favorite: bool,
) -> Result<(), Error> {
self.0.set_art_image_favorite(content_id, favorite).await
}
pub async fn get_available_mattes(&self) -> Result<Vec<Matte>, Error> {
self.0.get_available_mattes().await
}
pub async fn set_art_image_matte(
&self,
content_id: &str,
matte_id: &str,
portrait_matte_id: Option<&str>,
) -> Result<(), Error> {
self.0
.set_art_image_matte(content_id, matte_id, portrait_matte_id)
.await
}
pub async fn get_available_photo_filters(&self) -> Result<Vec<PhotoFilter>, Error> {
self.0.get_available_photo_filters().await
}
pub async fn set_art_image_photo_filter(
&self,
content_id: &str,
filter_id: &str,
) -> Result<(), Error> {
self.0
.set_art_image_photo_filter(content_id, filter_id)
.await
}
pub async fn enable_artmode(&self) -> Result<(), Error> {
self.0.enable_artmode().await
}
pub async fn disable_artmode(&self) -> Result<(), Error> {
self.0.disable_artmode().await
}
pub async fn is_artmode_enabled(&self) -> Result<bool, Error> {
self.0.is_artmode_enabled().await
}
pub async fn enable_slideshow(&self, config: Option<SlideshowConfig>) -> Result<(), Error> {
self.0.enable_slideshow(config).await
}
pub async fn disable_slideshow(&self) -> Result<(), Error> {
self.0.disable_slideshow().await
}
pub async fn set_slideshow_config(&self, config: SlideshowConfig) -> Result<(), Error> {
self.0.set_slideshow_config(config).await
}
pub async fn is_slideshow_enabled(&self) -> Result<bool, Error> {
self.0.is_slideshow_enabled().await
}
pub async fn get_slideshow_config(&self) -> Result<SlideshowConfig, Error> {
self.0.get_slideshow_config().await
}
pub async fn set_display_brightness(&self, brightness: DisplayBrightness) -> Result<(), Error> {
self.0.set_display_brightness(brightness).await
}
pub async fn set_display_color_temp(&self, color_temp: DisplayColorTemp) -> Result<(), Error> {
self.0.set_display_color_temp(color_temp).await
}
pub async fn get_display_brightness(&self) -> Result<DisplayBrightness, Error> {
self.0.get_display_brightness().await
}
pub async fn get_display_color_temp(&self) -> Result<DisplayColorTemp, Error> {
self.0.get_display_color_temp().await
}
pub async fn get_display_rotation(&self) -> Result<DisplayRotation, Error> {
self.0.get_display_rotation().await
}
pub async fn enable_auto_brightness(&self) -> Result<(), Error> {
self.0.enable_auto_brightness().await
}
pub async fn disable_auto_brightness(&self) -> Result<(), Error> {
self.0.disable_auto_brightness().await
}
pub async fn set_motion_timer(&self, timer: MotionTimer) -> Result<(), Error> {
self.0.set_motion_timer(timer).await
}
pub async fn set_motion_sensitivity(
&self,
sensitivity: MotionSensitivity,
) -> Result<(), Error> {
self.0.set_motion_sensitivity(sensitivity).await
}
pub async fn press_remote_control_button(
&self,
button: RemoteControlButton,
) -> Result<(), Error> {
self.0.press_remote_control_button(button).await
}
pub async fn get_device_info(&self) -> Result<DeviceInfo, Error> {
self.0.get_device_info().await
}
}