Ejemplo n.º 1
0
        @Override
        public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();
          Log.d(TAG, "进入广播:" + action.toString());

          // 发现设备
          if (BluetoothDevice.ACTION_FOUND.equals(action)) {
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
            Log.d(TAG, "发现设备");
            devices.add(device.getName() + "\n" + device.getAddress());
            Log.d(TAG, "devices:" + device.getName() + "[" + device.getAddress() + "]");

            // 添加非配对设备
            if (isLock(device)) {
              String address = device.getAddress();

              devices.add(device.getName() + "\n" + device.getAddress());
              Log.d(TAG, "devices" + devices);
              deviceList.add(device);
              Log.d(TAG, "deviceList" + deviceList);
              Log.d(TAG, "address" + address);
              device1 = adapter.getRemoteDevice(address);
              Log.d(TAG, "device1:" + device1);
              blueclient.nativeInit(device);
            }
          }
        }
Ejemplo n.º 2
0
  public boolean isConnected() {

    return blueclient.isConnected();
  }
Ejemplo n.º 3
0
 public void stop() {
   // TODO Auto-generated method stub
   blueclient.stop();
 }
Ejemplo n.º 4
0
 public void sendMessage() {
   blueclient.sendmsg(0, 0);
 }