设备连接丢失

时间:2019-07-25 10:06:16

标签: plugins android-bluetooth

我无法通过使用cordova-plugin-bluetooth-serial将星系选项卡A蓝牙与某些其他设备连接。我正在使用Mendix,它是一个混合应用程序

我曾经像一个月前那样连接它们,但不知何故我无法再连接它。我尝试同时使用bluetoothserial.connectInsecure和bluetoothserial.connect

// this is a connecting part.. it always say that Device connection was lost
function ConnectBluetoothDevice(address) {
    // BEGIN USER CODE
    if(address == "" || address == null){
        alert("No address");
        return Promise.reject(false);
    }
    else {
    bluetoothSerial.connectInsecure(address, 
    function(){

        return Promise.resolve(true);
    }, function(error){
        alert(error);
        return Promise.reject(false);
    });
    }
    // END USER CODE
}
//This part is always say that Device is connected after that first attempt //to connect even though it's not connected at all

function DeviceIsConnected() {
    // BEGIN USER CODE
    return new Promise(function(resolve){
        bluetoothSerial.isConnected(
            function() {
                resolve(true);
            },
            function(error) {
                alert(error);
                resolve(false);
            }
    );
    }
);
    // END USER CODE
}

我不确定这是由我的不同Mendix版本还是由其他设备的软件版本引起的,但是其他蓝牙终端应用程序是否可以正常连接到这些设备。希望我能在这里找到一些线索

0 个答案:

没有答案