exphat / swiftbluetooth Goto Github PK
View Code? Open in Web Editor NEW📲 CoreBluetooth API's for modern Swift
License: MIT License
📲 CoreBluetooth API's for modern Swift
License: MIT License
You are currently ignoring the values here:
But those values are useful. For example, the RSSI provided there is the only way to get the RSSI without connecting to a peripheral first.
Maybe add a initialRSSI
and advertisementData
property to Peripheral
.
Would be nice if advertisementData
was a struct based on fetching these keys from the original advertisement data: https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/advertisement_data_retrieval_keys
On a sidenote: I think the RSSI should be returned as a Double, not NSNumber.
There are 8 cases of fatalError()
in the non-test code. This is really not acceptable for production code.
There are several remedies:
knownCharacteristics
, then the fatalError()
message should include the the known characteristics. However, since known characteristics are specific to a device I don't see how this is the correct solution.fatalError()
s with correct error handling code.Something like this:
@available(iOS 13, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
@discardableResult
func connect(_ peripheral: Peripheral, options: [String: Any]? = nil) async throws -> Peripheral {
try await withTaskCancellationHandler {
try await withCheckedThrowingContinuation { cont in
self.connect(peripheral, options: options) { result in
switch result {
case .success(let peripheral):
cont.resume(returning: peripheral)
case .failure(let error):
cont.resume(throwing: error)
}
}
}
} onCancel: {
cancelPeripheralConnection(peripheral)
}
}
Hi, the link in the readme is incorrect.
https://swiftpackageindex.com/exPHAT/SwiftBluetooth/1.0.0/documentation/
Should be:
https://swiftpackageindex.com/exPHAT/SwiftBluetooth/0.1.0/documentation/
This crashes in some situations: https://github.com/exPHAT/SwiftBluetooth/blob/c5a9f4e5d6d1ffc312ffe26ea1760dc9a9a9673f/Sources/SwiftBluetooth/Peripheral/Peripheral.swift#L31C30-L31C39
When retrieving the device from central.retrievePeripherals(withIdentifiers: [uuid])
.
Hi, Apple announced that, starting May 1, they would start enforcing that all new apps and updates must declare approved reasons for using specific APIs in a privacy manifest, preventing uploads to TestFlight if the requirement is not met.
These requirements also apply to 3rd party SDK's: Upcoming third-party SDK requirements:
Starting May 1: You’ll need to include approved reasons for the listed APIs used by your app’s code to upload a new or updated app to App Store Connect. If you’re not using an API for an allowed reason, please find an alternative. And if you add a new third-party SDK that’s on the list of commonly used third-party SDKs, these API, privacy manifest, and signature requirements will apply to that SDK. Make sure to use a version of the SDK that includes its privacy manifest and note that signatures are also required when the SDK is added as a binary dependency.
This functionality is a step forward for all apps and we encourage all SDKs to adopt it to better support the apps that depend on them.
At this moment, since SwiftBluetooth
is not included in the list of commonly used libraries, it is not necessary to include the PrivacyInfo.xcprivacy
, but in the future it will be.
I suggest this utility that can help to create the manifest: iOS Privacy Manifest Maker.
Even if no data is collected from what I understand the manifest is mandatory and should be used the empty template:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
</dict>
</plist>
For example, if you try to use .connect()
with a device that is offline, it will await forever.
This may very well be the correct behavior, but I think at least it should be documented.
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.