Skip to content

Commit

Permalink
Working on Central
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Sep 14, 2018
1 parent f195db2 commit e5ce441
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/DarwinGATT/DarwinCentral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ public final class DarwinCentral: NSObject, CentralProtocol, CBCentralManagerDel
// write request
corePeripheral.writeValue(data, for: coreCharacteristic, type: writeType)

guard coreCharacteristic.properties.contains(.writeWithoutResponse) == false
else { return }

// calls `peripheral:didWriteValueForCharacteristic:error:` only
// if you specified the write type as `.withResponse`.

Expand Down
5 changes: 5 additions & 0 deletions Sources/GATT/GATTCentral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,16 @@ public final class GATTCentral <HostController: BluetoothHostControllerInterface
public func disconnect(peripheral: Peripheral) {

self.connections[peripheral] = nil

// L2CAP socket may be retained by background thread
sleep(1)
}

public func disconnectAll() {

self.connections.removeAll(keepingCapacity: true)

sleep(1)
}

public func discoverServices(_ services: [BluetoothUUID] = [],
Expand Down

0 comments on commit e5ce441

Please sign in to comment.