RemoteControl

@objcMembers
@objc(GSRemoteControl)
public class RemoteControl : NSObject, InstrumentProvider, PeripheralProvider

Remote control.

  • Model of remote control.

    See more

    Declaration

    Swift

    @objc(GSRemoteControlModel)
    public enum Model : Int, CustomStringConvertible
  • uid

    Remote control unique identifier, persistant between sessions.

    Declaration

    Swift

    public var uid: String { get }
  • Remote control mode.

    Declaration

    Swift

    public var model: Model { get }
  • Remote control name.

    Declaration

    Swift

    public var name: String { get }
  • Remote control state.

    Declaration

    Swift

    public var state: DeviceState { get }
  • Equatable (override the isEqual function because RemoteControl inherits from NSObject).

    Declaration

    Swift

    override public func isEqual(_ object: Any?) -> Bool
  • Debug description.

    Declaration

    Swift

    override public var description: String { get }
  • Gets the remote control name and registers an observer notified each time it changes.

    The observer is called immediately with the current remote control name name and will be called each time it changes.

    Seealso

    property name to get current name without registering an observer

    Declaration

    Swift

    public func getName(observer: @escaping Ref<String>.Observer) -> Ref<String>

    Parameters

    observer

    observer to notify when the remote control name changes

    Return Value

    reference to remote control name

  • Gets the remote control state and registers an observer notified each time it changes.

    The observer is called immediately with the current remote control state and will be called each time it changes.

    Seealso

    property state to get current state without registering an observer

    Declaration

    Swift

    public func getState(observer: @escaping Ref<DeviceState>.Observer) -> Ref<DeviceState>

    Parameters

    observer

    observer to notify when the remote control state changes

    Return Value

    reference to remote control state

  • Forgets the remote control.

    Persisted remote control data are deleted and the remote control is removed from the list of remote control if it’s no more available.

    Declaration

    Swift

    public func forget() -> Bool

    Return Value

    true if the remote control has been forgotten, false otherwise

  • Connects the remote control using the best connector.

    Declaration

    Swift

    public func connect() -> Bool

    Return Value

    true if the connection process has started

  • Connects the remote control with a specific connector.

    Declaration

    Swift

    public func connect(connector: DeviceConnector) -> Bool

    Parameters

    connector

    connector to use to connect the remote control

    Return Value

    true if the connection process has started

  • Connects the remote control with a specific connector, using a password.

    Declaration

    Swift

    public func connect(connector: DeviceConnector, password: String) -> Bool

    Parameters

    connector

    connector to use to connect the remote control

    password

    password to use to connect the remote control

    Return Value

    true if the connection process has started

  • Disconnects the remote control.

    This method can be use to disconnect the remote control when connected or to cancel the connection process if the remote control is connecting.

    Declaration

    Swift

    public func disconnect() -> Bool

    Return Value

    true if the disconnection process has started, false otherwise

  • Gets an instrument.

    Returns the requested instrument or nil if the remote control doesn’t have the requested instrument or if the instrument is not available in the current connection state.

    Declaration

    Swift

    public func getInstrument<Desc>(_ desc: Desc) -> Desc.ApiProtocol? where Desc : InstrumentClassDesc

    Parameters

    desc

    requested instrument. See Instruments api for available descriptors instances.

    Return Value

    requested instrument

  • Get san instrument and registers an observer notified each time it changes.

    If the instrument is present, the observer will be called immediately with. If the instrument is not present, the observer won’t be called until the instrument is added to the remote control. If the instrument or the remote control are removed, the observer will be notified and referenced value is set to nil.

    Declaration

    Swift

    public func getInstrument<Desc: InstrumentClassDesc>(_ desc: Desc,
                              observer: @escaping Ref<Desc.ApiProtocol>.Observer) -> Ref<Desc.ApiProtocol>

    Parameters

    desc

    requested instrument. See Instruments api for available descriptors instances

    observer

    observer to notify when the instrument changes

    Return Value

    reference to the requested instrument

  • Gets a peripheral.

    Returns the requested peripheral or nil if the remote control doesn’t have the requested peripheral or if the peripheral is not available in the current connection state.

    Declaration

    Swift

    public func getPeripheral<Desc>(_ desc: Desc) -> Desc.ApiProtocol? where Desc : PeripheralClassDesc

    Parameters

    desc

    requested peripheral. See Peripherals api for available descriptors instances.

    Return Value

    requested peripheral

  • Gets a peripheral and registers an observer notified each time it changes.

    If the peripheral is present, the observer will be called immediately with. If the peripheral is not present, the observer won’t be called until the peripheral is added to the remote control. If the peripheral or the remote control are removed, the observer will be notified and referenced value is set to nil.

    Declaration

    Swift

    public func getPeripheral<Desc: PeripheralClassDesc>(_ desc: Desc,
                              observer: @escaping Ref<Desc.ApiProtocol>.Observer) -> Ref<Desc.ApiProtocol>

    Parameters

    desc

    requested peripheral. See Peripherals api for available descriptors instances.

    observer

    observer to notify when the peripheral changes

    Return Value

    reference to the requested peripheral

  • Gets the remote control name and registers an observer notified each time it changes.

    If the remote control is removed, the observer will be notified and the referenced value is set to nil.

    Note

    This method is for Objective-C only. Swift must use func getName:observer.

    Seealso

    property name to get current name without registering an observer

    Declaration

    Swift

    @objc(getNameRef:)
    func getNameRef(observer: @escaping (String?) -> Void) -> GSNameRef

    Parameters

    observer

    observer to notify when the remote control name changes

    Return Value

    reference to remote control name

  • Gets the remote control state and registers an observer notified each time it changes.

    If the remote control is removed, the observer will be notified and the referenced value is set to nil.

    Note

    This method is for Objective-C only. Swift must use func getState:observer.

    Seealso

    property state to get current state without registering an observer

    Declaration

    Swift

    @objc(getStateRef:)
    func getStateRef(observer: @escaping (DeviceState?) -> Void) -> GSDeviceStateRef

    Parameters

    observer

    observer to notify when the remote control state changes

    Return Value

    reference to remote control state

  • Gets an instrument.

    Note

    This method is for Objective-C only. Swift must use func getInstrument:.

    Declaration

    Swift

    @objc(getInstrument:)
    func getInstrument(desc: ComponentDescriptor) -> Instrument?

    Parameters

    desc

    requested instrument. See Instruments api for available descriptors instances.

    Return Value

    requested instrument

  • Gets a instrument and registers an observer notified each time it changes.

    Note

    this method is for Objective-C only. Swift must use func getInstrument:desc:observer.

    Declaration

    Swift

    @objc(getInstrument:observer:)
    func getInstrumentRef(desc: ComponentDescriptor, observer: @escaping (Instrument?) -> Void)
        -> GSInstrumentRef

    Parameters

    desc

    requested instrument. See Instruments api for available descriptors instances.

    observer

    observer to notify when the instrument changes

    Return Value

    reference to the requested instrument

  • Gets a peripheral.

    Note

    This method is for Objective-C only. Swift must use func getPeripheral:.

    Declaration

    Swift

    @objc(getPeripheral:)
    func getPeripheral(desc: ComponentDescriptor) -> Peripheral?

    Parameters

    desc

    requested peripheral. See Peripherals api for available descriptors instances.

    Return Value

    requested peripheral

  • Gets a peripheral and registers an observer notified each time it changes.

    Note

    This method is for Objective-C only. Swift must use func getPeripheral:desc:observer.

    Declaration

    Swift

    @objc(getPeripheral:observer:)
    func getPeripheralRef(desc: ComponentDescriptor, observer: @escaping (Peripheral?) -> Void)
        -> GSPeripheralRef

    Parameters

    desc

    requested peripheral. See Peripherals api for available descriptors instances.

    observer

    observer to notify when the peripheral changes

    Return Value

    reference to the requested peripheral