pureswift / gatt Goto Github PK
View Code? Open in Web Editor NEWBluetooth Generic Attribute Profile (GATT) for Swift (Supports Linux)
License: MIT License
Bluetooth Generic Attribute Profile (GATT) for Swift (Supports Linux)
License: MIT License
doing carthage update
from another package, that depends on GATT i get the following error
CompileSwift normal x86_64
cd /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Xcode
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Central.swift /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinAttributes.swift /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/LinuxPeripheral.swift /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinPeripheral.swift /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peripheral.swift /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Beacon.swift -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/BuildProductsPath/Release" -F "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/BuildProductsPath/Release" -F /Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Xcode/../Carthage/Build/Mac -g -import-underlying-module -module-cache-path /Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/ModuleCache -swift-version 3 -serialize-debugging-options -report-errors-to-debugger -Xcc "-I/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/swift-overrides.hmap" -Xcc -iquote -Xcc "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/GATT-generated-files.hmap" -Xcc "-I/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/GATT-own-target-headers.hmap" -Xcc "-I/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/GATT-all-non-framework-target-headers.hmap" -Xcc -ivfsoverlay -Xcc "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/all-product-headers.yaml" -Xcc -iquote -Xcc "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/GATT-project-headers.hmap" -Xcc "-I/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/BuildProductsPath/Release/include" -Xcc "-I/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/DerivedSources/x86_64" -Xcc "-I/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/DerivedSources" -Xcc -ivfsoverlay -Xcc "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/unextended-module-overlay.yaml" -Xcc -working-directory/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Xcode -emit-module-doc-path "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/GATT.swiftdoc" -serialize-diagnostics-path "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/Central.dia" -O -module-name GATT -emit-module-path "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/GATT.swiftmodule" -emit-objc-header-path "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/GATT-Swift.h" -emit-dependencies-path "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/Central.d" -num-threads 8 -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/Central.o" -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/DarwinAttributes.o" -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/LinuxPeripheral.o" -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/Peer.o" -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/DarwinPeripheral.o" -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/DarwinCentral.o" -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/Peripheral.o" -o "/Users/rs/Library/Caches/org.carthage.CarthageKit/DerivedData/9.1_9B46/GATT/0337518dcfc032850f3a764ab751822499db29c5/Build/Intermediates.noindex/ArchiveIntermediates/GATT OS X/IntermediateBuildFilesPath/GATT.build/Release/GATT OS X.build/Objects-normal/x86_64/Beacon.o"
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:68:39: error: 'identifier' is only available on OS X 10.13 or newer
self.identifier = central.identifier
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:68:39: note: add 'if #available' version check
self.identifier = central.identifier
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:66:9: note: add @available attribute to enclosing initializer
init(_ central: CBCentral) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:64:5: note: add @available attribute to enclosing extension
extension Central {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:88:39: error: 'identifier' is only available on OS X 10.13 or newer
self.identifier = central.identifier
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:88:39: note: add 'if #available' version check
self.identifier = central.identifier
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:86:9: note: add @available attribute to enclosing initializer
init(_ central: CBPeripheral) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/Peer.swift:84:5: note: add @available attribute to enclosing extension
extension Peripheral {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinPeripheral.swift:33:36: error: cannot convert return expression of type 'CBManagerState' to return type 'CBPeripheralManagerState'
return internalManager.state
~~~~~~~~~~~~~~~~^~~~~
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinPeripheral.swift:245:37: error: cannot convert value of type 'CBManagerState' to expected argument type 'CBPeripheralManagerState'
stateChanged(peripheral.state)
~~~~~~~~~~~^~~~~
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinPeripheral.swift:364:61: error: cannot force unwrap value of non-optional type 'CBUUID'
let foundation = characteristic.uuid!
~~~~~~~~~~~~~~~~~~~^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:34:36: error: cannot convert return expression of type 'CBManagerState' to return type 'CBCentralManagerState'
return internalManager.state
~~~~~~~~~~~~~~~~^~~~~
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:241:39: error: 'identifier' is only available on OS X 10.13 or newer
guard foundPeripheral.identifier != peripheral.identifier
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:241:39: note: add 'if #available' version check
guard foundPeripheral.identifier != peripheral.identifier
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:237:22: note: add @available attribute to enclosing instance method
private func peripheral(_ peripheral: Peripheral) -> CBPeripheral? {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:334:34: error: cannot convert value of type 'CBManagerState' to expected argument type 'CBCentralManagerState'
stateChanged(central.state)
~~~~~~~~^~~~~
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:365:57: error: 'identifier' is only available on OS X 10.13 or newer
log?("Connecting to peripheral \(peripheral.identifier.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:365:57: note: add 'if #available' version check
log?("Connecting to peripheral \(peripheral.identifier.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:363:21: note: add @available attribute to enclosing instance method
public func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:380:40: error: 'identifier' is only available on OS X 10.13 or newer
if connectingToPeripheral?.identifier == peripheral.identifier {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:380:40: note: add 'if #available' version check
if connectingToPeripheral?.identifier == peripheral.identifier {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:376:21: note: add @available attribute to enclosing instance method
public func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Swift.Error?) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:380:65: error: 'identifier' is only available on OS X 10.13 or newer
if connectingToPeripheral?.identifier == peripheral.identifier {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:380:65: note: add 'if #available' version check
if connectingToPeripheral?.identifier == peripheral.identifier {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:376:21: note: add @available attribute to enclosing instance method
public func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Swift.Error?) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:403:47: error: 'identifier' is only available on OS X 10.13 or newer
log?("Peripheral \(peripheral.identifier.uuidString) did discover \(peripheral.services?.count ?? 0) services")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:403:47: note: add 'if #available' version check
log?("Peripheral \(peripheral.identifier.uuidString) did discover \(peripheral.services?.count ?? 0) services")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:395:21: note: add @available attribute to enclosing instance method
public func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Swift.Error?) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:418:47: error: 'identifier' is only available on OS X 10.13 or newer
log?("Peripheral \(peripheral.identifier.uuidString) did discover \(service.characteristics?.count ?? 0) characteristics for service \(service.uuid.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:418:47: note: add 'if #available' version check
log?("Peripheral \(peripheral.identifier.uuidString) did discover \(service.characteristics?.count ?? 0) characteristics for service \(service.uuid.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:410:21: note: add @available attribute to enclosing instance method
public func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Swift.Error?) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:433:47: error: 'identifier' is only available on OS X 10.13 or newer
log?("Peripheral \(peripheral.identifier.uuidString) did update value for characteristic \(characteristic.uuid.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:433:47: note: add 'if #available' version check
log?("Peripheral \(peripheral.identifier.uuidString) did update value for characteristic \(characteristic.uuid.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:425:21: note: add @available attribute to enclosing instance method
public func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Swift.Error?) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:451:47: error: 'identifier' is only available on OS X 10.13 or newer
log?("Peripheral \(peripheral.identifier.uuidString) did write value for characteristic \(characteristic.uuid.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:451:47: note: add 'if #available' version check
log?("Peripheral \(peripheral.identifier.uuidString) did write value for characteristic \(characteristic.uuid.uuidString)")
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:443:21: note: add @available attribute to enclosing instance method
public func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Swift.Error?) {
^
/Users/rs/projects/ble-vibro-mat/DemoPeripheral/Carthage/Checkouts/GATT/Sources/GATT/DarwinCentral.swift:20:24: note: add @available attribute to enclosing class
public final class DarwinCentral: NSObject, NativeCentral, CBCentralManagerDelegate, CBPeripheralDelegate {
^
** ARCHIVE FAILED **
The following build commands failed:
CompileSwift normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
``
Would it be possible to provide some documentation or examples of using GATTPeripheral
to accomplish something like this?
Also any help would be appreciated, as my peripheral with service and characteristics isn't working for some reason even though nothing that can throw is throwing and it should be discoverable..
(I'm not an expert, but have a good understanding of bluetooth/GATT. I have setup a custom python GATT server that does similar things to the bluez example in the above link. I also have written the Central that talks to it in Swift on iOS - however porting the python code to pure swift so far is proving to be more difficult than anticipated.. )
Kind regards,
The LE Scanning is currently only taking into account LE Advertising Data, not the LE Scan Response data.
See how Android currently handles scanning and advertisements.
There seems to be a bug with Swift 3.0, where the delegate methods are not getting called. An Objective-C wrapper might provide a temporary solution.
I'm trying to implement a peripheral on a Pi that looks at the central's UUID on a willRead and figures out the reply based on some business logic. The problem is that because peripheral.write is async, there doesn't appear to be a way to dynamically change the value on a willRead in time for the response to go out.
Is there a recommended pattern to follow for this:
private func willRead(_ request: GATTReadRequest<Central>) -> ATTError? {
logger.info("Recevied read")
guard let peripheral else {
return nil
}
/// SET THE VALUE OF THE CHARACTERISTIC
}
Using PureSwift GATT I wish to implement a GATT Peripheral that will be deployed on Darwin (MacOS, iOS, Mac Catalyst) and Linux platforms. How can a peripheral such as a Heart rate Monitor be implemented without custom coding for each platform?
Perhaps I am missing a trick?
CoreBluetooth state restoration needs to be properly implemented, and be an optional feature. Since CoreBluetooth uses Objective-C runtime introspection to check if the CBCentralManagerDelegate
instance implements the state restoration delegate methods, it makes optionally enabling this feature a bit more difficult.
Subscribing to notifications for characteristics from different services is not working as expected on Darwin platforms (iOS and macOS).
I'd expect for the notification handler to be triggered for all of the characteristics I subscribe to, even if those characteristics are from different services.
Only the last characteristics I subscribe to from a single service have the notification handlers called.
I've done some initial investigation and the cause of this limitation may live in the Cache
of DarwinCentral.swift
:
GATT/Sources/DarwinGATT/DarwinCentral.swift
Lines 781 to 823 in 5752c67
The Cache
stores Services
and Characteristics
as siblings. The Characteristics
are stored by the index / order that they were discovered in.
This means that if you discover characteristics from Service A. Then discover characteristics from Service B. The characteristics from Service B overwrite the characteristics from Service A.
Depending on how the caller discovers / subscribes to notifications, this may result in an Invalid characteristic
assertion failure when attempting to call the notification handlers:
GATT/Sources/DarwinGATT/DarwinCentral.swift
Lines 595 to 598 in 5752c67
With this test program:
import GATT
import Bluetooth
import BluetoothLinux
typealias LinuxCentral = GATTCentral<BluetoothLinux.HostController, BluetoothLinux.L2CAPSocket>
guard let hostController = await HostController.default else { fatalError("No Bluetooth hardware available") }
let central = LinuxCentral(hostController: hostController, socket: BluetoothLinux.L2CAPSocket.self)
// start scanning
let stream = try await central.scan(filterDuplicates: true)
for try await scanData in stream {
print(scanData)
stream.stop()
}
I'm getting Swift/ErrorType.swift:200: Fatal error: Error raised at top level: Command Disallowed
(even with sudo
).
I'm on an Ubuntu 20.04.2 LTS derivate. Any idea what could be wrong?
Services added to a GATTPeripheral
are discoverable once a remote central has connected, their UUIDs are, however, now included in the LE advertising payload. This causes nodes acting as a GATTPeripheral
to go undiscovered if the central scans for specific service UUIDs.
I am trying to have listener to read notify (Bluetooth.GATT.CharacteristicProperty.Notify) but i am having falling to do that.
can you help me by doing some example?
This is what i have done.
`let foundPeripherals = central.scan()
print("Scan results: \(foundPeripherals.map({ $0.identifier }))")
for peripheral in foundPeripherals {
do { try central.connect(to: peripheral) }
catch {
print("Error connecting to \(peripheral.identifier): \(error)")
continue
}
print("Did connect to \(peripheral.identifier)")
let services = try! central.discoverServices(for: peripheral)
print("Discovered services: \(services.map({ $0.UUID }))")
let serviceUuid = BluetoothUUID.init(rawValue: "1706BBC0-88AB-4B8D-877E-2237916EE929")
if services.contains(where: { $0.UUID == serviceUuid }) {
print(" SERVICE FOUND")
print(" Number of services",services.count)
print(" service 1 ",services.first?.UUID ?? "null")
for service in services {
let characteristics = try! central.discoverCharacteristics(for: service.UUID, peripheral: peripheral)
print("Found \(characteristics.count) characteristics for service \(service.UUID)")
if(characteristics.count == 0){
self.central.disconnect(peripheral: peripheral)
return
}
for characteristic in characteristics {
print(" characteristic: ",characteristic.UUID)
print(" characteristic prop: ",characteristic.properties)
let charWriteUuid = BluetoothUUID.init(rawValue: CHARACTERISTIC_WRITE)
if (characteristic.UUID == charWriteUuid) {
do { try central.write(data: "Test Write".data(using: .utf8)!, response: true, characteristic: characteristic.UUID, service: service.UUID, peripheral: peripheral) }
catch { print("Error write to \(peripheral.identifier): \(error)")}
}
let charNotifyUuid = BluetoothUUID.init(rawValue: CHARACTERISTIC_NOTIFY)
if(characteristic.UUID == charNotifyUuid){
DispatchQueue.main.async(execute: {
var value: Data!
var a = self.central.stateChanged
/*do { value = try self.central.read(characteristic: characteristic.UUID, service: service.UUID, peripheral: peripheral) }
catch { print("Error read to \(peripheral.identifier): \(error)")}
print(" READDDDD: ",value)*/
self.central.disconnect(peripheral: peripheral)
})
}
}
}
}
`
A simple Swift project using the latest versions of BluetoothLinux
and GATT
with the following main script
import Bluetooth
import BluetoothLinux
import GATT
let hostController = BluetoothLinux.HostController.default!
let central = GATTCentral<BluetoothLinux.HostController, BluetoothLinux.L2CAPSocket>(hostController: hostController)
causes linking to fail:
<compiler-generated>:0: error: undefined reference to '$s13BluetoothGATT26ATTMaximumTransmissionUnitV3maxACvgZ'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
link command failed with exit code 1 (use -v to see invocation)
I want to implement BLE stuff regarding blood sugar measurement and found this project.
Is there any chance to get general starter information regarding how to implement a simple read workflow of an characteristic: connect device, peripheral service discover, manage notify values, read and write characteristic data?
I took already a look at https://github.com/MillerTechnologyPeru/SmartLock, but honestly, it's not very helpful to get started.
Any help appreciated!
Use Travis CI to build iOS, macOS, watchOS, and Linux framework target using SPM on Linux and SPM and Carthage on Mac.
See .travis.yml.
When I start a service as follows, LightBlue sees the device and can scan it, but does not see it advertising a service. ScanBeacon does not see the beacon. Should I be able to see both?
if let uuid = Foundation.UUID(uuidString: "C870EC7D-4EB9-4549-A355-5663EB99D71D"),
let rssi = RSSI(rawValue: Int8(bitPattern: 0xb3)) {
let beacon = Bluetooth.iBeacon(uuid: uuid, major: 787, minor: 0, rssi: rssi, interval: 800)
print("Beacon id = \(beacon)")
do {
let _ = try peripheral.add(service: ConfigurationProfile.Service) // ConfigurationProfile.Service is a correctly configured service
do {
try peripheral.start(beacon: beacon)
print("Vending ConfigurationService = \n\(ConfigurationProfile.Service)")
} catch {
print("failed to start service")
print("Exception: \(error.localizedDescription)")
}
} catch {
print("failed to add service")
print("Exception: \(error.localizedDescription)")
}
}
Use a different strategy that doesn't involve sleep()
while scanning to improve energy efficiency and decrease unnecessary CPU usage. DispatchSemaphore
might be a good solution.
DarwinCentral.stateUpdated
is not called on first app launch. However, if when debugging, the internal CBCentralManager
state is updated, so it seems to be a CoreBluetooth bug.
When the connection is lost, the GATT Server is not enabling advertising mode.
Implement an iOS app that duplicates the functionality of LightBlue Explorer using GATT.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.