FileDocCategorySizeDatePackage
BluetoothMasRequestGetMessage.javaAPI DocAndroid 5.1 API2627Thu Mar 12 22:22:50 GMT 2015android.bluetooth.client.map

BluetoothMasRequestGetMessage

public 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 voidexecute(javax.obex.ClientSession session)

        executeGet(session);
    
public BluetoothMapBmessagegetMessage()

        return mBmessage;
    
protected voidreadResponse(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;
        }