ITCB_Device_Protocol
public protocol ITCB_Device_Protocol
This just has a couple of common properties.
-
This is the device name.
Declaration
Swift
var name: String { get }
-
This is any errors that may have occurred. It may be nil.
Declaration
Swift
var error: ITCB_Errors! { get }
-
This is a “faux Equatable” method. It allows us to compare something that is expressed only as a protocol instance with ourselves, without the need to be Equatable.
The reason for doing this, is that I don’t want to have to conform to the whole Equatable protocol. We just need a quick identity test, and this will give it to us without requiring anything too fancy.
Declaration
Swift
func amIThisDevice(_ inDevice: ITCB_Device_Protocol) -> Bool
Parameters
inDevice
The device that we are comparing.
Return Value
True, if we are the device.
-
This allows the user of an SDK to reject a connection attempt by another device (either a question or an answer).
The reason that we have this, as opposed to a function return from the observer, is because I think observer should be one-way. Outgoing only.
Declaration
Swift
func rejectConnectionBecause(_ reason: ITCB_RejectionReason!)
Parameters
reason
The reason for the rejection. It may be nil. If nil, .unkownError is assumed, with no error associated value.