Bluetooth Low Energy——藍芽低功耗
Android4.3(API級別18)引入內建平臺支援BLE的central角色,同時提供API和app應用程式用來發現裝置,查詢服務,和讀/寫characteristics。與傳統藍芽(ClassicBluetooth)不同,藍芽低功耗(BLE)的目的是提供更顯著的低功耗。這使得Android應用程式可以和具有低功耗的要求BLE裝置,如接近感測器,心臟速率監視器,健身裝置等進行通訊。
關鍵術語和概念
下面是關鍵BLE術語和概念的總結:
通用屬性規範(GATT)—GATTprofile是一個通用規範用於在BLE鏈路傳送和接收被稱為“屬性(attributes)”的資料片。目前所有的低功耗應用 profile都是基於GATT。
藍芽SIG定義了許多profile用於低功耗裝置。Profile(配置檔案)是一個規範,規範了裝置如何工作在一個特定的應用場景。注意:一個裝置可以實現多個profile。例如,一個裝置可以包含一個心臟監測儀和電池電平檢測器。
屬性協議( ATT )—GATT是建立在屬性協議( ATT )的頂層,通常也被稱為GATT/ ATT 。 ATT進行了優化用於在BLE裝置上執行。為此,它採用儘可能少的位元組越好。每個attribute屬性被UUID(通用唯一識別符號)唯一標識 ,UUID是標準128-bit格式的ID用來唯一標識資訊。attributes 被 ATT 格式化characteristics和services形式進行傳送。
特徵(Characteristics)— 一個characteristics包含一個單獨的value值和0 –n個用來描述characteristic 值(value)的descriptors。一個characteristics可以被認為是一種型別的,類似於一個類。
描述符(descriptor)—descriptor是被定義的attributes,用來描述一個characteristic的值。例如,一個descriptor可以指定一個人類可讀的描述中,在可接受的範圍裡characteristic值,或者是測量單位,用來明確characteristic的值。
服務(service)—service是characteristic的集合。例如,你可以有一個所謂的“Heart RateMonitor”service,其中包括characteristic,如“heart rate measurement ”。你可以在
角色和職責
以下是適用於當一個Android裝置與BLE裝置互動的角色和責任:
中心裝置(central)與外圍裝置(peripheral)。這也適用於BLE連線本身。Central裝置進行掃描,尋找advertisenment,peripheral裝置發出advertisement。
GATT server(伺服器)與GATTclient(客戶端)。這決定了兩個裝置建立連線後如何互相互動。
要了解它們的區別,假設你有一個Android手機和活動跟蹤器,活動跟蹤器是一個BLE裝置。這款手機扮演central角色;活動跟蹤器扮演peripheral角色(建立一個BLE連線,必須具備兩者。如果兩個裝置只支援central角色或peripheral角色,不能跟對方建立一個BLE連線)。
一旦手機與活動跟蹤器已經建立連線,他們開始相互傳送GATT資料。根據它們傳送資料的種類,其中一個可能作為 GATT server。例如,如果該活動跟蹤器將感測器資料彙報到手機上,活動跟蹤器作為server。如果活動跟蹤器想要從手機接收更新,那麼手機作為server。
在本文件中使用的示例中,Android應用程式(在Android裝置上執行)是GATT client。該應用從GATT server 獲取資料,server是一款支援 HeartRate Profile的BLE心臟速率監測儀。但你可以設計你的Android應用程式,作為GATT server角色。見BluetoothGattServer 獲取更多資訊。
BLE許可權
為了使用應用程式中的藍芽功能,你必須宣告藍芽許可權BLUETOOTH。你需要這個許可權執行任意藍芽通訊,如請求連線,接受連線,傳輸資料。
宣告藍芽許可權在你的應用程式清單(manifest)檔案。例如:
<uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
如果你想宣告,你的應用程式是隻提供給BLE功能的裝置,在您的應用程式的清單包括如下語句:
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
不過,如果你想使你的應用程式提供給那些不支援BLE裝置,你仍然應該在您的應用程式的清單包含這個上述語句,但設定required="false"。然後在執行時可以通過使用 PackageManager.hasSystemFeature()確定BLE可用性:
// Use this check to determine whether BLE is supported on the device. Then // you can selectively disable BLE-related features. if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) { Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show(); finish(); }
設定BLE
在你的應用程式可以進行BLE通訊之前 ,你需要驗證這個裝置上BLE是否被支援,如果支援,請確保它已啟用。請注意,如果<uses-feature.../>設定為false,這個檢查才是必需的。
如果不支援BLE ,那麼你應該適當地禁用任何BLE功能。如果BLE支援,但被禁用,那麼你可以要求使用者啟動藍芽時不要離開應用程式。這種設定兩個步驟完成,使用 BluetoothAdapter.
該BluetoothAdapter是所有的藍芽活動所必需的。該BluetoothAdapter代表裝置自身的藍芽介面卡(藍芽無線電)。只有一個藍芽介面卡用於整個系統,並且你的應用程式可以使用該物件進行互動。下面的程式碼片段顯示瞭如何獲取介面卡。注意,該方法使用getSystemService() 返回BluetoothManager的一個例項, 用於獲取介面卡。Android 4.3 ( API級別18 )引入BluetoothManager:
// Initializes Bluetooth adapter. final BluetoothManager bluetoothManager= (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); mBluetoothAdapter = bluetoothManager.getAdapter();
2. 啟用藍芽
接下來,你需要確保藍芽已啟用。用isEnabled() 來檢查藍芽當前是否啟用。如果此方法返回false,那麼藍芽被禁用。下面的程式碼片段檢查藍芽是否開啟。如果不是,該片段將顯示錯誤提示使用者去設定以啟用藍芽:
private BluetoothAdapter mBluetoothAdapter; ... // Ensures Bluetooth is available on the device and it is enabled. If not, // displays a dialog requesting user permission to enable Bluetooth. if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent,REQUEST_ENABLE_BT); }
查詢BLE裝置
為了找到BLE裝置,您可以使用startLeScan() 方法。此方法需要一個BluetoothAdapter.LeScanCallback作為引數。你必須實現這個回撥,因為它決定掃描結果如何返回。因為掃描耗電量大,你應當遵守以下準則:
1)只要你找到所需的裝置,停止掃描。
2)不要掃描一個迴圈,並設定您的掃描時間限制。以前可用的裝置可能已經移出範圍,繼續掃描消耗電池電量。
下面的程式碼片段顯示瞭如何啟動和停止掃描:
/** * Activity for scanning and displaying available BLE devices. */ public class DeviceScanActivity extends ListActivity { private BluetoothAdapter mBluetoothAdapter; private boolean mScanning; private Handler mHandler; // Stops scanning after 10 seconds. private static final long SCAN_PERIOD = 10000; ... private void scanLeDevice(final boolean enable) { if (enable) { // Stops scanning after a pre-defined scan period. mHandler.postDelayed(new Runnable() { @Override public void run() { mScanning = false; mBluetoothAdapter.stopLeScan(mLeScanCallback); } }, SCAN_PERIOD); mScanning = true; mBluetoothAdapter.startLeScan(mLeScanCallback); } else { mScanning = false; mBluetoothAdapter.stopLeScan(mLeScanCallback); } ... } ... }
private LeDeviceListAdapter mLeDeviceListAdapter; ... // Device scan callback. private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) { runOnUiThread(new Runnable() { @Override public void run() { mLeDeviceListAdapter.addDevice(device); mLeDeviceListAdapter.notifyDataSetChanged(); } }); } };
注意:你可以只掃描BLE裝置或傳統藍芽裝置,就像Bluetooth描述那樣。你不可以同時掃描BLE裝置和傳統藍芽裝置。
連線到GATT server
在和一個BLE裝置互動的第一步是連線到它,更具體地,連線到所述裝置上的GATT server。要連線到一個BLE裝置上的GATT server,您可以使用connectGatt()方法。這個方法有三個引數:一個Context 物件,一個autoConnect(布林值,表示是否自動連線到BLE裝置)和BluetoothGattCallback:
mBluetoothGatt = device.connectGatt(this,false, mGattCallback);
這個函式連線到由BLE裝置上的GATTserver,並返回一個BluetoothGatt例項,您可以使用它來進行GATT client操作。呼叫者(Android應用程式)是GATT client。該BluetoothGattCallback是用來提供結果給client,如連線狀態,以及任何進一步的GATT client操作。
在這個例子中,BLE應用程式提供了一個活動(DeviceControlActivity)連線,顯示資料,和顯示該裝置支援的GATTservices和characteristics。根據使用者的輸入,這一活動與一個叫BluetoothLeService的Service互動,BluetoothService通過Android BLE的API與 BLE裝置進行互動:
// A service that interacts with the BLE device via the Android BLE API. public class BluetoothLeService extends Service { private final static String TAG = BluetoothLeService.class.getSimpleName(); private BluetoothManager mBluetoothManager; private BluetoothAdapter mBluetoothAdapter; private String mBluetoothDeviceAddress; private BluetoothGatt mBluetoothGatt; private int mConnectionState = STATE_DISCONNECTED; private static final int STATE_DISCONNECTED = 0; private static final int STATE_CONNECTING = 1; private static final int STATE_CONNECTED = 2; public final static String ACTION_GATT_CONNECTED = "com.example.bluetooth.le.ACTION_GATT_CONNECTED"; public final static String ACTION_GATT_DISCONNECTED = "com.example.bluetooth.le.ACTION_GATT_DISCONNECTED"; public final static String ACTION_GATT_SERVICES_DISCOVERED = "com.example.bluetooth.le.ACTION_GATT_SERVICES_DISCOVERED"; public final static String ACTION_DATA_AVAILABLE = "com.example.bluetooth.le.ACTION_DATA_AVAILABLE"; public final static String EXTRA_DATA = "com.example.bluetooth.le.EXTRA_DATA"; public final static UUID UUID_HEART_RATE_MEASUREMENT = UUID.fromString(SampleGattAttributes.HEART_RATE_MEASUREMENT); // Various callback methods defined by the BLE API. private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { String intentAction; if (newState == BluetoothProfile.STATE_CONNECTED) { intentAction = ACTION_GATT_CONNECTED; mConnectionState = STATE_CONNECTED; broadcastUpdate(intentAction); Log.i(TAG, "Connected to GATT server."); Log.i(TAG, "Attempting to start service discovery:" + mBluetoothGatt.discoverServices()); } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { intentAction = ACTION_GATT_DISCONNECTED; mConnectionState = STATE_DISCONNECTED; Log.i(TAG, "Disconnected from GATT server."); broadcastUpdate(intentAction); } } @Override // New services discovered public void onServicesDiscovered(BluetoothGatt gatt, int status) { if (status == BluetoothGatt.GATT_SUCCESS) { broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED); } else { Log.w(TAG, "onServicesDiscovered received: " + status); } } @Override // Result of a characteristic read operation public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { if (status == BluetoothGatt.GATT_SUCCESS) { broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic); } } ... }; ... }
當一個特定的回撥被觸發時,它會呼叫相應的broadcastUpdate()輔助方法並傳遞給它一個動作。注意,在該部分中的資料解析參照 Bluetooth Heart Rate Measurement profilespecifications進行。
private void broadcastUpdate(final String action) { final Intent intent = new Intent(action); sendBroadcast(intent); } private void broadcastUpdate(final String action, final BluetoothGattCharacteristic characteristic) { final Intent intent = new Intent(action); // This is special handling for the Heart Rate Measurement profile. Data // parsing is carried out as per profile specifications. if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) { int flag = characteristic.getProperties(); int format = -1; if ((flag & 0x01) != 0) { format = BluetoothGattCharacteristic.FORMAT_UINT16; Log.d(TAG, "Heart rate format UINT16."); } else { format = BluetoothGattCharacteristic.FORMAT_UINT8; Log.d(TAG, "Heart rate format UINT8."); } final int heartRate = characteristic.getIntValue(format, 1); Log.d(TAG, String.format("Received heart rate: %d", heartRate)); intent.putExtra(EXTRA_DATA, String.valueOf(heartRate)); } else { // For all other profiles, writes the data formatted in HEX. final byte[] data = characteristic.getValue(); if (data != null && data.length > 0) { final StringBuilder stringBuilder = new StringBuilder(data.length); for(byte byteChar : data) stringBuilder.append(String.format("%02X ", byteChar)); intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString()); } } sendBroadcast(intent); }
早在DeviceControlActivity, 這些事件由一個BroadcastReceiver處理:
// Handles various events fired by the Service. // ACTION_GATT_CONNECTED: connected to a GATT server. // ACTION_GATT_DISCONNECTED: disconnected from a GATT server. // ACTION_GATT_SERVICES_DISCOVERED: discovered GATT services. // ACTION_DATA_AVAILABLE: received data from the device. This can be a // result of read or notification operations. private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) { mConnected = true; updateConnectionState(R.string.connected); invalidateOptionsMenu(); } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) { mConnected = false; updateConnectionState(R.string.disconnected); invalidateOptionsMenu(); clearUI(); } else if (BluetoothLeService. ACTION_GATT_SERVICES_DISCOVERED.equals(action)) { // Show all the supported services and characteristics on the // user interface. displayGattServices(mBluetoothLeService.getSupportedGattServices()); } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) { displayData(intent.getStringExtra(BluetoothLeService.EXTRA_DATA)); } } };
讀取BLE屬性
一旦你的Android應用程式已連線到GATTserver和discoveriable service,它可以讀取和寫入支援的attributes。例如,通過server的service和characteristic這個片段進行迭代,在UI上顯示它們:
public class DeviceControlActivity extends Activity { ... // Demonstrates how to iterate through the supported GATT // Services/Characteristics. // In this sample, we populate the data structure that is bound to the // ExpandableListView on the UI. private void displayGattServices(List<BluetoothGattService> gattServices) { if (gattServices == null) return; String uuid = null; String unknownServiceString = getResources(). getString(R.string.unknown_service); String unknownCharaString = getResources(). getString(R.string.unknown_characteristic); ArrayList<HashMap<String, String>> gattServiceData = new ArrayList<HashMap<String, String>>(); ArrayList<ArrayList<HashMap<String, String>>> gattCharacteristicData = new ArrayList<ArrayList<HashMap<String, String>>>(); mGattCharacteristics = new ArrayList<ArrayList<BluetoothGattCharacteristic>>(); // Loops through available GATT Services. for (BluetoothGattService gattService : gattServices) { HashMap<String, String> currentServiceData = new HashMap<String, String>(); uuid = gattService.getUuid().toString(); currentServiceData.put( LIST_NAME, SampleGattAttributes. lookup(uuid, unknownServiceString)); currentServiceData.put(LIST_UUID, uuid); gattServiceData.add(currentServiceData); ArrayList<HashMap<String, String>> gattCharacteristicGroupData = new ArrayList<HashMap<String, String>>(); List<BluetoothGattCharacteristic> gattCharacteristics = gattService.getCharacteristics(); ArrayList<BluetoothGattCharacteristic> charas = new ArrayList<BluetoothGattCharacteristic>(); // Loops through available Characteristics. for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) { charas.add(gattCharacteristic); HashMap<String, String> currentCharaData = new HashMap<String, String>(); uuid = gattCharacteristic.getUuid().toString(); currentCharaData.put( LIST_NAME, SampleGattAttributes.lookup(uuid, unknownCharaString)); currentCharaData.put(LIST_UUID, uuid); gattCharacteristicGroupData.add(currentCharaData); } mGattCharacteristics.add(charas); gattCharacteristicData.add(gattCharacteristicGroupData); } ... } ... }
接收GATT通知 (Notifications)
這是常見的裝置上的BLE應用程式要求被通知,當一個特定characteristic改變時。這段程式碼顯示瞭如何使用 setCharacteristicNotification()方法設定一個Notifications用於characteristic:
private BluetoothGatt mBluetoothGatt; BluetoothGattCharacteristic characteristic; boolean enabled; ... mBluetoothGatt.setCharacteristicNotification(characteristic, enabled); ... BluetoothGattDescriptor descriptor = characteristic.getDescriptor( UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG)); descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); mBluetoothGatt.writeDescriptor(descriptor);
一旦啟動了屬性通知( notifications for acharacteristic),如果在遠端裝置上characteristic 發生改變,onCharacteristicChanged() 回撥函式將被啟動。
@Override // Characteristic notification public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic); }
關閉Client應用程式
一旦你的應用程式已經使用BLE裝置完成後,應該呼叫close(),這樣系統就可以適當地釋放資源:
public void close() { if (mBluetoothGatt == null) { return; } mBluetoothGatt.close(); mBluetoothGatt = null; }
相關推薦
Bluetooth Low Energy——藍芽低功耗
Android4.3(API級別18)引入內建平臺支援BLE的central角色,同時提供API和app應用程式用來發現裝置,查詢服務,和讀/寫characteristics。與傳統藍芽(ClassicBluetooth)不同,藍芽低功耗(BLE)的目的是提供更顯著的低功耗。這使得Android應用程式可以
nRF51822-QFAC 藍芽低功耗和2.4G NORDIC全線原裝現貨
1、產品介紹 nRF51822是一種超低能耗的2.4 GHz無線系統晶片(SoC)整合nRF51 2.4系列GHz收發器,一個32位ARM。m0 CPU、快閃記憶體、模擬和數字外設。nRF51822可以支援藍芽低能量和一系列專有2.4 GHz協議,如Gazell從北歐半導體。
FastBle藍芽低功耗框架的使用
因為自己的專案中有用到了藍芽相關的功能,所以之前也斷斷續續地針對藍芽通訊尤其是BLE通訊進行了一番探索,整理出了一個開源框架FastBle與各位分享經驗。 原始碼地址: 隨著對FastBle框架關注的人越來越多,與我討論問題的小夥伴也多起來,所以整理了一篇文章,詳細介紹
[藍芽]低功耗藍芽之 GAP、GATT
低功耗藍芽之 GAP、GATT 低功耗藍芽之 GAP、GATT 基礎介紹 BLE GAP GAP 協議 GAP 裝置角色 GAP 廣播資料 GAP 廣播流程
一文讀懂藍芽低功耗BLE的應用市場
藍芽低功耗BLE(Bluetooth Low Energy)技術,也稱為Bluetooth® Smart,從藍芽V4.0開始作為核心規範的一部分,顧名思義,它可以滿足小型電池供電的裝置進行低功耗無線連線的要求,並大大延長電池壽命。主要應用包括:定位標籤,資產跟蹤,運動及
LE gatt 第三方應用無法搜尋到藍芽低功耗裝置
手機端修改packages/apps/Bluetooth/res/values/config.xml檔案中strict_location_check的值由true改為false,使用者 在進行掃描LE裝置時則可以返回給APP。從而不需要使用者強制開啟GPS。 package
藍芽低功耗profile:ATT和GATT
原文:https://epx.com.br/artigos/bluetooth_gatt.php 藍芽4.0版本推出了低功耗規範,引入了兩個核心協議:ATT(Attribute Protocol)和GATT(Generic Attribute Protocol).這兩個協議
Android BLE 藍芽低功耗教程,中央BluetoothGatt和周邊BluetoothGattServer的實現
Android4.3 規範了BLE的API,但是直到目前的4.4,還有些功能不完善。 在BLE協議中,有兩個角色,周邊(Periphery)和中央(Central);周邊是資料提供者,中央是資料使用/處理者;在iOS SDK裡面,可以把一個iOS裝置作為一個周邊,也可以作為
基於藍芽4.0的藍芽印表機 低耗電藍芽 BLE (Bluetooth Low Energy)
作者:朱克鋒 郵箱:[email protected] 轉載請註明出處:http://blog.csdn.net/linux_zkf 基於藍芽4.0的藍芽印表機低耗電藍芽 BLE
CC2541是功率優化的真正系統級芯片(SoC)解決方案,適用於藍牙低功耗(BLE)和專用的2.4GHz應用
芯片 通道 深圳市 ssi 同時 工作 uart 關註 特性 CC2541是功率優化的真正系統級芯片(SoC)解決方案,適用於藍牙低功耗(BLE)和專用的2.4GHz應用.該SOC芯片集成性能極好RF收發器以及標準工業級增強型8051內核,支持系統編程Flash,8KRAM
CC2540是一款高性價比,低功耗片上系統(Soc)解決方案,它適合藍牙低功耗應用領域
數字 醫療 保持 國內 定時 技術 定位 集成電路 性能 CC2540是一款高性價比,低功耗片上系統(Soc)解決方案,它適合藍牙低功耗應用領域,極少的外圍元器件以及強大網絡節點建立成為可能。CC2540是一款含有高速和低功耗8051內核的RF收發器。適用於低功耗系統,有超
Android --- Bluetooth(基礎藍芽)
藍芽簡介 藍芽(Bluetooth)是一種短距離的無線通訊技術標準。這個名子來源於10世紀丹麥國王 Harald Blatand,英文名子是Harold Bluetooth。在無線行業協會組織人員的討論後,有人 認為用Blatand國王的名字命名這種無線技
Hollong 低功耗藍芽4.0/4.1/4.2 BLE Sniffer協議分析儀
名稱:緯圖Hollong BLE藍芽 監控分析儀 品牌:ViewTool/緯圖 型號:VTH201A 典型應用: - 抓取BLE藍芽傳輸資料,分析資料傳輸協議; - 實時捕獲、顯示、分析、過濾協議資料,減少除錯時間,加速產品進入市場; - 協助開發除錯BLE相關
一分鐘讀懂低功耗藍芽(BLE)MTU交換資料包
1.概述 * MTU: 最大傳輸單元(MAXIMUM TRANSMISSION UNIT) , 指在一個PDU (Protocol Data Unit: 協議資料單元,在一個傳輸單元中的有效傳輸數據)能夠傳輸的最大資料量(多少位元組可以一次性傳輸到對方)。  
一分鐘讀懂低功耗藍芽(BLE)連線資料包
一分鐘讀懂低功耗藍芽(BLE)連線資料包1.概述 BLE 連線過程中有三個重要的資料包:SCAN_REQ, SCAN_RSP 和 CONNECT_REQ。 SCAN_REQ: 掃描請求,由主裝置(MASTER DEVICE)向從裝置(SLAVE DEV
一分鐘讀懂低功耗藍芽(BLE)廣播資料包
一分鐘讀懂低功耗藍芽(BLE)廣播資料包 低功耗藍芽 =》 BLE (Bluetooth Low Energy) 1. 怎樣抓取BLE廣播資料包 * 硬體:一個BLE裝置(具有廣播功能); 一臺H
一分鐘讀懂低功耗藍芽連線資料包
一分鐘讀懂低功耗藍芽(BLE)連線資料包1.概述 BLE 連線過程中有三個重要的資料包:SCAN_REQ, SCAN_RSP 和 CONNECT_REQ。 SCAN_REQ: 掃描請求,由主裝置(MASTER DEVICE)向從裝置(SLAVE DEV
TI低功耗藍芽(BLE)介紹
轉載自:http://www.cnblogs.com/cainiaoaixuexi/archive/2013/11/08/3414433.html 本文件翻譯和修改自參考資料:CC2540Bluetooth Low Energy Software Developer’s Guide (Rev.
低功耗藍芽(BLE)和ZigBee在物聯網應用中的區別
隨著低功耗、廣域網(LPWAN)市場的擴大,物聯網(IoT)應用的低功耗協議有了更多的選擇。在本文中,我們將藍芽和藍芽低能耗(BLE)與ZigBee進行比較,這樣您就可以更好地瞭解在連線裝置上使用哪種無線協議。 簡單來說,藍芽是近場通訊,ZigBee是區域網,更深入的區別繼續看下文。
Android藍芽開發之低功耗藍芽(藍芽4.0)開發全記錄
主要內容概況 前面我記錄了開發藍芽2.0的過程,今天準備介紹現在的主流藍芽技術,藍芽4.0的開發,該藍芽技術是在Android4.3(API級別18)版本引入的API。 官方文件 具體的區別主要以下幾點: 1.新的藍芽技術提供了連線服務的方法,以前是沒有提供連線藍芽的方法