use crate::error::{not_implemented, OnvifError};
use crate::generated::types::{
DeviceInfo, HostnameInformation, NetworkInterface, Scope, ScopeDefinition,
};
use async_trait::async_trait;
#[async_trait]
pub trait DeviceService: Send + Sync + 'static {
async fn get_system_date_and_time(&self) -> Result<chrono::DateTime<chrono::Utc>, OnvifError> {
Ok(chrono::Utc::now())
}
async fn get_device_information(&self) -> Result<DeviceInfo, OnvifError> {
not_implemented()
}
async fn get_scopes(&self) -> Result<Vec<Scope>, OnvifError> {
Ok(vec![
Scope {
scope_def: ScopeDefinition::Fixed,
scope_item: "onvif://www.onvif.org/type/video_encoder".into(),
},
Scope {
scope_def: ScopeDefinition::Fixed,
scope_item: "onvif://www.onvif.org/Profile/Streaming".into(),
},
])
}
async fn get_hostname(&self) -> Result<HostnameInformation, OnvifError> {
Ok(HostnameInformation {
from_dhcp: false,
name: Some("onvif-device".into()),
})
}
async fn get_network_interfaces(&self) -> Result<Vec<NetworkInterface>, OnvifError> {
not_implemented()
}
}