Protocols

The following protocols are available globally.

Standardized Sequence Protocol to Let Collectors be Sequences

  • 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 more

    Declaration

    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 more

    Declaration

    Swift

    public protocol RVS_IPAddress

Dispatch Core Functions

Dispatch Profile S Functions

  • This protocol covers Profile S (Streaming) dispatcher expectations.

    See more

    Declaration

    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 more

    Declaration

    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 more

    Declaration

    Swift

    public protocol OwnedInstanceProtocol
  • This protocol is used to define the basic interface for our ONVIF Profile implementation classes.

    See more

    Declaration

    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 more

    Declaration

    Swift

    public protocol RVS_ONVIF_DeviceRequestProtocol
  • This protocol defines the three main parameters of most configuration structs.

    See more

    Declaration

    Swift

    public protocol ConfigurationProtocol : OwnedInstanceProtocol

This is a special protocol for developing “dispatcher” handlers for RVS_ONVIF instances.

  • 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, the getParametersForCommand methods. If deliverResponse returns true, then the iteration stops, once the deliverResponse call is made. The deliverResponse call will not be made, unless the Dispatcher returns true from its isAbleToHandleThisCommand method.

    deliverResponse is the only method that is required to be implemented by the conforming class, but you should also implement getParametersForCommand if you will provide arguments. All calls are made in the main thread.

    See more

    Declaration

    Swift

    public protocol RVS_ONVIF_Dispatcher : AnyObject