ServiceSelectorpublic class ServiceSelector extends ServiceSearcherBase This class provides functionality of DiscoveryAgent.selectService()
(see JSR 82 texts for details) using SDP serviceAttribute request. |
Fields Summary |
---|
private static final boolean | DEBUGSet to false in RR version - then the javac skip the code. | private static final String | cnthis class name for debug. | private javax.bluetooth.DataElement[] | attrValuesKeeps attributes values retrieved from SDP_ServiceAttributeResponse. | private IOException | ioExcptKeeps an IOException if any occured or SDP_ErrorResponceRecieved. |
Methods Summary |
---|
public void | errorResponse(int errorCode, java.lang.String info, int transactionID)Recieves error information retrieved from SDP_ErrorResponse and
copmpletes the request activity by error reason.
if (DEBUG) {
System.out.println(cn + ".errorResponse: called");
}
synchronized (this) {
ioExcpt = new IOException(info);
notify();
}
| javax.bluetooth.ServiceRecord | getServiceRecord()Performs SERVICESEARCHATTRIBUTE transaction and returns newly created
ServiceRecordImpl instance with attributes and values
returned by server within SDP_serviceSearchAttributeResponse.
SDPClient sdp = null;
short transactionID = SDPClient.newTransactionID();
try {
sdp = new SDPClient(btDev.getBluetoothAddress());
if (sdp != null) {
sdp.serviceSearchAttributeRequest(attrSet, uuidSet,
transactionID, this);
}
} catch (IOException ioe) {
if (DEBUG) {
ioe.printStackTrace();
}
ioExcpt = ioe;
}
synchronized (this) {
if (ioExcpt == null && attrValues == null && sdp != null) {
try {
wait();
} catch (InterruptedException ie) {
// ignore (break waiting)
}
}
}
SDPClient.freeTransactionID(transactionID);
try {
if (sdp != null) {
sdp.close();
}
} catch (IOException ioe) {
if (DEBUG) {
ioe.printStackTrace();
}
// ignore
}
if (ioExcpt != null) {
return null;
} else if (attrValues == null) {
return null;
} else if (attrValues.length == 0) {
return null;
} else {
return new ServiceRecordImpl(btDev, attrSet, attrValues);
}
| public void | serviceAttributeResponse(int[] attrIDs, javax.bluetooth.DataElement[] attributeValues, int transactionID)Base class method not relevant to this subclass, it must never be called.
if (DEBUG) {
System.out.println(cn +
".serviceAttributeResponse: unexpected call");
}
throw new RuntimeException("unexpected call");
| public void | serviceSearchAttributeResponse(int[] attrIDs, javax.bluetooth.DataElement[] attributeValues, int transactionID)Receives arrays of service record attributes and their values retrieved
from SDP_ServiceSearchAttributeResponse.
if (DEBUG) {
System.out.println(cn + ".serviceSearchAttributeResponse: called");
}
synchronized (this) {
attrSet = attrIDs;
attrValues = attributeValues;
notify();
}
| public void | serviceSearchResponse(int[] handleList, int transactionID)Base class method not relevant to this subclass, it must never be called.
if (DEBUG) {
System.out.println(cn + ".serviceSearchResponse: unexpected call");
}
throw new RuntimeException("unexpected call");
|
|