Skip to content

Commit

Permalink
See issue #36: Added remainder of callbacks, but they don't do anything
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshjoshi committed Nov 27, 2019
1 parent eed7ac7 commit ed2de11
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 28 deletions.
40 changes: 39 additions & 1 deletion Sources/SwiftyTooth/SwiftyTooth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public extension SwiftyTooth {
}
}

// MARK: - Manager Advertise functions
// MARK: - SwiftyTooth Advertise functions
public extension SwiftyTooth {

var isAdvertising: Bool {
Expand Down Expand Up @@ -75,6 +75,8 @@ public extension SwiftyTooth {

// MARK: - Peripheral manager
extension SwiftyTooth: CBPeripheralManagerDelegate {

// MARK: - Peripheral Manager State Changes
public func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
switch (peripheral.state) {
case .unknown:
Expand All @@ -99,8 +101,44 @@ extension SwiftyTooth: CBPeripheralManagerDelegate {
stateChangedHandler?(state)
}

public func peripheralManager(_ peripheral: CBPeripheralManager, willRestoreState dict: [String : Any]) {

}

// MARK: - Peripheral Manager Services

public func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: Error?) {

}

// MARK: - Peripheral Manager Advertisments

public func peripheralManagerDidStartAdvertising(_ peripheral: CBPeripheralManager, error: Error?) {
Log(v: "Started advertising")
print("Started advertising")
}

// MARK: - Peripheral Manager Characteristic Subscriptions
public func peripheralManager(_ peripheral: CBPeripheralManager, central: CBCentral, didSubscribeTo characteristic: CBCharacteristic) {

}

public func peripheralManager(_ peripheral: CBPeripheralManager, central: CBCentral, didUnsubscribeFrom characteristic: CBCharacteristic) {

}

public func peripheralManagerIsReady(toUpdateSubscribers peripheral: CBPeripheralManager) {

}

// MARK: - Peripheral Manager Read/Write requests
public func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveRead request: CBATTRequest) {
request.value = Data(base64Encoded: "Hello")
peripheralManager.respond(to: request, withResult: .success)
}

public func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveWrite requests: [CBATTRequest]) {
peripheralManager.respond(to: <#T##CBATTRequest#>, withResult: <#T##CBATTError.Code#>)
}

}
27 changes: 0 additions & 27 deletions SwiftyTeeth.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@
isa = PBXGroup;
children = (
8B64D1951DC2E39900D41A2C /* Enums */,
8B64D1961DC2E39900D41A2C /* Errors */,
8B64D1971DC2E39900D41A2C /* Extensions */,
8B64D1981DC2E39900D41A2C /* Helpers */,
8B64D1991DC2E39900D41A2C /* Logging */,
8B64D19A1DC2E39900D41A2C /* Models */,
8B64D19C1DC2E39900D41A2C /* Protocols */,
8B64D19E1DC2E39900D41A2C /* Security */,
Expand Down Expand Up @@ -219,14 +216,6 @@
path = Enums;
sourceTree = "<group>";
};
8B64D1961DC2E39900D41A2C /* Errors */ = {
isa = PBXGroup;
children = (
);
name = Errors;
path = ../Errors;
sourceTree = "<group>";
};
8B64D1971DC2E39900D41A2C /* Extensions */ = {
isa = PBXGroup;
children = (
Expand All @@ -238,22 +227,6 @@
path = Extensions;
sourceTree = "<group>";
};
8B64D1981DC2E39900D41A2C /* Helpers */ = {
isa = PBXGroup;
children = (
);
name = Helpers;
path = ../Helpers;
sourceTree = "<group>";
};
8B64D1991DC2E39900D41A2C /* Logging */ = {
isa = PBXGroup;
children = (
);
name = Logging;
path = ../Logging;
sourceTree = "<group>";
};
8B64D19A1DC2E39900D41A2C /* Models */ = {
isa = PBXGroup;
children = (
Expand Down

0 comments on commit ed2de11

Please sign in to comment.