Menghubungkan kotlin dengan rust
This commit is contained in:
+15
-8
@@ -4,19 +4,26 @@ use tauri::{plugin::PluginApi, AppHandle, Runtime};
|
||||
use crate::models::*;
|
||||
|
||||
pub fn init<R: Runtime, C: DeserializeOwned>(
|
||||
app: &AppHandle<R>,
|
||||
_api: PluginApi<R, C>,
|
||||
app: &AppHandle<R>,
|
||||
_api: PluginApi<R, C>,
|
||||
) -> crate::Result<Bluclas<R>> {
|
||||
Ok(Bluclas(app.clone()))
|
||||
Ok(Bluclas(app.clone()))
|
||||
}
|
||||
|
||||
/// Access to the bluclas APIs.
|
||||
pub struct Bluclas<R: Runtime>(AppHandle<R>);
|
||||
|
||||
impl<R: Runtime> Bluclas<R> {
|
||||
pub fn ping(&self, payload: PingRequest) -> crate::Result<PingResponse> {
|
||||
Ok(PingResponse {
|
||||
value: payload.value,
|
||||
})
|
||||
}
|
||||
pub fn daftar_perangkat(&self) -> crate::Result<Vec<SBluetoothClassicResponPerangkat>> {
|
||||
let daftar_res: Vec<SBluetoothClassicResponPerangkat> =
|
||||
vec![SBluetoothClassicResponPerangkat {
|
||||
nama: String::new(),
|
||||
alamat: String::new(),
|
||||
}];
|
||||
return Ok(daftar_res);
|
||||
}
|
||||
|
||||
pub fn kirim(&self, _: SBluetoothClassicMuatanKirim) -> crate::Result<()> {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user