标签: disconnection

在Android中断开蓝牙插座

我正在开发一个程序,其中从Android手机,我必须作为客户端连接到蓝牙医疗传感器.我正在使用官方蓝牙API并且在连接期间没有问题(SPP配置文件),但是当我结束插座时,传感器仍然连接到我的手机(虽然我已经关闭了连接).

有没有办法让蓝牙断开连接?我认为有一个名为ACTION_ACL_CONNECTED的意图,它就是这样做的.任何人都可以解释我如何使用它?

提前致谢.

编辑:这是代码,如果有人需要其他信息,它是一个Nonin 4100医疗传感器.

Set<BluetoothDevice> pairedDevices = Activa.myBluetoothAdapter.getBondedDevices();
        // If there are paired devices
        if (pairedDevices.size() > 0) {
            // Loop through paired devices
            for (BluetoothDevice device : pairedDevices) {
                // Add the name and address to an array adapter to show in a ListView
                String name = device.getName();
                if (name.contains("Nonin")) {
                    try {
                        found = true;
//                      socket = device.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
//                      handler.sendEmptyMessage(5);
//                      Activa.myBluetoothAdapter.cancelDiscovery();
//                      socket.connect();
                        BluetoothDevice hxm = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(device.getAddress());
                        Method m;
                        try {
                            m = hxm.getClass().getMethod("createRfcommSocket", new …
Run Code Online (Sandbox Code Playgroud)

android bluetooth disconnection

40
推荐指数
3
解决办法
7万
查看次数

Linux Socket:如何在客户端程序中检测断开的网络?

我正在调试基于ac的linux socket程序.正如网站上提供的所有示例一样,我应用了以下结构:

sockfd= socket(AF_INET, SOCK_STREAM, 0);

connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr));

send_bytes = send(sockfd, sock_buff, (size_t)buff_bytes, MSG_DONTWAIT);
Run Code Online (Sandbox Code Playgroud)

当删除服务器关闭其服务器程序时,我可以检测到断开连接.但是如果我拔掉以太网电缆,send函数仍会返回正值而不是-1.

假设我无法更改服务器端,如何检查客户端程序中的网络连接?

c sockets linux send disconnection

13
推荐指数
1
解决办法
5万
查看次数

Android蓝牙外设:由对等方终止连接(状态19)

开发了一个应用程序,它充当外围设备并与其他设备连接(仅限中央).

它在具有操作系统版本6.0的设备中运行良好,但在Nougat 7.0中遇到了一些问题.

我收集了一些日志,在开发者选项中启用"Bluetooth HCI snoop log".

收集的日志:

W/bt_btm: btm_sec_disconnect : reason=19
W/bt_btif: btif_dm_generic_evt: event=33035
W/bt_btif: btif_dm_generic_evt: event=33035
W/bt_btm: btm_sec_send_hci_disconnect:  handle:0x41, reason=0x13
W/bt_btif: btif_dm_generic_evt: event=33035
W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016
W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0016
W/bt_btif: bta_gattc_conn_cback() - cif=5 connected=0 conn_id=5 reason=0x0016
W/bt_btif: bta_gattc_conn_cback() - cif=7 connected=0 conn_id=7 reason=0x0016
W/bt_btif: bta_dm_bl_change_cback : reason=22
W/bt_btif: bta_dm_bl_change_cback : reason=22
W/bt_btm: btm_sec_disconnected
W/bt_btif: conn.link_down.is_removed : 0
D/BtGatt.GattService: onClientConnected() serverIf: 6, connId=6, address=00:16:A4:13:1E:48, connected=false
W/bt_btif: btif_dm_upstreams_cback  ev: BTA_DM_LINK_DOWN_EVT
W/bt_btif: BTA_DM_LINK_DOWN_EVT. …
Run Code Online (Sandbox Code Playgroud)

android bluetooth disconnection bluetooth-peripheral pairing

7
推荐指数
1
解决办法
1780
查看次数

Flutter:关闭互联网连接后出错 - “将 io.flutter.console.FlutterConsoleFilter@70f92821 应用于 'W/zzajf (5265) 时出错”

我将 Firestore 用于我的 Flutter 应用程序。

当我在模拟器上禁用互联网连接时,控制台上会出现以下错误:

V/NativeCrypto( 6278): Read error: ssl=0xa4621708: I/O error during system call, Software caused connection abort
W/zzaeo   ( 6278): [{0}] Failed to resolve name. status={1}
V/NativeCrypto( 6278): Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
V/NativeCrypto( 6278): Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
W/zzajf   ( 6278): Failed closing connection
W/zzajf   ( 6278): javax.net.ssl.SSLException: Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
W/zzajf   ( 6278):  at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_write(Native Method)
W/zzajf …
Run Code Online (Sandbox Code Playgroud)

error-handling disconnection flutter

6
推荐指数
1
解决办法
3396
查看次数