Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ml-opensource/proximity
Detect when a BLE peripheral is held directly up to a host iOS device.
https://github.com/ml-opensource/proximity
airpods bluetooth bluetooth-low-energy cocoapods corebluetooth ios swift xcode
Last synced: 9 days ago
JSON representation
Detect when a BLE peripheral is held directly up to a host iOS device.
- Host: GitHub
- URL: https://github.com/ml-opensource/proximity
- Owner: ml-opensource
- License: mit
- Created: 2019-02-27T18:02:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-12T15:02:33.000Z (almost 6 years ago)
- Last Synced: 2025-01-17T19:16:58.396Z (19 days ago)
- Topics: airpods, bluetooth, bluetooth-low-energy, cocoapods, corebluetooth, ios, swift, xcode
- Language: Swift
- Homepage:
- Size: 85 KB
- Stars: 25
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![proximity logo](images/logo_120.png)
# Proximity[![Version](https://img.shields.io/cocoapods/v/Proximity.svg?style=flat)](https://cocoapods.org/pods/Proximity)
[![License](https://img.shields.io/cocoapods/l/Proximity.svg?style=flat)](https://cocoapods.org/pods/Proximity)
[![Platform](https://img.shields.io/cocoapods/p/Proximity.svg?style=flat)](https://cocoapods.org/pods/Proximity)Proximity is a bluetooth library for detecting when a BLE device is held up to the host device.
It mimics the behavior of the AirPods connection/status sheet when holding open Airpods nearby an iPhone. It is also intended to be used in place of RFID.
![proximity demo animation](images/proximity_animation_300.gif)
## How it Works
Proximity continually monitors the signal strength of nearby BLE devices. This strength is referred to as the received signal strength indicator (RSSI). The RSSI is checked every time an advertising packet is received from nearby devices.The `Proximity.delegate` is notified when the RSSI of a nearby device meets a threshold. The default threshold is -40. This value was selected based on testing with iPhone Xs, iPhone Xr, iPhone SE, and iPad Pro 3rd generation to get a notification when within a couple inches. It may be overridden via the `Proximity.immediateVicinityThreshold`.
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Usage
### Quick Start
```Swift
import Proximityclass MyViewController: UIViewController {
let proximity = Proximity()
override func viewDidLoad() {
super.viewDidLoad()
proximity.delegate = self
proximity.startScanning(forPeripheralsWithServices: ["CAE2...03C3"])
}}
extension MyViewController: ProximityDelegate {
func proximityDidUpdateState(_ proximity: Proximity) {}
func proximityDidUpdatePeripherals(_ proximity: Proximity) {}
func proximityThresholdPassed(by peripheral: Peripheral) {
// peripheral is nearby
}}
```
## Requirements
## Installation
Proximity is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'Proximity'
```## Use Cases
### Tap-to-book a conference room
iPads outside conference rooms could each advertise a different service (UUID). An iPhone monitoring for all of those services could know which conference room iPad it tapped based on the detected service of the peripheral. Then the iPhone could book a meeting at the particular room.## Goals
- [ ] The ability to connect and communicate with devices once detected.
## Author
Eric Kunz, [email protected], Fuzz Productions
## License
Proximity is available under the MIT license. See the LICENSE file for more info.
"proximity" icon by Andrejis Kirma from thenounproject.com.
"iPhone" icon by kakoki from thenounproject.com.