Android 蓝牙4.0(BLE)开发实现对蓝牙的写入数据和读取数据

Android-Ble蓝牙通讯开发–扫描,连接,发送和接收数据,分包解包(附源码) 万物互联的物联网时代的已经来临,ble蓝牙开发在其中扮演着举重若轻的角色。最近刚好闲一点,抽时间梳理下这块的知识点。 涉及ble蓝牙通讯的客户端(开启、扫描、连接、发送和接收数据、分包解包)和服务端(初始化广播数据、开始广播、配置Services、Server回调操作)整个环节以及一些常见的问题即踩过的一些坑。 阅读详情

From:http://blog.youkuaiyun.com/chenfengdejuanlian/article

/details/45787123

由于最近学校组织了一个移动APP(安卓)设计大赛,自己也学习安卓有一段时间了,就跟同学商量一起去参加试试,一拍即合,然后我们就开始想idea,因为最近可穿戴设备比较火,我们也就想试试。经过商量,我负责Android上位机的开发,同学负责下位机的开发。

上位机的开发主要是低功耗蓝牙BLE的开发,然后就开始找资料,各种找,最后谷歌官方提供的demo还有其他网友基于官方demo修改的demo,结合网上的博客对demo进行理解。刚开始是觉得看起来有点费劲,各种广播,跳来跳去的,刚开始就晕菜了。但是经过三四天的理解,算是把官方的demo理解了。

代码基本上都是官方的demo,只是通过修改获得自己想要的结果,下面就简单介绍一下自己的理解。

一、扫描BLE设备activity

检查该设备是否支持BLE设备,谷歌在Android4.3才开始支持BLE设备(晕死,很长一段时间都没有一台4.3的设备,看着程序修改了也不能测试!)。

[java]  view plain  copy
  1. if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {  
  2.            Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();  
  3.            finish();  
  4.        }  

初始化获得一个bluetoothManager,并检测设备是否支持蓝牙

[java]  view plain  copy
  1. final BluetoothManager bluetoothManager =  
  2.                 (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);  
  3.         mBluetoothAdapter = bluetoothManager.getAdapter();  
[java]  view plain  copy
  1. // Checks if Bluetooth is supported on the device.  
  2.         if (mBluetoothAdapter == null) {  
  3.             Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();  
  4.             finish();  
  5.             return;  
  6.         }  
扫描BLE设备,然后添加到listView里面。

[java]  view plain  copy
  1. private void scanLeDevice(final boolean enable) {  
  2.         if (enable) {  
  3.             // Stops scanning after a pre-defined scan period.  
  4.             mHandler.postDelayed(new Runnable() {  
  5.                 @Override  
  6.                 public void run() {  
  7.                     mScanning = false;  
  8.                     mBluetoothAdapter.stopLeScan(mLeScanCallback);  
  9.                     invalidateOptionsMenu();  
  10.                 }  
  11.             }, SCAN_PERIOD);  
  12.   
  13.             mScanning = true;  
  14.             mBluetoothAdapter.startLeScan(mLeScanCallback);  
  15.         } else {  
  16.             mScanning = false;  
  17.             mBluetoothAdapter.stopLeScan(mLeScanCallback);  
  18.         }  
  19.         invalidateOptionsMenu();  
  20.     }  

二、蓝牙控制的服务BluetoothLeService

在这个服务里面有一个很重要的回调函数BluetoothGattCallback(),蓝牙的数据读取和状态改变都会回调这个函数。

[java]  view plain  copy
  1. private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {  
  2.         @Override  
  3.         public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {  
  4.             String intentAction;  
  5.           //收到设备notify值 (设备上报值)  
  6.             if (newState == BluetoothProfile.STATE_CONNECTED) {  
  7.                 intentAction = ACTION_GATT_CONNECTED;  
  8.                 mConnectionState = STATE_CONNECTED;  
  9.                 broadcastUpdate(intentAction);  
  10.                 Log.i(TAG, "Connected to GATT server.");  
  11.                 // Attempts to discover services after successful connection.  
  12.                 Log.i(TAG, "Attempting to start service discovery:" +  
  13.                         mBluetoothGatt.discoverServices());  
  14.   
  15.             } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {  
  16.                 intentAction = ACTION_GATT_DISCONNECTED;  
  17.                 mConnectionState = STATE_DISCONNECTED;  
  18.                 Log.i(TAG, "Disconnected from GATT server.");  
  19.                 broadcastUpdate(intentAction);  
  20.             }  
  21.         }  
  22.   
  23.         @Override  
  24.         public void onServicesDiscovered(BluetoothGatt gatt, int status) {  
  25.             if (status == BluetoothGatt.GATT_SUCCESS) {  
  26.                 broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);  
  27.             } else {  
  28.                 Log.w(TAG, "onServicesDiscovered received: " + status);  
  29.                 System.out.println("onServicesDiscovered received: " + status);  
  30.             }  
  31.         }  
  32.   
  33.         @Override  
  34.         public void onCharacteristicRead(BluetoothGatt gatt,  
  35.                                          BluetoothGattCharacteristic characteristic,  
  36.                                          int status) {  
  37.             //读取到值,在这里读数据  
  38.             if (status == BluetoothGatt.GATT_SUCCESS) {  
  39.                 broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);  
  40.             }  
  41.         }  
  42.   
  43.         @Override  
  44.         public void onCharacteristicChanged(BluetoothGatt gatt,  
  45.                                             BluetoothGattCharacteristic characteristic) {  
  46.             broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);  
  47.         }  
  48.     };  
在官方的demo中还使用到广播,可能是因为人大神写的,要严谨些。我一开始看的时候就得这有点麻烦,跳转的多麻烦。

[java]  view plain  copy
  1. private void broadcastUpdate(final String action) {  
  2.         final Intent intent = new Intent(action);  
  3.         sendBroadcast(intent);  
  4.     }  
  5.   
  6.     private void broadcastUpdate(final String action,  
  7.                                  final BluetoothGattCharacteristic characteristic) {  
  8.         final Intent intent = new Intent(action);  
  9.   
  10.         // This is special handling for the Heart Rate Measurement profile.  Data parsing is  
  11.         // carried out as per profile specifications:  
  12.         // http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml  
  13.         if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {  
  14.             int flag = characteristic.getProperties();  
  15.             int format = -1;  
  16.             if ((flag & 0x01) != 0) {  
  17.                 format = BluetoothGattCharacteristic.FORMAT_UINT16;  
  18.                 Log.d(TAG, "Heart rate format UINT16.");  
  19.             } else {  
  20.                 format = BluetoothGattCharacteristic.FORMAT_UINT8;  
  21.                 Log.d(TAG, "Heart rate format UINT8.");  
  22.             }  
  23.             final int heartRate = characteristic.getIntValue(format, 1);  
  24.             Log.d(TAG, String.format("Received heart rate: %d", heartRate));  
  25.             intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));  
  26.         } else {  
  27.             // For all other profiles, writes the data formatted in HEX.对于所有的文件,写入十六进制格式的文件  
  28.             //这里读取到数据  
  29.             final byte[] data = characteristic.getValue();  
  30.             for (int i = 0; i < data.length; i++) {  
  31.                 System.out.println("data......" + data[i]);  
  32.             }  
  33.             if (data != null && data.length > 0) {  
  34.                 final StringBuilder stringBuilder = new StringBuilder(data.length);  
  35.                 for(byte byteChar : data)  
  36.                     //以十六进制的形式输出  
  37.                     stringBuilder.append(String.format("%02X ", byteChar));  
  38.                // intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());  
  39.                 intent.putExtra(EXTRA_DATA, new String(data));  
  40.             }  
  41.         }  
  42.         sendBroadcast(intent);  
  43.     }  
发送了广播之后就肯定有广播接收器,这个是在控制蓝牙的activity中,后面再说。

还有几个重要的函数比如readCharacteristic(BluetoothGattCharacteristic characteristic)函数,读取蓝牙中数据。

[java]  view plain  copy
  1. public void readCharacteristic(BluetoothGattCharacteristic characteristic) {  
  2.         if (mBluetoothAdapter == null || mBluetoothGatt == null) {  
  3.             Log.w(TAG, "BluetoothAdapter not initialized");  
  4.             return;  
  5.         }  
  6.         mBluetoothGatt.readCharacteristic(characteristic);  
  7.     }  
有readCharacteristic(BluetoothGattCharacteristic characteristic)函数,当然就有writeCharacteristic(BluetoothGattCharacteristic characteristic),向蓝牙中写入数据。

[java]  view plain  copy
  1. public void writeCharacteristic(BluetoothGattCharacteristic characteristic) {  
  2.       if (mBluetoothAdapter == null || mBluetoothGatt == null) {  
  3.           Log.w(TAG, "BluetoothAdapter not initialized");  
  4.           return;  
  5.       }  
  6.       mBluetoothGatt.writeCharacteristic(characteristic);  
  7.   }  
另外在这个service中还有其他的一些函数例如初始化initialize()函数、连接蓝牙函数connect(final String address)、断开蓝牙连接函数disconnect()等。
三、蓝牙控制DeviceControlActivity

扫描到蓝牙设备之后就是对蓝牙进行自己需要的控制,比如写数据,读数据,获取设备信息,设备电量等。

在Service中讲到有一个广播,广播接收器就在这个activity中,通过不同的action做出相应的操作。

注册的几种事件

[java]  view plain  copy
  1. private static IntentFilter makeGattUpdateIntentFilter() {  
  2.        final IntentFilter intentFilter = new IntentFilter();  
  3.        intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED);  
  4.        intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED);  
  5.        intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED);  
  6.        intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE);  
  7.        return intentFilter;  
  8.    }  

[java]  view plain  copy
  1. // Handles various events fired by the Service.处理服务所激发的各种事件  
  2.     // ACTION_GATT_CONNECTED: connected to a GATT server.连接一个GATT服务  
  3.     // ACTION_GATT_DISCONNECTED: disconnected from a GATT server.从GATT服务中断开连接  
  4.     // ACTION_GATT_SERVICES_DISCOVERED: discovered GATT services.查找GATT服务  
  5.     // ACTION_DATA_AVAILABLE: received data from the device.  This can be a result of read  
  6.     //                        or notification operations.从服务中接受数据  
  7.     private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() {  
  8.         @Override  
  9.         public void onReceive(Context context, Intent intent) {  
  10.             final String action = intent.getAction();  
  11.             if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {  
  12.                 mConnected = true;  
  13.                 updateConnectionState(R.string.connected);  
  14.                 invalidateOptionsMenu();  
  15.             } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {  
  16.                 mConnected = false;  
  17.                 updateConnectionState(R.string.disconnected);  
  18.                 invalidateOptionsMenu();  
  19.                 clearUI();  
  20.             }   
  21.             //发现有可支持的服务  
  22.             else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {  
  23.                 //写数据的服务和characteristic  
  24.                 mnotyGattService = mBluetoothLeService.getSupportedGattServices(UUID.fromString("0000ffe5-0000-1000-8000-00805f9b34fb"));  
  25.                 characteristic = mnotyGattService.getCharacteristic(UUID.fromString("0000ffe9-0000-1000-8000-00805f9b34fb"));  
  26.                 //读数据的服务和characteristic  
  27.                 readMnotyGattService = mBluetoothLeService.getSupportedGattServices(UUID.fromString("0000ffe0-0000-1000-8000-00805f9b34fb"));  
  28.                 readCharacteristic = readMnotyGattService.getCharacteristic(UUID.fromString("0000ffe4-0000-1000-8000-00805f9b34fb"));  
  29.             }   
  30.             //显示数据  
  31.             else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {  
  32.                 //将数据显示在mDataField上  
  33.                 String data = intent.getStringExtra(BluetoothLeService.EXTRA_DATA);  
  34.                 System.out.println("data----" + data);  
  35.                 displayData(data);  
  36.             }  
  37.         }  
  38.     };      
在发现了有可支持的服务之后会回调Service中的onServicesDiscovered()函数,并发送广播,在官方的demo中发现了可用的Service之后,就查找该BLE设备支持的所有服务和characteristic,在这里不需要查找所有的服务,只需要向蓝牙写数据和读取数据的 Service和characteristic的UUID即可。通过查询低功耗蓝牙(BLE)的数据手册可以得到所需要的UUID。


有了这两个Service和characteristic的UUID,就可以对蓝牙发送数据,并发出通知(当写数据发生改变时发出)。

[java]  view plain  copy
  1. <span style="font-size:18px;">//写数据的服务和characteristic  
  2.                 mnotyGattService = mBluetoothLeService.getSupportedGattServices(UUID.fromString("0000ffe5-0000-1000-8000-00805f9b34fb"));  
  3.                 characteristic = mnotyGattService.getCharacteristic(UUID.fromString("0000ffe9-0000-1000-8000-00805f9b34fb"));  
  4.                 //读数据的服务和characteristic  
  5.                 readMnotyGattService = mBluetoothLeService.getSupportedGattServices(UUID.fromString("0000ffe0-0000-1000-8000-00805f9b34fb"));  
  6.                 readCharacteristic = readMnotyGattService.getCharacteristic(UUID.fromString("0000ffe4-0000-1000-8000-00805f9b34fb"));</span>  
得到这两个Service和characteristic就可以向蓝牙发送数据了。

[java]  view plain  copy
  1. private void read() {  
  2.         //mBluetoothLeService.readCharacteristic(readCharacteristic);  
  3.         //readCharacteristic的数据发生变化,发出通知  
  4.         mBluetoothLeService.setCharacteristicNotification(readCharacteristic, true);  
  5.         //Toast.makeText(this, "读成功", Toast.LENGTH_SHORT).show();  
  6.     }  
检测readCharacteristic的数据发生变化,发出通知。

向蓝牙发送数据。

[java]  view plain  copy
  1. read();  
  2.                   
  3.                 final int charaProp = characteristic.getProperties();  
  4.                   
  5.                 //如果该char可写  
  6.                 if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {  
  7.                     // If there is an active notification on a characteristic, clear  
  8.                     // it first so it doesn't update the data field on the user interface.  
  9.                     if (mNotifyCharacteristic != null) {  
  10.                         mBluetoothLeService.setCharacteristicNotification( mNotifyCharacteristic, false);  
  11.                         mNotifyCharacteristic = null;  
  12.                     }  
  13.                     //读取数据,数据将在回调函数中  
  14.                     //mBluetoothLeService.readCharacteristic(characteristic);  
  15.                     byte[] value = new byte[20];  
  16.                     value[0] = (byte) 0x00;  
  17.                     if(edittext_input_value.getText().toString().equals("")){  
  18.                         Toast.makeText(getApplicationContext(), "请输入!", Toast.LENGTH_SHORT).show();  
  19.                         return;  
  20.                     }else{  
  21.                         WriteBytes = edittext_input_value.getText().toString().getBytes();  
  22.                         characteristic.setValue(value[0],BluetoothGattCharacteristic.FORMAT_UINT8, 0);  
  23.                         characteristic.setValue(WriteBytes);  
  24.                         mBluetoothLeService.writeCharacteristic(characteristic);  
  25.                         Toast.makeText(getApplicationContext(), "写入成功!", Toast.LENGTH_SHORT).show();  
  26.                     }  
  27.                 }  
  28.                 if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {  
  29.                     mNotifyCharacteristic = characteristic;  
  30.                     mBluetoothLeService.setCharacteristicNotification(characteristic, true);  
  31.                 }  
  32.                 edittext_input_value.setText("");  
  33.             }  
一旦数据发生改变,就会发出通知,通知发出后就会调用下面的函数并发出广播。

[java]  view plain  copy
  1. @Override  
  2.        public void onCharacteristicChanged(BluetoothGatt gatt,  
  3.                                            BluetoothGattCharacteristic characteristic) {  
  4.            broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);  
  5.        }  

在广播接收器中接收到广播后,把数据显示在EditText上。下面是测试的两张图片。



demo下载地址:BLE 读写


Android开发蓝牙与ble设备的通讯 一、写在前面的话 一直想写一篇关于蓝牙与ble设备通讯的博客,但是一直也不知道从何下手,可能是之前思路不清晰吧,也就一直拖拖拖,拖到现在。最近又做到关于ble设备的项目了,在此总结一下吧。(如有不到位或者不太对的地方,希望各位多多指教) 二、关于蓝牙 蓝牙是一种短距的无线通讯技术,可实现固定设备、移动设备之间的数据交换。一般将蓝牙3.0之前的BR/EDR蓝牙称为传统蓝牙,而将蓝牙4... 阅读详情

相关推荐

Android蓝牙开发—BLE(低功耗)蓝牙详细开发流程

        Android蓝牙开发前,首先要区分是经典蓝牙开发还是BLE(低功耗)蓝牙开发,它们的开发是有区别的,如果还分不清经典蓝牙和BLE(低功耗)蓝牙的小伙伴,可以先看Android蓝牙开发—经典蓝牙和BLE(低功耗)蓝牙的区别 本文是针对BLE蓝牙开发的,如果是经典蓝牙开发,可以看Android蓝牙开发—经典蓝牙详细开发流程 注意:蓝牙4.0只有android4.3或4.3以上才支...

zqf_888的博客 1万+

Android 读取蓝牙设备信息开发

Android 读取蓝牙设备信息开发

Android framework 528

Android 蓝牙BLE开发详解

Android 蓝牙BLE开发详解 有传输数据 多设备连接 获取uuid等

Charon1997的博客 1万+

开发BLE蓝牙手机上位机软件竟是如此的简单

第二步,使用中需要完成单击响应的,我们可以在设计区直接双击组件,即可自动在代码区生成一个空的事件(类似单片机开发中的中断处理函数,用于响应单击事件),例如四个方向键的单击事件。第一步,先根据我们的需要完成可视化的组件布局,并给添加的组件起上一个跟操作相关的名字,在组件的属性对话框设置,同时可以设置组件的其他相关属性。然后就是测试对应的服务与通道是否可读,可写,可通知。找到合适的服务与通道后,想实现数据的接收,要执行 读取数据的方法,如果直接读,那么系统没有准备好呢,会导致读失败,后面就容易卡死。

ic2121的博客 4059

BLE蓝牙(4.0)你要懂的基本使用

BLE蓝牙(4.0)你要懂的基本使用 每个人对于蓝牙都不陌生,近距离数据传输,方便;可是当你的业务需求需要你第一次接触蓝牙开发的时候,却会发现你对它并不了解;首先,蓝牙发展至今经历了8个版本的更新。1.1、1.2、2.0、2.1、3.0、4.0、4.1、4.2。那么在1.x~3.0之间的我们称之为传统蓝牙,4.x开始的蓝牙我们称之为低功耗蓝牙也就是蓝牙ble,当然4.x版本的蓝牙也是向下兼容的。...

Lukang_0513的博客 1万+

安卓蓝牙开发(1)BLE蓝牙基础知识和一般开发流程

一、BLE(Bluetooth Low Energy)低功耗蓝牙基本知识 Android 4.3(API级别18)引入了以低功耗蓝牙(BLE)为中心角色的内置平台支持,并提供应用程序可用于发现设备,查询服务和传输信息的API 常见用例包括以下内容: 在附近的设备之间传输少量的数据 与Google Beacons等接近传感器进行互动,为用户提供基于当前位置的定制体验。 传统蓝牙可以用于数据量比较大的传输,如语音,音乐,较高数据量传输等,但是比较耗电,低功耗蓝牙这样应用于实时性要求比较高,功耗比较

mike_jun的博客 6064

Android 蓝牙4.0BLE开发实现对蓝牙的写入数据和读取数据

Android 蓝牙4.0BLE开发实现对蓝牙的写入数据和读取数据 代码基本上都是官方的demo,只是通过修改获得自己想要的结果,下面就简单介绍一下自己的理解。 一、扫描BLE设备activity 检查该设备是否支持BLE设备,谷歌在Android4.3才开始支持BLE设备(晕死,很长一段时间都没有一台4.3的设备,看着程序修改了也不能测试!)。

3万+

Ble蓝牙开发详解

蓝牙主要分为两种:经典蓝牙和低功耗蓝牙 Ble简介 低功耗蓝牙4.0只有android4.3或4.3以上才支持 1、BLE蓝牙4.0核心profile,主要特点是快速搜索,快速连接,超低功耗保持连接和数据传输,缺点:数据传输速率低,BLE蓝牙一包数据最多为20字节,因此安卓系统下最好不要使用BLE蓝牙传输大量数据,由于其具有低功耗特点,所以经常用在可穿戴设备之中。 2、Profile: 蓝牙规范,...

qq_36159785的博客 5061

Android BLE蓝牙4.0开发详解

这篇博客主要讲解蓝牙 BLE的用法。在讲解之前先讲一些概念性的东西,对于之前没接触过蓝牙开发,现在手上又有个蓝牙BLE项目需要做的人,先看下这些概念还是很重要的。因为我之前就是这样,之前没有接触过蓝牙方面的开发,然后来了个蓝牙的项目,于是就到网上百度了一番,于是有点茫然,产生了几点疑惑: 1:发现蓝牙有传统蓝牙和低功耗蓝牙(ble)之分。那么什么是传...

我的博客 5万+

Android蓝牙4.0 BLE开发坑总结

onServicesDiscovered 回调里不能直接执行 write /readDataFromCharacteristic() 或者 enableNotificationOfCharacteristic之类的,而要放到主线程里执行,如 handler.post( … ); 如果发现连接上了,service也discover到了,但是始终不能触发onCharacteristicChanged的,

qingtiantianqing的博客 1万+

Android蓝牙开发(二) BLE4.0低功耗蓝牙

一、BLE4.0低功耗蓝牙 Bluetooth Low Energy,蓝牙低功耗,是从蓝牙4.0开始支持的技术。相较传统蓝牙,传输速度更快、覆盖范围广、安全性高、延时短、耗电低等特点。 二、关键术语 1.GATT(通用属性配置):通用属性配置文件,用于ble链路上发送和接收“属性”的数据块。目前所有的ble应用都是基于GATT的,一个设备可以实现多个配置文件。 2.ATT(属性

Near的博客 6206

Android开发之蓝牙(二)——基于BLE协议蓝牙模块通信

介绍 基本概念 Android蓝牙开发流程 app是ble与spp选择连接蓝牙模块,关于spp的可以看 介绍摘要:蓝牙4.0——BLE是近年来应用比较广泛的profile,与传统蓝牙相比,其低功耗的特征最为显著,在蓝牙模块中(CC2540),一块纽扣电池可供电半年到一年之间。

zh1豪的博客 9538

android 低功耗BLE蓝牙连接示例代码

android 低功耗ble蓝牙连接跟标准的蓝牙连接还是有很大的不同的。本文低功耗蓝牙连接代码是在sdk的版本4.3以上才支持。所用的核心代码连接也是不一样的。 本文demo下载地址:http://download.csdn.net/detail/qq_16064871/9657885 1、区别 常规的蓝牙连接类是BluetoothSocket final BluetoothDevice

mmsx990的博客 8718

Android蓝牙BLE开发

这篇文章是本人这几天对BLE开发基础的大概总结

weixin_51890646的博客 8211

E4A BLE蓝牙串口通信

这是一个易安卓(E4A)安卓手机APP,通过蓝牙模块与手机进行无线串口通信,手机可通过 蓝牙模块的串口(TXD RXD)通信线收发从电脑或单片机串口的数据 。通过上位机程序或单片机程序控制电器设备。

E4A(易安卓) BLE通信

该资源为E4A(易安卓)结合BLE蓝牙模块进行通信的代码,但是目前无法确定新版E4A 是否兼容。

上一篇: Android蓝牙搜索设备,向其发送数据并接收
下一篇: Android编程常见问题之五
It_BeeCoder
博客等级 码龄10年 967粉丝 238原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值