123456789101112131415161718192021222324252627 |
- use crate::ems::service::Service;
- use anyhow::Error;
- use std::time::Duration;
- use tokio::task::JoinHandle;
- use tokio::time::sleep;
- pub struct Bms {}
- impl Bms {
- /// 初始化BMS
- pub fn new() -> Self {
- println!("Bms初始化成功");
- Bms {}
- }
- }
- impl Service for Bms {
- fn run(&self) -> Result<JoinHandle<()>, Error> {
- let handle = tokio::spawn(async {
- loop {
- println!("bms");
- tokio::time::sleep(Duration::from_secs(1)).await;
- }
- });
- Ok(handle)
- }
- }
|