Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux BLE module #539

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
81f8176
BLE end of workday commit
MathJud May 30, 2022
d5b4976
feat: [Flutter] add BLE permission requests on libqaul worker initial…
brenodt Jul 18, 2022
4b61ace
feat: listen for RightsRequest to trigger permission request on Android
brenodt Jul 20, 2022
b0ea7dc
fix: [Flutter] compilation errors
brenodt Sep 20, 2022
2cb2cf0
chore: [Flutter] update gradle version
brenodt Sep 28, 2022
1251005
Add Libqaul & Blemodule(android) interface module.
mingchee1026 Nov 20, 2022
843c29d
Fixed code for building
MathJud Nov 21, 2022
9e75dc5
Upgraded Java-Version to 11 for Gradle
MathJud Nov 21, 2022
8d70a03
Fix compilation issue for flutter app
mingchee1026 Nov 22, 2022
6391975
Fix ble service issue on blemodule
mingchee1026 Nov 25, 2022
0ddac80
added protobuf dependency to flutter android gradle
MathJud Nov 23, 2022
9088b3f
BLE: added comments
MathJud Dec 12, 2022
82d3ee4
qaul ID bytes to string logging function
MathJud Jan 18, 2023
eaa923c
debug file reformatted
MathJud Jan 18, 2023
16b7240
added debug logs
MathJud Jan 18, 2023
78441e2
Flutter: added missing Android BLE permission
MathJud Jan 24, 2023
125eb5e
Android BLE comments: TODO catch permission result
MathJud Jan 24, 2023
8894a92
Fix Permission Issue
vishalbluepixel Feb 2, 2023
5ddccac
run android without building rust libqaul
MathJud Jan 30, 2023
8fb57e6
Moved Kotlin BLEModule and Libqaul to Flutter Android project
vishalbluepixel Feb 3, 2023
65dd8ca
I have read the CLA Document and I hereby sign the CLA
vishalbluepixel Feb 2, 2023
7744afd
reinstating build script
MathJud Feb 7, 2023
581db10
fix: compilation issue with Flutter, accessing invalid package "badges"
brenodt Feb 7, 2023
02f0fb6
fixed linux android build
MathJud Feb 7, 2023
795a837
removed android folder
MathJud Feb 7, 2023
b51d1d4
BLE: added log entries
MathJud Feb 13, 2023
3d78c13
Feature/314 ble linux (#1)
6d7a Mar 9, 2023
e45fa41
fix(ble): import generated protobuf from libqaul
6d7a Mar 9, 2023
df77e55
style: remove unused UUID
6d7a Mar 9, 2023
7a320bc
chore(ble): revert changes to generated protorust
6d7a Mar 9, 2023
f46f66e
added ble_module to libqaul for linux
MathJud Mar 13, 2023
13af785
created a library out of the ble_module
MathJud Mar 19, 2023
c523d15
Removed unused SYS channels
MathJud Mar 19, 2023
2db4574
refactor(linux-ble): run main loop on local task
6d7a Mar 24, 2023
8564030
feat(linux-ble): send up results from main loop
6d7a Mar 24, 2023
2e533c9
refactor(linux-ble): remove main.rs and pass callback to init
6d7a Apr 14, 2023
8a7404b
refactor(ble_module): run in tokio runtime
6d7a Apr 14, 2023
2c01e4c
ci(ble_module): apt install bluer dependencies
6d7a Apr 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(linux-ble): remove main.rs and pass callback to init
  • Loading branch information
6d7a committed Apr 14, 2023
commit 2e533c988bba97f8cc8f1d4b0af96e2a8ae9ca2e
35 changes: 22 additions & 13 deletions rust/ble_module/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,48 @@
//! # qaul BLE Module for Linux
//!
//! qaul BLE module for Linux

#[macro_use]
extern crate log;
use crate::ble::ble_service::IdleBleService;
use async_std::task::spawn;
use async_std::{stream::StreamExt, task::spawn};
use futures::executor::block_on;
use rpc::msg_loop::listen_for_sys_msgs;
use rpc::{msg_loop::listen_for_sys_msgs, utils::BleResultSender};
use std::thread;

mod ble;
pub mod rpc;

/// initialize and start the ble_module in an own thread
pub fn init() {
pub fn init(sys_rpc_callback: Box<dyn FnMut(Vec<u8>) + Send>) {
// Spawn new thread
thread::spawn(move || {
block_on(async move {
// start BLE module main loop
main_loop().await;
main_loop(sys_rpc_callback).await;
})
});
}

/// Start the setup and main loop of this library
async fn main_loop() {
async fn main_loop(mut sys_rpc_callback: Box<dyn FnMut(Vec<u8>) + Send>) {
let rpc_receiver = rpc::init();
let ble_service = IdleBleService::new().await.unwrap_or_else(|err| {
log::error!("{:#?}", err);
error!("{:#?}", err);
std::process::exit(1);
});

// listen_for_sys_msgs(rpc_receiver, ble_service)
// .await
// .unwrap_or_else(|err| {
// log::error!("{:#?}", err);
// std::process::exit(1);
// });
let (tx, mut rx) = async_std::channel::unbounded::<Vec<u8>>();

spawn(async move {
while let Some(result) = rx.next().await {
sys_rpc_callback(result)
}
});

listen_for_sys_msgs(rpc_receiver, ble_service, BleResultSender::new(tx))
.await
.unwrap_or_else(|err| {
error!("{:#?}", err);
std::process::exit(1);
});
}
112 changes: 0 additions & 112 deletions rust/ble_module/src/main.rs

This file was deleted.