Provided from API 5: Basic Functions
- BluetoothAdapter
- Represents the local Bluetooth adapter (Bluetooth radio). 代表手機上的籃芽裝置?
- 藍芽的工作基本上都得透過它來完成。
- BluetoothAdapter.getDefaultAdapter();
- 可這樣取得,若取到的是 null,也就表示此手機不支援籃芽。
- ACTION_REQUEST_ENABLE
- 可呼叫開啟籃芽的畫面。
- enable()/disable()
- 不經過 user 同意便能開啟/關閉藍芽。
- STATE_ON/STATE_OFF
- 是否開啟藍芽的狀態。
- Enable discovered
- ACTION_REQUEST_DISCOVERABLE
- 可透過這個 action 開啟一個畫面,取得 user 同意讓 device 可被搜尋到(若藍芽尚未開啟,便會直接開啟)。
- EXTRA_DISCOVERABLE_DURATION
- 送出上列 action 時可以設定被搜尋的時間長度。
- ACTION_SCAN_MODE_CHANGED
- 註冊此 action 可以接收搜尋的狀態的改變。
- EXTRA_SCAN_MODE
- EXTRA_PREVIOUS_SCAN_MODE
- SCAN_MODE_CONNECTABLE
- Not in discoverable mode but still able to receive connections
- SCAN_MODE_CONNECTABLE_DISCOVERABLE
- Discoverable mode
- SCAN_MODE_NONE
- Not in discoverable mode and unable to receive connections.
- Get paired devices
- Discovery devices
- BluetoothDevice
- 連線中 device 的相關資訊。
- Connection - Server
- Connection - Client
- BluetoothSocket
- BluetoothDevice.createRfcommSocketToServiceRecord(UUID uuid)
- connect()
- Permissions
- BLUETOOTH
- 讓程式有權限連接裝置、傳輸資料。
- BLUETOOTH_ADMIN
- 讓程式有權限搜尋裝置及設定藍芽。
Provided from API 11: Working with Profiles
- BluetoothProfile
- A Bluetooth profile is a wireless interface specification for Bluetooth-based communication between devices.
- BluetoothProfile.ServiceListener
- The internal service that runs a particular profile
- BluetoothA2dp
- A2dp: Advanced Audio Distribution Profile
- Defines how high quality audio can be streamed from one device to another over a Bluetooth connection.
- To control the Bluetooth A2DP profile.
- Only supports one connected Bluetooth A2dp device at a time.
- BluetoothAssignedNumbers
- Only include Company ID values.
- Company Identifiers
- BluetoothHeadset
- Provides support for Bluetooth headsets to be used with mobile phones.
- Controlling the Bluetooth Headset(Handsfree v1.5) Service.
- Only supports one connected Bluetooth Headset at a time.
Provided from API 14: Bluetooth Health Devices
- 提供使用藍芽進行健康照護,透過藍芽與監視裝置連線
- BluetoothHealth
- A proxy object for controlling the Bluetooth Service via IPC.BluetoothHealthCallback
- 接收所監視的資訊與藍芽狀態。
- BluetoothHealthAppConfiguration
- 會從 BluetoothHealthCallback 得到此物件,其中關於連線設備的設定資訊。
- ex: 可由 configuration 資訊來 initiate and terminate connections。
* Reference
- Bluetooth | Android Developers
- Bluetooth Glossary
沒有留言:
張貼留言