Class

IOBluetoothDevice

An instance of IOBluetoothDevice represents a single remote Bluetooth device.

Overview

An IOBluetoothDevice object may exist independent of the existence of a baseband connection with the target device. Using this object, a client can request creation and destruction of baseband connections, and request the opening of L2CAP and RFCOMM channels on the remote device. Many of the other APIs in the IOBluetooth framework will return this object, or it's C counterpart (IOBluetoothDeviceRef).

Topics

Initializers

init!(address: UnsafePointer<BluetoothDeviceAddress>!)

Returns the IOBluetoothDevice object for the given BluetoothDeviceAddress

init!(addressString: String!)

Returns the IOBluetoothDevice object for the given BluetoothDeviceAddress

Instance Properties

var addressString: String!

Get a string representation of the Bluetooth device address for the target device. The format of the string is the same as returned by IOBluetoothNSStringFromDeviceAddress().

var classOfDevice: BluetoothClassOfDevice

Gets the full class of device value for the remote device.

var connectionHandle: BluetoothConnectionHandle

Get the connection handle for the baseband connection.

var deviceClassMajor: BluetoothDeviceClassMajor

Get the major device class of the device.

var deviceClassMinor: BluetoothDeviceClassMinor

Get the minor service class of the device.

var lastNameUpdate: Date!

Get the date/time of the last successful remote name request.

var name: String!

Get the human readable name of the remote device.

var nameOrAddress: String!

Get the human readable name of the remote device. If the name is not present, it will return a string containing the device's address.

var serviceClassMajor: BluetoothServiceClassMajor

Get the major service class of the device.

var services: [Any]!

Gets an array of service records for the device.

Instance Methods

func rssi() -> BluetoothHCIRSSIValue

Get the RSSI device (if connected), above or below the golden range. If the RSSI is within the golden range, a value of 0 is returned. For the actual RSSI value, use getRawRSSI. For more information, see the Bluetooth 4.0 Core Specification.

func addToFavorites() -> IOReturn

Adds the target device to the user's favorite devices list.

func closeConnection() -> IOReturn

Close down the baseband connection to the device.

func getAddress() -> UnsafePointer<BluetoothDeviceAddress>!

Get the Bluetooth device address for the target device.

func getClockOffset() -> BluetoothClockOffset

Get the clock offset value of the device.

func getEncryptionMode() -> BluetoothHCIEncryptionMode

Get the encryption mode for the baseband connection.

func getLastInquiryUpdate() -> Date!

Get the date/time of the last time the device was returned during an inquiry.

func getLastServicesUpdate() -> Date!

Get the date/time of the last SDP query.

func getLinkType() -> BluetoothLinkType

Get the link type for the baseband connection.

func getPageScanMode() -> BluetoothPageScanMode

Get the page scan mode for the device.

func getPageScanPeriodMode() -> BluetoothPageScanPeriodMode

Get the value of the page scan period mode for the device.

func getPageScanRepetitionMode() -> BluetoothPageScanRepetitionMode

Get the value of the page scan repetition mode for the device.

func getServiceRecord(for: IOBluetoothSDPUUID!) -> IOBluetoothSDPServiceRecord!

Search for a service record containing the given UUID.

func isConnected() -> Bool

Indicates whether a baseband connection to the device exists.

func isFavorite() -> Bool

Reports whether the target device is a favorite for the user.

func isIncoming() -> Bool

Returns TRUE if the device connection was generated by the remote host.

func isPaired() -> Bool

Returns whether the target device is paired.

func openConnection() -> IOReturn

Create a baseband connection to the device.

func openConnection(Any!) -> IOReturn

Create a baseband connection to the device.

func openL2CAPChannelAsync(AutoreleasingUnsafeMutablePointer<IOBluetoothL2CAPChannel?>!, withPSM: BluetoothL2CAPPSM, delegate: Any!) -> IOReturn

Opens a new L2CAP channel to the target device. Returns immediately after starting the opening process.

func performSDPQuery(Any!) -> IOReturn

Performs an SDP query on the target device.

func performSDPQuery(Any!, uuids: [Any]!) -> IOReturn

Performs an SDP query on the target device with the specified service UUIDs.

func rawRSSI() -> BluetoothHCIRSSIValue

Get the raw RSSI device (if connected).

func recentAccessDate() -> Date!

Returns the date/time of the most recent access of the target device.

func remoteNameRequest(Any!) -> IOReturn

Issues a remote name request to the target device.

func removeFromFavorites() -> IOReturn

Removes the target device from the user's favorite devices list.

func requestAuthentication() -> IOReturn

Requests that the existing baseband connection be authenticated.

func sendL2CAPEchoRequest(UnsafeMutableRawPointer!, length: UInt16) -> IOReturn

Send an echo request over the L2CAP connection to a remote device.

func setSupervisionTimeout(UInt16) -> IOReturn

Sets the connection supervision timeout.

Type Methods

class func favoriteDevices() -> [Any]!

Gets an array of the user's favorite devices.

class func pairedDevices() -> [Any]!

Gets an array of all of the paired devices on the system.

class func recentDevices(UInt) -> [Any]!

Gets an array of recently used Bluetooth devices.

class func register(forConnectNotifications: Any!, selector: Selector!) -> IOBluetoothUserNotification!

Allows a client to register for device connect notifications for any connection.