/** * Send Set_Idle_Time command to the connected HID input device. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * * @param device Remote Bluetooth Device * @param idleTime Idle time to be set on HID Device * @return false on immediate error, true otherwise * @hide */ public boolean setIdleTime(BluetoothDevice device, byte idleTime) { if (DBG) log("setIdletime(" + device + "), idleTime=" + idleTime); if (mService != null && isEnabled() && isValidDevice(device)) { try { return mService.setIdleTime(device, idleTime); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; }
/** * Send Get_Protocol_Mode command to the connected HID input device. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * * @param device Remote Bluetooth Device * @return false on immediate error, true otherwise * @hide */ public boolean getProtocolMode(BluetoothDevice device) { if (VDBG) log("getProtocolMode(" + device + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { try { return mService.getProtocolMode(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; }
/** * Send Send_Data command to the connected HID input device. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * * @param device Remote Bluetooth Device * @param data Data to send * @return false on immediate error, true otherwise * @hide */ public boolean sendData(BluetoothDevice device, String report) { if (DBG) log("sendData(" + device + "), report=" + report); if (mService != null && isEnabled() && isValidDevice(device)) { try { return mService.sendData(device, report); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; }
/** * Get the priority of the profile. * * <p>The priority can be any of: {@link #PRIORITY_AUTO_CONNECT}, {@link #PRIORITY_OFF}, {@link * #PRIORITY_ON}, {@link #PRIORITY_UNDEFINED} * * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. * * @param device Bluetooth device * @return priority of the device * @hide */ public int getPriority(BluetoothDevice device) { if (VDBG) log("getPriority(" + device + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { try { return mService.getPriority(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.PRIORITY_OFF; } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return BluetoothProfile.PRIORITY_OFF; }
/** {@inheritDoc} */ public int getConnectionState(BluetoothDevice device) { if (VDBG) log("getState(" + device + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { try { return mService.getConnectionState(device); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return BluetoothProfile.STATE_DISCONNECTED; } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return BluetoothProfile.STATE_DISCONNECTED; }
/** {@inheritDoc} */ public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) { if (VDBG) log("getDevicesMatchingStates()"); if (mService != null && isEnabled()) { try { return mService.getDevicesMatchingConnectionStates(states); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return new ArrayList<BluetoothDevice>(); } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return new ArrayList<BluetoothDevice>(); }
/** * Set priority of the profile * * <p>The device should already be paired. Priority can be one of {@link #PRIORITY_ON} or {@link * #PRIORITY_OFF}, * * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * * @param device Paired bluetooth device * @param priority * @return true if priority is set, false on error * @hide */ public boolean setPriority(BluetoothDevice device, int priority) { if (DBG) log("setPriority(" + device + ", " + priority + ")"); if (mService != null && isEnabled() && isValidDevice(device)) { if (priority != BluetoothProfile.PRIORITY_OFF && priority != BluetoothProfile.PRIORITY_ON) { return false; } try { return mService.setPriority(device, priority); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; }
/** * Send Get_Report command to the connected HID input device. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission. * * @param device Remote Bluetooth Device * @param reportType Report type * @param reportId Report ID * @param bufferSize Report receiving buffer size * @return false on immediate error, true otherwise * @hide */ public boolean getReport(BluetoothDevice device, byte reportType, byte reportId, int bufferSize) { if (VDBG) log( "getReport(" + device + "), reportType=" + reportType + " reportId=" + reportId + "bufferSize=" + bufferSize); if (mService != null && isEnabled() && isValidDevice(device)) { try { return mService.getReport(device, reportType, reportId, bufferSize); } catch (RemoteException e) { Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); return false; } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; }