2026-04-26 19:58:17 +02:00
|
|
|
use rocket::{get, http::Status, put};
|
2025-02-27 10:25:31 +01:00
|
|
|
use serde::Serialize;
|
|
|
|
|
use crate::xml::Xml;
|
|
|
|
|
|
|
|
|
|
#[derive(Serialize)]
|
|
|
|
|
#[serde(rename(serialize = "device"))]
|
|
|
|
|
pub struct Device;
|
|
|
|
|
|
|
|
|
|
#[get("/v1/api/devices/@current/status")]
|
|
|
|
|
pub fn current_device_status() -> Xml<Device>{
|
|
|
|
|
Xml(Device)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-26 19:58:17 +02:00
|
|
|
#[put("/v1/api/devices/@current/inactivate")]
|
2026-04-26 19:47:02 +02:00
|
|
|
pub fn inactivate_device() -> Status {
|
|
|
|
|
Status::Ok
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-27 10:25:31 +01:00
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests {
|
|
|
|
|
use crate::nnid::devices::Device;
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_device_data(){
|
|
|
|
|
let text = crate::xml::serialize_with_version(&Device).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
println!("{}", text);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|