run (untested)
This commit is contained in:
parent
321ece84bc
commit
b63986711d
1 changed files with 8 additions and 3 deletions
|
@ -1,10 +1,10 @@
|
||||||
use std::{collections::VecDeque, ops::{Deref, Div, Index, Range, Sub}, sync::Arc};
|
use std::{collections::VecDeque, future::Future, ops::{Deref, Div, Index, Range, Sub}, pin::Pin, sync::Arc};
|
||||||
|
|
||||||
use common::{CamState, ControlPacket, SensorData, TelemetryPacket};
|
use common::{CamState, ControlPacket, SensorData, TelemetryPacket};
|
||||||
use anyhow::{Context, Ok, Result};
|
use anyhow::{Context, Ok, Result};
|
||||||
use eframe::Storage;
|
use eframe::Storage;
|
||||||
use libloading::{Library, Symbol};
|
use libloading::{Library, Symbol};
|
||||||
use tokio::sync::{self, broadcast, mpsc, watch};
|
use tokio::{sync::{self, broadcast, mpsc, watch}, task::JoinHandle};
|
||||||
|
|
||||||
use crate::storage::StorageManager;
|
use crate::storage::StorageManager;
|
||||||
|
|
||||||
|
@ -118,7 +118,12 @@ impl Auto {
|
||||||
|
|
||||||
}
|
}
|
||||||
/// entrypoint
|
/// entrypoint
|
||||||
async fn run(&self, interface: &AutoInterface) {
|
pub async fn run(&self, interface: &AutoInterface) -> Result<JoinHandle<()>> {
|
||||||
|
let func: Symbol<unsafe extern "C" fn(AutoInterface) -> Pin<Box<dyn Future<Output = ()> + Send>>> = unsafe {self.library.get(b"entry")?};
|
||||||
|
|
||||||
|
let fut = unsafe { func(interface.clone()) };
|
||||||
|
|
||||||
|
Ok(tokio::spawn(fut))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn configs(&self) -> &'static [Configurable] {
|
pub fn configs(&self) -> &'static [Configurable] {
|
||||||
|
|
Loading…
Reference in a new issue