Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通信问题 #2

Open
ADsuper opened this issue Oct 25, 2021 · 1 comment
Open

通信问题 #2

ADsuper opened this issue Oct 25, 2021 · 1 comment

Comments

@ADsuper
Copy link

ADsuper commented Oct 25, 2021

你好,最近在尝试使用这个蓝牙库,有几个问题想请教一下,期待大佬回复。

第一个,低功耗蓝牙的 UUID 怎么传,需要进行蓝牙通信。

第二个,通信时,传输 JSON 数据,应该怎么写。Demo 中的看不太明白。

sender.send(new byte[]{0x01, 0x02}, new SendCallBack() {
@OverRide
public void onSending() {
Log.i(TAG, "命令发送中...");
}
Demo 中 通信时,在 log 中也没看到 onSending() 和 onReceived() 的回调

@g-HJY
Copy link
Owner

g-HJY commented Nov 10, 2021

你好,感谢你的使用。针对第一个问题,我完善下代码,发布新版本
第一个问题:低功耗蓝牙UUID一般有主服务UUID(SERVICE UUID),特征读写UUID,通知UUID(NOTIFY UUID),根据需要对应修改即可,若仍有疑问可单独联系。
第二个问题:传输JSON数据,传输之前将json字符串转换成byte数组再传即可,demo中的发命令只是一个简单演示

@g-HJY g-HJY closed this as completed Dec 3, 2021
@g-HJY g-HJY reopened this Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants