您的位置:首页 > 移动开发 > Android开发

4000 蓝牙BLE开发基础教程 android5.0 蓝牙4.0 透传 Android Studio(三)

2017-04-06 17:13 417 查看
六、收发数据

发送示例

byte[] senddatas =new byte[]{1,2,3,4,34,56,78,90};
bluetoothGattCharacteristic.setValue(senddatas);
bluetoothGatt.writeCharacteristic(bluetoothGattCharacteristic);


接收示例

//在onCharacteristicChanged()中加入以下处理代码
{
byte[] bytesreceive = characteristic.getValue();
Log.e(TAG,bytesreceive[0]+""+bytesreceive[1]+""+bytesreceive[2]+""+bytesreceive[4])
}


下面附上制作完成的Android项目文件





点击这里下载 http://download.csdn.net/detail/deweikaiwen/9808901
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐