gaowenhao's recent timeline updates
gaowenhao

gaowenhao

V2EX member #326252, joined on 2018-07-02 15:11:23 +08:00
gaowenhao's recent replies
Jul 9, 2018
Replied to a topic by gaowenhao Android android 蓝牙连接硬件的密码校验过程
诸位,这个问题我理清了。
这个密码校验确实存在,硬件貌似管他叫始能,说白了就是 android 这边写一个密码给硬件硬件通过这个密码鉴别是不是自己人,确实过是自己人后才给发送数据,就是这样希望能帮到后来的人。

另外,感谢 chunchun1028 的回复。
Jul 4, 2018
Replied to a topic by gaowenhao Android android 蓝牙连接硬件的密码校验过程
希望有经验的大佬看到后能给点指点。
Jul 3, 2018
Replied to a topic by gaowenhao Android android 蓝牙连接硬件的密码校验过程
我连接的方法大体如下:
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice device = adapter.getRemoteDevice("硬件的 mac 地址");
device.connectGatt(MainActivity.this, false, bluetoothGattCallbackOne); //这里传入 callback 函数,


在 callback 中获取所有的 Service 中的 Characteristic,然后对这些 characteristic 进行 setCharacteristicNotification
这样 硬件那边有消息后,就会回掉这个回掉方法中的 onCharacteristicChanged。

但是必须开启一下配套的 app 才能在收到硬件打过来的数据,希望有此方面经验的大神能指点一二。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1143 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 17:36 · PVG 01:36 · LAX 10:36 · JFK 13:36
♥ Do have faith in what you're doing.