BluetoothMasRequestGetMessagepublic final class BluetoothMasRequestGetMessage extends BluetoothMasRequest
Fields Summary |
---|
private static final String | TAG | private static final String | TYPE | private BluetoothMapBmessage | mBmessage |
Constructors Summary |
---|
public BluetoothMasRequestGetMessage(String handle, android.bluetooth.client.map.BluetoothMasClient.CharsetType charset, boolean attachment)
mHeaderSet.setHeader(HeaderSet.NAME, handle);
mHeaderSet.setHeader(HeaderSet.TYPE, TYPE);
ObexAppParameters oap = new ObexAppParameters();
oap.add(OAP_TAGID_CHARSET, CharsetType.UTF_8.equals(charset) ? CHARSET_UTF8
: CHARSET_NATIVE);
oap.add(OAP_TAGID_ATTACHMENT, attachment ? ATTACHMENT_ON : ATTACHMENT_OFF);
oap.addToHeaderSet(mHeaderSet);
|
Methods Summary |
---|
public void | execute(javax.obex.ClientSession session)
executeGet(session);
| public BluetoothMapBmessage | getMessage()
return mBmessage;
| protected void | readResponse(java.io.InputStream stream)
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
try {
int len;
while ((len = stream.read(buf)) != -1) {
baos.write(buf, 0, len);
}
} catch (IOException e) {
Log.e(TAG, "I/O exception while reading response", e);
}
String bmsg = baos.toString();
mBmessage = BluetoothMapBmessageParser.createBmessage(bmsg);
if (mBmessage == null) {
mResponseCode = ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
}
|
|