Swiftpack.co - PureSwift/BluetoothLinux as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by PureSwift.
PureSwift/BluetoothLinux 4.2.0
Pure Swift Linux Bluetooth Stack
⭐️ 153
🕓 3 weeks ago
.package(url: "https://github.com/PureSwift/BluetoothLinux.git", from: "4.2.0")

BluetoothLinux

Swift Platform Release Build Status License CodeBeat

SPM compatible

Pure Swift Bluetooth Stack for Linux

Does not require BlueZ, communicates directly with the Linux kernel and Bluetooth controller.

Usage

import Bluetooth
import BluetoothLinux

guard let hostController = BluetoothLinux.HostController.default
    else { fatalError("No Bluetooth adapters found") }
let uuid = UUID(rawValue: "E2C56DB5-DFFB-48D2-B060-D0F5A71096E0")!
let beacon = AppleBeacon(uuid: uuid, major: 1, minor: 1, rssi: -29)
do { try hostController.iBeacon(beacon) }
catch { print("Error enabling iBeacon: \(error)") }

Installation

Swift Package Manager

import PackageDescription

let package = Package(
    dependencies: [
        .package(
			url: "https://github.com/PureSwift/BluetoothLinux.git",
    		.branch("master")
    		)
        ]
)

Documentation

Documentation can be generated with Jazzy.

swift package generate-xcodeproj
jazzy

Read the documentation here. For more information, see the gh-pages branch.

Troubleshooting

Do not test in Parallels or VMware with the built in Bluetooth adapter found in Macs. You can, however, use VMWare or Parallels, with a Linux compatible Bluetooth LE USB adapter plugged in. VirtualBox will work with the builtin adapter on Macs.

For best results, test with Swift 5.1.5 on ARMv7 and a Linux-comptible Bluetooth dongle (e.g. CSR8510 A10).

See Also

  • Bluetooth - Pure Swift Bluetooth Definitions.
  • GATT - Bluetooth Generic Attribute Profile (GATT) for Swift
  • Silica - Pure Swift CoreGraphics (Quartz2D) implementation
  • Predicate - Pure Swift Predicate implementation

License

BluetoothLinux is released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 153
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v4.2.0
1 year ago
  • 299b830 Updated for Swift 5.1
  • a559422 Removed HostController.address
  • f716d7f Added HCIDeviceOptions

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics