Epson BT-2000 Developers Guide - Page 155
Searching for Primary Service
![]() |
View all Epson BT-2000 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 155 highlights
8.8.5. Searching for Primary Service You can search for the Primary Service on a connected BLE device byexecuting the callback function setGattCallback() and Primary Service search using discPriSrv(). import android.bluetooth.BluetoothLeAdapterManager; import android.bluetooth.BluetoothLeGapEvtConnected; import android.bluetooth.BluetoothLeGattCallback; public class MainActivity extends Activity { private BluetoothLeAdapterManager mManager; @Override protected void onCreate(Bundle savedInstanceState) { //Instance acquisition for the BLE manager class mManager = BluetoothLeAdapterManager.getInstance(); //Register a callback for the GATT function provided mManager.setGattCallback(mLeGattCallback); //Searching for Primary Service //Set the connection handle ConnectedHandle in connected event status connStatus acquired in onConnectResult mManager.discPriSrv(ConnectedHandle, (char) 1); } Use the following callback to output logs when a Primary Service is detected. private BluetoothLeGattCallback mLeGattCallback = new BluetoothLeGattCallback() { @Override public void onDiscPriSrvResult(char connectedHandle, int status, BluetoothLeGattService[] data) { for (int cnt=0; cnt
![](/manual_guide/products/epson-bt2000-developers-guide-3a30282/155.png)