/**
  * Unregisters a capabilities listener
  *
  * @param listener Capabilities listener
  * @throws RcsServiceNotAvailableException
  * @throws RcsGenericException
  */
 public void removeCapabilitiesListener(CapabilitiesListener listener)
     throws RcsServiceNotAvailableException, RcsGenericException {
   if (mApi == null) {
     throw new RcsServiceNotAvailableException();
   }
   try {
     mApi.removeCapabilitiesListener(listener);
   } catch (Exception e) {
     RcsIllegalArgumentException.assertException(e);
     throw new RcsGenericException(e);
   }
 }
 /**
  * Requests capabilities for all contacts existing in the local address book. This method
  * initiates in background new capability requests for each contact of the address book by sending
  * SIP OPTIONS. The result of a capability request is sent asynchronously via callback method of
  * the capabilities listener. The result of the capability refresh request is provided to all the
  * clients that have registered the listener for this event.
  *
  * @throws RcsServiceNotRegisteredException
  * @throws RcsServiceNotAvailableException
  * @throws RcsGenericException
  */
 public void requestAllContactsCapabilities()
     throws RcsServiceNotRegisteredException, RcsServiceNotAvailableException,
         RcsGenericException {
   if (mApi == null) {
     throw new RcsServiceNotAvailableException();
   }
   try {
     mApi.requestAllContactsCapabilities();
   } catch (Exception e) {
     RcsServiceNotRegisteredException.assertException(e);
     throw new RcsGenericException(e);
   }
 }
  /**
   * Returns the capabilities supported by the local end user. The supported capabilities are fixed
   * by the MNO and read during the provisioning.
   *
   * @return Capabilities
   * @throws RcsPersistentStorageException
   * @throws RcsServiceNotAvailableException
   * @throws RcsGenericException
   */
  public Capabilities getMyCapabilities()
      throws RcsPersistentStorageException, RcsServiceNotAvailableException, RcsGenericException {
    if (mApi == null) {
      throw new RcsServiceNotAvailableException();
    }
    try {
      return mApi.getMyCapabilities();

    } catch (Exception e) {
      RcsPersistentStorageException.assertException(e);
      throw new RcsGenericException(e);
    }
  }
 /**
  * Requests capabilities to a remote contact. This method initiates in background a new capability
  * request to the remote contact by sending a SIP OPTIONS. The result of the capability request is
  * sent asynchronously via callback method of the capabilities listener. The parameter contact
  * supports the following formats: MSISDN in national or international format, SIP address,
  * SIP-URI or Tel-URI. If the format of the contact is not supported an exception is thrown. The
  * result of the capability refresh request is provided to all the clients that have registered
  * the listener for this event.
  *
  * @param contact Contact Identifier
  * @throws RcsServiceNotRegisteredException
  * @throws RcsServiceNotAvailableException
  * @throws RcsGenericException
  */
 public void requestContactCapabilities(ContactId contact)
     throws RcsServiceNotRegisteredException, RcsServiceNotAvailableException,
         RcsGenericException {
   if (mApi == null) {
     throw new RcsServiceNotAvailableException();
   }
   try {
     mApi.requestContactCapabilities(contact);
   } catch (Exception e) {
     RcsIllegalArgumentException.assertException(e);
     RcsServiceNotRegisteredException.assertException(e);
     throw new RcsGenericException(e);
   }
 }
  /**
   * Returns the capabilities of a given contact from the local database. This method doesn't
   * request any network update to the remote contact. The parameter contact supports the following
   * formats: MSISDN in national or international format, SIP address, SIP-URI or Tel-URI. If the
   * format of the contact is not supported an exception is thrown.
   *
   * @param contact Contact Identifier
   * @return Capabilities
   * @throws RcsPersistentStorageException
   * @throws RcsServiceNotAvailableException
   * @throws RcsGenericException
   */
  public Capabilities getContactCapabilities(ContactId contact)
      throws RcsPersistentStorageException, RcsServiceNotAvailableException, RcsGenericException {
    if (mApi == null) {
      throw new RcsServiceNotAvailableException();
    }
    try {
      return mApi.getContactCapabilities(contact);

    } catch (Exception e) {
      RcsIllegalArgumentException.assertException(e);
      RcsPersistentStorageException.assertException(e);
      throw new RcsGenericException(e);
    }
  }
 /**
  * Unregisters a capabilities listener on a list of contacts
  *
  * @param contacts Set of contact identifiers
  * @param listener Capabilities listener
  * @throws RcsServiceNotAvailableException
  * @throws RcsGenericException
  */
 public void removeCapabilitiesListener(Set<ContactId> contacts, CapabilitiesListener listener)
     throws RcsServiceNotAvailableException, RcsGenericException {
   if (mApi == null) {
     throw new RcsServiceNotAvailableException();
   }
   if (contacts == null || contacts.isEmpty()) {
     throw new RcsIllegalArgumentException("contacts must not be null or empty!");
   }
   try {
     for (ContactId contact : contacts) {
       mApi.removeCapabilitiesListener2(contact, listener);
     }
   } catch (Exception e) {
     RcsIllegalArgumentException.assertException(e);
     throw new RcsGenericException(e);
   }
 }