Beispiel #1
0
 private static synchronized void setHidService(HidService instance) {
   if (instance != null && instance.isAvailable()) {
     if (DBG) Log.d(TAG, "setHidService(): set to: " + sHidService);
     sHidService = instance;
   } else {
     if (DBG) {
       if (sHidService == null) {
         Log.d(TAG, "setHidService(): service not available");
       } else if (!sHidService.isAvailable()) {
         Log.d(TAG, "setHidService(): service is cleaning up");
       }
     }
   }
 }
Beispiel #2
0
 public static synchronized HidService getHidService() {
   if (sHidService != null && sHidService.isAvailable()) {
     if (DBG) Log.d(TAG, "getHidService(): returning " + sHidService);
     return sHidService;
   }
   if (DBG) {
     if (sHidService == null) {
       Log.d(TAG, "getHidService(): service is NULL");
     } else if (!(sHidService.isAvailable())) {
       Log.d(TAG, "getHidService(): service is not available");
     }
   }
   return null;
 }
Beispiel #3
0
    private HidService getService() {
      if (!Utils.checkCaller()) {
        Log.w(TAG, "InputDevice call not allowed for non-active user");
        return null;
      }

      if (mService != null && mService.isAvailable()) {
        return mService;
      }
      return null;
    }
Beispiel #4
0
 public boolean getIdleTime(BluetoothDevice device) {
   HidService service = getService();
   if (service == null) return false;
   return service.getIdleTime(device);
 }
Beispiel #5
0
 public boolean sendData(BluetoothDevice device, String report) {
   HidService service = getService();
   if (service == null) return false;
   return service.sendData(device, report);
 }
Beispiel #6
0
 public boolean setReport(BluetoothDevice device, byte reportType, String report) {
   HidService service = getService();
   if (service == null) return false;
   return service.setReport(device, reportType, report);
 }
Beispiel #7
0
 public boolean getReport(
     BluetoothDevice device, byte reportType, byte reportId, int bufferSize) {
   HidService service = getService();
   if (service == null) return false;
   return service.getReport(device, reportType, reportId, bufferSize);
 }
Beispiel #8
0
 public boolean setProtocolMode(BluetoothDevice device, int protocolMode) {
   HidService service = getService();
   if (service == null) return false;
   return service.setProtocolMode(device, protocolMode);
 }
Beispiel #9
0
 public boolean virtualUnplug(BluetoothDevice device) {
   HidService service = getService();
   if (service == null) return false;
   return service.virtualUnplug(device);
 }
Beispiel #10
0
 public int getPriority(BluetoothDevice device) {
   HidService service = getService();
   if (service == null) return BluetoothProfile.PRIORITY_UNDEFINED;
   return service.getPriority(device);
 }
Beispiel #11
0
 public boolean setPriority(BluetoothDevice device, int priority) {
   HidService service = getService();
   if (service == null) return false;
   return service.setPriority(device, priority);
 }
Beispiel #12
0
 public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
   HidService service = getService();
   if (service == null) return new ArrayList<BluetoothDevice>(0);
   return service.getDevicesMatchingConnectionStates(states);
 }
Beispiel #13
0
 public int getConnectionState(BluetoothDevice device) {
   HidService service = getService();
   if (service == null) return BluetoothInputDevice.STATE_DISCONNECTED;
   return service.getConnectionState(device);
 }
Beispiel #14
0
 public boolean disconnect(BluetoothDevice device) {
   HidService service = getService();
   if (service == null) return false;
   return service.disconnect(device);
 }