Package totalcross.io.device.bluetooth
Interface DiscoveryListener
-
public interface DiscoveryListenerTheDiscoveryListenerinterface 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.- Since:
- TotalCross 1.2
-
-
Field Summary
Fields Modifier and Type Field Description static intINQUIRY_COMPLETEDIndicates the normal completion of device discovery.static intINQUIRY_ERRORIndicates that the inquiry request failed to complete normally, but was not cancelled.static intINQUIRY_TERMINATEDIndicates device discovery has been canceled by the application and did not complete.static intSERVICE_SEARCH_COMPLETEDIndicates the normal completion of service discovery.static intSERVICE_SEARCH_DEVICE_NOT_REACHABLEIndicates the service search could not be completed because the remote device provided toDiscoveryAgent.searchServices()could not be reached.static intSERVICE_SEARCH_ERRORIndicates the service search terminated with an error.static intSERVICE_SEARCH_NO_RECORDSIndicates the service search has completed with no service records found on the device.static intSERVICE_SEARCH_TERMINATEDIndicates the service search has been canceled by the application and did not complete.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddeviceDiscovered(RemoteDevice btDevice, DeviceClass cod)Called when a device is found during an inquiry.voidinquiryCompleted(int discType)Called when an inquiry is completed.voidservicesDiscovered(int transID, ServiceRecord[] servRecord)Called when service(s) are found during a service search.voidserviceSearchCompleted(int transID, int respCode)Called when a service search is completed or was terminated because of an error.
-
-
-
Field Detail
-
INQUIRY_COMPLETED
static final int INQUIRY_COMPLETED
Indicates the normal completion of device discovery. Used with theinquiryCompleted()method.The value of
INQUIRY_COMPLETEDis 0x00 (0).- See Also:
- Constant Field Values
-
INQUIRY_ERROR
static final int INQUIRY_ERROR
Indicates that the inquiry request failed to complete normally, but was not cancelled.The value of
INQUIRY_ERRORis 0x07 (7).- See Also:
- Constant Field Values
-
INQUIRY_TERMINATED
static final int INQUIRY_TERMINATED
Indicates device discovery has been canceled by the application and did not complete. Used with theinquiryCompleted()method.The value of
INQUIRY_TERMINATEDis 0x05 (5).- See Also:
- Constant Field Values
-
SERVICE_SEARCH_COMPLETED
static final int SERVICE_SEARCH_COMPLETED
Indicates the normal completion of service discovery. Used with theserviceSearchCompleted()method.The value of
SERVICE_SEARCH_COMPLETEDis 0x01 (1).- See Also:
- Constant Field Values
-
SERVICE_SEARCH_DEVICE_NOT_REACHABLE
static final int SERVICE_SEARCH_DEVICE_NOT_REACHABLE
Indicates the service search could not be completed because the remote device provided toDiscoveryAgent.searchServices()could not be reached. Used with theserviceSearchCompleted()method.The value of
SERVICE_SEARCH_DEVICE_NOT_REACHABLEis 0x06 (6).- See Also:
- Constant Field Values
-
SERVICE_SEARCH_ERROR
static final int SERVICE_SEARCH_ERROR
Indicates the service search terminated with an error. Used with theserviceSearchCompleted()method.The value of
SERVICE_SEARCH_ERRORis 0x03 (3).- See Also:
- Constant Field Values
-
SERVICE_SEARCH_NO_RECORDS
static final int SERVICE_SEARCH_NO_RECORDS
Indicates the service search has completed with no service records found on the device. Used with theserviceSearchCompleted()method.The value of
SERVICE_SEARCH_NO_RECORDSis 0x04 (4).- See Also:
- Constant Field Values
-
SERVICE_SEARCH_TERMINATED
static final int SERVICE_SEARCH_TERMINATED
Indicates the service search has been canceled by the application and did not complete. Used with theserviceSearchCompleted()method.The value of
SERVICE_SEARCH_TERMINATEDis 0x02 (2).- See Also:
- Constant Field Values
-
-
Method Detail
-
deviceDiscovered
void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
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.- Parameters:
btDevice- the device that was found during the inquirycod- the service classes, major device class, and minor device class of the remote device- Since:
- TotalCross 1.2
-
inquiryCompleted
void inquiryCompleted(int discType)
Called when an inquiry is completed.discTypewill beINQUIRY_COMPLETEDif the inquiry ended normally orINQUIRY_TERMINATEDif the inquiry was canceled by a call toDiscoveryAgent.cancelInquiry(). ThediscTypewill beINQUIRY_ERRORif an error occurred while processing the inquiry causing the inquiry to end abnormally.- Parameters:
discType- the type of request that was completed; eitherINQUIRY_COMPLETED,INQUIRY_TERMINATED, orINQUIRY_ERROR- Since:
- TotalCross 1.2
-
servicesDiscovered
void servicesDiscovered(int transID, ServiceRecord[] servRecord)Called when service(s) are found during a service search.- Parameters:
transID- the transaction ID of the service search that is posting the resultservRecord- a list of services found during the search request- Since:
- TotalCross 1.2
-
serviceSearchCompleted
void serviceSearchCompleted(int transID, int respCode)Called when a service search is completed or was terminated because of an error. Legal status values in therespCodeargument includeSERVICE_SEARCH_COMPLETED,SERVICE_SEARCH_TERMINATED,SERVICE_SEARCH_ERROR,SERVICE_SEARCH_NO_RECORDSandSERVICE_SEARCH_DEVICE_NOT_REACHABLE. The following table describes when eachrespCodewill be used:respCodeReason SERVICE_SEARCH_COMPLETEDif the service search completed normally SERVICE_SEARCH_TERMINATEDif the service search request was cancelled by a call to DiscoveryAgent.cancelServiceSearch()SERVICE_SEARCH_ERRORif an error occurred while processing the request SERVICE_SEARCH_NO_RECORDSif no records were found during the service search SERVICE_SEARCH_DEVICE_NOT_REACHABLEif the device specified in the search request could not be reached or the local device could not establish a connection to the remote device - Parameters:
transID- the transaction ID identifying the request which initiated the service searchrespCode- the response code that indicates the status of the transaction- Since:
- TotalCross 1.2
-
-