DDController

class DDController: NSObject

An instance of a Daydream View controller.

  • An array of currently connected controllers.

    Declaration

    Swift

    static fileprivate(set) var controllers = [DDController]()
  • The battery level of the controller. Note: Call updateBatteryLevel on the controller object periodically to update this value.

    Declaration

    Swift

    fileprivate(set) var batteryLevel: Float?
  • The manufacturer of the controller.

    Declaration

    Swift

    fileprivate(set) var manufacturer: String?
  • The firmware version of the controller.

    Declaration

    Swift

    fileprivate(set) var firmwareVersion: String?
  • The serial number of the controller.

    Declaration

    Swift

    fileprivate(set) var serialNumber: String?
  • The model number of the controller.

    Declaration

    Swift

    fileprivate(set) var modelNumber: String?
  • The hardware version of the controller.

    Declaration

    Swift

    fileprivate(set) var hardwareVersion: String?
  • The software version of the controller.

    Declaration

    Swift

    fileprivate(set) var softwareVersion: String?
  • Starts discovery of Daydream View controllers.

    To be notified when a controller connects, subscribe to the DDControllerDidConnect notification. To be notified when a controller disconnects, subscribe to the DDControllerDidDisconnect notification. The object on the notification will be the newly connected or disconnected DDController.

    This function throws a DDControllerError if Bluetooth is turned off.

    Declaration

    Swift

    class func startDaydreamControllerDiscovery() throws
  • Stops discovery of Daydream View controllers.

    Declaration

    Swift

    class func stopDaydreamControllerDiscovery()
  • Updates the controller’s battery level. To be notified when the battery level update completes, subscribe to the DDControllerDidUpdateBatteryLevel notification. The object on the notification will be an instance of DDController with the updated batteryLevel.

    Declaration

    Swift

    public func updateBatteryLevel()
  • Called when services are discovered on the peripheral.

    Declaration

    Swift

    func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?)
  • Called when characteristics are discovered for one of the elements of services, which represents the services (whose UUIDs are members of DDController.serviceUUIDs) of the peripheral.

    Declaration

    Swift

    func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?)
  • Called when a characteristic value is read and returned by the device.

    Declaration

    Swift

    func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?)