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

bluetooth drivers #58

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft

Conversation

MatejMagat305
Copy link

@MatejMagat305 MatejMagat305 commented May 17, 2023

this is not final version, but skeleton (base, it contains bugs and unrefactor things), I would like for some advise and notice

Goal is bring bluetooth on GO (Fyne) to android

@MatejMagat305 MatejMagat305 marked this pull request as draft May 17, 2023 11:00
@andydotxyz
Copy link
Member

This is a really epic piece of work, thanks @MatejMagat305. I love the idea and would be happy to help push it forward. I think the main thing we need to do is figure out how to avoid the API being Android specific.
The API should be agnostic to the OS so we can add more implementations in later.
The two main things this means:

  1. remove android from the naming
  2. remove all the env and related contexts from the API (we can use the recent RunNative system so just need the fyne.App context).

I know this is a big ask, but it will make the result so much more useful over time.
This may also mean that we need more interfaces where the current API is android specific structs, though in some cases it may be possible to switch out the details using compile flags.

Excellent work, thanks!

@MatejMagat305
Copy link
Author

MatejMagat305 commented May 18, 2023

so I remove env from functions, it is really nicer ...,

I created this for any Go library based on gomobile (I (we) will incorporate it with fyne-x, but other libraries could also import "fyne-x/..."), but if you say so, we can further integrate it with fyne (it would save several methods in C, for example streams).

there is still lots of work, but I finally believe the base form of API is done

@andydotxyz
Copy link
Member

Fyne-x repo will always depend upon Fyne. If you want to offer the opportunity for people to use the Bluetooth work without that you might have to consider putting the contribution outside the fyne-x repository :(.

@andydotxyz
Copy link
Member

You should not have to use linkname - you can just use RunOnJVM directly, or alias the function name to a local name if that is required for some reason.
It's great to have another platform on here to show it can work - would it be possible to add a third "other" implementation that is a no-op so that apps won't fail to compile when the platform is not supported? (runtime error on init instead of a compile error).

@MatejMagat305
Copy link
Author

MatejMagat305 commented Jun 13, 2023

You should not have to use linkname - you can just use RunOnJVM directly, or alias the function name to a local name if that is required for some reason. It's great to have another platform on here to show it can work - would it be possible to add a third "other" implementation that is a no-op so that apps won't fail to compile when the platform is not supported? (runtime error on init instead of a compile error).

arch sorry, linkname was my experiment ..., and yes when it will finale version I will import .../internal/mobileinit... yes other will be done, but please give me moment, I have school exams period and I want make this for windows too, but it will hardest part of this. But thank for advise and feel free to change if you want

@andydotxyz
Copy link
Member

Hi, that's all cool - no hurry.
I was just catching up on PRs so people are not waiting on me or anyone in the team.
Good luck with your exams.

@MatejMagat305 MatejMagat305 changed the title bluetooth drivers for android bluetooth drivers Jun 13, 2023
@MatejMagat305
Copy link
Author

MatejMagat305 commented Jun 21, 2023

well I do not know the best way for windows would be golang/go#52958, but it is stil proposial ..., what do you (@andydotxyz ) think should I try something with cgo with help tinygo.org/x/bluetooth or would I try for something like go-ole/go-ole#198 which seems like pure go implementation? and on IOS i have no experience, I have found something, but ...

@MatejMagat305 MatejMagat305 marked this pull request as ready for review June 21, 2023 13:57
@andydotxyz
Copy link
Member

think should I try something with cgo with help tinygo.org/x/bluetooth or would I try for something like go-ole/go-ole#198 which seems like pure go implementation?

I guess it's up to you, but I don't think we should be depending upon tiny at the repository level.

Also, if you are adding files from other repositories please do write a comment in the header or commit so it is clear - and double check the license of the source as well.

@MatejMagat305
Copy link
Author

MatejMagat305 commented Feb 23, 2024

I found https://github.com/OpenBluetoothToolbox/SimpleBLE
can I ask you, cmd fyne can embed .jar or .dex file to apk? This jni is too complicated ..., but i do not want to bring something breaking new ...
I am asking, because I found also https://git.wow.st/gmp/ble (which put idea in my head) and golang/sys@66a0560 (which add interface for windows bluetooth)

i maybe should reopen, but i do not know ...

@MatejMagat305
Copy link
Author

I found https://github.com/OpenBluetoothToolbox/SimpleBLE can I ask you, cmd fyne can embed .jar or .dex file to apk? This jni is too complicated ..., but i do not want to bring something breaking new ... I am asking, because I found also https://git.wow.st/gmp/ble (which put idea in my head) and golang/sys@66a0560 (which add interface for windows bluetooth)

i maybe should reopen, but i do not know ...

I do not know whether it will work as multiplatform, but it is progress ..., but if fyne can embede .dex file please write ......

@MatejMagat305 MatejMagat305 reopened this Feb 26, 2024
@MatejMagat305 MatejMagat305 marked this pull request as draft February 26, 2024 13:50
@andydotxyz
Copy link
Member

Our packaging does not support adding .jar or .dex file into the app at this time

can I ask you, cmd fyne can embed .jar or .dex file to apk? This jni is too complicated ..., but i do not want to bring something breaking new ...

No, Fyne package command cannot embed other libraries at this time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants