Java Android设备上的QT Creator蓝牙广告
我想用Qt Creator编写我的bluetooth observer代码。使用android studio SDK,我可以通过以下回调函数读取自定义广告数据:Java Android设备上的QT Creator蓝牙广告,java,android,qt,bluetooth,qt-creator,Java,Android,Qt,Bluetooth,Qt Creator,我想用Qt Creator编写我的bluetooth observer代码。使用android studio SDK,我可以通过以下回调函数读取自定义广告数据: private BluetoothAdapter.LeScanCallback mLeScanCallback; { mLeScanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan
private BluetoothAdapter.LeScanCallback mLeScanCallback;
{
mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
Data = scanRecord;
// Convert Hex to String
int temp, digit1,digit0;
stringData="";
for (int i = 1; i < Data.length; i++)
{
temp = Data[i] & 0xff;
digit1 = temp >> 0x04;
digit0 = temp & 0x0f;
stringData += String.valueOf(digit1) + String.valueOf(digit0);
}
RSSI = rssi;
runOnUiThread(new Runnable() {
@Override
public void run() {
mLeDeviceListAdapter.addDevice(device);
mLeDeviceListAdapter.notifyDataSetChanged();
}
});
}
};
}
private BluetoothAdapter.LeScanCallback mLeScanCallback;
{
mLeScanCallback=新的BluetoothAdapter.LeScanCallback(){
@凌驾
public void onLeScan(最终BluetoothDevice设备,int rssi,字节[]扫描记录){
数据=扫描记录;
//将十六进制转换为字符串
内部温度,数字1,数字0;
stringData=“”;
对于(int i=1;i>0x04;
数字0=温度&0x0f;
stringData+=String.valueOf(digit1)+String.valueOf(digit0);
}
RSSI=RSSI;
runOnUiThread(新的Runnable(){
@凌驾
公开募捐{
mLeDeviceListAdapter.addDevice(设备);
mLeDeviceListAdapter.notifyDataSetChanged();
}
});
}
};
}
使用QtCreator,我想做同样的事情,但我找不到读取广告数据的方法或函数。我可以读取地址和名称,但不能读取自定义用户数据。欢迎所有建议