diff --git a/Sources/GATT/Central.swift b/Sources/GATT/Central.swift index 0edee59..d60de1a 100644 --- a/Sources/GATT/Central.swift +++ b/Sources/GATT/Central.swift @@ -30,6 +30,10 @@ public protocol CentralProtocol: class { func connect(to peripheral: Peripheral, timeout: TimeInterval) throws + func disconnect(peripheral: Peripheral) + + func disconnectAll() + func discoverServices(_ services: [BluetoothUUID], for peripheral: Peripheral, timeout: TimeInterval) throws -> [Service] diff --git a/Sources/GATT/LinuxCentral.swift b/Sources/GATT/LinuxCentral.swift index 1042448..3b335d8 100644 --- a/Sources/GATT/LinuxCentral.swift +++ b/Sources/GATT/LinuxCentral.swift @@ -22,40 +22,50 @@ public final class LinuxCentral: CentralProtocol { fatalError() } - public func scan(filterDuplicates: Bool, shouldContinueScanning: () -> (Bool), foundDevice: @escaping (ScanData) -> ()) throws { + public func scan(filterDuplicates: Bool = true, shouldContinueScanning: () -> (Bool), foundDevice: @escaping (ScanData) -> ()) throws { fatalError() } - public func connect(to peripheral: Peripheral, timeout: TimeInterval) throws { + public func connect(to peripheral: Peripheral, timeout: TimeInterval = 30) throws { } - public func discoverServices(_ services: [BluetoothUUID], for peripheral: Peripheral, timeout: TimeInterval) throws -> [Service] { + public func discoverServices(_ services: [BluetoothUUID] = [], for peripheral: Peripheral, timeout: TimeInterval = 30) throws -> [Service] { fatalError() } - public func discoverCharacteristics(_ characteristics: [BluetoothUUID], for service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval) throws -> [Characteristic] { + public func discoverCharacteristics(_ characteristics: [BluetoothUUID] = [], for service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval = 30) throws -> [Characteristic] { fatalError() } - public func readValue(for characteristic: BluetoothUUID, service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval) throws -> Data { + public func readValue(for characteristic: BluetoothUUID, service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval = 30) throws -> Data { fatalError() } - public func writeValue(_ data: Data, for characteristic: BluetoothUUID, withResponse: Bool, service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval) throws { + public func writeValue(_ data: Data, for characteristic: BluetoothUUID, withResponse: Bool = true, service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval = 30) throws { fatalError() } - public func notify(_ notification: ((Data) -> ())?, for characteristic: BluetoothUUID, service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval) throws { + public func notify(_ notification: ((Data) -> ())?, for characteristic: BluetoothUUID, service: BluetoothUUID, peripheral: Peripheral, timeout: TimeInterval = 30) throws { fatalError() } + + public func disconnect(peripheral: Peripheral) { + + fatalError() + } + + public func disconnectAll() { + + fatalError() + } } #endif