nativescript-community / nativescript-community/ble

optimistic connect attempts?

Open
#137 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
202
Forks
79
PR merge metrics
No merged PRs in 30d

Description

is it possible to attempt to connect to a peripheral by UUID without first scanning to see if it's in range? the app only needs to connect to a specific peripheral, which has already been identified by UUID (and mac address, service uuids, etc) -- i would like to be able to attempt connection on an interval without having to initiate a scan process each time to test its availability. When i try i get file:///app/tns_modules/nativescript-bluetooth/bluetooth.js:463:18: Error in Bluetooth.connect: TypeError: null is not an object (evaluating 'Bluetooth._state.peripheralArray.count'), presumably because there are no scan results to check against. I'm using the nativescript + angular (typescript) with the current release, 1.3.1
not even sure this is possible, but it was suggested to me as a way to auto-reconnect to a known device and avoid the overhead of 1-2 second device scans on an endless 5-10 second interval, and figured i'd check with the experts ;).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at bluetooth.js line 463 and the Bluetooth.connect entry point; reproduce the call without scan results in the reported NativeScript/Angular setup. Determine whether a known UUID or MAC address can be used directly, with done defined as reconnect attempts that avoid repeated scans without the null peripheralArray error.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.