Giter Club home page Giter Club logo

Comments (4)

M201370367 avatar M201370367 commented on July 17, 2024

具体是调用哪一个接口返回-7?建议也提供下Log。

from mijiasdk.

Tywei24 avatar Tywei24 commented on July 17, 2024

采用此接口:
XmBluetoothManager mXmBluetoothManager = XmBluetoothManager.getInstance();
int state = mXmBluetoothManager.getConnectStatus(mDeviceMac);
if (state == XmBluetoothManager.STATE_CONNECTED || state == XmBluetoothManager.STATE_CONNECTING) {
} else {
Log.e("tywei", "这里进行安全连接开始");
mXmBluetoothManager.secureConnect(mDeviceMac, connectResp);
}

先在public static final String ACTION_CONNECT_STATUS_CHANGED = "com.xiaomi.smarthome.bluetooth.connect_status_changed";回调中,输出有连接成功,并且设备也有连接成功的符号了。

过一会,又在这个回调中报-7
private Response.BleConnectResponse connectResp = new Response.BleConnectResponse() {
@OverRide
public void onResponse(int code, Bundle data) {
if (code == XmBluetoothManager.Code.REQUEST_SUCCESS) {//0
Log.e("tywei", "安全连接成功" + code);
enableNotify();
} else {
EventBus.getDefault().post(new BuleConnectStatus(false));
Log.e("tywei", "没有发现设备" + code);//报错点
mHandler.postDelayed(notFindDevice, 0);
}
}
};
01-29 18:04:50.418 14503-14503/com.xiaomi.smarthome:plugin0 E/tywei: 蓝牙连接建立了
01-29 18:05:05.708 14503-14503/com.xiaomi.smarthome:plugin0 E/tywei: 能否看到蓝牙连接的状态false
01-29 18:05:05.711 14503-14503/com.xiaomi.smarthome:plugin0 E/tywei: 没有发现设备-7

from mijiasdk.

badsdy avatar badsdy commented on July 17, 2024

如何提供log?

from mijiasdk.

M201370367 avatar M201370367 commented on July 17, 2024

-7表示连接超时了。APP和设备建立连接后设备需要收到设备返回的加密token才行。

from mijiasdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.