RVS_BTDriver_Service
class RVS_BTDriver_Service : NSObject, RVS_BTDriver_ServiceProtocol
extension RVS_BTDriver_Service: RVS_BTDriverCommunicatorTools
This is a standard service class.
-
This is an Array of subscribers.
Declaration
Swift
internal var internal_subscribers: [RVS_BTDriver_ServiceSubscriberProtocol]
-
This contains the property list for this instance of the driver.
Declaration
Swift
internal var internal_holding_pen: [RVS_BTDriver_Property] -
This contains the property list for this instance of the driver.
Declaration
Swift
internal var internal_property_list: [RVS_BTDriver_Property] -
This is a String, holding the service UUID.
Declaration
Swift
internal var internal_uuid: String! -
This is a read-only accessor for the object that “owns” this instance.
Declaration
Swift
internal weak var internal_owner: RVS_BTDriver_Device! -
This is a placeholder for subclasses. This class doesn’t do anything.
Subclasses should use this to start a discovery process for their characteristics (properties).
Declaration
Swift
internal func discoverInitialCharacteristics() -
Main initializer.
Declaration
Swift
internal init(owner inOwner: RVS_BTDriver_Device, uuid inUUID: String)Parameters
ownerThe device that “owns” this service.
uuidA String, with the service UUID.
-
Notifies subscribers of a new property. This is defined here, so we can override.
Declaration
Swift
internal func notifySubscribersOfNewProperty(_ inProperty: RVS_BTDriver_Property)Parameters
inPropertyThe property to notify.
-
Notifies subscribers of a status update. This is defined here, so we can override.
Declaration
Swift
internal func notifySubscribersOfStatusUpdate() -
This displays a useful debug display of the service data.
Declaration
Swift
override var description: String { get }
-
This method will move a property from the holding pen to the main list.
Declaration
Swift
internal func movePropertyFromHoldingPenToMainList(_ inProperty: RVS_BTDriver_Property)Parameters
inPropertyThe property object to be moved.
-
This method will remove a property from the holding pen or the main list.
Declaration
Swift
internal func removeThisProperty(_ inProperty: RVS_BTDriver_Service)Parameters
inPropertyThe property object to be removed.
-
This method adds a property to the holding pen.
If already there, nothing happens.
Declaration
Swift
internal func addPropertyToHoldingPen(_ inProperty: RVS_BTDriver_Property)Parameters
inPropertyThe property object to be added.
-
This method adds a property to the main list.
If already there, nothing happens.
Declaration
Swift
internal func addPropertyToMainList(_ inProperty: RVS_BTDriver_Property)Parameters
inPropertyThe property object to be added.
-
Called to report that our holding pen is empty.
Declaration
Swift
internal func reportCompletion()
-
Test to see if a subscriber is already subscribed.
Declaration
Swift
public func isThisInstanceASubscriber(_ inSubscriber: RVS_BTDriver_ServiceSubscriberProtocol) -> BoolParameters
inSubscriberThe subscriber to test.
Return Value
True, if the instance is subscribed.
-
Add an observer of the service.
It should be noted that subscribers are held as strong references (if they are classes).
Declaration
Swift
public func subscribe(_ inSubscriber: RVS_BTDriver_ServiceSubscriberProtocol)Parameters
subscriberThe instance to subscribe. Nothing is done, if we are already subscribed.
-
remove a subscriber from the list. Nothing happens if the subscriber is not already subscribed.
Declaration
Swift
public func unsubscribe(_ inSubscriber: RVS_BTDriver_ServiceSubscriberProtocol)Parameters
subscriberThe instance to unsubscribe. Nothing is done, if we are not already subscribed.
-
This method will “kick the can” up to the driver, where the error will finally be sent to the delegate.
Declaration
Swift
internal func reportThisError(_ inError: RVS_BTDriver.Errors)Parameters
inErrorThe error to be sent to the owner.
-
This is the public read-only access to the property list.
Declaration
Swift
public var properties: [RVS_BTDriver_PropertyProtocol] { get } -
This is the read-only count of properties.
Declaration
Swift
public var count: Int { get } -
This is a public read-only 0-based integer subscript to the property list.
Declaration
Swift
public subscript(inIndex: Int) -> RVS_BTDriver_PropertyProtocol { get } -
Simple “String Key” subscript, so we can treat the array as a dictionary.
Declaration
Swift
public subscript(inStringKey: String) -> RVS_BTDriver_PropertyProtocol! { get }Parameters
inStringKeyA String, containing the unique UUID of the property we are looking for.
Return Value
The property, or nil, if not found.
-
This is the read-only unique ID for this service.
Declaration
Swift
public var uuid: String { get } -
This refers to the device instance that “owns” this service.
Declaration
Swift
public var owner: RVS_BTDriver_DeviceProtocol! { get }
View on GitHub
RVS_BTDriver_Service Class Reference