Initial support for AsteroidOS watches #3013

Merged
ashimokawa merged 6 commits from Noodlez/Gadgetbridge:asteroid-os-support into master 2023-01-12 17:16:32 +00:00

Hi! This is my contribution to the project. Current support for AsteroidOS by the AsteroidOSSync application is a bit lackluster for my uses, and after my great experience with Gadgetbridge for my PineTime, I figured I'd get AsteroidOS working in here!

There are a few known problems:

  1. AsteroidOS devices need to be detected by doing unsupported devices. You can then choose AsteroidOS from the options there. I would love some advice and support here. I can provide hardware testing. AsteroidOS is supposed to be advertising a service UUID, but upon testing I wasn't able to find it at all.
  2. AsteroidOS is missing a lot of features. This will need to be solved upstream, but there's a lot of potential here that's being missed because it's just not implemented upstream. The main one I can think of is the heartbeat sensor.

The great thing about AsteroidOS is the project is open source, and I hope to work with them to use some more standardized GATT services for things like device information, and time synchronization.

Hi! This is my contribution to the project. Current support for AsteroidOS by the AsteroidOSSync application is a bit lackluster for my uses, and after my great experience with Gadgetbridge for my PineTime, I figured I'd get AsteroidOS working in here! There are a few known problems: 1. AsteroidOS devices need to be detected by doing unsupported devices. You can then choose AsteroidOS from the options there. I would love some advice and support here. I can provide hardware testing. AsteroidOS is supposed to be advertising a service UUID, but upon testing I wasn't able to find it at all. 2. AsteroidOS is missing a lot of features. This will need to be solved upstream, but there's a lot of potential here that's being missed because it's just not implemented upstream. The main one I can think of is the heartbeat sensor. The great thing about AsteroidOS is the project is open source, and I hope to work with them to use some more standardized GATT services for things like device information, and time synchronization.

Another thing to note is that it's not really WIP. It works as is technically. The main thing I want to get fixed is the advertisement problem where I can't find the watch without using unsupported devices.

Another thing to note is that it's not really WIP. It works as is technically. The main thing I want to get fixed is the advertisement problem where I can't find the watch without using unsupported devices.

Ah and for more info on AsteroidOS you can look here: https://asteroidos.org/

Ah and for more info on AsteroidOS you can look here: https://asteroidos.org/
joserebelo reviewed 2023-01-03 10:30:27 +00:00
@ -0,0 +76,4 @@
{
LOG.debug("Name: " + candidate.getName());
LOG.debug("Num services: " + candidate.getServiceUuids().length);
for (ParcelUuid uuid : candidate.getServiceUuids()) {
Collaborator

I think we should remove this before merging, it will be noisy.

I think we should remove this before merging, it will be noisy.

Yep! Just removed that. I just forgot to take that out thanks for letting me know!

Yep! Just removed that. I just forgot to take that out thanks for letting me know!
Noodlez marked this conversation as resolved
@ -0,0 +27,4 @@
@NonNull
@Override
public String toString() {
switch (this) {
Collaborator

You could just return name().toLowerCase(Locale.ROOT) and avoid the switch :)

You could just `return name().toLowerCase(Locale.ROOT)` and avoid the switch :)

Awesome! Just learned something new about Java. I didn't know it had language reflection functions like that

Awesome! Just learned something new about Java. I didn't know it had language reflection functions like that
Noodlez marked this conversation as resolved
@ -0,0 +253,4 @@
}
@Override
public void onFindDevice(boolean start) {
Collaborator

FYI (non-blocker for this PR) - On most devices that don't have this natively, GB usually just sends a call:

final CallSpec callSpec = new CallSpec();
callSpec.command = start ? CallSpec.CALL_INCOMING : CallSpec.CALL_END;
callSpec.name = "Gadgetbridge";
onSetCallState(callSpec);

And set supportsFindDevice to true on the coordinator.

FYI (non-blocker for this PR) - On most devices that don't have this natively, GB usually just sends a call: ```java final CallSpec callSpec = new CallSpec(); callSpec.command = start ? CallSpec.CALL_INCOMING : CallSpec.CALL_END; callSpec.name = "Gadgetbridge"; onSetCallState(callSpec); ``` And set `supportsFindDevice` to true on the coordinator.

Gotcha sounds cool. As an aside, would it be possible to start adding this as a default implementation for devices? Or at least have a helper function for doing exactly this?

Gotcha sounds cool. As an aside, would it be possible to start adding this as a default implementation for devices? Or at least have a helper function for doing exactly this?
Noodlez marked this conversation as resolved
@ -0,0 +307,4 @@
AsteroidOSWeather asteroidOSWeather = new AsteroidOSWeather(weatherSpec);
// Send weather city
{
TransactionBuilder builder = new TransactionBuilder("send weather city");
Collaborator

Should we consider using a single TransactionBuilder for send weather and queueing everything at the end?

Should we consider using a single TransactionBuilder for `send weather` and queueing everything at the end?

Oh yeah I can do that. Can you queue for different characteristics? I'm just learning about all this now, so I have no clue what I'm doing in this regard.

I also was thinking, if that is the case, should I do the same for the music info as well, since I am also splitting those up into different builders and queues?

Oh yeah I can do that. Can you queue for different characteristics? I'm just learning about all this now, so I have no clue what I'm doing in this regard. I also was thinking, if that is the case, should I do the same for the music info as well, since I am also splitting those up into different builders and queues?
Collaborator

Can you queue for different characteristics?

Yup, should be fine, we do it in other parts of the code. It just queues multiple write actions.

> Can you queue for different characteristics? Yup, should be fine, we do it in other parts of the code. It just queues multiple write actions.
Noodlez marked this conversation as resolved

I have some ideas for device discovery as well, since I think it's a good enough solution for an initial commit. AsteroidOS has a list of supported watches, and will advertise their bluetooth name by the watch's codename (eg. the LG Watch Urbane is codename "bass", so the device's name will be "bass")

We can just match on a list of supported devices, and discover that way.

AsteroidOS is supposed to be advertising a service, but when checking for it in the device coordinator in getSupportedType(), it's not showing up. I know this exists, because the official AsteroidOSSync application uses this and detects it.

I have some ideas for device discovery as well, since I think it's a good enough solution for an initial commit. AsteroidOS has a list of supported watches, and will advertise their bluetooth name by the watch's codename (eg. the LG Watch Urbane is codename "bass", so the device's name will be "bass") We can just match on a list of supported devices, and discover that way. [AsteroidOS is supposed to be advertising a service](https://asteroidos.org/wiki/ble-profiles/#advertisement), but when checking for it in the device coordinator in `getSupportedType()`, it's not showing up. I know this exists, because the official AsteroidOSSync application uses this and detects it.

I've been doing some thinking and I think I'm willing to remove the WIP prefix if you guys are. I think it's in a good enough state to be used and integrated

I've been doing some thinking and I think I'm willing to remove the WIP prefix if you guys are. I think it's in a good enough state to be used and integrated
arjan5 reviewed 2023-01-05 22:03:41 +00:00
@ -0,0 +144,4 @@
builder.queue(getQueue());
}
@Override
Collaborator

Hi, just wanted to let you know that we added empty implementations of all interface functions to the AbstractDeviceSupport class today. That means you can now remove all empty overridden functions from this class, which keeps the code cleaner and more readable.

Hi, just wanted to let you know that we added empty implementations of all interface functions to the `AbstractDeviceSupport` class today. That means you can now remove all empty overridden functions from this class, which keeps the code cleaner and more readable.
Noodlez marked this conversation as resolved

I just finished this but somehow rebasing onto master broke my fork. I pushed up to it and now I get a Gitea: Internal Server Error every time I try to do any git operations to my fork, so I'll make a new branch and a new pull request, if that works for you guys.

It seems also this pull request is broken as well due to missing fork information.

I just finished this but somehow rebasing onto master broke my fork. I pushed up to it and now I get a Gitea: Internal Server Error every time I try to do any git operations to my fork, so I'll make a new branch and a new pull request, if that works for you guys. It seems also this pull request is broken as well due to missing fork information.
Collaborator

Yeah, it's an ongoing issue currently. The Codeberg team is looking into it. I think (hope) you don't need to recreate your branch and PR, just wait it out.

Yeah, it's an ongoing issue currently. The Codeberg team is looking into it. I think (hope) you don't need to recreate your branch and PR, just wait it out.
Collaborator

The problem should be fixed now, but this PR is still invalid. Could you try to push something again? Perhaps Gitea picks it up again correctly then...

The problem should be fixed now, but this PR is still invalid. Could you try to push something again? Perhaps Gitea picks it up again correctly then...

@arjan5

How do you see that this is "invalid"?

@arjan5 How do you see that this is "invalid"?

Awesome okay that fixed it! Just needed some patience. I think it's ready to merge as-is, so I'm removing the WIP prefix

Awesome okay that fixed it! Just needed some patience. I think it's ready to merge as-is, so I'm removing the WIP prefix
Noodlez changed title from WIP: Initial support for AsteroidOS watches to Initial support for AsteroidOS watches 2023-01-06 18:31:45 +00:00
Noodlez force-pushed asteroid-os-support from 960a7bc794 to ad6962303c 2023-01-06 20:00:55 +00:00 Compare
ashimokawa merged commit ead7ada987 into master 2023-01-12 17:16:32 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Freeyourgadget/Gadgetbridge#3013
There is no content yet.