Comments (6)
That is the way it is implemented. You can stop the scan anytime after you connect.
from bluecap.
@troystribling But the scan is stopped right after discovery. Why the second scan attempt doesn't employ timeout?
from bluecap.
@troystribling Quick follow-up sequence
- disable the peripheral you are trying to discover
- start scanning for it with timeout
- you will get timeout as expected
- enable the peripheral you are trying to discover
- start scanning for it with timeout
- you will successfully connect and stop scanning in the future
- disconnect
- disable the peripheral you are trying to discover
- start scanning for it with timeout
- you won't get timeout for that discovery attempt
Am I missing something?
from bluecap.
Did not follow. That sounds like a bug. Start looking here. https://github.com/troystribling/BlueCap/blob/master/BlueCapKit/Central/CentralManager.swift#L212. The code is not that complicated. I do not have the time available now to look into this but will be will ing to accept a PR.
from bluecap.
@troystribling Ok, thank you. Will dive into this, once we will be working on new maintenance release of our App
from bluecap.
Quick try to fix the timeout inside the library wasn't successful, so I've worked-around this by the following code
func startDiscovery(uuid:String){
scanTimeoutTimer = Timer.scheduledTimer(withTimeInterval: 10.0, repeats: false) { _ in
log.info("Scan timeout has passed")
if self.manager.isScanning {
self.manager.stopScanning()
//trigger timeout event here
}
self.scanTimeoutTimer?.invalidate()
}
let discoveryFuture = manager.startScanning(forServiceUUIDs: [CBUUID(string:uuid)]).flatMap { peripheral -> FutureStream<Void> in
log.info("scanFuture: Found peripheral UUID: \(peripheral.identifier.uuidString). Trying to connect")
self.manager.stopScanning()
self.scanTimeoutTimer?.invalidate()
return peripheral.connect(connectionTimeout: 10, capacity: 1)
}
}
from bluecap.
Related Issues (20)
- Peripheral Connection Status Updates HOT 2
- Discovered Services and Characteristics are removed on new search HOT 9
- Multiple connections HOT 1
- Issue with connect inside custom framework HOT 2
- Not getting callback for peripheral Disconnection HOT 4
- Limit on number of characteristics notifying? HOT 3
- How to catch the error when a connected peripheral was been power down? HOT 6
- Connect Peripheral Powered Off, 30 seconds later powered On HOT 3
- Connection and disconnection not working properly HOT 5
- Write to characteristic after start receiveNotificationUpdates HOT 2
- Does it support multiple BLE connection and read value for multiple BLE device HOT 1
- Is there a way to enqueue read/writes?
- How i can run app on background?
- How i can run app on background?
- Will you support br/edr?
- Getting disconnected every 33 secs from iOS Central
- Receiving didModifyServices message for Peripheral HOT 1
- Is there support for passkey or OOB BLE pairing methods?
- Advertisement data is dropped for retrieved peripherals
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluecap.