react-native-bluetooth-classic icon indicating copy to clipboard operation
react-native-bluetooth-classic copied to clipboard

Why I cant fix a timeout to startDiscovery like in Bluetooth Serial ?

Open geralda05 opened this issue 2 years ago • 5 comments

Mobile Device Environment Android

Is your feature request related to a problem? Please describe. Yes, I'm trying to scan available devices but it's very slow. It takes 2 minutes approximately.

Describe the solution you'd like Set a timeout option for startDiscovery (in bluetooth serial already exists) or a onDeviceDiscovered function

geralda05 avatar Sep 09 '22 15:09 geralda05

All this does is pass through to the android system. You can easily add your own time out to stop scanning based on your own rules to cancel discovery.

Not sure whether it's worth adding into the library at this point in time.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Gerald Alarcon @.> Sent: Friday, September 9, 2022 11:24:01 AM To: kenjdavidson/react-native-bluetooth-classic @.> Cc: Subscribed @.***> Subject: [kenjdavidson/react-native-bluetooth-classic] Why I cant fix a timeout to startDiscovery like in Bluetooth Serial ? (Issue #200)

Mobile Device Environment Android

Is your feature request related to a problem? Please describe. Yes, I'm trying to scan available devices but it's very slow. It takes 2 minutes approximately.

Describe the solution you'd like Set a timeout option for startDiscovery (in bluetooth serial already exists) or a onDeviceDiscovered function

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkenjdavidson%2Freact-native-bluetooth-classic%2Fissues%2F200&data=05%7C01%7C%7C6e9fc0f9abc645ecff0408da927752e2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637983338432715837%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XD2EAWUQpGjvGHVGMtGEDkDKhTVZCq0VQ701An2PW4A%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABPMJLZ7IIZUP7R3RKAFSBDV5NJBDANCNFSM6AAAAAAQIY4WPQ&data=05%7C01%7C%7C6e9fc0f9abc645ecff0408da927752e2%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637983338432715837%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AFV8QGBrtGQBZ%2FcU3oOhigL8v8b3t78Xh3aRA2c3UR0%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>

kenjdavidson avatar Sep 09 '22 15:09 kenjdavidson

Thanks. Is there a function like "onDeviceDiscovered" for show available devices while the scan is running ?

geralda05 avatar Sep 09 '22 16:09 geralda05

I closed it by mistake. Sorry. Is there a function like "onDeviceDiscovered" for show available devices while the scan is running ?

geralda05 avatar Sep 09 '22 16:09 geralda05

https://github.com/kenjdavidson/react-native-bluetooth-classic/blob/5a9b0c2249da025bec431e7f4f47bcdf8c049997/android/src/main/java/kjd/reactnative/bluetooth/RNBluetoothClassicModule.java#L452

Does that do it?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Gerald Alarcon @.> Sent: Friday, September 9, 2022 12:27:08 PM To: kenjdavidson/react-native-bluetooth-classic @.> Cc: Ken Davidson @.>; Comment @.> Subject: Re: [kenjdavidson/react-native-bluetooth-classic] Why I cant fix a timeout to startDiscovery like in Bluetooth Serial ? (Issue #200)

I closed it by mistake. Sorry. Is there a function like "onDeviceDiscovered" for show available devices while the scan is running ?

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkenjdavidson%2Freact-native-bluetooth-classic%2Fissues%2F200%23issuecomment-1242192959&data=05%7C01%7C%7C4fd3ffc204d2480a36f508da92802456%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637983376299862417%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=14lzX2WqhWEClxqimhulyJmfas5qWXBX46AVglBVqFQ%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABPMJL4MSS3KRULPPBNV3MTV5NQNZANCNFSM6AAAAAAQIY4WPQ&data=05%7C01%7C%7C4fd3ffc204d2480a36f508da92802456%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637983376299862417%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JQCG2F492g1GiJBY6P52CoPq2oTpPHYunWliNiyt3ik%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

kenjdavidson avatar Sep 09 '22 16:09 kenjdavidson

Any update on this, did you get the DEVICE_FOUND event working?

kenjdavidson avatar Oct 11 '22 12:10 kenjdavidson

@kenjdavidson Hello, for the record I've tried this event and it doesn't trigger ... Even though my promise from startScan return an element ... :/

Has this event been deprecated ?

seba9999 avatar Feb 28 '24 16:02 seba9999

Not on purpose. If it's not working then feel free to PR a fix for it. It should be there since it's in the Native code, unless something on the JS side is causing it not to get passed through.

kenjdavidson avatar Feb 28 '24 16:02 kenjdavidson

Hmmm sorry I was just confused in my code ... This event works ! Sorry ^^'

But the device found with this event don't have the function connect ... Only when found with startDiscovery they have it ... Is this normal ?

seba9999 avatar Feb 28 '24 17:02 seba9999