예제 #1
0
 /** Callback invoked when buttons/switches clicked */
 @Override
 public void onClick(View v) {
   if (v == mButtonSelectDevice) {
     // Start the device selector
     mDevicePicker.show(getFragmentManager(), FRAGMENT_DEVICE_PICKER);
   } else if (v == mButtonConnect) {
     // Start device connection
     connect();
   } else if (v == mButtonDisconnect) {
     // Start device disconnect
     disconnect();
   } else if (v == mButtonReadDeviceInfo) {
     // Start reading the device information characteristics
     readDeviceInfoCharacteristics();
   } else if (v == mButtonReadBatteryInfo) {
     // Start reading the battery characteristics
     readBatteryCharacteristic();
   } else if (v == mButtonReadHelloConfiguration) {
     // Start reading the hello configuration characteristics
   } else if (v == mButtonWriteHelloConfiguration) {
     // Start writing the hello configuration characteristics
     writeHelloConfigurationCharacteristic();
   } else if (v == mButtonReadHelloInput) {
     // Start reading hello input descriptors
     readHelloInputCharacteristic();
   } else if (v == mButtonClear) {
     // Clear the notification area
     mTextAreaNotification.setText("");
   }
 }
예제 #2
0
 /**
  * Initialize the device picker
  *
  * @return
  */
 private void initDevicePicker() {
   mDevicePicker = DevicePickerFragment.createDialog(this, null, true);
 }