diff --git a/.swift-version b/.swift-version index 819e07a..a75b92f 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.0 +5.1 diff --git a/.travis.yml b/.travis.yml index 39002e0..b5f4a8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ os: osx language: swift -osx_image: xcode10.3 +osx_image: xcode11.0 xcode_project: UB.xcodeproj xcode_scheme: UB.Package diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..106964b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,99 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.1) + activesupport (4.2.11.1) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + atomos (0.1.3) + claide (1.0.3) + cocoapods (1.7.5) + activesupport (>= 4.0.2, < 5) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.7.5) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.2.2, < 2.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-stats (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.3.1, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.6.6) + nap (~> 1.0) + ruby-macho (~> 1.4) + xcodeproj (>= 1.10.0, < 2.0) + cocoapods-core (1.7.5) + activesupport (>= 4.0.2, < 6) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + cocoapods-deintegrate (1.0.4) + cocoapods-downloader (1.2.2) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.0) + cocoapods-stats (1.1.0) + cocoapods-trunk (1.4.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.1.0) + colored2 (3.1.2) + concurrent-ruby (1.1.5) + escape (0.0.4) + ffi (1.11.1) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + jazzy (0.11.1) + cocoapods (~> 1.5) + mustache (~> 1.1) + open4 + redcarpet (~> 3.4) + rouge (>= 2.0.6, < 4.0) + sassc (~> 2.1) + sqlite3 (~> 1.3) + xcinvoke (~> 0.3.0) + liferaft (0.0.6) + minitest (5.11.3) + molinillo (0.6.6) + mustache (1.1.0) + nanaimo (0.2.6) + nap (1.1.0) + netrc (0.11.0) + open4 (1.3.4) + redcarpet (3.5.0) + rouge (2.0.7) + ruby-macho (1.4.0) + sassc (2.2.1) + ffi (~> 1.9) + sqlite3 (1.4.1) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + xcinvoke (0.3.0) + liferaft (~> 0.0.6) + xcodeproj (1.12.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.6) + xcpretty (0.3.0) + rouge (~> 2.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + jazzy (= 0.11.1) + xcpretty + +BUNDLED WITH + 1.17.2 diff --git a/Package.swift b/Package.swift index 5b35f6a..801b4a0 100644 --- a/Package.swift +++ b/Package.swift @@ -1,11 +1,11 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "UB", platforms: [ - .macOS(.v10_13), + .macOS(.v10_15), ], products: [ // Products define the executables and libraries produced by a package, and make them visible to other packages. diff --git a/Podfile b/Podfile index 4e38668..56ea6f1 100644 --- a/Podfile +++ b/Podfile @@ -1,5 +1,5 @@ # Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' +platform :ios, '13.0' target 'UB' do # Comment the next line if you don't want to use dynamic frameworks diff --git a/README.md b/README.md index 21f9e0d..8354671 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ UB.swift is the swift implementation of the Ultralight Beam protocol, its primar ## Requirements - **iOS 9** or later -- **OSX 10.13** or later -- **Swift 5.0** or later +- **OSX 10.15** or later +- **Swift 5.1** or later ## Installation @@ -43,7 +43,7 @@ Using the UB within your own project is kept simple. Initialize a `Node`, and as ```swift import UB -let node = Node() +let node = Node(key: Curve25519.Signing.PrivateKey()) node.delegate = self node.add(transport: CoreBluetoothTransport()) diff --git a/Sources/UB/Node.swift b/Sources/UB/Node.swift index e72c4b6..5e33215 100644 --- a/Sources/UB/Node.swift +++ b/Sources/UB/Node.swift @@ -1,3 +1,4 @@ +import CryptoKit import Foundation import SwiftProtobuf @@ -8,11 +9,22 @@ public class Node { /// The known transports for the node. public private(set) var transports = [String: Transport]() + /// The known peers for a node. + public private(set) var peers = [Addr: Peer]() + /// The nodes delegate. public weak var delegate: NodeDelegate? + /// The nodes private key. + private let key: Curve25519.Signing.PrivateKey + /// Initializes a node. - public init() {} + /// + /// - Parameters: + /// - key: The private key for the node. + public init(key: Curve25519.Signing.PrivateKey) { + self.key = key + } /// Adds a new transport to the list of known transports. /// @@ -27,7 +39,7 @@ public class Node { transports[id] = transport transports[id]?.delegate = self - transport.listen() + transport.listen(identity: UBID(key.publicKey.rawRepresentation)) } /// Removes a transport from the list of known transports. @@ -55,48 +67,42 @@ public class Node { return } - transports.forEach { _, transport in - let peers = transport.peers - - // @todo ensure that messages are delivered? - // what this does is try to send a message to an exact target or broadcast it to all peers - if message.recipient.count != 0 { - if peers.contains(where: { $0.id == message.recipient }) { - return transport.send(message: data, to: message.recipient) + if message.recipient.count != 0 { + if let peer = peers[message.recipient] { + // @todo ensure we actually had > 0 transports to send to. + return peer.transports.forEach { id, addr in + guard let transport = transports[id] else { return } + transport.send(message: data, to: addr) } } + } + + // @todo: there is probably some better way of doing this + transports.forEach { id, transport in + let transportPeers = Array( + peers.filter { + $1.transports[id] != nil && $1.id != message.from && $1.id != message.origin + }.values + ) - // what this does is send a message to anyone that implements a specific service if message.service.count != 0 { - let filtered = peers.filter { $0.services.contains { $0 == message.service } } + let filtered = transportPeers.filter { $0.services.contains { $0 == message.service } } if filtered.count > 0 { - let sends = flood(message, data: data, transport: transport, peers: filtered) - if sends > 0 { - return + return filtered.forEach { + transport.send(message: data, to: $0.id) } } } - _ = flood(message, data: data, transport: transport, peers: peers) - } - } - private func flood(_ message: Message, data: Data, transport: Transport, peers: [Peer]) -> Int { - var sends = 0 - peers.forEach { - if $0.id == message.from || $0.id == message.origin { - return + transportPeers.forEach { + transport.send(message: data, to: $0.id) } - - sends += 1 - transport.send(message: data, to: $0.id) } - - return sends } - - // @todo create a message send loop with retransmissions and shit } +// @todo create a message send loop with retransmissions and shit + /// :nodoc: extension Node: TransportDelegate { public func transport(_: Transport, didReceiveData data: Data, from: Addr) { @@ -113,4 +119,19 @@ extension Node: TransportDelegate { delegate?.node(self, didReceiveMessage: Message(protobuf: packet, from: from)) } + + public func transport(_ transport: Transport, didConnectToPeer id: Addr, withAddr addr: Addr) { + if peers[id] == nil { + peers[id] = Peer(id: id, services: [UBID]()) + } + + guard let peer = peers[id] else { return } + + peer.transports[String(describing: transport)] = addr + } + + public func transport(_ transport: Transport, didDisconnectFromPeer id: Addr) { + guard let peer = peers[id] else { return } + peer.transports.removeValue(forKey: String(describing: transport)) + } } diff --git a/Sources/UB/Peer.swift b/Sources/UB/Peer.swift index 8c94bb9..50b5ae5 100644 --- a/Sources/UB/Peer.swift +++ b/Sources/UB/Peer.swift @@ -2,14 +2,19 @@ import Foundation // @todo clean this up properly, currently very rough for testing purposes. +// @todo set transport addresses, allowing a node to select which transports to send on. + /// Represents the nodes a transport can communicate with. public class Peer { - /// The peers id. + /// The peers identifier. public let id: Addr /// The services a peer knows. public let services: [UBID] + /// A list of peer addresses for a given transport. + public var transports = [String: Addr]() + /// Initializes a peer with a specified id and list of known services. /// /// - Parameters: diff --git a/Sources/UB/Transports/CoreBluetoothTransport.swift b/Sources/UB/Transports/CoreBluetoothTransport.swift index e31d8a9..815f9b4 100644 --- a/Sources/UB/Transports/CoreBluetoothTransport.swift +++ b/Sources/UB/Transports/CoreBluetoothTransport.swift @@ -3,11 +3,14 @@ import Foundation /// CoreBluetoothTransport is used to send and receive message over Bluetooth public class CoreBluetoothTransport: NSObject { + /// :nodoc: + fileprivate var identity: UBID! + /// :nodoc: public weak var delegate: TransportDelegate? /// :nodoc: - public fileprivate(set) var peers = [Peer]() + public fileprivate(set) var peers = [Addr: Addr]() private let centralManager: CBCentralManager private let peripheralManager: CBPeripheralManager @@ -24,13 +27,26 @@ public class CoreBluetoothTransport: NSObject { private static let ubServiceUUID = CBUUID(string: "BEA3B031-76FB-4889-B3C7-000000000000") - private static let receiveCharacteristic = CBMutableCharacteristic( + private static let identityCharacteristic = CBMutableCharacteristic( type: CBUUID(string: "BEA3B031-76FB-4889-B3C7-000000000001"), properties: [.read, .writeWithoutResponse, .notify], value: nil, permissions: [.writeable, .readable] ) + private static let receiveCharacteristic = CBMutableCharacteristic( + type: CBUUID(string: "BEA3B031-76FB-4889-B3C7-000000000002"), + properties: [.read, .writeWithoutResponse, .notify], + value: nil, + permissions: [.writeable, .readable] + ) + + private enum State { + case off, listening + } + + private var state = State.off + // make this nicer, we need this cause we need a reference to the peripheral? private var perp: CBPeripheral? private var centrals = [Addr: CBCentral]() @@ -59,7 +75,7 @@ public class CoreBluetoothTransport: NSObject { private func remove(peer: Addr) { peripherals.removeValue(forKey: peer) - peers.removeAll(where: { $0.id == peer }) + peers.removeValue(forKey: peer) } private func add(central: CBCentral) { @@ -70,19 +86,15 @@ public class CoreBluetoothTransport: NSObject { } centrals[id] = central - - if peers.filter({ $0.id == id }).count != 0 { - return - } - - peers.append(Peer(id: id, services: [UBID]())) } } /// :nodoc: extension CoreBluetoothTransport: Transport { public func send(message: Data, to: Addr) { - if let peer = peripherals[to] { + guard let id = peers.first(where: { $0.value == to })?.key else { return } + + if let peer = peripherals[id] { return peer.peripheral.writeValue( message, for: peer.characteristic, @@ -90,7 +102,7 @@ extension CoreBluetoothTransport: Transport { ) } - if let central = centrals[to] { + if let central = centrals[id] { peripheralManager.updateValue( message, for: CoreBluetoothTransport.receiveCharacteristic, @@ -99,44 +111,86 @@ extension CoreBluetoothTransport: Transport { } } - public func listen() { - // @todo mark as listening, only turn on peripheral characteristic at this point, etc. + public func listen(identity: UBID) { + state = .listening + + self.identity = identity + + if peripheralManager.state == .poweredOn { + startAdvertising() + } + + if centralManager.state == .poweredOn { + startScanning() + } } } /// :nodoc: extension CoreBluetoothTransport: CBPeripheralManagerDelegate { public func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) { - if peripheral.state == .poweredOn { - let service = CBMutableService(type: CoreBluetoothTransport.ubServiceUUID, primary: true) - - service.characteristics = [CoreBluetoothTransport.receiveCharacteristic] - peripheral.add(service) - - peripheral.startAdvertising([ - CBAdvertisementDataServiceUUIDsKey: [CoreBluetoothTransport.ubServiceUUID], - ]) + if peripheral.state == .poweredOn, state == .listening { + startAdvertising() } } public func peripheralManager(_: CBPeripheralManager, didReceiveWrite requests: [CBATTRequest]) { + requests + .filter { $0.characteristic.uuid == CoreBluetoothTransport.identityCharacteristic.uuid } + .forEach { request in + guard let data = request.value else { + return + } + + let id = Addr(request.central.identifier.bytes) + add(central: request.central) + + let addr = Addr(data) + peers[id] = addr + peripheralManager.updateValue( + Data(identity), + for: CoreBluetoothTransport.identityCharacteristic, + onSubscribedCentrals: [request.central] + ) + delegate?.transport(self, didConnectToPeer: addr, withAddr: id) + } + for request in requests { + if request.characteristic.uuid == CoreBluetoothTransport.identityCharacteristic.uuid { + continue + } + guard let data = request.value else { - // @todo - return + continue } - delegate?.transport(self, didReceiveData: data, from: Addr(request.central.identifier.bytes)) + guard let peer = peers[Addr(request.central.identifier.bytes)] else { continue } + delegate?.transport(self, didReceiveData: data, from: peer) + } + } + + public func peripheralManager(_: CBPeripheralManager, didReceiveRead request: CBATTRequest) { + if request.characteristic.uuid == CoreBluetoothTransport.identityCharacteristic.uuid { + peripheralManager.updateValue( + Data(identity), + for: CoreBluetoothTransport.identityCharacteristic, + onSubscribedCentrals: [request.central] + ) + add(central: request.central) } } public func peripheralManager( - _: CBPeripheralManager, + _ peripheral: CBPeripheralManager, central: CBCentral, - didSubscribeTo _: CBCharacteristic + didSubscribeTo characteristic: CBCharacteristic ) { add(central: central) + if characteristic.uuid == CoreBluetoothTransport.identityCharacteristic.uuid { + peripheral.updateValue(Data(identity), for: CoreBluetoothTransport.identityCharacteristic, onSubscribedCentrals: [central]) + return + } } public func peripheralManager( @@ -147,18 +201,32 @@ extension CoreBluetoothTransport: CBPeripheralManagerDelegate { // @todo check that this is the characteristic let id = Addr(central.identifier.bytes) centrals.removeValue(forKey: id) - peers.removeAll(where: { $0.id == id }) + peers.removeValue(forKey: id) + } + + fileprivate func startAdvertising() { + if peripheralManager.isAdvertising { return } + let service = CBMutableService(type: CoreBluetoothTransport.ubServiceUUID, primary: true) + + service.characteristics = [ + CoreBluetoothTransport.identityCharacteristic, + CoreBluetoothTransport.receiveCharacteristic, + ] + + peripheralManager.add(service) + + peripheralManager.startAdvertising([ + CBAdvertisementDataServiceUUIDsKey: [CoreBluetoothTransport.ubServiceUUID], + ]) } } /// :nodoc: extension CoreBluetoothTransport: CBCentralManagerDelegate { public func centralManagerDidUpdateState(_ central: CBCentralManager) { - if central.state == .poweredOn { - centralManager.scanForPeripherals(withServices: [CoreBluetoothTransport.ubServiceUUID]) + if central.state == .poweredOn, state == .listening { + startScanning() } - - // @todo handling for other states } public func centralManager( @@ -179,13 +247,21 @@ extension CoreBluetoothTransport: CBCentralManagerDelegate { public func centralManager(_: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error _: Error?) { remove(peer: Addr(peripheral.identifier.bytes)) } + + fileprivate func startScanning() { + if centralManager.isScanning { return } + centralManager.scanForPeripherals(withServices: [CoreBluetoothTransport.ubServiceUUID]) + } } /// :nodoc: extension CoreBluetoothTransport: CBPeripheralDelegate { public func peripheral(_ peripheral: CBPeripheral, didDiscoverServices _: Error?) { if let service = peripheral.services?.first(where: { $0.uuid == CoreBluetoothTransport.ubServiceUUID }) { - peripheral.discoverCharacteristics([CoreBluetoothTransport.receiveCharacteristic.uuid], for: service) + peripheral.discoverCharacteristics( + [CoreBluetoothTransport.identityCharacteristic.uuid, CoreBluetoothTransport.receiveCharacteristic.uuid], + for: service + ) } } @@ -199,17 +275,18 @@ extension CoreBluetoothTransport: CBPeripheralDelegate { return } - let characteristics = service.characteristics - if let char = characteristics?.first(where: { $0.uuid == CoreBluetoothTransport.receiveCharacteristic.uuid }) { - peripherals[id] = (peripheral, char) - peripherals[id]?.peripheral.setNotifyValue(true, for: char) - // @todo we may need to do some handshake to obtain services from a peer. - - if peers.filter({ $0.id == id }).count != 0 { - return + guard let characteristics = service.characteristics else { return } + for characteristic in characteristics { + if characteristic.uuid == CoreBluetoothTransport.identityCharacteristic.uuid { + peripheral.setNotifyValue(true, for: characteristic) + peripheral.readValue(for: characteristic) + peripheral.writeValue(Data(identity), for: characteristic, type: .withoutResponse) } - peers.append(Peer(id: id, services: [UBID]())) + if characteristic.uuid == CoreBluetoothTransport.receiveCharacteristic.uuid { + peripherals[id] = (peripheral, characteristic) + peripheral.setNotifyValue(true, for: characteristic) + } } } @@ -224,9 +301,17 @@ extension CoreBluetoothTransport: CBPeripheralDelegate { didUpdateValueFor characteristic: CBCharacteristic, error _: Error? ) { - guard let value = characteristic.value else { return } + let id = Addr(peripheral.identifier.bytes) + if characteristic.uuid == CoreBluetoothTransport.identityCharacteristic.uuid { + guard let data = characteristic.value else { return } + let addr = Addr(data) + peers[id] = addr + delegate?.transport(self, didConnectToPeer: addr, withAddr: id) + return + } - delegate?.transport(self, didReceiveData: value, from: Addr(peripheral.identifier.bytes)) + guard let value = characteristic.value, let peer = peers[id] else { return } + delegate?.transport(self, didReceiveData: value, from: peer) } public func peripheral( diff --git a/Sources/UB/Transports/Transport.swift b/Sources/UB/Transports/Transport.swift index 6950007..7c3972e 100644 --- a/Sources/UB/Transports/Transport.swift +++ b/Sources/UB/Transports/Transport.swift @@ -5,9 +5,6 @@ public protocol Transport { /// The transports delegate. var delegate: TransportDelegate? { get set } - /// The peers a specific transport can send messages to. - var peers: [Peer] { get } - /// Send implements a function to send messages between nodes using the transport. /// /// - Parameters: @@ -16,5 +13,8 @@ public protocol Transport { func send(message: Data, to: Addr) /// Listen implements a function to receive messages being sent to a node. - func listen() + /// + /// - Parameters: + /// - identity: The identity of the node. + func listen(identity: UBID) } diff --git a/Sources/UB/Transports/TransportDelegate.swift b/Sources/UB/Transports/TransportDelegate.swift index 7880d63..0524d17 100644 --- a/Sources/UB/Transports/TransportDelegate.swift +++ b/Sources/UB/Transports/TransportDelegate.swift @@ -9,4 +9,19 @@ public protocol TransportDelegate: AnyObject { /// - data: The received data. /// - from: The peer from which the data was received. func transport(_ transport: Transport, didReceiveData data: Data, from: Addr) + + /// This method is called when a transport connects to a specific peer. + /// + /// - Parameters: + /// - transport: The transport that connected to a peer. + /// - peer: The peer identifier. + /// - addr: The peer address. + func transport(_ transport: Transport, didConnectToPeer peer: Addr, withAddr addr: Addr) + + /// This method is called when a transport disconnects from a specific peer. + /// + /// - Parameters: + /// - transport: The transport that disconnected from a peer. + /// - peer: The peer identifier. + func transport(_ transport: Transport, didDisconnectFromPeer peer: Addr) } diff --git a/Tests/UBTests/stubs/Transport.swift b/Tests/UBTests/stubs/Transport.swift index cf569c1..04f30b8 100644 --- a/Tests/UBTests/stubs/Transport.swift +++ b/Tests/UBTests/stubs/Transport.swift @@ -8,9 +8,11 @@ class Transport: UB.Transport { var peers: [Peer] = [] + init() {} + func send(message: Data, to: Addr) { sent.append((message, to)) } - func listen() {} + func listen(identity _: UBID) {} } diff --git a/UB.podspec b/UB.podspec index 4222c76..6b0340f 100644 --- a/UB.podspec +++ b/UB.podspec @@ -7,8 +7,8 @@ Pod::Spec.new do |spec| spec.source = { :git => 'https://github.com/ultralight-beam/UB.swift.git', :tag => 'v0.2.0'} spec.source_files = 'Sources/UB/**/*.swift' spec.summary = 'Swift implementation of the Ultralight Beam protocol' - spec.swift_version = '5.0' - spec.ios.deployment_target = '9.0' + spec.swift_version = '5.1' + spec.ios.deployment_target = '13.0' spec.osx.deployment_target = '10.13' spec.dependency 'SwiftProtobuf' end diff --git a/docs/Classes.html b/docs/Classes.html index bdb4417..18d9894 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -184,7 +184,7 @@

Declaration

diff --git a/docs/Classes/CoreBluetoothTransport.html b/docs/Classes/CoreBluetoothTransport.html index befd0c2..f41e657 100644 --- a/docs/Classes/CoreBluetoothTransport.html +++ b/docs/Classes/CoreBluetoothTransport.html @@ -183,7 +183,7 @@

Parameters

diff --git a/docs/Classes/Node.html b/docs/Classes/Node.html index 9d06c55..c1fd2c9 100644 --- a/docs/Classes/Node.html +++ b/docs/Classes/Node.html @@ -317,7 +317,7 @@

Parameters

diff --git a/docs/Classes/Peer.html b/docs/Classes/Peer.html index 82c105c..85d0f07 100644 --- a/docs/Classes/Peer.html +++ b/docs/Classes/Peer.html @@ -152,7 +152,7 @@

Declaration

diff --git a/docs/Protocols.html b/docs/Protocols.html index 94317fb..cefd24d 100644 --- a/docs/Protocols.html +++ b/docs/Protocols.html @@ -184,7 +184,7 @@

Declaration

diff --git a/docs/Protocols/NodeDelegate.html b/docs/Protocols/NodeDelegate.html index 6360217..a4f9aa3 100644 --- a/docs/Protocols/NodeDelegate.html +++ b/docs/Protocols/NodeDelegate.html @@ -156,7 +156,7 @@

Parameters

diff --git a/docs/Protocols/Transport.html b/docs/Protocols/Transport.html index 2d32869..af2468f 100644 --- a/docs/Protocols/Transport.html +++ b/docs/Protocols/Transport.html @@ -208,9 +208,9 @@

Parameters

  • - - - listen() + + + listen(identity:)
    @@ -225,10 +225,29 @@

    Parameters

    Declaration

    Swift

    -
    func listen()
    +
    func listen(identity _: UBID)
    +
    +

    Parameters

    + + + + + + + +
    + + identity + + +
    +

    The identity of the node.

    +
    +
    +
  • @@ -237,7 +256,7 @@

    Declaration

    diff --git a/docs/Protocols/TransportDelegate.html b/docs/Protocols/TransportDelegate.html index de48e62..f2b826c 100644 --- a/docs/Protocols/TransportDelegate.html +++ b/docs/Protocols/TransportDelegate.html @@ -168,7 +168,7 @@

    Parameters

    diff --git a/docs/Structs.html b/docs/Structs.html index 20f5e79..7cf5a38 100644 --- a/docs/Structs.html +++ b/docs/Structs.html @@ -120,7 +120,7 @@

    Declaration

    diff --git a/docs/Structs/Message.html b/docs/Structs/Message.html index 684f8b8..a9b9904 100644 --- a/docs/Structs/Message.html +++ b/docs/Structs/Message.html @@ -329,7 +329,7 @@

    Parameters

    diff --git a/docs/Typealiases.html b/docs/Typealiases.html index 785708b..60177c6 100644 --- a/docs/Typealiases.html +++ b/docs/Typealiases.html @@ -146,7 +146,7 @@

    Declaration

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes.html index bdb4417..18d9894 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes.html @@ -184,7 +184,7 @@

    Declaration

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/CoreBluetoothTransport.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/CoreBluetoothTransport.html index befd0c2..f41e657 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/CoreBluetoothTransport.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/CoreBluetoothTransport.html @@ -183,7 +183,7 @@

    Parameters

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Node.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Node.html index 9d06c55..c1fd2c9 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Node.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Node.html @@ -317,7 +317,7 @@

    Parameters

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Peer.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Peer.html index 82c105c..85d0f07 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Peer.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Classes/Peer.html @@ -152,7 +152,7 @@

    Declaration

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols.html index 94317fb..cefd24d 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols.html @@ -184,7 +184,7 @@

    Declaration

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/NodeDelegate.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/NodeDelegate.html index 6360217..a4f9aa3 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/NodeDelegate.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/NodeDelegate.html @@ -156,7 +156,7 @@

    Parameters

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/Transport.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/Transport.html index 2d32869..af2468f 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/Transport.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/Transport.html @@ -208,9 +208,9 @@

    Parameters

  • - - - listen() + + + listen(identity:)
    @@ -225,10 +225,29 @@

    Parameters

    Declaration

    Swift

    -
    func listen()
    +
    func listen(identity _: UBID)
    +
    +

    Parameters

    + + + + + + + +
    + + identity + + +
    +

    The identity of the node.

    +
    +
    +
  • @@ -237,7 +256,7 @@

    Declaration

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/TransportDelegate.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/TransportDelegate.html index de48e62..f2b826c 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/TransportDelegate.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Protocols/TransportDelegate.html @@ -168,7 +168,7 @@

    Parameters

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Structs.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Structs.html index 20f5e79..7cf5a38 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Structs.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Structs.html @@ -120,7 +120,7 @@

    Declaration

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Structs/Message.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Structs/Message.html index 684f8b8..a9b9904 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Structs/Message.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Structs/Message.html @@ -329,7 +329,7 @@

    Parameters

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/Typealiases.html b/docs/docsets/UB.docset/Contents/Resources/Documents/Typealiases.html index 785708b..60177c6 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/Typealiases.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/Typealiases.html @@ -146,7 +146,7 @@

    Declaration

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/index.html b/docs/docsets/UB.docset/Contents/Resources/Documents/index.html index 54bbe6f..65f1a38 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/index.html +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/index.html @@ -86,7 +86,7 @@

    UB.swift

    License Maintainability Pod -GitHub release (latest SemVer)

    +GitHub release (latest SemVer)

    UB.swift is the swift implementation of the Ultralight Beam protocol, its primary focus is to provide an SDK for iOS and OSX devices.

    Requirements

    @@ -135,7 +135,7 @@

    License

    diff --git a/docs/docsets/UB.docset/Contents/Resources/Documents/search.json b/docs/docsets/UB.docset/Contents/Resources/Documents/search.json index 0c793a7..8ce35ed 100644 --- a/docs/docsets/UB.docset/Contents/Resources/Documents/search.json +++ b/docs/docsets/UB.docset/Contents/Resources/Documents/search.json @@ -1 +1 @@ -{"Typealiases.html#/s:2UB4Addra":{"name":"Addr","abstract":"

    A node address represented as a byte array.

    "},"Typealiases.html#/s:2UB4UBIDa":{"name":"UBID","abstract":"

    Ultralight Beam specific IDs represented as byte arrays.

    "},"Structs/Message.html#/s:2UB7MessageV7serviceSays5UInt8VGvp":{"name":"service","abstract":"

    The message service.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV9recipientSays5UInt8VGvp":{"name":"recipient","abstract":"

    The recipient of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV4fromSays5UInt8VGvp":{"name":"from","abstract":"

    The sender of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV6originSays5UInt8VGvp":{"name":"origin","abstract":"

    The origin of the message, or the original sender.","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7message10Foundation4DataVvp":{"name":"message","abstract":"

    The raw message data.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7service9recipient4from6origin7messageACSays5UInt8VG_A3K10Foundation4DataVtcfc":{"name":"init(service:recipient:from:origin:message:)","abstract":"

    Initializes a message with the passed data.

    ","parent_name":"Message"},"Structs/Message.html":{"name":"Message","abstract":"

    Message represents the message sent between nodes.

    "},"Protocols/TransportDelegate.html#/s:2UB17TransportDelegateP9transport_14didReceiveData4fromyAA0B0_p_10Foundation0G0VSays5UInt8VGtF":{"name":"transport(_:didReceiveData:from:)","abstract":"

    This method is called when a transport receives new data.

    ","parent_name":"TransportDelegate"},"Protocols/Transport.html#/s:2UB9TransportP8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The transports delegate.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP5peersSayAA4PeerCGvp":{"name":"peers","abstract":"

    The peers a specific transport can send messages to.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP4send7message2toy10Foundation4DataV_Says5UInt8VGtF":{"name":"send(message:to:)","abstract":"

    Send implements a function to send messages between nodes using the transport.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP6listenyyF":{"name":"listen()","abstract":"

    Listen implements a function to receive messages being sent to a node.

    ","parent_name":"Transport"},"Protocols/NodeDelegate.html#/s:2UB12NodeDelegateP4node_17didReceiveMessageyAA0B0C_AA0G0VtF":{"name":"node(_:didReceiveMessage:)","abstract":"

    This method is called when a node receives a message.

    ","parent_name":"NodeDelegate"},"Protocols/NodeDelegate.html":{"name":"NodeDelegate","abstract":"

    An interface used to handle events on the Node.

    "},"Protocols/Transport.html":{"name":"Transport","abstract":"

    Transports are used to send messages between nodes using different methods, e.g. wifi direct or bluetooth.

    "},"Protocols/TransportDelegate.html":{"name":"TransportDelegate","abstract":"

    An interface used to handle events on the Transport.

    "},"Classes/CoreBluetoothTransport.html#/c:@M@UB@objc(cs)CoreBluetoothTransport(im)init":{"name":"init()","abstract":"

    Initializes a CoreBluetoothTransport with a new CBCentralManager and CBPeripheralManager.

    ","parent_name":"CoreBluetoothTransport"},"Classes/CoreBluetoothTransport.html#/s:2UB22CoreBluetoothTransportC14centralManager010peripheralF0ACSo09CBCentralF0C_So012CBPeripheralF0Ctcfc":{"name":"init(centralManager:peripheralManager:)","abstract":"

    Initializes a CoreBluetoothTransport.

    ","parent_name":"CoreBluetoothTransport"},"Classes/Peer.html#/s:2UB4PeerC2idSays5UInt8VGvp":{"name":"id","abstract":"

    The peers id.

    ","parent_name":"Peer"},"Classes/Peer.html#/s:2UB4PeerC8servicesSaySays5UInt8VGGvp":{"name":"services","abstract":"

    The services a peer knows.

    ","parent_name":"Peer"},"Classes/Node.html#/s:2UB4NodeC10transportsSDySSAA9Transport_pGvp":{"name":"transports","abstract":"

    The known transports for the node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The nodes delegate.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeCACycfc":{"name":"init()","abstract":"

    Initializes a node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC3add9transportyAA9Transport_p_tF":{"name":"add(transport:)","abstract":"

    Adds a new transport to the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC6remove9transportySS_tF":{"name":"remove(transport:)","abstract":"

    Removes a transport from the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC4sendyyAA7MessageVF":{"name":"send(_:)","abstract":"

    Sends a message through the current transports.

    ","parent_name":"Node"},"Classes/Node.html":{"name":"Node","abstract":"

    An ultralight beam node, handles the interaction with transports and services.

    "},"Classes/Peer.html":{"name":"Peer","abstract":"

    Represents the nodes a transport can communicate with.

    "},"Classes/CoreBluetoothTransport.html":{"name":"CoreBluetoothTransport","abstract":"

    CoreBluetoothTransport is used to send and receive message over Bluetooth

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file +{"Typealiases.html#/s:2UB4Addra":{"name":"Addr","abstract":"

    A node address represented as a byte array.

    "},"Typealiases.html#/s:2UB4UBIDa":{"name":"UBID","abstract":"

    Ultralight Beam specific IDs represented as byte arrays.

    "},"Structs/Message.html#/s:2UB7MessageV7serviceSays5UInt8VGvp":{"name":"service","abstract":"

    The message service.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV9recipientSays5UInt8VGvp":{"name":"recipient","abstract":"

    The recipient of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV4fromSays5UInt8VGvp":{"name":"from","abstract":"

    The sender of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV6originSays5UInt8VGvp":{"name":"origin","abstract":"

    The origin of the message, or the original sender.","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7message10Foundation4DataVvp":{"name":"message","abstract":"

    The raw message data.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7service9recipient4from6origin7messageACSays5UInt8VG_A3K10Foundation4DataVtcfc":{"name":"init(service:recipient:from:origin:message:)","abstract":"

    Initializes a message with the passed data.

    ","parent_name":"Message"},"Structs/Message.html":{"name":"Message","abstract":"

    Message represents the message sent between nodes.

    "},"Protocols/TransportDelegate.html#/s:2UB17TransportDelegateP9transport_14didReceiveData4fromyAA0B0_p_10Foundation0G0VSays5UInt8VGtF":{"name":"transport(_:didReceiveData:from:)","abstract":"

    This method is called when a transport receives new data.

    ","parent_name":"TransportDelegate"},"Protocols/Transport.html#/s:2UB9TransportP8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The transports delegate.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP5peersSayAA4PeerCGvp":{"name":"peers","abstract":"

    The peers a specific transport can send messages to.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP4send7message2toy10Foundation4DataV_Says5UInt8VGtF":{"name":"send(message:to:)","abstract":"

    Send implements a function to send messages between nodes using the transport.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP6listen8identityySays5UInt8VG_tF":{"name":"listen(identity:)","abstract":"

    Listen implements a function to receive messages being sent to a node.

    ","parent_name":"Transport"},"Protocols/NodeDelegate.html#/s:2UB12NodeDelegateP4node_17didReceiveMessageyAA0B0C_AA0G0VtF":{"name":"node(_:didReceiveMessage:)","abstract":"

    This method is called when a node receives a message.

    ","parent_name":"NodeDelegate"},"Protocols/NodeDelegate.html":{"name":"NodeDelegate","abstract":"

    An interface used to handle events on the Node.

    "},"Protocols/Transport.html":{"name":"Transport","abstract":"

    Transports are used to send messages between nodes using different methods, e.g. wifi direct or bluetooth.

    "},"Protocols/TransportDelegate.html":{"name":"TransportDelegate","abstract":"

    An interface used to handle events on the Transport.

    "},"Classes/CoreBluetoothTransport.html#/c:@M@UB@objc(cs)CoreBluetoothTransport(im)init":{"name":"init()","abstract":"

    Initializes a CoreBluetoothTransport with a new CBCentralManager and CBPeripheralManager.

    ","parent_name":"CoreBluetoothTransport"},"Classes/CoreBluetoothTransport.html#/s:2UB22CoreBluetoothTransportC14centralManager010peripheralF0ACSo09CBCentralF0C_So012CBPeripheralF0Ctcfc":{"name":"init(centralManager:peripheralManager:)","abstract":"

    Initializes a CoreBluetoothTransport.

    ","parent_name":"CoreBluetoothTransport"},"Classes/Peer.html#/s:2UB4PeerC2idSays5UInt8VGvp":{"name":"id","abstract":"

    The peers id.

    ","parent_name":"Peer"},"Classes/Peer.html#/s:2UB4PeerC8servicesSaySays5UInt8VGGvp":{"name":"services","abstract":"

    The services a peer knows.

    ","parent_name":"Peer"},"Classes/Node.html#/s:2UB4NodeC10transportsSDySSAA9Transport_pGvp":{"name":"transports","abstract":"

    The known transports for the node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The nodes delegate.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeCACycfc":{"name":"init()","abstract":"

    Initializes a node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC3add9transportyAA9Transport_p_tF":{"name":"add(transport:)","abstract":"

    Adds a new transport to the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC6remove9transportySS_tF":{"name":"remove(transport:)","abstract":"

    Removes a transport from the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC4sendyyAA7MessageVF":{"name":"send(_:)","abstract":"

    Sends a message through the current transports.

    ","parent_name":"Node"},"Classes/Node.html":{"name":"Node","abstract":"

    An ultralight beam node, handles the interaction with transports and services.

    "},"Classes/Peer.html":{"name":"Peer","abstract":"

    Represents the nodes a transport can communicate with.

    "},"Classes/CoreBluetoothTransport.html":{"name":"CoreBluetoothTransport","abstract":"

    CoreBluetoothTransport is used to send and receive message over Bluetooth

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file diff --git a/docs/docsets/UB.docset/Contents/Resources/docSet.dsidx b/docs/docsets/UB.docset/Contents/Resources/docSet.dsidx index b723cbf..5857611 100644 Binary files a/docs/docsets/UB.docset/Contents/Resources/docSet.dsidx and b/docs/docsets/UB.docset/Contents/Resources/docSet.dsidx differ diff --git a/docs/docsets/UB.tgz b/docs/docsets/UB.tgz index 9ffd7af..233b530 100644 Binary files a/docs/docsets/UB.tgz and b/docs/docsets/UB.tgz differ diff --git a/docs/index.html b/docs/index.html index 54bbe6f..65f1a38 100644 --- a/docs/index.html +++ b/docs/index.html @@ -86,7 +86,7 @@

    UB.swift

    License Maintainability Pod -GitHub release (latest SemVer)

    +GitHub release (latest SemVer)

    UB.swift is the swift implementation of the Ultralight Beam protocol, its primary focus is to provide an SDK for iOS and OSX devices.

    Requirements

    @@ -135,7 +135,7 @@

    License

    diff --git a/docs/search.json b/docs/search.json index 0c793a7..8ce35ed 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -{"Typealiases.html#/s:2UB4Addra":{"name":"Addr","abstract":"

    A node address represented as a byte array.

    "},"Typealiases.html#/s:2UB4UBIDa":{"name":"UBID","abstract":"

    Ultralight Beam specific IDs represented as byte arrays.

    "},"Structs/Message.html#/s:2UB7MessageV7serviceSays5UInt8VGvp":{"name":"service","abstract":"

    The message service.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV9recipientSays5UInt8VGvp":{"name":"recipient","abstract":"

    The recipient of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV4fromSays5UInt8VGvp":{"name":"from","abstract":"

    The sender of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV6originSays5UInt8VGvp":{"name":"origin","abstract":"

    The origin of the message, or the original sender.","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7message10Foundation4DataVvp":{"name":"message","abstract":"

    The raw message data.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7service9recipient4from6origin7messageACSays5UInt8VG_A3K10Foundation4DataVtcfc":{"name":"init(service:recipient:from:origin:message:)","abstract":"

    Initializes a message with the passed data.

    ","parent_name":"Message"},"Structs/Message.html":{"name":"Message","abstract":"

    Message represents the message sent between nodes.

    "},"Protocols/TransportDelegate.html#/s:2UB17TransportDelegateP9transport_14didReceiveData4fromyAA0B0_p_10Foundation0G0VSays5UInt8VGtF":{"name":"transport(_:didReceiveData:from:)","abstract":"

    This method is called when a transport receives new data.

    ","parent_name":"TransportDelegate"},"Protocols/Transport.html#/s:2UB9TransportP8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The transports delegate.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP5peersSayAA4PeerCGvp":{"name":"peers","abstract":"

    The peers a specific transport can send messages to.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP4send7message2toy10Foundation4DataV_Says5UInt8VGtF":{"name":"send(message:to:)","abstract":"

    Send implements a function to send messages between nodes using the transport.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP6listenyyF":{"name":"listen()","abstract":"

    Listen implements a function to receive messages being sent to a node.

    ","parent_name":"Transport"},"Protocols/NodeDelegate.html#/s:2UB12NodeDelegateP4node_17didReceiveMessageyAA0B0C_AA0G0VtF":{"name":"node(_:didReceiveMessage:)","abstract":"

    This method is called when a node receives a message.

    ","parent_name":"NodeDelegate"},"Protocols/NodeDelegate.html":{"name":"NodeDelegate","abstract":"

    An interface used to handle events on the Node.

    "},"Protocols/Transport.html":{"name":"Transport","abstract":"

    Transports are used to send messages between nodes using different methods, e.g. wifi direct or bluetooth.

    "},"Protocols/TransportDelegate.html":{"name":"TransportDelegate","abstract":"

    An interface used to handle events on the Transport.

    "},"Classes/CoreBluetoothTransport.html#/c:@M@UB@objc(cs)CoreBluetoothTransport(im)init":{"name":"init()","abstract":"

    Initializes a CoreBluetoothTransport with a new CBCentralManager and CBPeripheralManager.

    ","parent_name":"CoreBluetoothTransport"},"Classes/CoreBluetoothTransport.html#/s:2UB22CoreBluetoothTransportC14centralManager010peripheralF0ACSo09CBCentralF0C_So012CBPeripheralF0Ctcfc":{"name":"init(centralManager:peripheralManager:)","abstract":"

    Initializes a CoreBluetoothTransport.

    ","parent_name":"CoreBluetoothTransport"},"Classes/Peer.html#/s:2UB4PeerC2idSays5UInt8VGvp":{"name":"id","abstract":"

    The peers id.

    ","parent_name":"Peer"},"Classes/Peer.html#/s:2UB4PeerC8servicesSaySays5UInt8VGGvp":{"name":"services","abstract":"

    The services a peer knows.

    ","parent_name":"Peer"},"Classes/Node.html#/s:2UB4NodeC10transportsSDySSAA9Transport_pGvp":{"name":"transports","abstract":"

    The known transports for the node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The nodes delegate.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeCACycfc":{"name":"init()","abstract":"

    Initializes a node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC3add9transportyAA9Transport_p_tF":{"name":"add(transport:)","abstract":"

    Adds a new transport to the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC6remove9transportySS_tF":{"name":"remove(transport:)","abstract":"

    Removes a transport from the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC4sendyyAA7MessageVF":{"name":"send(_:)","abstract":"

    Sends a message through the current transports.

    ","parent_name":"Node"},"Classes/Node.html":{"name":"Node","abstract":"

    An ultralight beam node, handles the interaction with transports and services.

    "},"Classes/Peer.html":{"name":"Peer","abstract":"

    Represents the nodes a transport can communicate with.

    "},"Classes/CoreBluetoothTransport.html":{"name":"CoreBluetoothTransport","abstract":"

    CoreBluetoothTransport is used to send and receive message over Bluetooth

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file +{"Typealiases.html#/s:2UB4Addra":{"name":"Addr","abstract":"

    A node address represented as a byte array.

    "},"Typealiases.html#/s:2UB4UBIDa":{"name":"UBID","abstract":"

    Ultralight Beam specific IDs represented as byte arrays.

    "},"Structs/Message.html#/s:2UB7MessageV7serviceSays5UInt8VGvp":{"name":"service","abstract":"

    The message service.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV9recipientSays5UInt8VGvp":{"name":"recipient","abstract":"

    The recipient of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV4fromSays5UInt8VGvp":{"name":"from","abstract":"

    The sender of the message.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV6originSays5UInt8VGvp":{"name":"origin","abstract":"

    The origin of the message, or the original sender.","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7message10Foundation4DataVvp":{"name":"message","abstract":"

    The raw message data.

    ","parent_name":"Message"},"Structs/Message.html#/s:2UB7MessageV7service9recipient4from6origin7messageACSays5UInt8VG_A3K10Foundation4DataVtcfc":{"name":"init(service:recipient:from:origin:message:)","abstract":"

    Initializes a message with the passed data.

    ","parent_name":"Message"},"Structs/Message.html":{"name":"Message","abstract":"

    Message represents the message sent between nodes.

    "},"Protocols/TransportDelegate.html#/s:2UB17TransportDelegateP9transport_14didReceiveData4fromyAA0B0_p_10Foundation0G0VSays5UInt8VGtF":{"name":"transport(_:didReceiveData:from:)","abstract":"

    This method is called when a transport receives new data.

    ","parent_name":"TransportDelegate"},"Protocols/Transport.html#/s:2UB9TransportP8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The transports delegate.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP5peersSayAA4PeerCGvp":{"name":"peers","abstract":"

    The peers a specific transport can send messages to.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP4send7message2toy10Foundation4DataV_Says5UInt8VGtF":{"name":"send(message:to:)","abstract":"

    Send implements a function to send messages between nodes using the transport.

    ","parent_name":"Transport"},"Protocols/Transport.html#/s:2UB9TransportP6listen8identityySays5UInt8VG_tF":{"name":"listen(identity:)","abstract":"

    Listen implements a function to receive messages being sent to a node.

    ","parent_name":"Transport"},"Protocols/NodeDelegate.html#/s:2UB12NodeDelegateP4node_17didReceiveMessageyAA0B0C_AA0G0VtF":{"name":"node(_:didReceiveMessage:)","abstract":"

    This method is called when a node receives a message.

    ","parent_name":"NodeDelegate"},"Protocols/NodeDelegate.html":{"name":"NodeDelegate","abstract":"

    An interface used to handle events on the Node.

    "},"Protocols/Transport.html":{"name":"Transport","abstract":"

    Transports are used to send messages between nodes using different methods, e.g. wifi direct or bluetooth.

    "},"Protocols/TransportDelegate.html":{"name":"TransportDelegate","abstract":"

    An interface used to handle events on the Transport.

    "},"Classes/CoreBluetoothTransport.html#/c:@M@UB@objc(cs)CoreBluetoothTransport(im)init":{"name":"init()","abstract":"

    Initializes a CoreBluetoothTransport with a new CBCentralManager and CBPeripheralManager.

    ","parent_name":"CoreBluetoothTransport"},"Classes/CoreBluetoothTransport.html#/s:2UB22CoreBluetoothTransportC14centralManager010peripheralF0ACSo09CBCentralF0C_So012CBPeripheralF0Ctcfc":{"name":"init(centralManager:peripheralManager:)","abstract":"

    Initializes a CoreBluetoothTransport.

    ","parent_name":"CoreBluetoothTransport"},"Classes/Peer.html#/s:2UB4PeerC2idSays5UInt8VGvp":{"name":"id","abstract":"

    The peers id.

    ","parent_name":"Peer"},"Classes/Peer.html#/s:2UB4PeerC8servicesSaySays5UInt8VGGvp":{"name":"services","abstract":"

    The services a peer knows.

    ","parent_name":"Peer"},"Classes/Node.html#/s:2UB4NodeC10transportsSDySSAA9Transport_pGvp":{"name":"transports","abstract":"

    The known transports for the node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC8delegateAA0B8Delegate_pSgvp":{"name":"delegate","abstract":"

    The nodes delegate.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeCACycfc":{"name":"init()","abstract":"

    Initializes a node.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC3add9transportyAA9Transport_p_tF":{"name":"add(transport:)","abstract":"

    Adds a new transport to the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC6remove9transportySS_tF":{"name":"remove(transport:)","abstract":"

    Removes a transport from the list of known transports.

    ","parent_name":"Node"},"Classes/Node.html#/s:2UB4NodeC4sendyyAA7MessageVF":{"name":"send(_:)","abstract":"

    Sends a message through the current transports.

    ","parent_name":"Node"},"Classes/Node.html":{"name":"Node","abstract":"

    An ultralight beam node, handles the interaction with transports and services.

    "},"Classes/Peer.html":{"name":"Peer","abstract":"

    Represents the nodes a transport can communicate with.

    "},"Classes/CoreBluetoothTransport.html":{"name":"CoreBluetoothTransport","abstract":"

    CoreBluetoothTransport is used to send and receive message over Bluetooth

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Structs.html":{"name":"Structures","abstract":"

    The following structures are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file