Ras*_*ail 7 java buffer hex bluetooth character
我正在研究蓝牙,我正在尝试编写代码以便在连接时继续收听输入流,并且我遇到了以下代码片段:
int data = mmInStream.read();
if(data == 0x0A) {
} else if(data == 0x0D) {
buffer = new byte[arr_byte.size()];
for(int i = 0 ; i < arr_byte.size() ; i++) {
buffer[i] = arr_byte.get(i).byteValue();
}
// Send the obtained bytes to the UI Activity
mHandler.obtainMessage(BluetoothState.MESSAGE_READ
, buffer.length, -1, buffer).sendToTarget();
arr_byte = new ArrayList<Integer>();
} else {
arr_byte.add(data);
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释0x0A和0x0D之间的区别.并且还简要说明了这段代码.请分享您的观点.
| 归档时间: |
|
| 查看次数: |
27148 次 |
| 最近记录: |