Поделиться через


BluetoothDevice.ConnectGatt Метод

Определение

Перегрузки

ConnectGatt(Context, Boolean, BluetoothGattCallback)

Подключитесь к серверу GATT, размещенного на этом устройстве.

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports)

Подключитесь к серверу GATT, размещенного на этом устройстве.

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy)

Подключитесь к серверу GATT, размещенного на этом устройстве.

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy)
Устаревшие..
ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy, Handler)

Подключитесь к серверу GATT, размещенного на этом устройстве.

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy, Handler)
Устаревшие..

ConnectGatt(Context, Boolean, BluetoothGattCallback)

Подключитесь к серверу GATT, размещенного на этом устройстве.

[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;)Landroid/bluetooth/BluetoothGatt;", "")]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;)Landroid/bluetooth/BluetoothGatt;", "")>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback -> Android.Bluetooth.BluetoothGatt

Параметры

context
Context
autoConnect
Boolean

Следует ли напрямую подключаться к удаленному устройству (false) или автоматически подключаться, как только удаленное устройство становится доступным (true).

callback
BluetoothGattCallback

Обработчик обратного вызова GATT, который получит асинхронные обратные вызовы.

Возвращаемое значение

Атрибуты

Исключения

Значение NULL, если обратный вызов имеет значение NULL

Комментарии

Документация по Java для android.bluetooth.BluetoothDevice.connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback).

Части этой страницы — это изменения на основе работы, созданной и общей проектом с открытым исходным кодом Android и используемой в соответствии с условиями, описанными в лицензии Creative Commons 2.5 Attribution.

Применяется к

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports)

Подключитесь к серверу GATT, размещенного на этом устройстве.

[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;I)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=23)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;I)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=23)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports -> Android.Bluetooth.BluetoothGatt

Параметры

context
Context
autoConnect
Boolean

Следует ли напрямую подключаться к удаленному устройству (false) или автоматически подключаться, как только удаленное устройство становится доступным (true).

callback
BluetoothGattCallback

Обработчик обратного вызова GATT, который получит асинхронные обратные вызовы.

transport
BluetoothTransports

Предпочтительный транспорт для подключений GATT к удаленным устройствам BluetoothDevice#TRANSPORT_AUTO с двойным режимом или BluetoothDevice#TRANSPORT_BREDRBluetoothDevice#TRANSPORT_LE

Возвращаемое значение

Атрибуты

Комментарии

Документация по Java для android.bluetooth.BluetoothDevice.connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int).

Части этой страницы — это изменения на основе работы, созданной и общей проектом с открытым исходным кодом Android и используемой в соответствии с условиями, описанными в лицензии Creative Commons 2.5 Attribution.

Применяется к

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy)

Подключитесь к серверу GATT, размещенного на этом устройстве.

[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;II)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.BluetoothPhy phy);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;II)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.BluetoothPhy -> Android.Bluetooth.BluetoothGatt

Параметры

context
Context
autoConnect
Boolean

Следует ли напрямую подключаться к удаленному устройству (false) или автоматически подключаться, как только удаленное устройство становится доступным (true).

callback
BluetoothGattCallback

Обработчик обратного вызова GATT, который получит асинхронные обратные вызовы.

transport
BluetoothTransports

Предпочтительный транспорт для подключений GATT к удаленным устройствам BluetoothDevice#TRANSPORT_AUTO с двойным режимом или BluetoothDevice#TRANSPORT_BREDRBluetoothDevice#TRANSPORT_LE

phy
BluetoothPhy

Предпочтительный PHY для подключений к удаленному устройству LE. Битовое ИЛИ любого из BluetoothDevice#PHY_LE_1M_MASK, BluetoothDevice#PHY_LE_2M_MASKи BluetoothDevice#PHY_LE_CODED_MASK. Этот параметр не действует, если autoConnect задано значение true.

Возвращаемое значение

Атрибуты

Комментарии

Документация по Java для android.bluetooth.BluetoothDevice.connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int, int).

Части этой страницы — это изменения на основе работы, созданной и общей проектом с открытым исходным кодом Android и используемой в соответствии с условиями, описанными в лицензии Creative Commons 2.5 Attribution.

Применяется к

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy)

Внимание!

This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.

[System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.LE.ScanSettingsPhy phy);
[<System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.LE.ScanSettingsPhy -> Android.Bluetooth.BluetoothGatt

Параметры

context
Context
autoConnect
Boolean

Возвращаемое значение

Атрибуты

Комментарии

Части этой страницы — это изменения на основе работы, созданной и общей проектом с открытым исходным кодом Android и используемой в соответствии с условиями, описанными в лицензии Creative Commons 2.5 Attribution.

Применяется к

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, BluetoothPhy, Handler)

Подключитесь к серверу GATT, размещенного на этом устройстве.

[Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;IILandroid/os/Handler;)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)]
[Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.BluetoothPhy phy, Android.OS.Handler? handler);
[<Android.Runtime.Register("connectGatt", "(Landroid/content/Context;ZLandroid/bluetooth/BluetoothGattCallback;IILandroid/os/Handler;)Landroid/bluetooth/BluetoothGatt;", "", ApiSince=26)>]
[<Android.Runtime.RequiresPermission("android.permission.BLUETOOTH_CONNECT")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.BluetoothPhy * Android.OS.Handler -> Android.Bluetooth.BluetoothGatt

Параметры

context
Context
autoConnect
Boolean

Следует ли напрямую подключаться к удаленному устройству (false) или автоматически подключаться, как только удаленное устройство становится доступным (true).

callback
BluetoothGattCallback

Обработчик обратного вызова GATT, который получит асинхронные обратные вызовы.

transport
BluetoothTransports

Предпочтительный транспорт для подключений GATT к удаленным устройствам BluetoothDevice#TRANSPORT_AUTO с двойным режимом или BluetoothDevice#TRANSPORT_BREDRBluetoothDevice#TRANSPORT_LE

phy
BluetoothPhy

Предпочтительный PHY для подключений к удаленному устройству LE. Битовая ИЛИ любого из BluetoothDevice#PHY_LE_1M_MASK, BluetoothDevice#PHY_LE_2M_MASKdBluetoothDevice#PHY_LE_CODED_MASK. Этот параметр не действует, если autoConnect задано значение true.

handler
Handler

Обработчик, используемый для обратного вызова. Если nullобратные вызовы будут выполняться в не указанном фоновом потоке.

Возвращаемое значение

Атрибуты

Комментарии

Документация по Java для android.bluetooth.BluetoothDevice.connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int, int, android.os.Handler).

Части этой страницы — это изменения на основе работы, созданной и общей проектом с открытым исходным кодом Android и используемой в соответствии с условиями, описанными в лицензии Creative Commons 2.5 Attribution.

Применяется к

ConnectGatt(Context, Boolean, BluetoothGattCallback, BluetoothTransports, ScanSettingsPhy, Handler)

Внимание!

This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.

[System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")]
public Android.Bluetooth.BluetoothGatt? ConnectGatt (Android.Content.Context? context, bool autoConnect, Android.Bluetooth.BluetoothGattCallback? callback, Android.Bluetooth.BluetoothTransports transport, Android.Bluetooth.LE.ScanSettingsPhy phy, Android.OS.Handler? handler);
[<System.Obsolete("This method has the wrong enumeration. Use the version that takes an 'Android.Bluetooth.BluetoothPhy' instead.")>]
member this.ConnectGatt : Android.Content.Context * bool * Android.Bluetooth.BluetoothGattCallback * Android.Bluetooth.BluetoothTransports * Android.Bluetooth.LE.ScanSettingsPhy * Android.OS.Handler -> Android.Bluetooth.BluetoothGatt

Параметры

context
Context
autoConnect
Boolean
handler
Handler

Возвращаемое значение

Атрибуты

Комментарии

Части этой страницы — это изменения на основе работы, созданной и общей проектом с открытым исходным кодом Android и используемой в соответствии с условиями, описанными в лицензии Creative Commons 2.5 Attribution.

Применяется к