Protocols
The following protocols are available globally.
-
If you conform to this protocol, you get a few basic Sequence attributes for free.
You’ll need to set up a sequence_contents Array (read/write), and set the Element type, and that’s about all.
This also gives you a read-only subscript.
This cannot be applied to enums, as it requires a stored property.
See moreDeclaration
Swift
public protocol RVS_SequenceProtocol : Sequence
-
This protocol is an abstract base for IP addresses. When we parse a String as an IP address, it will return a specific implementation of this.
When we say “valid,” we don’t mean the address resolves to anything; just that it is syntactically correct.
This file is the only one that you need for your implementation. Simply copy it wherever you want in your project, and add it to your chosen target.
See moreDeclaration
Swift
public protocol RVS_IPAddress
-
This is the protocol that defines the dispatcher for the Core ONVIF Profile.
See moreDeclaration
Swift
public protocol RVS_ONVIF_CoreDispatcher : RVS_ONVIF_Dispatcher
-
This protocol covers Profile S (Streaming) dispatcher expectations.
See moreDeclaration
Swift
public protocol RVS_ONVIF_Profile_SDispatcher : RVS_ONVIF_Dispatcher
-
This is the delegate protocol for use with the RVS_ONVIF framework.
This is a “pure” Swift protocol, requiring that it be applied to a class.
There can only be one Delegate at a time for an RVS_ONVIF instance (as opposed to Dispatchers, which can be more than one).
None of the Delegate methods are required.
These methods are all called in the main thread.
See moreDeclaration
Swift
public protocol RVS_ONVIFDelegate : AnyObject
-
This is a base protocol for structs returned from the ONVIF object. They can all refer back to their “owner.”
See moreDeclaration
Swift
public protocol OwnedInstanceProtocol
-
This protocol is used to define the basic interface for our ONVIF Profile implementation classes.
See moreDeclaration
Swift
public protocol ProfileHandlerProtocol : OwnedInstanceProtocol
-
This protocol defines the basic structure of our SOAP command enums.
This is a way to have “opaque” command enums that are independent of the calling context.
This should only be applied to enums, and should only be used internally for the RVS_ONVIF library.
See moreDeclaration
Swift
public protocol RVS_ONVIF_DeviceRequestProtocol
-
This protocol defines the three main parameters of most configuration structs.
See moreDeclaration
Swift
public protocol ConfigurationProtocol : OwnedInstanceProtocol
-
This protocol describes the expectations for generic ONVIF Dispatchers.
DISPATCHERS
These are a specialization of the Delegate Pattern.
Your implementation context will define classes that conform to specializations of the RVS_ONVIF_Dispatcher protocol. They must be classes.
The protocols will have default implementations of all methods and calculated properties except for
deliverResponse
, but some of the defaults are empty.Each profile handler will declare a specialization of the ProfileHandlerProtocol, and will take care of profile-specific functionality “behind the scenes.” Each profile handler will also declare a specialization of the RVS_ONVIF_Dispatcher protocol that applies to its own functionality, and the implementation context will then use these specializations to declare its own Dispatchers.
The Dispatchers are “registered” with the main driver, in a manner similar to Delegates. However, Dispatchers are assigned to an Array, and will signal to the RVS_ONVIF instance when they can handle specific calls.
When a call is returned from the device, the RVS_ONVIF driver will iterate the registered Dispatchers, and will stop when a Dispatcher signals that it will handle the response. Commands are handled by protocol-hander-sepcific implementations the RVS_ONVIF_DeviceRequestProtocol protocol, and are “opaque” enums. Basically, the important part of your Dispatcher is that your implementation should implement the
isAbleToHandleThisCommand
,deliverResponse
, and, if applicable, thegetParametersForCommand
methods. IfdeliverResponse
returns true, then the iteration stops, once thedeliverResponse
call is made. ThedeliverResponse
call will not be made, unless the Dispatcher returns true from itsisAbleToHandleThisCommand
method.
See moredeliverResponse
is the only method that is required to be implemented by the conforming class, but you should also implementgetParametersForCommand
if you will provide arguments. All calls are made in the main thread.Declaration
Swift
public protocol RVS_ONVIF_Dispatcher : AnyObject