All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.bluetooth.DiscoveryListener Maven / Gradle / Ivy

/**
 *  BlueCove - Java library for Bluetooth
 *  Copyright (C) 2004 Intel Corporation
 * 
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *
 *  Java docs licensed under the Apache License, Version 2.0
 *  http://www.apache.org/licenses/LICENSE-2.0 
 *   (c) Copyright 2001, 2002 Motorola, Inc.  ALL RIGHTS RESERVED.
 * 
 *   
 *  @version $Id: DiscoveryListener.java 549 2007-06-22 22:19:46Z skarzhevskyy $
 */
package javax.bluetooth;

/**
 * The DiscoveryListener interface allows an application to
 * receive device discovery and service discovery events. This interface
 * provides four methods, two for discovering devices and two for discovering
 * services.
 * 
 * @version 1.0 February 11, 2002
 * 
 * @since 1.1 The JSR 82 specification does not require that implementations
 *        create individual threads for event delivery. Thus, if a
 *        DiscoveryListener method does not return or the return is delayed, the
 *        system may be blocked. So the following note is given for application
 *        developers :
 *        

* * The following DiscoveryListener methods SHOULD return immediately : *

    *
  • DiscoveryListener.deviceDiscovered
  • *
  • DiscoveryListener.inquiryCompleted
  • *
  • DiscoveryListener.servicesDiscovered
  • *
  • DiscoveryListener.serviceSearchCompleted
  • *
* */ public interface DiscoveryListener { /** * Indicates the normal completion of device discovery. Used with the * {@link #inquiryCompleted(int)} method. *

* The value of INQUIRY_COMPLETED is 0x00 (0). * * @see #inquiryCompleted(int) * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener) */ public static final int INQUIRY_COMPLETED = 0x00; /** * Indicates device discovery has been canceled by the application and did * not complete. Used with the {@link #inquiryCompleted(int)} method. *

* The value of INQUIRY_TERMINATED is 0x05 (5). * * @see #inquiryCompleted(int) * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener) * @see DiscoveryAgent#cancelInquiry(javax.bluetooth.DiscoveryListener) */ public static final int INQUIRY_TERMINATED = 0x05; /** * Indicates that the inquiry request failed to complete normally, but was * not cancelled. *

* The value of INQUIRY_ERROR is 0x07 (7). * * @see #inquiryCompleted(int) * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener) */ public static final int INQUIRY_ERROR = 0x07; /** * Indicates the normal completion of service discovery. Used with the * {@link #serviceSearchCompleted(int, int)} method. *

* The value of SERVICE_SEARCH_COMPLETED is 0x01 (1). * * @see #serviceSearchCompleted(int, int) * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[], * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener) */ public static final int SERVICE_SEARCH_COMPLETED = 0x01; /** * Indicates the service search has been canceled by the application and did * not complete. Used with the {@link #serviceSearchCompleted(int, int)} method. *

* The value of SERVICE_SEARCH_TERMINATED is 0x02 (2). * * @see #serviceSearchCompleted(int, int) * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[], * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener) * @see DiscoveryAgent#cancelServiceSearch(int) */ public static final int SERVICE_SEARCH_TERMINATED = 0x02; /** * Indicates the service search terminated with an error. Used with the * {@link #serviceSearchCompleted(int, int)} method. *

* The value of SERVICE_SEARCH_ERROR is 0x03 (3). * * @see #serviceSearchCompleted(int, int) * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[], * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener) */ public static final int SERVICE_SEARCH_ERROR = 0x03; /** * Indicates the service search has completed with no service records found * on the device. Used with the {@link #serviceSearchCompleted(int, int)} method. *

* The value of SERVICE_SEARCH_NO_RECORDS is 0x04 (4). * * @see #serviceSearchCompleted(int, int) * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[], * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener) */ public static final int SERVICE_SEARCH_NO_RECORDS = 0x04; /** * Indicates the service search could not be completed because the remote * device provided to {@link DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[], * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener) * DiscoveryAgent.searchServices()} could not be reached. * Used with the {@link #serviceSearchCompleted(int, int)} method. *

* The value of SERVICE_SEARCH_DEVICE_NOT_REACHABLE is 0x06 (6). * * @see #serviceSearchCompleted(int, int) * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[], * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener) */ public static final int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 0x06; /** * Called when a device is found during an inquiry. An inquiry searches for * devices that are discoverable. The same device may be returned multiple * times. * * @param btDevice the device that was found during the inquiry * @param cod - the service classes, major device class, and minor device * class of the remote device * @see DiscoveryAgent#startInquiry(int, javax.bluetooth.DiscoveryListener) */ public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod); /** * Called when service(s) are found during a service search. * * @param transID the transaction ID of the service search that is posting the * result * @param servRecord a list of services found during the search request * @see DiscoveryAgent#searchServices(int[], javax.bluetooth.UUID[], * javax.bluetooth.RemoteDevice, javax.bluetooth.DiscoveryListener) */ public void servicesDiscovered(int transID, ServiceRecord[] servRecord); /** * Called when a service search is completed or was terminated because of an * error. Legal status values in the {@code respCode} argument include * {@link #SERVICE_SEARCH_COMPLETED}, {@link #SERVICE_SEARCH_TERMINATED}, * {@link #SERVICE_SEARCH_ERROR}, {@link #SERVICE_SEARCH_NO_RECORDS} and * {@link #SERVICE_SEARCH_DEVICE_NOT_REACHABLE}. The following table describes when * each {@code respCode} will be used: *

* * * * * * * * * *
respCodeReason
{@link #SERVICE_SEARCH_COMPLETED}if the service search completed normally
{@link #SERVICE_SEARCH_TERMINATED}if the service search request was cancelled by a call to * {@link DiscoveryAgent#cancelServiceSearch(int)}
{@link #SERVICE_SEARCH_ERROR}if an error occurred while processing the request
{@link #SERVICE_SEARCH_NO_RECORDS}if no records were found during the service search
{@link #SERVICE_SEARCH_DEVICE_NOT_REACHABLE}if the device specified in the search request could not be reached or * the local device could not establish a connection to the remote device *
* * @param transID the transaction ID identifying the request which * initiated the service search * @param respCode the response code that indicates the status of the transaction */ public void serviceSearchCompleted(int transID, int respCode); /** * Called when an inquiry is completed. The {@code discType} will be * {@link #INQUIRY_COMPLETED} if the inquiry ended normally or {@link #INQUIRY_TERMINATED} * if the inquiry was canceled by a call to * {@link DiscoveryAgent#cancelInquiry(DiscoveryListener)}. The {@code discType} will be * {@link #INQUIRY_ERROR} if an error occurred while processing the inquiry causing the * inquiry to end abnormally. * * @param discType the type of request that was completed; either * {@link #INQUIRY_COMPLETED}, {@link #INQUIRY_TERMINATED}, * or {@link #INQUIRY_ERROR} * @see #INQUIRY_COMPLETED * @see #INQUIRY_TERMINATED * @see #INQUIRY_ERROR */ public void inquiryCompleted(int discType); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy