professional audio NDK  1.1.3
include/apa/IAPAInterface.h
00001 /*
00002  * Samsung Handset Platform
00003  * Copyright (c) 2007 Software Center, Samsung Electronics, Inc.
00004  * All rights reserved.
00005  * This software is the confidential and proprietary information
00006  * of Samsung Electronics, Inc. ("Confidential Information").  You
00007  * shall not disclose such Confidential Information and shall use
00008  * it only in accordance with the terms of the license agreement
00009  * you entered into with Samsung Electronics.
00010  */
00011 
00012 /*
00013  * @author <a href="mailto:haeseok@samsung.com">HaeSeok Oh</a>
00014  * @author <a href="mailto:lh.bang@samsung.com">LaeHyuk Bang</a>
00015  * @author <a href="mailto:jeongyeon.kim@samsung.com">JeongYeon Kim</a>
00016  * @author <a href="mailto:dbs.park@samsung.com">DaeBeom Park</a>
00017  *
00018  */
00019 
00020 #ifndef ANDROID_APA_INTERFACE_H
00021 #define ANDROID_APA_INTERFACE_H
00022 
00023 #include <stdint.h>
00024 #include <IAPAResponseInterface.h>
00025 
00026 namespace android {
00027 
00028 class IJackClientInterface;
00029 
00038 class IAPAInterface {
00039     public:
00043         IAPAInterface(){mResponse = NULL;};
00044 
00048         virtual ~IAPAInterface(){};
00049         
00057         virtual int init() = 0; // called automatically
00058 
00067         virtual int sendCommand(const char* command) = 0;
00068 
00074         virtual IJackClientInterface* getJackClientInterface() = 0;
00075 
00082         void setResponseInterface(IAPAResponseInterface* itf){ mResponse = itf; }; // called automatically
00083 
00090         inline void response(const char* message){if(mResponse != NULL) mResponse->responseToService(message);};
00091 
00100         inline void response(const int32_t ext1, const size_t len, void const* data){if(mResponse != NULL) mResponse->responseToService(ext1,len,data);};
00101 
00115         virtual int request(const char* what, const long ext1, const long capacity, size_t &len, void* const data) = 0;
00116 
00124         inline void response(const char* message, const int id){if(mResponse != NULL) mResponse->responseToService(id, message);};
00125 
00126         
00127     private:
00128         IAPAResponseInterface* mResponse; // Don't need to release
00129 };
00130 
00131 #define APA_NDK_API_LEVEL (1)
00132 #define APA_NDK_VERSION_NUMBER (1103)
00133 #define DECLARE_APA_INTERFACE(NAME)                         \
00134     extern "C" NAME* apa_create();                          \
00135     extern "C" void apa_destroy(NAME* p);                   \
00136     extern "C" int apa_get_api_level();                     \
00137     extern "C" int apa_get_ndk_version();                   \
00138 
00139 #define IMPLEMENT_APA_INTERFACE(NAME)                       \
00140     NAME* apa_create(){                                     \
00141         return new NAME();                                  \
00142     }                                                       \
00143     void apa_destroy(NAME* p){                              \
00144         delete p;                                           \
00145     }                                                       \
00146     int apa_get_api_level(){                                \
00147         return APA_NDK_API_LEVEL;                           \
00148     }                                                       \
00149     extern "C" int apa_get_ndk_version(){                   \
00150         return APA_NDK_VERSION_NUMBER;                      \
00151     }
00152     
00153 
00154 };
00155 
00156 #endif // ANDROID_APA_INTERFACE_H