Android developers 翻訳 - android.bluetooth
ä»æ¥ã¯bluetoothã訳ãã¦ã¿ã¾ããããåèã¾ã§ã«ã
ã»ãªã³ã¯ãªã©æ¬å®¶ãµã¤ãã並è¡ãã¦åç
§ãã¦ä¸ããã
http://developer.android.com/intl/ja/reference/android/bluetooth/BluetoothAdapter.html
ã»public Methodsã¯æç²ãã¦è¨³ãã¦ãã¾ãããªã¯ã¨ã¹ããããã¾ãããä»ã®ã¡ã½ããã訳ãã¾ãï¼ï¼
-
-
-
- -
-
-
BluetoothAdapter
Class Overview
Represents the local device Bluetooth adapter. The BluetoothAdapter lets you perform fundamental Bluetooth tasks, such as initiate device discovery, query a list of bonded (paired) devices, instantiate a BluetoothDevice using a known MAC address, and create a BluetoothServerSocket to listen for connection requests from other devices.
âãã¼ã«ã«ããã¤ã¹ã®ãã«ã¼ãã¥ã¼ã¹ã¢ããã¿ã表ããã¾ãã BluetoothAdapterã«ãã£ã¦ãããã¤ã¹æ¢ç´¢éå§ããã³ãããã(ãã¢ã«ãªã£ã)ããã¤ã¹ãªã¹ãã®ã¯ã¨ãªãæ¢ç¥ã®MACã¢ãã¬ã¹ã使ã£ã¦BluetoothDeviceã®ã¤ã³ã¹ã¿ã³ãåãä»ããã¤ã¹ããã®æ¥ç¶ãªã¯ã¨ã¹ãããªã¹ã³ããçºã«BluetoothServerSocketãçæãçã¨ãã£ãåºæ¬çãªãã«ã¼ãã¥ã¼ã¹ã¿ã¹ã¯ãå®è¡ã§ããããã«ãªãã¾ãã
To get a BluetoothAdapter representing the local Bluetooth adapter, call the static getDefaultAdapter() method. Fundamentally, this is your starting point for all Bluetooth actions. Once you have the local adapter, you can get a set of BluetoothDevice objects representing all paired devices with getBondedDevices(); start device discovery with startDiscovery(); or create a BluetoothServerSocket to listen for incoming connection requests with listenUsingRfcommWithServiceRecord(String, UUID).
âãã¼ã«ã«ã®ãã«ã¼ãã¥ã¼ã¹ã¢ããã¿ã表ãBluetoothAdapterãåå¾ããçºã«ã¯ãstatic ã®getDefaultAdapter()ã¡ã½ãããã³ã¼ã«ãã¦ä¸ãããåºæ¬çã«ããããã¹ã¦ã®ãã«ã¼ãã¥ã¼ã¹ã¢ã¯ã·ã§ã³ã®éå§ãã¤ã³ãã«ãªãã¾ãããã¼ã«ã«ã¢ããã¿ãåå¾ããããgetBondedDevices()ã«ãã£ã¦ãã¢ã«ãªã£ã¦ããå
¨ã¦ã®ç«¯æ«ã表ãBluetoothDeviceãªãã¸ã§ã¯ããåå¾ãããã¨ãã§ãã¾ããstartDiscovery()ã§ããã¤ã¹æ¢ç´¢ãéå§ãããã¨ã§ãã¾ãããã¾ãlistenUsingRfcommWithServiceRecord(String,UUID)ã§ã¤ã³ã«ãã³ã°ã®æ¥ç¶è¦æ±ããªã¹ã³ããçºã®BluetoothServerSocketãçæãããã¨ãã§ãã¾ãã
Note: Most methods require the BLUETOOTH permission and some also require the BLUETOOTH_ADMIN permission.
â注æï¼ã»ã¨ãã©ã®ã¡ã½ããã§ã¯ãBLUETOOTHãã¼ããã·ã§ã³ãå¿
è¦ã¨ãªãã¾ããBLUETOOTHãADMINãã¼ããã·ã§ã³ãå¿
è¦ã¨ãªããã®ãããã¾ãã
-
-
- -
-
public Set
Since: API Level 5
Return the set of BluetoothDevice objects that are bonded (paired) to the local adapter.
Requires BLUETOOTH.
Returns
unmodifiable set of BluetoothDevice, or null on error
âãã¼ã«ã«ã¢ããã¿ã«ãã³ãããã(ãã¢ã«ãªã£ã)BluetoothDeviceãªãã¸ã§ã¯ãããªã¿ã¼ã³ãã¾ããBLUETOOTHãã¼ããã·ã§ã³å¿
è¦ã
ãªã¿ã¼ã³
å¤æ´ã§ããªãBluetoothDeviceãã¨ã©ã¼æã¯nullã
-
-
- -
-
public static synchronized BluetoothAdapter getDefaultAdapter ()
Since: API Level 5
Get a handle to the default local Bluetooth adapter.
Currently Android only supports one Bluetooth adapter, but the API could be extended to support more. This will always return the default adapter.
Returns
the default local adapter, or null if Bluetooth is not supported on this hardware platform
âããã©ã«ãã®ãã¼ã«ã«ãã«ã¼ãã¥ã¼ã¹ã¢ããã¿ã®ãã³ãã«ãåå¾ãã¾ãã
ç¾å¨Androidã§ã¯ãã«ã¼ãã¥ã¼ã¹ã¢ããã¿ãä¸ã¤ã ããµãã¼ããã¦ãã¾ãããAPIã¯ãã£ã¨ãµãã¼ãã§ããããã«æ¡å¼µã§ãã¾ãã常ã«ããã©ã«ãã®ã¢ããã¿ããªã¿ã¼ã³ãã¾ãã
ãªã¿ã¼ã³
ããã©ã«ãã®ãã¼ã«ã«ã¢ããã¿ããã¼ãã¦ã§ã¢ãã©ãããã©ã¼ã ã§ãã«ã¼ãã¥ã¼ã¹ããµãã¼ãããã¦ããªããã°nullã
-
-
- -
-
public BluetoothServerSocket listenUsingRfcommWithServiceRecord (String name, UUID uuid)
Since: API Level 5
Create a listening, secure RFCOMM Bluetooth socket with Service Record.
A remote device connecting to this socket will be authenticated and communication on this socket will be encrypted.
âãªã¹ãã¼ãçæãå®å
¨ãªRFCOMMãã«ã¼ãã¥ã¼ã¹ã½ã±ãããService Recordä»ãã§çæãã¾ãããã®ã½ã±ããã«æ¥ç¶ãã¦ãããªã¢ã¼ãããã¤ã¹ã¯èªè¨¼ãåãããã®ã½ã±ããä¸ã®éä¿¡ã¯æå·åããã¾ãã
Use accept() to retrieve incoming connections from a listening BluetoothServerSocket.
The system will assign an unused RFCOMM channel to listen on.
âBluetoothServerSocketããªã¹ã³ãã¦ãã¦å
¥ã£ã¦ããæ¥ç¶ãåãåºãã«ã¯accept()ã使ç¨ãã¦ä¸ããã
ã·ã¹ãã ã¯æªä½¿ç¨ã®RFCOMMãã£ãã«ããªã¹ã³ç¨ã«ã¢ãµã¤ã³ãã¾ãã
The system will also register a Service Discovery Protocol (SDP) record with the local SDP server containing the specified UUID, service name, and auto-assigned channel. Remote Bluetooth devices can use the same UUID to query our SDP server and discover which channel to connect to. This SDP record will be removed when this socket is closed, or if this application closes unexpectedly.
Use createRfcommSocketToServiceRecord(UUID) to connect to this socket from another device using the same UUID.
Requires BLUETOOTH
âã·ã¹ãã ã¯ã¾ãç¹å®UUIDããµã¼ãã¹åãèªåã¢ãµã¤ã³ãã£ãã«ãå«ãã ãã¼ã«ã«SDPãµã¼ããä¼´ã£ãSDPã¬ã³ã¼ã(Service Discovery Protocol recordï¼ãç»é²ãã¾ãããªã¢ã¼ãã®ãã«ã¼ãã¥ã¼ã¹ããã¤ã¹ã¯ãã¡ãã®SDPãµã¼ããã¯ã¨ãªããçºã¾ãã©ã®ãã£ãã«ã«æ¥ç¶ãããã決ããçºã«åãUUIDã使ç¨ãããã¨ãã§ãã¾ãããã®ã½ã±ãããã¯ãã¼ãºãããæãã¾ãã¯ãã®ã¢ããªã±ã¼ã·ã§ã³ãäºå®å¤ã«ã¯ãã¼ãºããå ´åã«ãã®SDPã¬ã³ã¼ãã¯é¤å»ããã¾ãã
ä»ããã¤ã¹ããåãUUIDã§ãã®ã½ã±ããã¸æ¥ç¶ããçºã«ã¯createRfcommSocketToServiceRecord(UUID)ã使ç¨ãã¦ä¸ããã
BLUETOOTHãã¼ããã·ã§ã³ãå¿
è¦ã
-
-
- -
-
public boolean startDiscovery ()
Since: API Level 5
Start the remote device discovery process.
The discovery process usually involves an inquiry scan of about 12 seconds, followed by a page scan of each new device to retrieve its Bluetooth name.
âãªã¢ã¼ãããã¤ã¹ã®æ¢ç´¢ããã»ã¹ãéå§ãã¾ãã
æ¢ç´¢ããã»ã¹ã«ã¯ãé常ç´12ç§ã®åãåããã¹ãã£ã³ãããã次ã«ããããã®æ°è¦ããã¤ã¹ã®ãã«ã¼ãã¥ã¼ã¹åãæ¢ãçºã®ãã¼ã¸ã¹ãã£ã³ãããã¾ãã
This is an asynchronous call, it will return immediately. Register for ACTION_DISCOVERY_STARTED and ACTION_DISCOVERY_FINISHED intents to determine exactly when the discovery starts and completes. Register for ACTION_FOUND to be notified as remote Bluetooth devices are found.
âéåæã³ã¼ã«ã§ããããã«ãªã¿ã¼ã³ããã¾ããACTION_DISCOVERY_STARTED, ACTION_DISCOVERY_FINISHEDã®ç»é²ã¯å³å¯ã«ãã¤æ¢ç´¢ãéå§ããããå®äºããããç¥ãçºã®ãã®ã§ããACTION_FOUNDãç»é²ããã¨ããªã¢ã¼ããã«ã¼ãã¥ã¼ã¹ããã¤ã¹ãè¦ã¤ããããæã«éç¥ããã¾ãã
Device discovery is a heavyweight procedure. New connections to remote Bluetooth devices should not be attempted while discovery is in progress, and existing connections will experience limited bandwidth and high latency. Use cancelDiscovery() to cancel an ongoing discovery. Discovery is not managed by the Activity, but is run as a system service, so an application should always call cancelDiscovery() even if it did not directly request a discovery, just to be sure.
âããã¤ã¹æ¢ç´¢ã¯éãå¦çã§ããæ¢ç´¢ä¸ãªã¢ã¼ããã«ã¼ãã¥ã¼ã¹ããã¤ã¹ã¸ã®æ°è¦æ¥ç¶ã¯è©¦ã¿ãã¹ãã§ã¯ãªããæ¢åã®æ¥ç¶ã§ã¯ãã³ãå¹
ãéå®ããããé·ãé
延ã«ãªãã¾ããå®è¡ä¸ã®æ¢ç´¢ããã£ã³ã»ã«ããã«ã¯cancelDiscovery()ã使ç¨ãã¦ä¸ãããæ¢ç´¢ã¯Activityã«ãã£ã¦ç®¡çããããã®ã§ã¯ãªããã·ã¹ãã ã®ãµã¼ãã¹ã¨ãã¦å®è¡ããã¾ãããã£ã¦ã¢ããªã±ã¼ã·ã§ã³ã¯ç´æ¥æ¢ç´¢ããªã¯ã¨ã¹ããã¦ããªãã¦ã常ã«cancelDiscovery()ãã³ã¼ã«ããã¹ãã§ãã念ã®ããã
Device discovery will only find remote devices that are currently discoverable (inquiry scan enabled). Many Bluetooth devices are not discoverable by default, and need to be entered into a special mode.
Requires BLUETOOTH_ADMIN.
âããã¤ã¹æ¢ç´¢ã§ã¯ç¾å¨discoverable(åãåããã¹ãã£ã³enabled)ã®ãªã¢ã¼ãããã¤ã¹ã®ã¿ãè¦ã¤ãã¾ãããã«ã¼ãã¥ã¼ã¹ããã¤ã¹ã®å¤ãã¯ããã©ã«ãã§discoverableã§ã¯ãªããç¹å¥ãªã¢ã¼ãã«å
¥ããã¨ãå¿
è¦ã«ãªãã¾ãã
BLUETOOTH_ADMINãã¼ããã·ã§ã³ãå¿
è¦ã