BluetoothMnsObexServerpublic class BluetoothMnsObexServer extends javax.obex.ServerRequestHandler
Fields Summary |
---|
private static final String | TAG | private static final byte[] | MNS_TARGET | private static final String | TYPE | private final android.os.Handler | mCallback |
Constructors Summary |
---|
public BluetoothMnsObexServer(android.os.Handler callback)
super();
mCallback = callback;
|
Methods Summary |
---|
public int | onAbort(javax.obex.HeaderSet request, javax.obex.HeaderSet reply)
Log.v(TAG, "onAbort");
return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED;
| public void | onClose()
Log.v(TAG, "onClose");
// TODO: call session handler so it can disconnect
| public int | onConnect(javax.obex.HeaderSet request, javax.obex.HeaderSet reply)
Log.v(TAG, "onConnect");
try {
byte[] uuid = (byte[]) request.getHeader(HeaderSet.TARGET);
if (!Arrays.equals(uuid, MNS_TARGET)) {
return ResponseCodes.OBEX_HTTP_NOT_ACCEPTABLE;
}
} catch (IOException e) {
// this should never happen since getHeader won't throw exception it
// declares to throw
return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
}
reply.setHeader(HeaderSet.WHO, MNS_TARGET);
return ResponseCodes.OBEX_HTTP_OK;
| public void | onDisconnect(javax.obex.HeaderSet request, javax.obex.HeaderSet reply)
Log.v(TAG, "onDisconnect");
| public int | onGet(javax.obex.Operation op)
Log.v(TAG, "onGet");
return ResponseCodes.OBEX_HTTP_BAD_REQUEST;
| public int | onPut(javax.obex.Operation op)
Log.v(TAG, "onPut");
try {
HeaderSet headerset;
headerset = op.getReceivedHeader();
String type = (String) headerset.getHeader(HeaderSet.TYPE);
ObexAppParameters oap = ObexAppParameters.fromHeaderSet(headerset);
if (!TYPE.equals(type) || !oap.exists(BluetoothMasRequest.OAP_TAGID_MAS_INSTANCE_ID)) {
return ResponseCodes.OBEX_HTTP_BAD_REQUEST;
}
Byte inst = oap.getByte(BluetoothMasRequest.OAP_TAGID_MAS_INSTANCE_ID);
BluetoothMapEventReport ev = BluetoothMapEventReport.fromStream(op
.openDataInputStream());
op.close();
mCallback.obtainMessage(BluetoothMnsService.MSG_EVENT, inst, 0, ev).sendToTarget();
} catch (IOException e) {
Log.e(TAG, "I/O exception when handling PUT request", e);
return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
}
return ResponseCodes.OBEX_HTTP_OK;
| public int | onSetPath(javax.obex.HeaderSet request, javax.obex.HeaderSet reply, boolean backup, boolean create)
Log.v(TAG, "onSetPath");
return ResponseCodes.OBEX_HTTP_BAD_REQUEST;
|
|