Guides and Sample Code

Developer

Playground Book Format Reference

PlaygroundBluetoothCentralManagerDelegate

A delegate you use to respond to peripheral discovery and manage the lifecycle of connections.
あなたが周辺機器発見に応答するためにそして接続のライフサイクルを管理するために使うデリケート。

Instance Methods
インスタンスメソッド

centralManagerStateDidChange(_:)

Tells the delegate that the state of the central manager has changed.
セントラルマネージャの状態が変更されたことをデリゲートに伝えます。

Required. Default implementation provided.
必須。省略時の実装の提供。

Declaration
宣言

  • func centralManagerStateDidChange(_ centralManager: PlaygroundBluetoothCentralManager)

Parameters
パラメータ

centralManager

The central manager providing this information.
この情報を提供しているセントラルマネージャ。

centralManager(_:didDiscover:withAdvertisementData:rssi:)

Tells the delegate that a peripheral has been discovered during scanning.
周辺機器が走査している間に発見されたことをデリゲートに伝えます。

Required. Default implementation provided.
必須。省略時の実装の提供。

Declaration
宣言

  • func centralManager(_ centralManager: PlaygroundBluetoothCentralManager, didDiscover peripheral: CBPeripheral, withAdvertisementData advertisementData: [String: Any]?, rssi: Double)

Parameters
パラメータ

centralManager

The central manager providing this information.
この情報を提供しているセントラルマネージャ。

peripheral

The newly-discovered peripheral.

advertisementData

A dictionary containing any advertisement data that the peripheral provides.
周辺機器が提供する何らかの告知データを含んでいる辞書。

rssi

The current received signal strength indicator of the peripheral in decibels.
デシベルでの周辺機器の現在の受信信号強度表示器。

centralManager(_:willConnectTo:)

Tells the delegate that the central manager is about to attempt to establish a connection with a peripheral.
セントラルマネージャがまさにある周辺機器との接続の確立を試みようとしていることをデリゲートに伝えます。

Required. Default implementation provided.
必須。省略時の実装の提供。

Declaration
宣言

  • func centralManager(_ centralManager: PlaygroundBluetoothCentralManager, willConnectTo peripheral: CBPeripheral)

Parameters
パラメータ

centralManager

The central manager attempting the new connection.
新しい接続を試みているセントラルマネージャ。

peripheral

The peripheral that the central manager is attempting to connect to.
セントラルマネージャがそれに接続しようと試みている周辺機器。

centralManager(_:didConnectTo:)

Tells the delegate that the central manager established a connection with a peripheral.
セントラルマネージャが周辺機器との接続を確立したことをデリゲートに伝えます。

Required. Default implementation provided.
必須。省略時の実装の提供。

Declaration
宣言

  • func centralManager(_ centralManager: PlaygroundBluetoothCentralManager, didConnectTo peripheral: CBPeripheral)

Parameters
パラメータ

centralManager

The central manager that made the new connection.
新しい接続を作ったセントラルマネージャ。

peripheral

The newly connected peripheral.
新しく接続された周辺機器。

centralManager(_:didFailToConnectTo:error:)

Tells the delegate that the central manager failed to establish a connection with a peripheral.
セントラルマネージャが周辺機器との接続を確立するのに失敗したことをデリゲートに伝えます。

Required. Default implementation provided.
必須。省略時の実装の提供。

Declaration
宣言

  • func centralManager(_ centralManager: PlaygroundBluetoothCentralManager, didFailToConnectTo peripheral: CBPeripheral, error: Error?)

Parameters
パラメータ

centralManager

The central manager that failed to make the new connection.
新しい接続を作るのに失敗したセントラルマネージャ。

peripheral

The peripheral that the central manager couldn’t connect to.
セントラルマネージャがそれに対して接続できなかった周辺機器。

error

An error which describes the reason for the connection failure.
あるエラー、接続失敗の理由を表します。

centralManager(_:didDisconnectFrom:error:)

Tells the delegate that the central manager disconnected from a peripheral.
セントラルマネージャがある周辺機器から切断されたことをデリゲートに伝えます。

Required. Default implementation provided.
必須。省略時の実装の提供。

Declaration
宣言

  • func centralManager(_ centralManager: PlaygroundBluetoothCentralManager, didDisconnectFrom peripheral: CBPeripheral, error: Error?)

Parameters
パラメータ

centralManager

The central manager that disconnected from a peripheral.
周辺機器から切断されたセントラルマネージャ。

peripheral

The peripheral that the central manager disconnected from.
セントラルマネージャがそれから切断された周辺機器。

error

An error which, if present, describes the reason for the connection failure. The absence of an error indicates that the disconnection was requested via the manager’s disconnect(from:) method.
あるエラー、もし存在するならば、それは接続失敗の理由を記述します。エラーの不在は、切断がマネージャの持つdisconnect(from:)メソッド経由で要求されたことを指し示します。