IMediaHTTPService.cpp revision 1b86fe063badb5f28c467ade39be0f4008688947
1/* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17//#define LOG_NDEBUG 0 18#define LOG_TAG "IMediaHTTPService" 19#include <utils/Log.h> 20 21#include <media/IMediaHTTPService.h> 22 23#include <binder/Parcel.h> 24#include <media/IMediaHTTPConnection.h> 25 26namespace android { 27 28enum { 29 MAKE_HTTP = IBinder::FIRST_CALL_TRANSACTION, 30}; 31 32struct BpMediaHTTPService : public BpInterface<IMediaHTTPService> { 33 BpMediaHTTPService(const sp<IBinder> &impl) 34 : BpInterface<IMediaHTTPService>(impl) { 35 } 36 37 virtual sp<IMediaHTTPConnection> makeHTTPConnection() { 38 Parcel data, reply; 39 data.writeInterfaceToken( 40 IMediaHTTPService::getInterfaceDescriptor()); 41 42 remote()->transact(MAKE_HTTP, data, &reply); 43 44 status_t err = reply.readInt32(); 45 46 if (err != OK) { 47 return NULL; 48 } 49 50 return interface_cast<IMediaHTTPConnection>(reply.readStrongBinder()); 51 } 52}; 53 54IMPLEMENT_META_INTERFACE( 55 MediaHTTPService, "android.media.IMediaHTTPService"); 56 57} // namespace android 58 59