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?
-
The touch pad of the device.
Declaration
Swift
fileprivate(set) var touchpad: DDControllerTouchpad
-
The
app
button, which is the top button on the front of the controller.Declaration
Swift
fileprivate(set) var appButton: DDControllerButton
-
The home button, which is the bottom button on the front of the controller.
Declaration
Swift
fileprivate(set) var homeButton: DDControllerButton
-
The volume up button on the right side of the controller.
Declaration
Swift
fileprivate(set) var volumeUpButton: DDControllerButton
-
The volume down button on the right side of the controller.
Declaration
Swift
fileprivate(set) var volumeDownButton: DDControllerButton
-
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 theDDControllerDidDisconnect
notification. Theobject
on the notification will be the newly connected or disconnectedDDController
.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. Theobject
on the notification will be an instance ofDDController
with the updatedbatteryLevel
.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 ofDDController.serviceUUIDs
) of theperipheral
.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?)