Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement/bluetooth-l2cap #61

Closed
wants to merge 79 commits into from
Closed

Conversation

decanus
Copy link
Member

@decanus decanus commented Sep 17, 2019

closes #58

This PR implements generic stream handling and moves bluetooth over to l2cap implementation.

// @todo
}

public func peripheralManager(_ peripheral: CBPeripheralManager, didOpen channel: CBL2CAPChannel?, error: Error?) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

// @todo figure out exactly what we will want to do here.
}

public func peripheral(_ peripheral: CBPeripheral, didOpen channel: CBL2CAPChannel?, error: Error?) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -0,0 +1,10 @@
import Foundation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -0,0 +1,11 @@
import CoreBluetooth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

/// - Parameters:
/// - input: The input stream.
/// - output: The output stream.
public init(input: InputStream, output: OutputStream) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.


/// The StreamClient implements generic stream handling for Ultralight Beam transports.
public class StreamClient: NSObject {
// @TODO: We need to figure out how the dependants figure out which address or peer data came from.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODOs should be resolved (We need to figure out how the ...).

// @todo check that this is the characteristic
let id = Addr(central.identifier.bytes)
centrals.removeValue(forKey: id)
peers.removeAll(where: { $0.id == id })
}

public func peripheralManager(_ peripheral: CBPeripheralManager, didPublishL2CAPChannel PSM: CBL2CAPPSM, error: Error?) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line should be 120 characters or less: currently 125 characters

update(value: psm?.bytes)
}

public func peripheralManager(_ peripheral: CBPeripheralManager, didUnpublishL2CAPChannel PSM: CBL2CAPPSM, error: Error?) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line should be 120 characters or less: currently 127 characters

// @todo
}

public func peripheralManager(_: CBPeripheralManager, didOpen channel: CBL2CAPChannel?, error: Error?) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -220,4 +273,27 @@ extension CoreBluetoothTransport: CBPeripheralDelegate {
) {
// @todo figure out exactly what we will want to do here.
}

public func peripheral(_: CBPeripheral, didOpen channel: CBL2CAPChannel?, error: Error?) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -0,0 +1,9 @@
import Foundation
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Sep 18, 2019

Code Climate has analyzed commit 0c81cca and detected 6 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 6

View more on Code Climate.

@decanus
Copy link
Member Author

decanus commented Oct 21, 2019

on hold cause android does not support.

@decanus decanus closed this May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move Bluetooth to L2CAP
2 participants