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

BleScan.Impl.PollData make my Unity crashed. #53

Open
AlvinLBS opened this issue Aug 17, 2023 · 2 comments
Open

BleScan.Impl.PollData make my Unity crashed. #53

AlvinLBS opened this issue Aug 17, 2023 · 2 comments

Comments

@AlvinLBS
Copy link

AlvinLBS commented Aug 17, 2023

Hi, im a student doing a FYP about BLE communication. Sorry that I only had very little knowledge about Unity and Visual studio coding. Im using the BleWinrtDll Unity/Assets/Scenes/Demo and modify the subscribe function to call ReadPackage. I also changed BleApi.cs to BLE.cs.

I tried to debug line by line, notice the Unity crashed when it reached PollData. So i try to search the error in the library and notice is the QuittableWait(dataQueueSignal, lock) make my Unity crashed. I understand PollData is a function to retrieve data from BLE device, and QuittableWait() used to wait unitl there is data. My BLE device characteristic did not have data thats why it keep waiting (might causing loop).

I create a backup and try to ignore QuittableWait() function and replace it with saveError. So when block=true, and data is empty, it will saveError "no data". Everything work fine and Unity also did display the error (i modified Demo.cs and BLE.cs too so I can start ReadPackage when click subcribe).

May i know what is the problem?

@AlvinLBS
Copy link
Author

AlvinLBS commented Aug 17, 2023

I noticed if I run the Program.cs (by assigning it into Empty object, so i can trigger it), when i hit the Impl.PollService, my Unity also crashed. PollService also using QuittableWait( ) function.

@adabru
Copy link
Owner

adabru commented Aug 19, 2023

Hi Alvin :),
do I understand correctly:

  • You run the unmodified Demo.
  • The device-, service- and characteristic-scan all work fine.
  • When you select a characteristic and click "Subscribe", Unity crashes at following line:

while (BleApi.PollData(out res, false))

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

No branches or pull requests

2 participants