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

Winrt full support #266

Merged
merged 6 commits into from
May 9, 2024
Merged

Conversation

Cartermel
Copy link
Contributor

  • adds ble peripheral functionality for windows (advertising, notifying etc)

@deadprogram
Copy link
Member

Wow, this looks pretty great @Cartermel thank you for working on it!

@jagobagascon could you please take a look at this?

Copy link
Member

@jagobagascon jagobagascon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a quick advertising test and it is working. But at least for me the advertised data is switching back and forth between my own test, and Windows' own advertising (I'm running Windows on a VM so this may be related to my setup).

return err
}

a.publisher = pub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if a.publisher is null and release the existing instance if not?

If someone calls Configure a few times they would end up leaking memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, added that for the publisher as well as the advertisement, which was unused by accident! Looks to be working in the heartrate example if I try to reconfigure it a couple times before starting.

Could you give some more insight on how the advertisement is switching? The advertisements were quite strange to get working, I copied most of their implementation for this C# source, which I was never really able to see from my phone using the ble tester app on android. But seems to work fine when running the heartrate example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the nRF Connect app to check the advertised data. And this is what I get when running the advertisement example:

screen-20240426-090119.2.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay when using nrf connect I can see it. It's not alternating for me, sometimes it pops up then disappears for a second or two though, but I never see any windows advertising data.

this behavior is the same when I run the C# source as well, seems to be a windows quirk?
when running the heartrate example, and adding some manufacturer data to the advertisement, it shows up steady

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give some more insight on how the advertisement is switching?

This is pretty common behavior. If there's more than one advertisement happening at the same time, many systems will alternate between them. Because they use the same MAC address for both advertisements, it looks like it's constantly changing.
I wouldn't worry about it if it doesn't cause any problems.

@deadprogram
Copy link
Member

@Cartermel @jagobagascon @aykevl anything else needed here or are we good to merge?

@jagobagascon
Copy link
Member

I'll try to work on the bug (saltosystems/winrt-go#92) @Cartermel reported on winrt-go today. It would be great if you could wait for me to fix that.

@jagobagascon
Copy link
Member

FYI saltosystems/winrt-go#93 has been merged and should fix the vector errors @Cartermel was having.

@deadprogram
Copy link
Member

Thank you @jagobagascon for the fix.

@Cartermel can you please update the go.mod/go.sum in this PR and verify it has been addressed?

@Cartermel
Copy link
Contributor Author

@deadprogram updated and it's working great,
thanks @jagobagascon for implementing that!

@deadprogram
Copy link
Member

Thank you very much @Cartermel @jagobagascon and @aykevl now squash/merging.

@deadprogram deadprogram merged commit 314ca89 into tinygo-org:dev May 9, 2024
5 checks passed
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.

4 participants