pub struct Camera {
pub config: CameraConfig,
wakeup_list: Vec<NaiveTime>,
storage: Storage,
}
Expand description
Camera システムモジュール。
Fields§
§config: CameraConfig
設定データ。
web からも参照される。
wakeup_list: Vec<NaiveTime>
自動撮影の時刻リスト。
storage: Storage
ストレージ上の画像リストデータ。
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn new(wakeup_list: Vec<NaiveTime>) -> Result<Self>
pub fn new(wakeup_list: Vec<NaiveTime>) -> Result<Self>
コンストラクタ。
設定データの読み込みと、ストレージの状態取得を行い画像リストを初期化する。
Sourcepub fn pic_list(
&self,
) -> (&BTreeMap<String, PicEntry>, &BTreeMap<String, PicEntry>)
pub fn pic_list( &self, ) -> (&BTreeMap<String, PicEntry>, &BTreeMap<String, PicEntry>)
ストレージ上の画像リスト (history, archive) を取得する。
Sourcefn create_file_names(key: &str) -> (String, String)
fn create_file_names(key: &str) -> (String, String)
キーからファイル名を生成する。
Sourcepub async fn push_pic_history(&mut self, img: &[u8], thumb: &[u8]) -> Result<()>
pub async fn push_pic_history(&mut self, img: &[u8], thumb: &[u8]) -> Result<()>
撮影した画像をストレージに書き出し、管理構造に追加する。
名前は現在日時から自動的に付与される。
img
- jpg ファイルのバイナリデータ。thumb
- サムネイル jpg ファイルのバイナリデータ。
Sourcepub async fn push_pic_archive(&mut self, key: &str) -> Result<()>
pub async fn push_pic_archive(&mut self, key: &str) -> Result<()>
ヒストリ内の key
で指定したエントリを永続領域にコピーする。
key
- エントリ名。
pub async fn delete_pic_history(&mut self, id: &str) -> Result<()>
pub async fn delete_pic_archive(&mut self, id: &str) -> Result<()>
async fn delete_pic( list: &mut BTreeMap<String, PicEntry>, id: &str, ) -> Result<()>
Sourcefn calc_total_size(list: &BTreeMap<String, PicEntry>) -> u64
fn calc_total_size(list: &BTreeMap<String, PicEntry>) -> u64
PicDict の合計ファイルサイズを計算する。
オーダ O(n)。 64 bit でオーバーフローすると panic する。
Sourceasync fn clean_pic_history(&mut self) -> Result<()>
async fn clean_pic_history(&mut self) -> Result<()>
必要に応じて自動削除を行う。
Trait Implementations§
Source§impl SystemModule for Camera
impl SystemModule for Camera
Source§fn on_start(&mut self, ctrl: &Control)
fn on_start(&mut self, ctrl: &Control)
async 使用可能になってからの初期化。
設定有効ならば Self::auto_task を spawn する。
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnwindSafe for Camera
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 more