diff --git a/android/arm64-v8a/include/anysdk/AgentManager.h b/android/arm64-v8a/include/anysdk/AgentManager.h new file mode 100644 index 00000000..092a9eaf --- /dev/null +++ b/android/arm64-v8a/include/anysdk/AgentManager.h @@ -0,0 +1,245 @@ +/** @file AgentManager.h + */ + + +#ifndef __CCX_AGENTMANAGER_H__ +#define __CCX_AGENTMANAGER_H__ + +#include "PluginManager.h" +#include "ProtocolIAP.h" +#include "ProtocolAnalytics.h" +#include "ProtocolShare.h" +#include "ProtocolAds.h" +#include "ProtocolSocial.h" +#include "ProtocolUser.h" +#include "ProtocolPush.h" +#include "ProtocolCrash.h" +#include "ProtocolREC.h" +#include "ProtocolCustom.h" +#include "ProtocolAdTracking.h" +#include +#include +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum { + kPluginAds = 16,/**< enum value is the type of Ads. */ + kPluginAnalytics = 1,/**< enum value is the type of Analytics. */ + kPluginIAP = 8,/**< enum value is the type of IAP. */ + kPluginShare = 2,/**< enum value is the type of Share. */ + kPluginUser = 32,/**< enum value is the type of User. */ + kPluginSocial = 4,/**< enum value is the type of Social. */ + kPluginPush = 64,/**< enum value is the type of Push. */ + kPluginCrash = 128,/**< enum value is the type of Crash. */ + kPluginCustom = 256,/**< enum value is the type of Custom. */ + kPluginREC = 512,/**< enum value is the type of REC. */ + kPluginAdTracking = 1024,/**< enum value is the type of AdTracking. */ +}Plugin_type; +/**    + *  @class  AgentManager   + */ +class AgentManager +{ +public: + virtual ~AgentManager(); + /** + @brief Get singleton of AgentManager + */ + + static AgentManager* getInstance(); + /** + @brief Destory the instance of AgentManager + */ + static void end(); + + /** + @breif the init of AgentManager + @param the appKey of anysdk + @param the appSecret of anysdk + @param the privateKey of anysdk + @param the url of oauthLoginServer + @warning Must invoke this interface before loadAllPlugins + */ + void init(std::string appKey,std::string appSecret,std::string privateKey,std::string oauthLoginServer); + + /** + @brief load the plugins + */ + CC_DEPRECATED_ATTRIBUTE void loadALLPlugin(); + /** + @brief unload the plugins + */ + CC_DEPRECATED_ATTRIBUTE void unloadALLPlugin(); + + /** + @brief load the plugins + */ + void loadAllPlugins(); + + /** + @brief unload the plugins + */ + void unloadAllPlugins(); + + /** + @brief Get Analytics plugin + @return if Analytics plugin exist ,return value is Analytics plugin. + else return value is null pointer. + */ + ProtocolAnalytics* getAnalyticsPlugin(){return _pAnalytics;}; + + /** + @brief Get User plugin + @return if User plugin exist ,return value is User plugin. + else return value is null pointer. + */ + ProtocolUser* getUserPlugin(){return _pUser;}; + + /** + @brief Get IAP plugin + @return if IAP plugin exist ,return value is IAP plugin. + else return value is null pointer. + */ + std::map* getIAPPlugin(){return &_pluginsIAPMap;}; + + /** + @brief Get Share plugin + @return if Share plugin exist ,return value is Share plugin. + else return value is null pointer. + */ + ProtocolShare* getSharePlugin(){return _pShare;}; + + /** + @brief Get Social plugin + @return if Social plugin exist ,return value is Social plugin. + else return value is null pointer. + */ + ProtocolSocial* getSocialPlugin(){return _pSocial;}; + + /** + @brief Get Ads plugin + @return if Ads plugin exist ,return value is Ads plugin. + else return value is null pointer. + */ + ProtocolAds* getAdsPlugin(){return _pAds;}; + + /** + @brief Get Push plugin + @return if Push plugin exist ,return value is Push plugin. + else return value is null pointer. + */ + ProtocolPush* getPushPlugin(){return _pPush;}; + + /** + @brief Get Crash plugin + @return if Crash plugin exist ,return value is Crash plugin. + else return value is null pointer. + */ + ProtocolCrash* getCrashPlugin(){return _pCrash;}; + + /** + @brief Get Custom plugin + @return if Crash plugin exist ,return value is Custom plugin. + else return value is null pointer. + */ + ProtocolCustom* getCustomPlugin(){return _pCustom;}; + + + /** + @brief Get REC plugin + @return if REC plugin exist ,return value is REC plugin. + else return value is null pointer. + */ + ProtocolREC* getRECPlugin(){return _pREC;}; + + /** + @brief Get AdTracking plugin + @return if AdTracking plugin exist ,return value is AdTracking plugin. + else return value is null pointer. + */ + ProtocolAdTracking* getAdTrackingPlugin(){return _pAdTracking;}; + + /** + @brief Get channel ID + @return return value is channel ID. + */ + std::string getChannelId(); + + /** + @brief Get custom param + @return return value is custom param for channel. + */ + std::string getCustomParam(); + + /** + @brief Get framework version + @return return value is the version of AnySDKFramework. + */ + std::string getFrameworkVersion(); + + /** + @Title: setIsAnaylticsEnabled + @Description: choose to open or close + @param @param enabled true or false + @return void + */ + void setIsAnaylticsEnabled(bool value){bIsAnaylticsEnabled = value;}; + /** + @Title: isAnaylticsEnabled + @Description: the status of Anayltics + @param @return true or false + @return boolean + */ + bool isAnaylticsEnabled(){return bIsAnaylticsEnabled;}; + + + void loadPlugin(const char* nodeName,int type); +protected: + void setDebugMode(bool flag); + std::string getSupportPlugin(); + void release(); + + +private: + AgentManager(void); + + // Analytics plugin + ProtocolAnalytics* _pAnalytics; + + // user plugin + ProtocolUser* _pUser; + + // IAP plugins + // ProtocolIAP* _pIAP; + std::map _pluginsIAPMap; + + // Share plugin + ProtocolShare* _pShare; + + // Social plugin + ProtocolSocial* _pSocial; + + // Ads plugin + ProtocolAds* _pAds; + + // Push plugin + ProtocolPush* _pPush; + + // Crash plugin + ProtocolCrash* _pCrash; + + // Custom plugin + ProtocolCustom* _pCustom; + + // REC plugin + ProtocolREC* _pREC; + + // AdTracking plugin + ProtocolAdTracking* _pAdTracking; + + bool bIsAnaylticsEnabled; + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_AGENTMANAGER_H__ */ diff --git a/android/arm64-v8a/include/anysdk/JSBRelation.h b/android/arm64-v8a/include/anysdk/JSBRelation.h new file mode 100644 index 00000000..7775b0dc --- /dev/null +++ b/android/arm64-v8a/include/anysdk/JSBRelation.h @@ -0,0 +1,31 @@ +/** @file JSBRelation.h + */ +#ifndef __CCX_JSBRELATION_H__ +#define __CCX_JSBRELATION_H__ + +#include "PluginProtocol.h" +#include +#include +#include + +using namespace std; + +namespace anysdk { namespace framework { + +/**    + *  @class  JSBRelation   + */ +class JSBRelation +{ +public: + static string getMethodsOfPlugin(PluginProtocol* plugin); + + + + +private: +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_JSBRELATION_H__ */ diff --git a/android/arm64-v8a/include/anysdk/PluginFactory.h b/android/arm64-v8a/include/anysdk/PluginFactory.h new file mode 100644 index 00000000..79922c97 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginFactory.h @@ -0,0 +1,41 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGIN_FACTORY_H__ +#define __CCX_PLUGIN_FACTORY_H__ + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginManager; +/**    + *  @class  PluginFactory   + */ +class PluginFactory +{ +public: + virtual ~PluginFactory(); + /** + @brief Get singleton of PluginFactory + */ + static PluginFactory* getInstance(); + + /** + @brief Destory the instance of PluginFactory + */ + static void purgeFactory(); + +private: + friend class PluginManager; + PluginFactory(void); + + /** + @brief create the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* createPlugin(const char* name, int pluginType); +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_FACTORY_H__ */ diff --git a/android/arm64-v8a/include/anysdk/PluginJavaData.h b/android/arm64-v8a/include/anysdk/PluginJavaData.h new file mode 100644 index 00000000..bd37b745 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginJavaData.h @@ -0,0 +1,17 @@ +#ifndef __PLUGIN_JAVA_DATA_H__ +#define __PLUGIN_JAVA_DATA_H__ + +#include +#include + +namespace anysdk { namespace framework { + +typedef struct _PluginJavaData_ +{ + jobject jobj; + std::string jclassName; +} PluginJavaData; + +}} //namespace anysdk { namespace framework { + +#endif // __PLUGIN_JAVA_DATA_H__ diff --git a/android/arm64-v8a/include/anysdk/PluginJniHelper.h b/android/arm64-v8a/include/anysdk/PluginJniHelper.h new file mode 100644 index 00000000..82981907 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginJniHelper.h @@ -0,0 +1,43 @@ +#ifndef __PLUGIN_JNI_HELPER_H__ +#define __PLUGIN_JNI_HELPER_H__ + +#include +#include + +namespace anysdk {namespace framework{ + +typedef struct PluginJniMethodInfo_ +{ + JNIEnv * env; + jclass classID; + jmethodID methodID; +} PluginJniMethodInfo; + +class PluginJniHelper +{ +public: + static JavaVM* getJavaVM(); + static void setJavaVM(JavaVM *javaVM); + static JNIEnv* getEnv(); + + static bool getStaticMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static bool getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static std::string jstring2string(jstring jstr); + static jstring newStringUTF(JNIEnv* env, const std::string& utf8Str); + + static bool setClassLoaderFrom(jobject nativeActivityInstance); + + static jmethodID loadclassMethod_methodID; + static jobject classloader; + +private: + static JavaVM *_psJavaVM; + static bool getMethodInfo_DefaultClassLoader(PluginJniMethodInfo &methodinfo, + const char *className, + const char *methodName, + const char *paramCode); +}; + +}} + +#endif // __PLUGIN_JNI_HELPER_H__ diff --git a/android/arm64-v8a/include/anysdk/PluginJniMacros.h b/android/arm64-v8a/include/anysdk/PluginJniMacros.h new file mode 100644 index 00000000..eace0d9a --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginJniMacros.h @@ -0,0 +1,156 @@ +#ifndef __PLUGIN_JNI_MACROS_H__ +#define __PLUGIN_JNI_MACROS_H__ + +#define return_if_fails(cond) if (!(cond)) return; +#define return_val_if_fails(cond, ret) if(!(cond)) return (ret); + +#define CALL_BASERET_JAVA_FUNC_WITH_PARAM(retType, paramCode, param, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID, param); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_BASERET_JAVA_FUNC(retType, paramCode, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_JAVA_FUNC_WITH_VALIST(retCode) \ +std::vector allParams; \ +if (NULL != param) \ +{ \ + allParams.push_back(param); \ + \ + va_list argp; \ + PluginParam* pArg = NULL; \ + va_start( argp, param ); \ + while (1) \ + { \ + pArg = va_arg(argp, PluginParam*); \ + if (pArg == NULL) \ + break; \ + \ + allParams.push_back(pArg); \ + } \ + va_end(argp); \ +} \ + \ +return call##retCode##FuncWithParam(funcName, allParams); \ + + +#define CALL_JAVA_FUNC(retType, retCode, defaultRet, jRetCode) \ +retType ret = defaultRet; \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(this); \ +if (NULL == pData) { \ + PluginUtils::outputLog(ANDROID_LOG_ERROR, "PluginProtocol", "Can't find java data for plugin : %s", this->getPluginName()); \ + return ret; \ +} \ + \ +std::string paramCode; \ +int nParamNum = params.size(); \ +if (0 == nParamNum) \ +{ \ + paramCode = "()"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName(this, funcName); \ +} else \ +{ \ + PluginParam* pRetParam = NULL; \ + bool needDel = false; \ + if (nParamNum == 1) { \ + pRetParam = params[0]; \ + } else { \ + std::map allParams; \ + for (int i = 0; i < nParamNum; i++) \ + { \ + PluginParam* pArg = params[i]; \ + if (pArg == NULL) \ + { \ + break; \ + } \ + \ + char strKey[8] = { 0 }; \ + sprintf(strKey, "Param%d", i + 1); \ + allParams[strKey] = pArg; \ + } \ + \ + pRetParam = new PluginParam(allParams); \ + needDel = true; \ + } \ + \ + switch(pRetParam->getCurrentType()) \ + { \ + case PluginParam::kParamTypeInt: \ + paramCode = "(I)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getIntValue()); \ + break; \ + case PluginParam::kParamTypeFloat: \ + paramCode = "(F)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getFloatValue()); \ + break; \ + case PluginParam::kParamTypeBool: \ + paramCode = "(Z)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getBoolValue()); \ + break; \ + case PluginParam::kParamTypeString: \ + { \ + jstring jstr = PluginJniHelper::newStringUTF(PluginUtils::getEnv(), pRetParam->getStringValue()); \ + paramCode = "(Ljava/lang/String;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jstr); \ + PluginUtils::getEnv()->DeleteLocalRef(jstr); \ + } \ + break; \ + case PluginParam::kParamTypeStringMap: \ + case PluginParam::kParamTypeMap: \ + { \ + jobject jMap = PluginUtils::getJObjFromParam(pRetParam); \ + paramCode = "(Lorg/json/JSONObject;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jMap); \ + PluginUtils::getEnv()->DeleteLocalRef(jMap); \ + } \ + break; \ + default: \ + break; \ + } \ + \ + if (needDel && pRetParam != NULL) \ + { \ + delete pRetParam; \ + pRetParam = NULL; \ + } \ +} \ +return ret; \ + + +#endif // __PLUGIN_JNI_MACROS_H__ diff --git a/android/arm64-v8a/include/anysdk/PluginManager.h b/android/arm64-v8a/include/anysdk/PluginManager.h new file mode 100644 index 00000000..93282ae7 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginManager.h @@ -0,0 +1,51 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGINMANAGER_H__ +#define __CCX_PLUGINMANAGER_H__ + +#include "PluginProtocol.h" +#include "PluginFactory.h" +#include +#include + +namespace anysdk { namespace framework { + +/**    + *  @class  PluginManager   + */ +class PluginManager +{ +public: + virtual ~PluginManager(); + /** + @brief Get singleton of PluginManager + */ + static PluginManager* getInstance(); + /** + @brief Destory the instance of PluginManager + */ + static void end(); + + /** + @brief load the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* loadPlugin(const char* name, int pluginType); + /** + @brief unload the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + void unloadPlugin(const char* name, int pluginType = 0); + + +private: + PluginManager(void); + std::map _pluginsMap; +// bool _isDebug; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGINMANAGER_H__ */ diff --git a/android/arm64-v8a/include/anysdk/PluginParam.h b/android/arm64-v8a/include/anysdk/PluginParam.h new file mode 100644 index 00000000..1f35d4a7 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginParam.h @@ -0,0 +1,126 @@ +/** @file PluginParam.h + */ +#ifndef __CCX_PLUGIN_PARAM_H__ +#define __CCX_PLUGIN_PARAM_H__ + +#include +#include +/// \typedef std::map StringMap +/// typedef YString. +typedef std::map StringMap; + +namespace anysdk { namespace framework { + +class PluginProtocol; +/**    + *  @class  PluginParam   + */ +class PluginParam +{ +public: + /** + @brief the default constructor of PluginParam + */ + PluginParam(); + + virtual ~PluginParam(); + /** + @brief the constructor of PluginParam + @param the value is Integer + */ + PluginParam(int nValue); + /** + @brief the constructor of PluginParam + @param the value is float + */ + PluginParam(float fValue); + /** + @brief the constructor of PluginParam + @param the value is boolean + */ + PluginParam(bool bValue); + /** + @brief the default constructor of PluginParam + @param the value is char + */ + PluginParam(const char* strValue); + /** + @brief the default constructor of PluginParam + @param the value is StringMap + */ + PluginParam(StringMap strMapValue); + + typedef enum{ + kParamTypeNull = 0, + kParamTypeInt, + kParamTypeFloat, + kParamTypeBool, + kParamTypeString, + kParamTypeStringMap, + kParamTypeMap, + } ParamType; + /** + @brief get the ParamType of value + */ + inline ParamType getCurrentType() { + return _type; + } + /** + @brief get the int value + */ + inline int getIntValue() { + return _intValue; + } + /** + @brief get the float value + */ + inline float getFloatValue() { + return _floatValue; + } + /** + @brief get the boolean value + */ + inline bool getBoolValue() { + return _boolValue; + } + /** + @brief get the char value + */ + inline const char* getStringValue() { + return _strValue.c_str(); + } + /** + @brief get the map of value + */ + inline std::map getMapValue() { + return _mapValue; + } + /** + @brief get the StringMap value + */ + inline StringMap getStrMapValue() { + return _strMapValue; + } + +private: + friend class PluginProtocol; + /** + @brief the constructor of PluginParam + @param the map of value + */ + PluginParam(std::map mapValue); + +private: + ParamType _type; + + int _intValue; + float _floatValue; + bool _boolValue; + std::string _strValue; + std::map _mapValue; + StringMap _strMapValue; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_PARAM_H__ */ diff --git a/android/arm64-v8a/include/anysdk/PluginProtocol.h b/android/arm64-v8a/include/anysdk/PluginProtocol.h new file mode 100644 index 00000000..95cf706d --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginProtocol.h @@ -0,0 +1,144 @@ +/** @file PluginProtocol.h + */ +#ifndef __CCX_IPLUGIN_H__ +#define __CCX_IPLUGIN_H__ + +#include "PluginParam.h" +#include + +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#elif _MSC_VER >= 1400 //vs 2005 or higher +#define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated) +#else +#define CC_DEPRECATED_ATTRIBUTE +#endif + +namespace anysdk { namespace framework { + +/** + * @class PluginProtocol + * @brief The super class for all plugins. + */ +class PluginProtocol +{ +public: + virtual ~PluginProtocol() {}; + + /** + *@brief set plugin name + *@param the name of plugin + */ + virtual void setPluginName(const char* name) = 0 ; + /** + *@brief get plugin name + *@return the name of plugin + */ + virtual const char* getPluginName() = 0 ; + + /** + *@brief get the version of plugin + *@return the version of plugin + */ + virtual std::string getPluginVersion(); + /** + *@brief get the version of sdk + *@return the version of sdk + */ + virtual std::string getSDKVersion(); + + /** + *@brief switch debug plug-in on/off + *@param the value of on/off + */ + CC_DEPRECATED_ATTRIBUTE virtual void setDebugMode(bool bDebug); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return void + */ + virtual void callFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return void + */ + virtual void callFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, std::vector params); + + /** + @brief Check function the plugin support or not + @param the name of plugin + @return if the function support ,return true + else retur false + */ + virtual bool isFunctionSupported(std::string functionName); + + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_IPLUGIN_H__ */ diff --git a/android/arm64-v8a/include/anysdk/PluginUtils.h b/android/arm64-v8a/include/anysdk/PluginUtils.h new file mode 100644 index 00000000..3742c161 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/PluginUtils.h @@ -0,0 +1,157 @@ +#ifndef __PLUGIN_UTILS_H__ +#define __PLUGIN_UTILS_H__ + +#include "PluginJniHelper.h" +#include "PluginJavaData.h" +#include +#include +#include "PluginParam.h" +#include "PluginJniMacros.h" +#include +//#include + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginUtils +{ +public: +//cjh static void initPluginWrapper(android_app* app); + static jobject createJavaMapObject(std::map* paramMap); + static jobject createJavaListObject(std::list* paramList); + static void initJavaPlugin(PluginProtocol* pPlugin, jobject jObj, const char* className, int type); + static JNIEnv* getEnv(); + + static PluginJavaData* getPluginJavaData(PluginProtocol* pKeyObj); + static void setPluginJavaData(PluginProtocol* pKeyObj, PluginJavaData* pData, int type); + static void erasePluginJavaData(PluginProtocol* pKeyObj,int type); + static void erasePluginJavaData(std::string key); + + static PluginProtocol* getPluginPtr(std::string className); + + static jobject getJObjFromParam(PluginParam* param); + + // methods have no return value + template + static void callJavaFunctionWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + return_if_fails(paramCode != NULL && strlen(paramCode) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + t.env->CallVoidMethod(pData->jobj, t.methodID, param); + t.env->DeleteLocalRef(t.classID); + } + } + static void callJavaFunctionWithName(PluginProtocol* thiz, const char* funcName) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()V")) + { + t.env->CallVoidMethod(pData->jobj, t.methodID); + t.env->DeleteLocalRef(t.classID); + } + } + + // methods return value is string + template + static std::string callJavaStringFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + jstring strRet = (jstring)t.env->CallObjectMethod(pData->jobj, t.methodID, param); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + static std::string callJavaStringFuncWithName(PluginProtocol* thiz, const char* funcName) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()Ljava/lang/String;")) + { + jstring strRet = (jstring) t.env->CallObjectMethod(pData->jobj, t.methodID); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + + // methods return value is int + template + static int callJavaIntFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(int, paramCode, param, Int, 0) + } + static int callJavaIntFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(int, "()I", Int, 0) + } + + // methods return value is float + template + static float callJavaFloatFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(float, paramCode, param, Float, 0.0f) + } + static float callJavaFloatFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(float, "()F", Float, 0.0f); + } + + // methods return value is bool + template + static bool callJavaBoolFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(bool, paramCode, param, Boolean, false) + } + static bool callJavaBoolFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(bool, "()Z", Boolean, false) + } + + static void callJavaFunctionWithName_string_map(PluginProtocol* thiz, const char* funcName, const char* keyParam, std::map* paramMap); + + static void outputLog(int type, const char* logTag, const char* pFormat, ...); + static void output(int type, const char* logTag, const char* contents); + + static void resetLogLevel(); +private: + static std::string _logLevel; +}; + +}} // namespace anysdk { namespace framework { + +#endif //__PLUGIN_UTILS_H__ diff --git a/android/arm64-v8a/include/anysdk/ProtocolAdTracking.h b/android/arm64-v8a/include/anysdk/ProtocolAdTracking.h new file mode 100644 index 00000000..6fc557a2 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolAdTracking.h @@ -0,0 +1,58 @@ +/** @file ProtocolAdTracking.h + */ +#ifndef __CCX_PROTOCOL_ADTRACKING_H__ +#define __CCX_PROTOCOL_ADTRACKING_H__ + +#include "PluginProtocol.h" +#include +namespace anysdk { namespace framework { +/**    + *@class  ProtocolAdTracking + *@brief the interface of AdTracking   + */ +class ProtocolAdTracking : public PluginProtocol +{ +public: + + /** + * + * @Title: onRegister + * @Description: Call this method if you want to track register events as happening during a section. + * @param userId user identifier + * @return void + */ + virtual void onRegister(const char* userId) = 0; + + /** + * + * @Title: onLogin + * @Description:Call this method if you want to track login events as happening during a section. + * @param userInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onLogin(std::map userInfo) = 0; + + /** + * + * @Title: onPay + * @Description: Call this method if you want to track pay events as happening during a section. + * @param productInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onPay(std::map productInfo) = 0; + + /** + * + * @Title: trackEvent + * @Description: Call this method if you want to track custom events with parameters as happening during a section. + * @param eventId The custom event name. + * @param paramMap The details of this parameters are already covered by document. + */ + virtual void trackEvent(const char* eventId, std::map* paramMap = NULL) = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_ADTRACKING_H__ ----- */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolAds.h b/android/arm64-v8a/include/anysdk/ProtocolAds.h new file mode 100644 index 00000000..8e29987f --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolAds.h @@ -0,0 +1,133 @@ +/** @file ProtocolAds.h + */ +#ifndef __CCX_PROTOCOL_ADS_H__ +#define __CCX_PROTOCOL_ADS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TAdsDeveloperInfo +/// typedef TAdsDeveloperInfo. +typedef std::map TAdsDeveloperInfo; +/// \typedef std::map TAdsInfo +/// typedef TAdsInfo. +typedef std::map TAdsInfo; +/** @brief AdsResultCode enum, with inline docs */ +typedef enum +{ + kAdsReceived = 0, /**< enum the callback: the ad is received is at center. */ + + kAdsShown, /**< enum the callback: the advertisement dismissed. */ + kAdsDismissed, /**< enum the callback: the advertisement dismissed. */ + + kPointsSpendSucceed, /**< enum the callback: the points spend succeed. */ + kPointsSpendFailed, /**< enum the callback: the points spend failed. */ + + kNetworkError, /**< enum the callback of Network error at center. */ + kUnknownError, /**< enum the callback of Unknown error. */ + kOfferWallOnPointsChanged, /**< enum the callback of Changing the point of offerwall. */ + kRewardedVideoWithReward,/**< enum the callback of receiving the reward of rewardedvideo. */ + kInAppPurchaseFinished,/**< enum the callback of finishing IAP ad. */ + kAdsClicked,/**< enum the callback of the advertisement clicked. */ + kAdsExtension = 40000 /**< enum value is extension code . */ +} AdsResultCode; +/** @brief AdsPos enum, with inline docs */ +typedef enum { + kPosCenter = 0,/**< enum the toolbar is at center. */ + kPosTop,/**< enum the toolbar is at top. */ + kPosTopLeft,/**< enum the toolbar is at topleft. */ + kPosTopRight,/**< enum the toolbar is at topright. */ + kPosBottom,/**< enum the toolbar is at bottom. */ + kPosBottomLeft,/**< enum the toolbar is at bottomleft. */ + kPosBottomRight,/**< enum the toolbar is at bottomright. */ +} AdsPos; +/** @brief AdsType enum, with inline docs */ +typedef enum { + AD_TYPE_BANNER = 0,/**< enum value is banner ads . */ + AD_TYPE_FULLSCREEN,/**< enum value is fullscreen ads . */ + AD_TYPE_MOREAPP,/**< enum value is moreapp ads . */ + AD_TYPE_OFFERWALL,/**< enum value is offerwall ads . */ + AD_TYPE_REWARDEDVIDEO,/**< enum value is rewarded video ads . */ + AD_TYPE_NATIVEEXPRESS,/**< enum value is Native express ads . */ + AD_TYPE_NATIVEADVANCED,/**< enum value is Native advanced ads . */ +} AdsType; + +class ProtocolAds; +class AdsListener +{ +public: + /** + *@brief The advertisement request result + *@param the id of callback + *@param the information of callback + */ + virtual void onAdsResult(AdsResultCode code, const char* msg) = 0; +}; + +class ProtocolAds : public PluginProtocol +{ +public: + + + + /** + @brief show adview + @param the type of ads + @param the idx of ads + */ + virtual void showAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief Hide the adview + @param the type of ads + @param the idx of ads + */ + virtual void hideAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief preload the adview + @param the type of ads + @param the idx of ads + */ + virtual void preloadAds(AdsType adsType, int idx = 1)= 0; + + /** + *@brief Query the points of player + *@return the point + */ + virtual float queryPoints() = 0; + + /** + *@brief Spend the points. + Use this method to notify server spend points. + *@param points Need spend number of points + */ + virtual void spendPoints(int points) = 0; + + /** + @brief set the Ads listener + @param pListener The callback object for Ads result + */ + virtual void setAdsListener(AdsListener* listener) = 0; + + /** + @brief get pListener The callback object for Ads result + @return the listener + */ + virtual AdsListener* getAdsListener() = 0; + + /** + @brief Is it supportive of this type of ads + @param the type of ads + @return if it is supportive ,return true + else retur false + */ + virtual bool isAdTypeSupported(AdsType adType) = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_ADS_H__ */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolAnalytics.h b/android/arm64-v8a/include/anysdk/ProtocolAnalytics.h new file mode 100644 index 00000000..ce3372d6 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolAnalytics.h @@ -0,0 +1,107 @@ +/** @file ProtocolAnalytics.h + */ +#ifndef __CCX_PROTOCOL_ANALYTICS_H__ +#define __CCX_PROTOCOL_ANALYTICS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map LogEventParamPair +/// typedef LogEventParamPair. +typedef std::pair< std::string, std::string > LogEventParamPair; +/// \typedef std::map LogEventParamMap +/// typedef LogEventParamMap. +typedef std::map< std::string, std::string > LogEventParamMap; +typedef enum { + ANONYMOUS,/**< enum value is anonymous typek. */ + REGISTED,/**< enum value is registed type. */ + SINA_WEIBO,/**< enum value is sineweibo type. */ + TENCENT_WEIBO,/**< enum value is tecentweibo type */ + QQ,/**< enum value is qq type */ + ND91,/**< enum value is nd91 type. */ +} AccountType; +typedef enum { + LOGIN,/**< enum value is the login operate. */ + LOGOUT,/**< enum value is the logout operate. */ + REGISTER,/**< enum value is the register operate. */ +} AccountOperate; +typedef enum { + MALE,/**< enum value is male. */ + FEMALE,/**< enum value is female. */ + UNKNOWN,/**< enum value is unknow. */ + +} AccountGender; +typedef enum { + GUIDE_LINE,/**< enum value is the guideline type.. */ + MAIN_LINE,/**< enum value is the mainline type.. */ + BRANCH_LINE,/** +#include + +namespace anysdk { namespace framework { + +class ProtocolCrash : public PluginProtocol +{ +public: + /** + * set user identifier + * + * @param userInfo + */ + virtual void setUserIdentifier(const char* identifier) = 0; + + /** + * The uploader captured in exception information + * + * @param message Set the custom information + * @param exception The exception + */ + virtual void reportException(const char* message, const char* exception) = 0; + + /** + * customize logging + * + * @param string Custom log + */ + virtual void leaveBreadcrumb(const char* breadcrumb) = 0; + + + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_CRASH_H__ */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolCustom.h b/android/arm64-v8a/include/anysdk/ProtocolCustom.h new file mode 100644 index 00000000..dc92558e --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolCustom.h @@ -0,0 +1,50 @@ +/** @file ProtocolCustom.h + */ +#ifndef __CCX_PROTOCOL_CUSTOM_H__ +#define __CCX_PROTOCOL_CUSTOM_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +typedef enum +{ + kCustomExtension = 80000 /**< enum value is extension code . */ +} CustomResultCode; +/**    + *@class  CustomResultListener + *@brief the interface of share callback   + */ +class CustomResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onCustomResult(CustomResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolCustom + *@brief the interface of custom   + */ +class ProtocolCustom : public PluginProtocol +{ +public: + + /** + @breif set the result listener + @param pListener The callback object for custom result + @wraning Must invoke this interface before custom + */ + virtual void setResultListener(CustomResultListener* pListener) = 0; + + virtual CustomResultListener* getCustomListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_Custom_H__ ----- */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolIAP.h b/android/arm64-v8a/include/anysdk/ProtocolIAP.h new file mode 100644 index 00000000..4a875b32 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolIAP.h @@ -0,0 +1,119 @@ +/** @file ProtocolIAP.h + */ +#ifndef __CCX_PROTOCOL_IAP_H__ +#define __CCX_PROTOCOL_IAP_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TIAPDeveloperInfo +/// typedef TIAPDeveloperInfo. +typedef std::map TIAPDeveloperInfo; +/// \typedef std::map TProductInfo +/// typedef TProductInfo. +typedef std::map TProductInfo; +/// typedef TProductsInfo. +typedef std::map AllProductsInfo; +/** @brief PayResultCode enum, with inline docs */ +typedef enum +{ + kPaySuccess = 0,/**< enum value is callback of succeeding in paying . */ + kPayFail,/**< enum value is callback of failing to pay . */ + kPayCancel,/**< enum value is callback of canceling to pay . */ + kPayNetworkError,/**< enum value is callback of network error . */ + kPayProductionInforIncomplete,/**< enum value is callback of incompleting info . */ + kPayInitSuccess,/**< enum value is callback of succeeding in initing sdk . */ + kPayInitFail,/**< enum value is callback of failing to init sdk . */ + kPayNowPaying,/**< enum value is callback of paying now . */ + kPayRechargeSuccess,/**< enum value is callback of succeeding in recharging. */ + kPayExtension = 30000 /**< enum value is extension code . */ +} PayResultCode; +/** @brief RequestResultCode enum, with inline docs */ +typedef enum +{ + kRequestSuccess = 31000,/**< enum value is callback of succeeding in paying . */ + kRequestFail/**< enum value is callback of failing to pay . */ +} RequestResultCode; +/**    + *@class  PayResultListener + *@brief the interface of pay callback   + */ +class PayResultListener +{ +public: + /**    + *@brief the interface of pay callback  + *@param the id of callback + *@param the information of callback + *@param the info of pay + */ + virtual void onPayResult(PayResultCode ret, const char* msg, TProductInfo info) = 0; + /** + *@brief the interface of request callback + *@param the id of callback + *@param the information of callback + *@param the info of request product + */ + virtual void onRequestResult(RequestResultCode ret, const char* msg, AllProductsInfo info) {} +}; +/**    + *@class  ProtocolIAP + *@brief the interface of pay    + */ + +class ProtocolIAP : public PluginProtocol +{ +public: + + /** + @brief pay for product + @param info The info of product, must contains key: + productName The name of product + productPrice The price of product(must can be parse to float) + productDesc The description of product + @warning For different plugin, the parameter should have other keys to pay. + Look at the manual of plugins. + */ + virtual void payForProduct(TProductInfo info) = 0; + /** + @brief get order id + @return the order id + */ + virtual std::string getOrderId() = 0; + + /** + @breif set the result listener + @param pListener The callback object for pay result + @wraning Must invoke this interface before payForProduct. + */ + virtual void setResultListener(PayResultListener* pListener) = 0; + + virtual PayResultListener* getPayListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + /** + @brief change the state of paying + @param the state + */ + + static void resetPayState() + { + _paying = false; + } + static bool _paying; + + + +}; + + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_IAP_H__ */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolPush.h b/android/arm64-v8a/include/anysdk/ProtocolPush.h new file mode 100644 index 00000000..e9e2fac8 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolPush.h @@ -0,0 +1,104 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PROTOCOL_PUSH_H__ +#define __CCX_PROTOCOL_PUSH_H__ + +#include "PluginProtocol.h" +#include +#include +#include +using namespace std; + +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kPushReceiveMessage = 0,/**value is callback of Receiving Message . */ + kPushExtensionCode = 60000 /**< enum value is extension code . */ + + +} PushActionResultCode; +class ProtocolPush; +/**    + *@class  PushActionListener + *@brief the interface of Push callback   + */ +class PushActionListener +{ +public: + /**    + *@brief the interface of Push callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolPush   + */ +class ProtocolPush : public PluginProtocol +{ +public: + + + /** + *@brief start/register Push services + *@return void + */ + virtual void startPush() = 0 ; + + + /** + *@brief close Push services + *@return void + */ + virtual void closePush() = 0 ; + + + /** + *@brief set alias + *@param tags + *@return void + */ + virtual void setAlias(string alias) = 0; + + /** + *@brief del alias + *@param tags + *@return void + */ + virtual void delAlias(string alias) = 0; + + /** + *@brief set tag + *@param tags + *@return void + */ + virtual void setTags(list tags) = 0; + + /** + *@brief delete tag + *@param tags + *@return void + */ + virtual void delTags(list tags) = 0; + + /** + @brief set the result listener + @param pListener The callback object for push result + */ + virtual void setActionListener(PushActionListener* listener) = 0 ; + + /** + @brief get pListener The callback object for Push result + @return the listener + */ + virtual PushActionListener* getActionListener() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_PUSH_H__ */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolREC.h b/android/arm64-v8a/include/anysdk/ProtocolREC.h new file mode 100644 index 00000000..b0db2c0d --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolREC.h @@ -0,0 +1,83 @@ +/** @file ProtocolREC.h + */ +#ifndef __CCX_PROTOCOL_REC_H__ +#define __CCX_PROTOCOL_REC_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { + +typedef std::map TVideoInfo; + +/** @brief RECResultCode enum, with inline docs */ +typedef enum +{ + kRECInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk . */ + kRECInitFail,/**< enum value is callback of failing to init sdk. */ + kRECStartRecording,/**< enum value is callback of starting to record. */ + kRECStopRecording,/**< enum value is callback of stoping to record. */ + kRECPauseRecording,/**< enum value is callback of pausing to record. */ + kRECResumeRecording,/**< enum value is callback of resuming to record. */ + kRECEnterSDKPage,/**< enum value is callback of entering SDK`s page. */ + kRECQuitSDKPage,/**< enum value is callback of quiting SDK`s page. */ + kRECShareSuccess,/**< enum value is callback of succeeding in sharing. */ + kRECShareFail,/**< enum value is callback of failing to share. */ + kRECExtension = 90000 /**< enum value is extension code . */ +} RECResultCode; +/**    + *@class  RECResultListener + *@brief the interface of REC callback   + */ +class RECResultListener +{ +public: + /**    + *@brief the interface of REC callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onRECResult(RECResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolREC + *@brief the interface of REC   + */ +class ProtocolREC : public PluginProtocol +{ +public: + + /** + * @Description: Start to record video + */ + virtual void startRecording() = 0; + + /** + * @Description: Stop to record video + */ + virtual void stopRecording() = 0; + + /** + * @Description: share video + * @Param info The info of share + */ + virtual void share(TVideoInfo info) = 0; + + + + /** + @breif set the result listener + @param pListener The callback object for REC result + @wraning Must invoke this interface before REC + */ + virtual void setResultListener(RECResultListener* pListener) = 0; + + virtual RECResultListener* getRECListener() = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolShare.h b/android/arm64-v8a/include/anysdk/ProtocolShare.h new file mode 100644 index 00000000..2215a4ff --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolShare.h @@ -0,0 +1,72 @@ +/** @file ProtocolShare.h + */ +#ifndef __CCX_PROTOCOL_SHARE_H__ +#define __CCX_PROTOCOL_SHARE_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TShareDeveloperInfo +/// typedef TShareDeveloperInfo. +typedef std::map TShareDeveloperInfo; +/// \typedef std::map TShareInfo +/// typedef TShareInfo. +typedef std::map TShareInfo; +/** @brief ShareResultCode enum, with inline docs */ +typedef enum +{ + kShareSuccess = 0,/**< enum value is callback of failing to sharing . */ + kShareFail,/**< enum value is callback of failing to share . */ + kShareCancel,/**< enum value is callback of canceling to share . */ + kShareNetworkError,/**< enum value is callback of network error . */ + kShareExtension = 10000 /**< enum value is extension code . */ +} ShareResultCode; +/**    + *@class  ShareResultListener + *@brief the interface of share callback   + */ +class ShareResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onShareResult(ShareResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolShare + *@brief the interface of share   + */ +class ProtocolShare : public PluginProtocol +{ +public: + + + + /** + @brief share information + @param info The info of share, contains key: + SharedText The text need to share + SharedImagePath The full path of image file need to share (optinal) + @warning For different plugin, the parameter should have other keys to share. + Look at the manual of plugins. */ + virtual void share(TShareInfo info) = 0; + + /** + @breif set the result listener + @param pListener The callback object for share result + @wraning Must invoke this interface before share + */ + virtual void setResultListener(ShareResultListener* pListener) = 0; + + virtual ShareResultListener* getShareListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolSocial.h b/android/arm64-v8a/include/anysdk/ProtocolSocial.h new file mode 100644 index 00000000..3fa5639b --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolSocial.h @@ -0,0 +1,105 @@ +/** @file ProtocolSocial.h + */ +#ifndef __CCX_PROTOCOL_SOCIAL_H__ +#define __CCX_PROTOCOL_SOCIAL_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TSocialDeveloperInfo +/// typedef TSocialDeveloperInfo. +typedef std::map TSocialDeveloperInfo; +/// \typedef std::map TAchievementInfo +/// typedef TAchievementInfo. +typedef std::map TAchievementInfo; +/** @brief SocialRetCode enum, with inline docs */ +typedef enum +{ + // code for leaderboard feature + kScoreSubmitSucceed =1,/**< enum value is callback of succeeding in submiting. */ + kScoreSubmitfail,/**< enum value is callback of failing to submit . */ + + // code for achievement feature + kAchUnlockSucceed,/**< enum value is callback of succeeding in unlocking. */ + kAchUnlockFail,/**< enum value is callback of failing to unlock. */ + + kSocialSignInSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignInFail,/**< enum value is callback of failing to login. */ + + kSocialSignOutSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignOutFail,/**< enum value is callback of failing to login. */ + kSocialGetGameFriends,/**< enum value is callback of getGameFriends. */ + kSocialExtensionCode = 20000 /**< enum value is extension code . */ + +} SocialRetCode; +/**    + *@class  SocialListener + *@brief the interface of social callback   + */ +class SocialListener +{ +public: + /**    + *@brief the interface of social callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onSocialResult(SocialRetCode code, const char* msg) = 0; +}; + +/**    + *@class  ProtocolSocial + *@brief the interface of social   + */ +class ProtocolSocial : public PluginProtocol +{ +public: + + /** + @brief user signIn + */ + virtual void signIn() = 0; + + /** + @brief user signOut + */ + virtual void signOut() = 0; + + /** + @brief submit the score + @param leaderboardID + @param the score + */ + virtual void submitScore(const char* leadboardID, long score) = 0; + /** + @brief show the id of Leaderboard page + @param leaderboardID + */ + virtual void showLeaderboard(const char* leaderboardID) = 0; + + /** + @brief methods of achievement feature + @param the info of achievement + */ + virtual void unlockAchievement(TAchievementInfo achInfo) = 0; + /** + @brief show the page of achievements + */ + virtual void showAchievements() = 0; + /** + @brief set pListener The callback object for social result + @param the listener + */ + virtual void setListener(SocialListener* listener) = 0; + /** + @brief get pListener The callback object for social result + @return the listener + */ + virtual SocialListener* getListener() = 0; +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SOCIAL_H__ ----- */ diff --git a/android/arm64-v8a/include/anysdk/ProtocolUser.h b/android/arm64-v8a/include/anysdk/ProtocolUser.h new file mode 100644 index 00000000..14752215 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/ProtocolUser.h @@ -0,0 +1,134 @@ +/** @file ProtocolUser.h + */ +#ifndef __CCX_PROTOCOL_USER_H__ +#define __CCX_PROTOCOL_USER_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TUserDeveloperInfo +/// typedef TUserDeveloperInfo. +typedef std::map TUserDeveloperInfo; +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk. */ + kInitFail,/**< enum value is callback of failing to init sdk. */ + kLoginSuccess,/**< enum value is callback of succeeding in login.*/ + kLoginNetworkError,/**< enum value is callback of network error*/ + kLoginNoNeed,/**< enum value is callback of no need login.*/ + kLoginFail,/**< enum value is callback of failing to login. */ + kLoginCancel,/**< enum value is callback of canceling to login. */ + kLogoutSuccess,/**< enum value is callback of succeeding in logout. */ + kLogoutFail,/**< enum value is callback of failing to logout. */ + kPlatformEnter,/**< enum value is callback after enter platform. */ + kPlatformBack,/**< enum value is callback after exit antiAddiction. */ + kPausePage,/**< enum value is callback after exit pause page. */ + kExitPage,/**< enum value is callback after exit exit page. */ + kAntiAddictionQuery,/**< enum value is callback after querying antiAddiction. */ + kRealNameRegister,/**< enum value is callback after registering realname. */ + kAccountSwitchSuccess,/**< enum value is callback of succeeding in switching account. */ + kAccountSwitchFail,/**< enum value is callback of failing to switch account. */ + kOpenShop,/**< enum value is callback of open the shop. */ + kAccountSwitchCancel,/**< enum value is callback of canceling to switch account. */ + kUserExtension = 50000 /**< enum value is extension code . */ + + +} UserActionResultCode; +/** @brief ToolBarPlace enum, with inline docs */ +typedef enum +{ + kToolBarTopLeft = 1,/**< enum the toolbar is at topleft. */ + kToolBarTopRight,/**< enum the toolbar is at topright. */ + kToolBarMidLeft,/**< enum the toolbar is at midleft. */ + kToolBarMidRight,/**< enum the toolbar is at midright. */ + kToolBarBottomLeft,/**< enum the toolbar is at bottomleft. */ + kToolBarBottomRight,/**< enum the toolbar is at bottomright. */ +} ToolBarPlace; + +class ProtocolUser; +/**    + *@class  UserActionListener + *@brief the interface of user callback   + */ +class UserActionListener +{ +public: + /**    + *@brief the interface of user callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolUser* pPlugin, UserActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolUser   + */ +class ProtocolUser : public PluginProtocol +{ +public: + + + /** + @brief User login + */ + virtual void login() = 0 ; + + /** + @brief User login + if the process of logining need to know the param of server_id , + you can use the function + and if you must change oauthloginserver, you can add the param of oauthLoginServer + @param server_id + @param oauthLoginServer + */ + + CC_DEPRECATED_ATTRIBUTE virtual void login(std::string server_id, std::string oauthLoginServer = "") = 0 ; + + /** + @brief User login + if the process of logining need to know the parameters , + you can use the function + @param the parameters + */ + virtual void login(std::map info) = 0 ; + + /** + @brief Check whether the user logined or not + @return If user logined, return value is true; + else return value is false. + */ + virtual bool isLogined() = 0 ; + + /** + @brief Get USER ID + @return If user logined, return value is userID; + else return value is empty string. + */ + virtual std::string getUserID() = 0 ; + /** + @brief set the result listener + @param pListener The callback object for user result + */ + virtual void setActionListener(UserActionListener* listener) = 0 ; + /** + @brief get pListener The callback object for user result + @return the listener + */ + virtual UserActionListener* getActionListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_USER_H__ */ diff --git a/android/arm64-v8a/include/anysdk/Statistics.h b/android/arm64-v8a/include/anysdk/Statistics.h new file mode 100644 index 00000000..bb389ff0 --- /dev/null +++ b/android/arm64-v8a/include/anysdk/Statistics.h @@ -0,0 +1,18 @@ +#ifndef __STATISTICS_H__ +#define __STATISTICS_H__ + +#include +namespace anysdk { namespace framework { + +class Statistics +{ +public: + static void initInfo(); + static void createPlugin(std::string pluginName, int pluginType); + static void callFunction(std::string pluginName, std::string functionName); + +}; + +}} // namespace anysdk { namespace framework { + +#endif //__STATISTICS_H__ diff --git a/android/arm64-v8a/libPluginProtocolStatic.a b/android/arm64-v8a/libPluginProtocolStatic.a new file mode 100644 index 00000000..32df300b Binary files /dev/null and b/android/arm64-v8a/libPluginProtocolStatic.a differ diff --git a/android/armeabi-v7a/include/anysdk/AgentManager.h b/android/armeabi-v7a/include/anysdk/AgentManager.h new file mode 100644 index 00000000..092a9eaf --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/AgentManager.h @@ -0,0 +1,245 @@ +/** @file AgentManager.h + */ + + +#ifndef __CCX_AGENTMANAGER_H__ +#define __CCX_AGENTMANAGER_H__ + +#include "PluginManager.h" +#include "ProtocolIAP.h" +#include "ProtocolAnalytics.h" +#include "ProtocolShare.h" +#include "ProtocolAds.h" +#include "ProtocolSocial.h" +#include "ProtocolUser.h" +#include "ProtocolPush.h" +#include "ProtocolCrash.h" +#include "ProtocolREC.h" +#include "ProtocolCustom.h" +#include "ProtocolAdTracking.h" +#include +#include +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum { + kPluginAds = 16,/**< enum value is the type of Ads. */ + kPluginAnalytics = 1,/**< enum value is the type of Analytics. */ + kPluginIAP = 8,/**< enum value is the type of IAP. */ + kPluginShare = 2,/**< enum value is the type of Share. */ + kPluginUser = 32,/**< enum value is the type of User. */ + kPluginSocial = 4,/**< enum value is the type of Social. */ + kPluginPush = 64,/**< enum value is the type of Push. */ + kPluginCrash = 128,/**< enum value is the type of Crash. */ + kPluginCustom = 256,/**< enum value is the type of Custom. */ + kPluginREC = 512,/**< enum value is the type of REC. */ + kPluginAdTracking = 1024,/**< enum value is the type of AdTracking. */ +}Plugin_type; +/**    + *  @class  AgentManager   + */ +class AgentManager +{ +public: + virtual ~AgentManager(); + /** + @brief Get singleton of AgentManager + */ + + static AgentManager* getInstance(); + /** + @brief Destory the instance of AgentManager + */ + static void end(); + + /** + @breif the init of AgentManager + @param the appKey of anysdk + @param the appSecret of anysdk + @param the privateKey of anysdk + @param the url of oauthLoginServer + @warning Must invoke this interface before loadAllPlugins + */ + void init(std::string appKey,std::string appSecret,std::string privateKey,std::string oauthLoginServer); + + /** + @brief load the plugins + */ + CC_DEPRECATED_ATTRIBUTE void loadALLPlugin(); + /** + @brief unload the plugins + */ + CC_DEPRECATED_ATTRIBUTE void unloadALLPlugin(); + + /** + @brief load the plugins + */ + void loadAllPlugins(); + + /** + @brief unload the plugins + */ + void unloadAllPlugins(); + + /** + @brief Get Analytics plugin + @return if Analytics plugin exist ,return value is Analytics plugin. + else return value is null pointer. + */ + ProtocolAnalytics* getAnalyticsPlugin(){return _pAnalytics;}; + + /** + @brief Get User plugin + @return if User plugin exist ,return value is User plugin. + else return value is null pointer. + */ + ProtocolUser* getUserPlugin(){return _pUser;}; + + /** + @brief Get IAP plugin + @return if IAP plugin exist ,return value is IAP plugin. + else return value is null pointer. + */ + std::map* getIAPPlugin(){return &_pluginsIAPMap;}; + + /** + @brief Get Share plugin + @return if Share plugin exist ,return value is Share plugin. + else return value is null pointer. + */ + ProtocolShare* getSharePlugin(){return _pShare;}; + + /** + @brief Get Social plugin + @return if Social plugin exist ,return value is Social plugin. + else return value is null pointer. + */ + ProtocolSocial* getSocialPlugin(){return _pSocial;}; + + /** + @brief Get Ads plugin + @return if Ads plugin exist ,return value is Ads plugin. + else return value is null pointer. + */ + ProtocolAds* getAdsPlugin(){return _pAds;}; + + /** + @brief Get Push plugin + @return if Push plugin exist ,return value is Push plugin. + else return value is null pointer. + */ + ProtocolPush* getPushPlugin(){return _pPush;}; + + /** + @brief Get Crash plugin + @return if Crash plugin exist ,return value is Crash plugin. + else return value is null pointer. + */ + ProtocolCrash* getCrashPlugin(){return _pCrash;}; + + /** + @brief Get Custom plugin + @return if Crash plugin exist ,return value is Custom plugin. + else return value is null pointer. + */ + ProtocolCustom* getCustomPlugin(){return _pCustom;}; + + + /** + @brief Get REC plugin + @return if REC plugin exist ,return value is REC plugin. + else return value is null pointer. + */ + ProtocolREC* getRECPlugin(){return _pREC;}; + + /** + @brief Get AdTracking plugin + @return if AdTracking plugin exist ,return value is AdTracking plugin. + else return value is null pointer. + */ + ProtocolAdTracking* getAdTrackingPlugin(){return _pAdTracking;}; + + /** + @brief Get channel ID + @return return value is channel ID. + */ + std::string getChannelId(); + + /** + @brief Get custom param + @return return value is custom param for channel. + */ + std::string getCustomParam(); + + /** + @brief Get framework version + @return return value is the version of AnySDKFramework. + */ + std::string getFrameworkVersion(); + + /** + @Title: setIsAnaylticsEnabled + @Description: choose to open or close + @param @param enabled true or false + @return void + */ + void setIsAnaylticsEnabled(bool value){bIsAnaylticsEnabled = value;}; + /** + @Title: isAnaylticsEnabled + @Description: the status of Anayltics + @param @return true or false + @return boolean + */ + bool isAnaylticsEnabled(){return bIsAnaylticsEnabled;}; + + + void loadPlugin(const char* nodeName,int type); +protected: + void setDebugMode(bool flag); + std::string getSupportPlugin(); + void release(); + + +private: + AgentManager(void); + + // Analytics plugin + ProtocolAnalytics* _pAnalytics; + + // user plugin + ProtocolUser* _pUser; + + // IAP plugins + // ProtocolIAP* _pIAP; + std::map _pluginsIAPMap; + + // Share plugin + ProtocolShare* _pShare; + + // Social plugin + ProtocolSocial* _pSocial; + + // Ads plugin + ProtocolAds* _pAds; + + // Push plugin + ProtocolPush* _pPush; + + // Crash plugin + ProtocolCrash* _pCrash; + + // Custom plugin + ProtocolCustom* _pCustom; + + // REC plugin + ProtocolREC* _pREC; + + // AdTracking plugin + ProtocolAdTracking* _pAdTracking; + + bool bIsAnaylticsEnabled; + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_AGENTMANAGER_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/JSBRelation.h b/android/armeabi-v7a/include/anysdk/JSBRelation.h new file mode 100644 index 00000000..7775b0dc --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/JSBRelation.h @@ -0,0 +1,31 @@ +/** @file JSBRelation.h + */ +#ifndef __CCX_JSBRELATION_H__ +#define __CCX_JSBRELATION_H__ + +#include "PluginProtocol.h" +#include +#include +#include + +using namespace std; + +namespace anysdk { namespace framework { + +/**    + *  @class  JSBRelation   + */ +class JSBRelation +{ +public: + static string getMethodsOfPlugin(PluginProtocol* plugin); + + + + +private: +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_JSBRELATION_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/PluginFactory.h b/android/armeabi-v7a/include/anysdk/PluginFactory.h new file mode 100644 index 00000000..79922c97 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginFactory.h @@ -0,0 +1,41 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGIN_FACTORY_H__ +#define __CCX_PLUGIN_FACTORY_H__ + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginManager; +/**    + *  @class  PluginFactory   + */ +class PluginFactory +{ +public: + virtual ~PluginFactory(); + /** + @brief Get singleton of PluginFactory + */ + static PluginFactory* getInstance(); + + /** + @brief Destory the instance of PluginFactory + */ + static void purgeFactory(); + +private: + friend class PluginManager; + PluginFactory(void); + + /** + @brief create the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* createPlugin(const char* name, int pluginType); +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_FACTORY_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/PluginJavaData.h b/android/armeabi-v7a/include/anysdk/PluginJavaData.h new file mode 100644 index 00000000..bd37b745 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginJavaData.h @@ -0,0 +1,17 @@ +#ifndef __PLUGIN_JAVA_DATA_H__ +#define __PLUGIN_JAVA_DATA_H__ + +#include +#include + +namespace anysdk { namespace framework { + +typedef struct _PluginJavaData_ +{ + jobject jobj; + std::string jclassName; +} PluginJavaData; + +}} //namespace anysdk { namespace framework { + +#endif // __PLUGIN_JAVA_DATA_H__ diff --git a/android/armeabi-v7a/include/anysdk/PluginJniHelper.h b/android/armeabi-v7a/include/anysdk/PluginJniHelper.h new file mode 100644 index 00000000..82981907 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginJniHelper.h @@ -0,0 +1,43 @@ +#ifndef __PLUGIN_JNI_HELPER_H__ +#define __PLUGIN_JNI_HELPER_H__ + +#include +#include + +namespace anysdk {namespace framework{ + +typedef struct PluginJniMethodInfo_ +{ + JNIEnv * env; + jclass classID; + jmethodID methodID; +} PluginJniMethodInfo; + +class PluginJniHelper +{ +public: + static JavaVM* getJavaVM(); + static void setJavaVM(JavaVM *javaVM); + static JNIEnv* getEnv(); + + static bool getStaticMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static bool getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static std::string jstring2string(jstring jstr); + static jstring newStringUTF(JNIEnv* env, const std::string& utf8Str); + + static bool setClassLoaderFrom(jobject nativeActivityInstance); + + static jmethodID loadclassMethod_methodID; + static jobject classloader; + +private: + static JavaVM *_psJavaVM; + static bool getMethodInfo_DefaultClassLoader(PluginJniMethodInfo &methodinfo, + const char *className, + const char *methodName, + const char *paramCode); +}; + +}} + +#endif // __PLUGIN_JNI_HELPER_H__ diff --git a/android/armeabi-v7a/include/anysdk/PluginJniMacros.h b/android/armeabi-v7a/include/anysdk/PluginJniMacros.h new file mode 100644 index 00000000..eace0d9a --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginJniMacros.h @@ -0,0 +1,156 @@ +#ifndef __PLUGIN_JNI_MACROS_H__ +#define __PLUGIN_JNI_MACROS_H__ + +#define return_if_fails(cond) if (!(cond)) return; +#define return_val_if_fails(cond, ret) if(!(cond)) return (ret); + +#define CALL_BASERET_JAVA_FUNC_WITH_PARAM(retType, paramCode, param, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID, param); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_BASERET_JAVA_FUNC(retType, paramCode, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_JAVA_FUNC_WITH_VALIST(retCode) \ +std::vector allParams; \ +if (NULL != param) \ +{ \ + allParams.push_back(param); \ + \ + va_list argp; \ + PluginParam* pArg = NULL; \ + va_start( argp, param ); \ + while (1) \ + { \ + pArg = va_arg(argp, PluginParam*); \ + if (pArg == NULL) \ + break; \ + \ + allParams.push_back(pArg); \ + } \ + va_end(argp); \ +} \ + \ +return call##retCode##FuncWithParam(funcName, allParams); \ + + +#define CALL_JAVA_FUNC(retType, retCode, defaultRet, jRetCode) \ +retType ret = defaultRet; \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(this); \ +if (NULL == pData) { \ + PluginUtils::outputLog(ANDROID_LOG_ERROR, "PluginProtocol", "Can't find java data for plugin : %s", this->getPluginName()); \ + return ret; \ +} \ + \ +std::string paramCode; \ +int nParamNum = params.size(); \ +if (0 == nParamNum) \ +{ \ + paramCode = "()"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName(this, funcName); \ +} else \ +{ \ + PluginParam* pRetParam = NULL; \ + bool needDel = false; \ + if (nParamNum == 1) { \ + pRetParam = params[0]; \ + } else { \ + std::map allParams; \ + for (int i = 0; i < nParamNum; i++) \ + { \ + PluginParam* pArg = params[i]; \ + if (pArg == NULL) \ + { \ + break; \ + } \ + \ + char strKey[8] = { 0 }; \ + sprintf(strKey, "Param%d", i + 1); \ + allParams[strKey] = pArg; \ + } \ + \ + pRetParam = new PluginParam(allParams); \ + needDel = true; \ + } \ + \ + switch(pRetParam->getCurrentType()) \ + { \ + case PluginParam::kParamTypeInt: \ + paramCode = "(I)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getIntValue()); \ + break; \ + case PluginParam::kParamTypeFloat: \ + paramCode = "(F)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getFloatValue()); \ + break; \ + case PluginParam::kParamTypeBool: \ + paramCode = "(Z)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getBoolValue()); \ + break; \ + case PluginParam::kParamTypeString: \ + { \ + jstring jstr = PluginJniHelper::newStringUTF(PluginUtils::getEnv(), pRetParam->getStringValue()); \ + paramCode = "(Ljava/lang/String;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jstr); \ + PluginUtils::getEnv()->DeleteLocalRef(jstr); \ + } \ + break; \ + case PluginParam::kParamTypeStringMap: \ + case PluginParam::kParamTypeMap: \ + { \ + jobject jMap = PluginUtils::getJObjFromParam(pRetParam); \ + paramCode = "(Lorg/json/JSONObject;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jMap); \ + PluginUtils::getEnv()->DeleteLocalRef(jMap); \ + } \ + break; \ + default: \ + break; \ + } \ + \ + if (needDel && pRetParam != NULL) \ + { \ + delete pRetParam; \ + pRetParam = NULL; \ + } \ +} \ +return ret; \ + + +#endif // __PLUGIN_JNI_MACROS_H__ diff --git a/android/armeabi-v7a/include/anysdk/PluginManager.h b/android/armeabi-v7a/include/anysdk/PluginManager.h new file mode 100644 index 00000000..93282ae7 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginManager.h @@ -0,0 +1,51 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGINMANAGER_H__ +#define __CCX_PLUGINMANAGER_H__ + +#include "PluginProtocol.h" +#include "PluginFactory.h" +#include +#include + +namespace anysdk { namespace framework { + +/**    + *  @class  PluginManager   + */ +class PluginManager +{ +public: + virtual ~PluginManager(); + /** + @brief Get singleton of PluginManager + */ + static PluginManager* getInstance(); + /** + @brief Destory the instance of PluginManager + */ + static void end(); + + /** + @brief load the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* loadPlugin(const char* name, int pluginType); + /** + @brief unload the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + void unloadPlugin(const char* name, int pluginType = 0); + + +private: + PluginManager(void); + std::map _pluginsMap; +// bool _isDebug; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGINMANAGER_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/PluginParam.h b/android/armeabi-v7a/include/anysdk/PluginParam.h new file mode 100644 index 00000000..1f35d4a7 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginParam.h @@ -0,0 +1,126 @@ +/** @file PluginParam.h + */ +#ifndef __CCX_PLUGIN_PARAM_H__ +#define __CCX_PLUGIN_PARAM_H__ + +#include +#include +/// \typedef std::map StringMap +/// typedef YString. +typedef std::map StringMap; + +namespace anysdk { namespace framework { + +class PluginProtocol; +/**    + *  @class  PluginParam   + */ +class PluginParam +{ +public: + /** + @brief the default constructor of PluginParam + */ + PluginParam(); + + virtual ~PluginParam(); + /** + @brief the constructor of PluginParam + @param the value is Integer + */ + PluginParam(int nValue); + /** + @brief the constructor of PluginParam + @param the value is float + */ + PluginParam(float fValue); + /** + @brief the constructor of PluginParam + @param the value is boolean + */ + PluginParam(bool bValue); + /** + @brief the default constructor of PluginParam + @param the value is char + */ + PluginParam(const char* strValue); + /** + @brief the default constructor of PluginParam + @param the value is StringMap + */ + PluginParam(StringMap strMapValue); + + typedef enum{ + kParamTypeNull = 0, + kParamTypeInt, + kParamTypeFloat, + kParamTypeBool, + kParamTypeString, + kParamTypeStringMap, + kParamTypeMap, + } ParamType; + /** + @brief get the ParamType of value + */ + inline ParamType getCurrentType() { + return _type; + } + /** + @brief get the int value + */ + inline int getIntValue() { + return _intValue; + } + /** + @brief get the float value + */ + inline float getFloatValue() { + return _floatValue; + } + /** + @brief get the boolean value + */ + inline bool getBoolValue() { + return _boolValue; + } + /** + @brief get the char value + */ + inline const char* getStringValue() { + return _strValue.c_str(); + } + /** + @brief get the map of value + */ + inline std::map getMapValue() { + return _mapValue; + } + /** + @brief get the StringMap value + */ + inline StringMap getStrMapValue() { + return _strMapValue; + } + +private: + friend class PluginProtocol; + /** + @brief the constructor of PluginParam + @param the map of value + */ + PluginParam(std::map mapValue); + +private: + ParamType _type; + + int _intValue; + float _floatValue; + bool _boolValue; + std::string _strValue; + std::map _mapValue; + StringMap _strMapValue; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_PARAM_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/PluginProtocol.h b/android/armeabi-v7a/include/anysdk/PluginProtocol.h new file mode 100644 index 00000000..95cf706d --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginProtocol.h @@ -0,0 +1,144 @@ +/** @file PluginProtocol.h + */ +#ifndef __CCX_IPLUGIN_H__ +#define __CCX_IPLUGIN_H__ + +#include "PluginParam.h" +#include + +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#elif _MSC_VER >= 1400 //vs 2005 or higher +#define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated) +#else +#define CC_DEPRECATED_ATTRIBUTE +#endif + +namespace anysdk { namespace framework { + +/** + * @class PluginProtocol + * @brief The super class for all plugins. + */ +class PluginProtocol +{ +public: + virtual ~PluginProtocol() {}; + + /** + *@brief set plugin name + *@param the name of plugin + */ + virtual void setPluginName(const char* name) = 0 ; + /** + *@brief get plugin name + *@return the name of plugin + */ + virtual const char* getPluginName() = 0 ; + + /** + *@brief get the version of plugin + *@return the version of plugin + */ + virtual std::string getPluginVersion(); + /** + *@brief get the version of sdk + *@return the version of sdk + */ + virtual std::string getSDKVersion(); + + /** + *@brief switch debug plug-in on/off + *@param the value of on/off + */ + CC_DEPRECATED_ATTRIBUTE virtual void setDebugMode(bool bDebug); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return void + */ + virtual void callFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return void + */ + virtual void callFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, std::vector params); + + /** + @brief Check function the plugin support or not + @param the name of plugin + @return if the function support ,return true + else retur false + */ + virtual bool isFunctionSupported(std::string functionName); + + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_IPLUGIN_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/PluginUtils.h b/android/armeabi-v7a/include/anysdk/PluginUtils.h new file mode 100644 index 00000000..3742c161 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/PluginUtils.h @@ -0,0 +1,157 @@ +#ifndef __PLUGIN_UTILS_H__ +#define __PLUGIN_UTILS_H__ + +#include "PluginJniHelper.h" +#include "PluginJavaData.h" +#include +#include +#include "PluginParam.h" +#include "PluginJniMacros.h" +#include +//#include + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginUtils +{ +public: +//cjh static void initPluginWrapper(android_app* app); + static jobject createJavaMapObject(std::map* paramMap); + static jobject createJavaListObject(std::list* paramList); + static void initJavaPlugin(PluginProtocol* pPlugin, jobject jObj, const char* className, int type); + static JNIEnv* getEnv(); + + static PluginJavaData* getPluginJavaData(PluginProtocol* pKeyObj); + static void setPluginJavaData(PluginProtocol* pKeyObj, PluginJavaData* pData, int type); + static void erasePluginJavaData(PluginProtocol* pKeyObj,int type); + static void erasePluginJavaData(std::string key); + + static PluginProtocol* getPluginPtr(std::string className); + + static jobject getJObjFromParam(PluginParam* param); + + // methods have no return value + template + static void callJavaFunctionWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + return_if_fails(paramCode != NULL && strlen(paramCode) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + t.env->CallVoidMethod(pData->jobj, t.methodID, param); + t.env->DeleteLocalRef(t.classID); + } + } + static void callJavaFunctionWithName(PluginProtocol* thiz, const char* funcName) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()V")) + { + t.env->CallVoidMethod(pData->jobj, t.methodID); + t.env->DeleteLocalRef(t.classID); + } + } + + // methods return value is string + template + static std::string callJavaStringFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + jstring strRet = (jstring)t.env->CallObjectMethod(pData->jobj, t.methodID, param); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + static std::string callJavaStringFuncWithName(PluginProtocol* thiz, const char* funcName) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()Ljava/lang/String;")) + { + jstring strRet = (jstring) t.env->CallObjectMethod(pData->jobj, t.methodID); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + + // methods return value is int + template + static int callJavaIntFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(int, paramCode, param, Int, 0) + } + static int callJavaIntFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(int, "()I", Int, 0) + } + + // methods return value is float + template + static float callJavaFloatFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(float, paramCode, param, Float, 0.0f) + } + static float callJavaFloatFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(float, "()F", Float, 0.0f); + } + + // methods return value is bool + template + static bool callJavaBoolFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(bool, paramCode, param, Boolean, false) + } + static bool callJavaBoolFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(bool, "()Z", Boolean, false) + } + + static void callJavaFunctionWithName_string_map(PluginProtocol* thiz, const char* funcName, const char* keyParam, std::map* paramMap); + + static void outputLog(int type, const char* logTag, const char* pFormat, ...); + static void output(int type, const char* logTag, const char* contents); + + static void resetLogLevel(); +private: + static std::string _logLevel; +}; + +}} // namespace anysdk { namespace framework { + +#endif //__PLUGIN_UTILS_H__ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolAdTracking.h b/android/armeabi-v7a/include/anysdk/ProtocolAdTracking.h new file mode 100644 index 00000000..6fc557a2 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolAdTracking.h @@ -0,0 +1,58 @@ +/** @file ProtocolAdTracking.h + */ +#ifndef __CCX_PROTOCOL_ADTRACKING_H__ +#define __CCX_PROTOCOL_ADTRACKING_H__ + +#include "PluginProtocol.h" +#include +namespace anysdk { namespace framework { +/**    + *@class  ProtocolAdTracking + *@brief the interface of AdTracking   + */ +class ProtocolAdTracking : public PluginProtocol +{ +public: + + /** + * + * @Title: onRegister + * @Description: Call this method if you want to track register events as happening during a section. + * @param userId user identifier + * @return void + */ + virtual void onRegister(const char* userId) = 0; + + /** + * + * @Title: onLogin + * @Description:Call this method if you want to track login events as happening during a section. + * @param userInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onLogin(std::map userInfo) = 0; + + /** + * + * @Title: onPay + * @Description: Call this method if you want to track pay events as happening during a section. + * @param productInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onPay(std::map productInfo) = 0; + + /** + * + * @Title: trackEvent + * @Description: Call this method if you want to track custom events with parameters as happening during a section. + * @param eventId The custom event name. + * @param paramMap The details of this parameters are already covered by document. + */ + virtual void trackEvent(const char* eventId, std::map* paramMap = NULL) = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_ADTRACKING_H__ ----- */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolAds.h b/android/armeabi-v7a/include/anysdk/ProtocolAds.h new file mode 100644 index 00000000..8e29987f --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolAds.h @@ -0,0 +1,133 @@ +/** @file ProtocolAds.h + */ +#ifndef __CCX_PROTOCOL_ADS_H__ +#define __CCX_PROTOCOL_ADS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TAdsDeveloperInfo +/// typedef TAdsDeveloperInfo. +typedef std::map TAdsDeveloperInfo; +/// \typedef std::map TAdsInfo +/// typedef TAdsInfo. +typedef std::map TAdsInfo; +/** @brief AdsResultCode enum, with inline docs */ +typedef enum +{ + kAdsReceived = 0, /**< enum the callback: the ad is received is at center. */ + + kAdsShown, /**< enum the callback: the advertisement dismissed. */ + kAdsDismissed, /**< enum the callback: the advertisement dismissed. */ + + kPointsSpendSucceed, /**< enum the callback: the points spend succeed. */ + kPointsSpendFailed, /**< enum the callback: the points spend failed. */ + + kNetworkError, /**< enum the callback of Network error at center. */ + kUnknownError, /**< enum the callback of Unknown error. */ + kOfferWallOnPointsChanged, /**< enum the callback of Changing the point of offerwall. */ + kRewardedVideoWithReward,/**< enum the callback of receiving the reward of rewardedvideo. */ + kInAppPurchaseFinished,/**< enum the callback of finishing IAP ad. */ + kAdsClicked,/**< enum the callback of the advertisement clicked. */ + kAdsExtension = 40000 /**< enum value is extension code . */ +} AdsResultCode; +/** @brief AdsPos enum, with inline docs */ +typedef enum { + kPosCenter = 0,/**< enum the toolbar is at center. */ + kPosTop,/**< enum the toolbar is at top. */ + kPosTopLeft,/**< enum the toolbar is at topleft. */ + kPosTopRight,/**< enum the toolbar is at topright. */ + kPosBottom,/**< enum the toolbar is at bottom. */ + kPosBottomLeft,/**< enum the toolbar is at bottomleft. */ + kPosBottomRight,/**< enum the toolbar is at bottomright. */ +} AdsPos; +/** @brief AdsType enum, with inline docs */ +typedef enum { + AD_TYPE_BANNER = 0,/**< enum value is banner ads . */ + AD_TYPE_FULLSCREEN,/**< enum value is fullscreen ads . */ + AD_TYPE_MOREAPP,/**< enum value is moreapp ads . */ + AD_TYPE_OFFERWALL,/**< enum value is offerwall ads . */ + AD_TYPE_REWARDEDVIDEO,/**< enum value is rewarded video ads . */ + AD_TYPE_NATIVEEXPRESS,/**< enum value is Native express ads . */ + AD_TYPE_NATIVEADVANCED,/**< enum value is Native advanced ads . */ +} AdsType; + +class ProtocolAds; +class AdsListener +{ +public: + /** + *@brief The advertisement request result + *@param the id of callback + *@param the information of callback + */ + virtual void onAdsResult(AdsResultCode code, const char* msg) = 0; +}; + +class ProtocolAds : public PluginProtocol +{ +public: + + + + /** + @brief show adview + @param the type of ads + @param the idx of ads + */ + virtual void showAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief Hide the adview + @param the type of ads + @param the idx of ads + */ + virtual void hideAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief preload the adview + @param the type of ads + @param the idx of ads + */ + virtual void preloadAds(AdsType adsType, int idx = 1)= 0; + + /** + *@brief Query the points of player + *@return the point + */ + virtual float queryPoints() = 0; + + /** + *@brief Spend the points. + Use this method to notify server spend points. + *@param points Need spend number of points + */ + virtual void spendPoints(int points) = 0; + + /** + @brief set the Ads listener + @param pListener The callback object for Ads result + */ + virtual void setAdsListener(AdsListener* listener) = 0; + + /** + @brief get pListener The callback object for Ads result + @return the listener + */ + virtual AdsListener* getAdsListener() = 0; + + /** + @brief Is it supportive of this type of ads + @param the type of ads + @return if it is supportive ,return true + else retur false + */ + virtual bool isAdTypeSupported(AdsType adType) = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_ADS_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolAnalytics.h b/android/armeabi-v7a/include/anysdk/ProtocolAnalytics.h new file mode 100644 index 00000000..ce3372d6 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolAnalytics.h @@ -0,0 +1,107 @@ +/** @file ProtocolAnalytics.h + */ +#ifndef __CCX_PROTOCOL_ANALYTICS_H__ +#define __CCX_PROTOCOL_ANALYTICS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map LogEventParamPair +/// typedef LogEventParamPair. +typedef std::pair< std::string, std::string > LogEventParamPair; +/// \typedef std::map LogEventParamMap +/// typedef LogEventParamMap. +typedef std::map< std::string, std::string > LogEventParamMap; +typedef enum { + ANONYMOUS,/**< enum value is anonymous typek. */ + REGISTED,/**< enum value is registed type. */ + SINA_WEIBO,/**< enum value is sineweibo type. */ + TENCENT_WEIBO,/**< enum value is tecentweibo type */ + QQ,/**< enum value is qq type */ + ND91,/**< enum value is nd91 type. */ +} AccountType; +typedef enum { + LOGIN,/**< enum value is the login operate. */ + LOGOUT,/**< enum value is the logout operate. */ + REGISTER,/**< enum value is the register operate. */ +} AccountOperate; +typedef enum { + MALE,/**< enum value is male. */ + FEMALE,/**< enum value is female. */ + UNKNOWN,/**< enum value is unknow. */ + +} AccountGender; +typedef enum { + GUIDE_LINE,/**< enum value is the guideline type.. */ + MAIN_LINE,/**< enum value is the mainline type.. */ + BRANCH_LINE,/** +#include + +namespace anysdk { namespace framework { + +class ProtocolCrash : public PluginProtocol +{ +public: + /** + * set user identifier + * + * @param userInfo + */ + virtual void setUserIdentifier(const char* identifier) = 0; + + /** + * The uploader captured in exception information + * + * @param message Set the custom information + * @param exception The exception + */ + virtual void reportException(const char* message, const char* exception) = 0; + + /** + * customize logging + * + * @param string Custom log + */ + virtual void leaveBreadcrumb(const char* breadcrumb) = 0; + + + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_CRASH_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolCustom.h b/android/armeabi-v7a/include/anysdk/ProtocolCustom.h new file mode 100644 index 00000000..dc92558e --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolCustom.h @@ -0,0 +1,50 @@ +/** @file ProtocolCustom.h + */ +#ifndef __CCX_PROTOCOL_CUSTOM_H__ +#define __CCX_PROTOCOL_CUSTOM_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +typedef enum +{ + kCustomExtension = 80000 /**< enum value is extension code . */ +} CustomResultCode; +/**    + *@class  CustomResultListener + *@brief the interface of share callback   + */ +class CustomResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onCustomResult(CustomResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolCustom + *@brief the interface of custom   + */ +class ProtocolCustom : public PluginProtocol +{ +public: + + /** + @breif set the result listener + @param pListener The callback object for custom result + @wraning Must invoke this interface before custom + */ + virtual void setResultListener(CustomResultListener* pListener) = 0; + + virtual CustomResultListener* getCustomListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_Custom_H__ ----- */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolIAP.h b/android/armeabi-v7a/include/anysdk/ProtocolIAP.h new file mode 100644 index 00000000..4a875b32 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolIAP.h @@ -0,0 +1,119 @@ +/** @file ProtocolIAP.h + */ +#ifndef __CCX_PROTOCOL_IAP_H__ +#define __CCX_PROTOCOL_IAP_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TIAPDeveloperInfo +/// typedef TIAPDeveloperInfo. +typedef std::map TIAPDeveloperInfo; +/// \typedef std::map TProductInfo +/// typedef TProductInfo. +typedef std::map TProductInfo; +/// typedef TProductsInfo. +typedef std::map AllProductsInfo; +/** @brief PayResultCode enum, with inline docs */ +typedef enum +{ + kPaySuccess = 0,/**< enum value is callback of succeeding in paying . */ + kPayFail,/**< enum value is callback of failing to pay . */ + kPayCancel,/**< enum value is callback of canceling to pay . */ + kPayNetworkError,/**< enum value is callback of network error . */ + kPayProductionInforIncomplete,/**< enum value is callback of incompleting info . */ + kPayInitSuccess,/**< enum value is callback of succeeding in initing sdk . */ + kPayInitFail,/**< enum value is callback of failing to init sdk . */ + kPayNowPaying,/**< enum value is callback of paying now . */ + kPayRechargeSuccess,/**< enum value is callback of succeeding in recharging. */ + kPayExtension = 30000 /**< enum value is extension code . */ +} PayResultCode; +/** @brief RequestResultCode enum, with inline docs */ +typedef enum +{ + kRequestSuccess = 31000,/**< enum value is callback of succeeding in paying . */ + kRequestFail/**< enum value is callback of failing to pay . */ +} RequestResultCode; +/**    + *@class  PayResultListener + *@brief the interface of pay callback   + */ +class PayResultListener +{ +public: + /**    + *@brief the interface of pay callback  + *@param the id of callback + *@param the information of callback + *@param the info of pay + */ + virtual void onPayResult(PayResultCode ret, const char* msg, TProductInfo info) = 0; + /** + *@brief the interface of request callback + *@param the id of callback + *@param the information of callback + *@param the info of request product + */ + virtual void onRequestResult(RequestResultCode ret, const char* msg, AllProductsInfo info) {} +}; +/**    + *@class  ProtocolIAP + *@brief the interface of pay    + */ + +class ProtocolIAP : public PluginProtocol +{ +public: + + /** + @brief pay for product + @param info The info of product, must contains key: + productName The name of product + productPrice The price of product(must can be parse to float) + productDesc The description of product + @warning For different plugin, the parameter should have other keys to pay. + Look at the manual of plugins. + */ + virtual void payForProduct(TProductInfo info) = 0; + /** + @brief get order id + @return the order id + */ + virtual std::string getOrderId() = 0; + + /** + @breif set the result listener + @param pListener The callback object for pay result + @wraning Must invoke this interface before payForProduct. + */ + virtual void setResultListener(PayResultListener* pListener) = 0; + + virtual PayResultListener* getPayListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + /** + @brief change the state of paying + @param the state + */ + + static void resetPayState() + { + _paying = false; + } + static bool _paying; + + + +}; + + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_IAP_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolPush.h b/android/armeabi-v7a/include/anysdk/ProtocolPush.h new file mode 100644 index 00000000..e9e2fac8 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolPush.h @@ -0,0 +1,104 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PROTOCOL_PUSH_H__ +#define __CCX_PROTOCOL_PUSH_H__ + +#include "PluginProtocol.h" +#include +#include +#include +using namespace std; + +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kPushReceiveMessage = 0,/**value is callback of Receiving Message . */ + kPushExtensionCode = 60000 /**< enum value is extension code . */ + + +} PushActionResultCode; +class ProtocolPush; +/**    + *@class  PushActionListener + *@brief the interface of Push callback   + */ +class PushActionListener +{ +public: + /**    + *@brief the interface of Push callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolPush   + */ +class ProtocolPush : public PluginProtocol +{ +public: + + + /** + *@brief start/register Push services + *@return void + */ + virtual void startPush() = 0 ; + + + /** + *@brief close Push services + *@return void + */ + virtual void closePush() = 0 ; + + + /** + *@brief set alias + *@param tags + *@return void + */ + virtual void setAlias(string alias) = 0; + + /** + *@brief del alias + *@param tags + *@return void + */ + virtual void delAlias(string alias) = 0; + + /** + *@brief set tag + *@param tags + *@return void + */ + virtual void setTags(list tags) = 0; + + /** + *@brief delete tag + *@param tags + *@return void + */ + virtual void delTags(list tags) = 0; + + /** + @brief set the result listener + @param pListener The callback object for push result + */ + virtual void setActionListener(PushActionListener* listener) = 0 ; + + /** + @brief get pListener The callback object for Push result + @return the listener + */ + virtual PushActionListener* getActionListener() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_PUSH_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolREC.h b/android/armeabi-v7a/include/anysdk/ProtocolREC.h new file mode 100644 index 00000000..b0db2c0d --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolREC.h @@ -0,0 +1,83 @@ +/** @file ProtocolREC.h + */ +#ifndef __CCX_PROTOCOL_REC_H__ +#define __CCX_PROTOCOL_REC_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { + +typedef std::map TVideoInfo; + +/** @brief RECResultCode enum, with inline docs */ +typedef enum +{ + kRECInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk . */ + kRECInitFail,/**< enum value is callback of failing to init sdk. */ + kRECStartRecording,/**< enum value is callback of starting to record. */ + kRECStopRecording,/**< enum value is callback of stoping to record. */ + kRECPauseRecording,/**< enum value is callback of pausing to record. */ + kRECResumeRecording,/**< enum value is callback of resuming to record. */ + kRECEnterSDKPage,/**< enum value is callback of entering SDK`s page. */ + kRECQuitSDKPage,/**< enum value is callback of quiting SDK`s page. */ + kRECShareSuccess,/**< enum value is callback of succeeding in sharing. */ + kRECShareFail,/**< enum value is callback of failing to share. */ + kRECExtension = 90000 /**< enum value is extension code . */ +} RECResultCode; +/**    + *@class  RECResultListener + *@brief the interface of REC callback   + */ +class RECResultListener +{ +public: + /**    + *@brief the interface of REC callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onRECResult(RECResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolREC + *@brief the interface of REC   + */ +class ProtocolREC : public PluginProtocol +{ +public: + + /** + * @Description: Start to record video + */ + virtual void startRecording() = 0; + + /** + * @Description: Stop to record video + */ + virtual void stopRecording() = 0; + + /** + * @Description: share video + * @Param info The info of share + */ + virtual void share(TVideoInfo info) = 0; + + + + /** + @breif set the result listener + @param pListener The callback object for REC result + @wraning Must invoke this interface before REC + */ + virtual void setResultListener(RECResultListener* pListener) = 0; + + virtual RECResultListener* getRECListener() = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolShare.h b/android/armeabi-v7a/include/anysdk/ProtocolShare.h new file mode 100644 index 00000000..2215a4ff --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolShare.h @@ -0,0 +1,72 @@ +/** @file ProtocolShare.h + */ +#ifndef __CCX_PROTOCOL_SHARE_H__ +#define __CCX_PROTOCOL_SHARE_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TShareDeveloperInfo +/// typedef TShareDeveloperInfo. +typedef std::map TShareDeveloperInfo; +/// \typedef std::map TShareInfo +/// typedef TShareInfo. +typedef std::map TShareInfo; +/** @brief ShareResultCode enum, with inline docs */ +typedef enum +{ + kShareSuccess = 0,/**< enum value is callback of failing to sharing . */ + kShareFail,/**< enum value is callback of failing to share . */ + kShareCancel,/**< enum value is callback of canceling to share . */ + kShareNetworkError,/**< enum value is callback of network error . */ + kShareExtension = 10000 /**< enum value is extension code . */ +} ShareResultCode; +/**    + *@class  ShareResultListener + *@brief the interface of share callback   + */ +class ShareResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onShareResult(ShareResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolShare + *@brief the interface of share   + */ +class ProtocolShare : public PluginProtocol +{ +public: + + + + /** + @brief share information + @param info The info of share, contains key: + SharedText The text need to share + SharedImagePath The full path of image file need to share (optinal) + @warning For different plugin, the parameter should have other keys to share. + Look at the manual of plugins. */ + virtual void share(TShareInfo info) = 0; + + /** + @breif set the result listener + @param pListener The callback object for share result + @wraning Must invoke this interface before share + */ + virtual void setResultListener(ShareResultListener* pListener) = 0; + + virtual ShareResultListener* getShareListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolSocial.h b/android/armeabi-v7a/include/anysdk/ProtocolSocial.h new file mode 100644 index 00000000..3fa5639b --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolSocial.h @@ -0,0 +1,105 @@ +/** @file ProtocolSocial.h + */ +#ifndef __CCX_PROTOCOL_SOCIAL_H__ +#define __CCX_PROTOCOL_SOCIAL_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TSocialDeveloperInfo +/// typedef TSocialDeveloperInfo. +typedef std::map TSocialDeveloperInfo; +/// \typedef std::map TAchievementInfo +/// typedef TAchievementInfo. +typedef std::map TAchievementInfo; +/** @brief SocialRetCode enum, with inline docs */ +typedef enum +{ + // code for leaderboard feature + kScoreSubmitSucceed =1,/**< enum value is callback of succeeding in submiting. */ + kScoreSubmitfail,/**< enum value is callback of failing to submit . */ + + // code for achievement feature + kAchUnlockSucceed,/**< enum value is callback of succeeding in unlocking. */ + kAchUnlockFail,/**< enum value is callback of failing to unlock. */ + + kSocialSignInSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignInFail,/**< enum value is callback of failing to login. */ + + kSocialSignOutSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignOutFail,/**< enum value is callback of failing to login. */ + kSocialGetGameFriends,/**< enum value is callback of getGameFriends. */ + kSocialExtensionCode = 20000 /**< enum value is extension code . */ + +} SocialRetCode; +/**    + *@class  SocialListener + *@brief the interface of social callback   + */ +class SocialListener +{ +public: + /**    + *@brief the interface of social callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onSocialResult(SocialRetCode code, const char* msg) = 0; +}; + +/**    + *@class  ProtocolSocial + *@brief the interface of social   + */ +class ProtocolSocial : public PluginProtocol +{ +public: + + /** + @brief user signIn + */ + virtual void signIn() = 0; + + /** + @brief user signOut + */ + virtual void signOut() = 0; + + /** + @brief submit the score + @param leaderboardID + @param the score + */ + virtual void submitScore(const char* leadboardID, long score) = 0; + /** + @brief show the id of Leaderboard page + @param leaderboardID + */ + virtual void showLeaderboard(const char* leaderboardID) = 0; + + /** + @brief methods of achievement feature + @param the info of achievement + */ + virtual void unlockAchievement(TAchievementInfo achInfo) = 0; + /** + @brief show the page of achievements + */ + virtual void showAchievements() = 0; + /** + @brief set pListener The callback object for social result + @param the listener + */ + virtual void setListener(SocialListener* listener) = 0; + /** + @brief get pListener The callback object for social result + @return the listener + */ + virtual SocialListener* getListener() = 0; +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SOCIAL_H__ ----- */ diff --git a/android/armeabi-v7a/include/anysdk/ProtocolUser.h b/android/armeabi-v7a/include/anysdk/ProtocolUser.h new file mode 100644 index 00000000..14752215 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/ProtocolUser.h @@ -0,0 +1,134 @@ +/** @file ProtocolUser.h + */ +#ifndef __CCX_PROTOCOL_USER_H__ +#define __CCX_PROTOCOL_USER_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TUserDeveloperInfo +/// typedef TUserDeveloperInfo. +typedef std::map TUserDeveloperInfo; +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk. */ + kInitFail,/**< enum value is callback of failing to init sdk. */ + kLoginSuccess,/**< enum value is callback of succeeding in login.*/ + kLoginNetworkError,/**< enum value is callback of network error*/ + kLoginNoNeed,/**< enum value is callback of no need login.*/ + kLoginFail,/**< enum value is callback of failing to login. */ + kLoginCancel,/**< enum value is callback of canceling to login. */ + kLogoutSuccess,/**< enum value is callback of succeeding in logout. */ + kLogoutFail,/**< enum value is callback of failing to logout. */ + kPlatformEnter,/**< enum value is callback after enter platform. */ + kPlatformBack,/**< enum value is callback after exit antiAddiction. */ + kPausePage,/**< enum value is callback after exit pause page. */ + kExitPage,/**< enum value is callback after exit exit page. */ + kAntiAddictionQuery,/**< enum value is callback after querying antiAddiction. */ + kRealNameRegister,/**< enum value is callback after registering realname. */ + kAccountSwitchSuccess,/**< enum value is callback of succeeding in switching account. */ + kAccountSwitchFail,/**< enum value is callback of failing to switch account. */ + kOpenShop,/**< enum value is callback of open the shop. */ + kAccountSwitchCancel,/**< enum value is callback of canceling to switch account. */ + kUserExtension = 50000 /**< enum value is extension code . */ + + +} UserActionResultCode; +/** @brief ToolBarPlace enum, with inline docs */ +typedef enum +{ + kToolBarTopLeft = 1,/**< enum the toolbar is at topleft. */ + kToolBarTopRight,/**< enum the toolbar is at topright. */ + kToolBarMidLeft,/**< enum the toolbar is at midleft. */ + kToolBarMidRight,/**< enum the toolbar is at midright. */ + kToolBarBottomLeft,/**< enum the toolbar is at bottomleft. */ + kToolBarBottomRight,/**< enum the toolbar is at bottomright. */ +} ToolBarPlace; + +class ProtocolUser; +/**    + *@class  UserActionListener + *@brief the interface of user callback   + */ +class UserActionListener +{ +public: + /**    + *@brief the interface of user callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolUser* pPlugin, UserActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolUser   + */ +class ProtocolUser : public PluginProtocol +{ +public: + + + /** + @brief User login + */ + virtual void login() = 0 ; + + /** + @brief User login + if the process of logining need to know the param of server_id , + you can use the function + and if you must change oauthloginserver, you can add the param of oauthLoginServer + @param server_id + @param oauthLoginServer + */ + + CC_DEPRECATED_ATTRIBUTE virtual void login(std::string server_id, std::string oauthLoginServer = "") = 0 ; + + /** + @brief User login + if the process of logining need to know the parameters , + you can use the function + @param the parameters + */ + virtual void login(std::map info) = 0 ; + + /** + @brief Check whether the user logined or not + @return If user logined, return value is true; + else return value is false. + */ + virtual bool isLogined() = 0 ; + + /** + @brief Get USER ID + @return If user logined, return value is userID; + else return value is empty string. + */ + virtual std::string getUserID() = 0 ; + /** + @brief set the result listener + @param pListener The callback object for user result + */ + virtual void setActionListener(UserActionListener* listener) = 0 ; + /** + @brief get pListener The callback object for user result + @return the listener + */ + virtual UserActionListener* getActionListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_USER_H__ */ diff --git a/android/armeabi-v7a/include/anysdk/Statistics.h b/android/armeabi-v7a/include/anysdk/Statistics.h new file mode 100644 index 00000000..bb389ff0 --- /dev/null +++ b/android/armeabi-v7a/include/anysdk/Statistics.h @@ -0,0 +1,18 @@ +#ifndef __STATISTICS_H__ +#define __STATISTICS_H__ + +#include +namespace anysdk { namespace framework { + +class Statistics +{ +public: + static void initInfo(); + static void createPlugin(std::string pluginName, int pluginType); + static void callFunction(std::string pluginName, std::string functionName); + +}; + +}} // namespace anysdk { namespace framework { + +#endif //__STATISTICS_H__ diff --git a/android/armeabi-v7a/libPluginProtocolStatic.a b/android/armeabi-v7a/libPluginProtocolStatic.a new file mode 100644 index 00000000..346cf342 Binary files /dev/null and b/android/armeabi-v7a/libPluginProtocolStatic.a differ diff --git a/android/armeabi/include/anysdk/AgentManager.h b/android/armeabi/include/anysdk/AgentManager.h new file mode 100644 index 00000000..092a9eaf --- /dev/null +++ b/android/armeabi/include/anysdk/AgentManager.h @@ -0,0 +1,245 @@ +/** @file AgentManager.h + */ + + +#ifndef __CCX_AGENTMANAGER_H__ +#define __CCX_AGENTMANAGER_H__ + +#include "PluginManager.h" +#include "ProtocolIAP.h" +#include "ProtocolAnalytics.h" +#include "ProtocolShare.h" +#include "ProtocolAds.h" +#include "ProtocolSocial.h" +#include "ProtocolUser.h" +#include "ProtocolPush.h" +#include "ProtocolCrash.h" +#include "ProtocolREC.h" +#include "ProtocolCustom.h" +#include "ProtocolAdTracking.h" +#include +#include +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum { + kPluginAds = 16,/**< enum value is the type of Ads. */ + kPluginAnalytics = 1,/**< enum value is the type of Analytics. */ + kPluginIAP = 8,/**< enum value is the type of IAP. */ + kPluginShare = 2,/**< enum value is the type of Share. */ + kPluginUser = 32,/**< enum value is the type of User. */ + kPluginSocial = 4,/**< enum value is the type of Social. */ + kPluginPush = 64,/**< enum value is the type of Push. */ + kPluginCrash = 128,/**< enum value is the type of Crash. */ + kPluginCustom = 256,/**< enum value is the type of Custom. */ + kPluginREC = 512,/**< enum value is the type of REC. */ + kPluginAdTracking = 1024,/**< enum value is the type of AdTracking. */ +}Plugin_type; +/**    + *  @class  AgentManager   + */ +class AgentManager +{ +public: + virtual ~AgentManager(); + /** + @brief Get singleton of AgentManager + */ + + static AgentManager* getInstance(); + /** + @brief Destory the instance of AgentManager + */ + static void end(); + + /** + @breif the init of AgentManager + @param the appKey of anysdk + @param the appSecret of anysdk + @param the privateKey of anysdk + @param the url of oauthLoginServer + @warning Must invoke this interface before loadAllPlugins + */ + void init(std::string appKey,std::string appSecret,std::string privateKey,std::string oauthLoginServer); + + /** + @brief load the plugins + */ + CC_DEPRECATED_ATTRIBUTE void loadALLPlugin(); + /** + @brief unload the plugins + */ + CC_DEPRECATED_ATTRIBUTE void unloadALLPlugin(); + + /** + @brief load the plugins + */ + void loadAllPlugins(); + + /** + @brief unload the plugins + */ + void unloadAllPlugins(); + + /** + @brief Get Analytics plugin + @return if Analytics plugin exist ,return value is Analytics plugin. + else return value is null pointer. + */ + ProtocolAnalytics* getAnalyticsPlugin(){return _pAnalytics;}; + + /** + @brief Get User plugin + @return if User plugin exist ,return value is User plugin. + else return value is null pointer. + */ + ProtocolUser* getUserPlugin(){return _pUser;}; + + /** + @brief Get IAP plugin + @return if IAP plugin exist ,return value is IAP plugin. + else return value is null pointer. + */ + std::map* getIAPPlugin(){return &_pluginsIAPMap;}; + + /** + @brief Get Share plugin + @return if Share plugin exist ,return value is Share plugin. + else return value is null pointer. + */ + ProtocolShare* getSharePlugin(){return _pShare;}; + + /** + @brief Get Social plugin + @return if Social plugin exist ,return value is Social plugin. + else return value is null pointer. + */ + ProtocolSocial* getSocialPlugin(){return _pSocial;}; + + /** + @brief Get Ads plugin + @return if Ads plugin exist ,return value is Ads plugin. + else return value is null pointer. + */ + ProtocolAds* getAdsPlugin(){return _pAds;}; + + /** + @brief Get Push plugin + @return if Push plugin exist ,return value is Push plugin. + else return value is null pointer. + */ + ProtocolPush* getPushPlugin(){return _pPush;}; + + /** + @brief Get Crash plugin + @return if Crash plugin exist ,return value is Crash plugin. + else return value is null pointer. + */ + ProtocolCrash* getCrashPlugin(){return _pCrash;}; + + /** + @brief Get Custom plugin + @return if Crash plugin exist ,return value is Custom plugin. + else return value is null pointer. + */ + ProtocolCustom* getCustomPlugin(){return _pCustom;}; + + + /** + @brief Get REC plugin + @return if REC plugin exist ,return value is REC plugin. + else return value is null pointer. + */ + ProtocolREC* getRECPlugin(){return _pREC;}; + + /** + @brief Get AdTracking plugin + @return if AdTracking plugin exist ,return value is AdTracking plugin. + else return value is null pointer. + */ + ProtocolAdTracking* getAdTrackingPlugin(){return _pAdTracking;}; + + /** + @brief Get channel ID + @return return value is channel ID. + */ + std::string getChannelId(); + + /** + @brief Get custom param + @return return value is custom param for channel. + */ + std::string getCustomParam(); + + /** + @brief Get framework version + @return return value is the version of AnySDKFramework. + */ + std::string getFrameworkVersion(); + + /** + @Title: setIsAnaylticsEnabled + @Description: choose to open or close + @param @param enabled true or false + @return void + */ + void setIsAnaylticsEnabled(bool value){bIsAnaylticsEnabled = value;}; + /** + @Title: isAnaylticsEnabled + @Description: the status of Anayltics + @param @return true or false + @return boolean + */ + bool isAnaylticsEnabled(){return bIsAnaylticsEnabled;}; + + + void loadPlugin(const char* nodeName,int type); +protected: + void setDebugMode(bool flag); + std::string getSupportPlugin(); + void release(); + + +private: + AgentManager(void); + + // Analytics plugin + ProtocolAnalytics* _pAnalytics; + + // user plugin + ProtocolUser* _pUser; + + // IAP plugins + // ProtocolIAP* _pIAP; + std::map _pluginsIAPMap; + + // Share plugin + ProtocolShare* _pShare; + + // Social plugin + ProtocolSocial* _pSocial; + + // Ads plugin + ProtocolAds* _pAds; + + // Push plugin + ProtocolPush* _pPush; + + // Crash plugin + ProtocolCrash* _pCrash; + + // Custom plugin + ProtocolCustom* _pCustom; + + // REC plugin + ProtocolREC* _pREC; + + // AdTracking plugin + ProtocolAdTracking* _pAdTracking; + + bool bIsAnaylticsEnabled; + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_AGENTMANAGER_H__ */ diff --git a/android/armeabi/include/anysdk/JSBRelation.h b/android/armeabi/include/anysdk/JSBRelation.h new file mode 100644 index 00000000..7775b0dc --- /dev/null +++ b/android/armeabi/include/anysdk/JSBRelation.h @@ -0,0 +1,31 @@ +/** @file JSBRelation.h + */ +#ifndef __CCX_JSBRELATION_H__ +#define __CCX_JSBRELATION_H__ + +#include "PluginProtocol.h" +#include +#include +#include + +using namespace std; + +namespace anysdk { namespace framework { + +/**    + *  @class  JSBRelation   + */ +class JSBRelation +{ +public: + static string getMethodsOfPlugin(PluginProtocol* plugin); + + + + +private: +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_JSBRELATION_H__ */ diff --git a/android/armeabi/include/anysdk/PluginFactory.h b/android/armeabi/include/anysdk/PluginFactory.h new file mode 100644 index 00000000..79922c97 --- /dev/null +++ b/android/armeabi/include/anysdk/PluginFactory.h @@ -0,0 +1,41 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGIN_FACTORY_H__ +#define __CCX_PLUGIN_FACTORY_H__ + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginManager; +/**    + *  @class  PluginFactory   + */ +class PluginFactory +{ +public: + virtual ~PluginFactory(); + /** + @brief Get singleton of PluginFactory + */ + static PluginFactory* getInstance(); + + /** + @brief Destory the instance of PluginFactory + */ + static void purgeFactory(); + +private: + friend class PluginManager; + PluginFactory(void); + + /** + @brief create the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* createPlugin(const char* name, int pluginType); +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_FACTORY_H__ */ diff --git a/android/armeabi/include/anysdk/PluginJavaData.h b/android/armeabi/include/anysdk/PluginJavaData.h new file mode 100644 index 00000000..bd37b745 --- /dev/null +++ b/android/armeabi/include/anysdk/PluginJavaData.h @@ -0,0 +1,17 @@ +#ifndef __PLUGIN_JAVA_DATA_H__ +#define __PLUGIN_JAVA_DATA_H__ + +#include +#include + +namespace anysdk { namespace framework { + +typedef struct _PluginJavaData_ +{ + jobject jobj; + std::string jclassName; +} PluginJavaData; + +}} //namespace anysdk { namespace framework { + +#endif // __PLUGIN_JAVA_DATA_H__ diff --git a/android/armeabi/include/anysdk/PluginJniHelper.h b/android/armeabi/include/anysdk/PluginJniHelper.h new file mode 100644 index 00000000..82981907 --- /dev/null +++ b/android/armeabi/include/anysdk/PluginJniHelper.h @@ -0,0 +1,43 @@ +#ifndef __PLUGIN_JNI_HELPER_H__ +#define __PLUGIN_JNI_HELPER_H__ + +#include +#include + +namespace anysdk {namespace framework{ + +typedef struct PluginJniMethodInfo_ +{ + JNIEnv * env; + jclass classID; + jmethodID methodID; +} PluginJniMethodInfo; + +class PluginJniHelper +{ +public: + static JavaVM* getJavaVM(); + static void setJavaVM(JavaVM *javaVM); + static JNIEnv* getEnv(); + + static bool getStaticMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static bool getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static std::string jstring2string(jstring jstr); + static jstring newStringUTF(JNIEnv* env, const std::string& utf8Str); + + static bool setClassLoaderFrom(jobject nativeActivityInstance); + + static jmethodID loadclassMethod_methodID; + static jobject classloader; + +private: + static JavaVM *_psJavaVM; + static bool getMethodInfo_DefaultClassLoader(PluginJniMethodInfo &methodinfo, + const char *className, + const char *methodName, + const char *paramCode); +}; + +}} + +#endif // __PLUGIN_JNI_HELPER_H__ diff --git a/android/armeabi/include/anysdk/PluginJniMacros.h b/android/armeabi/include/anysdk/PluginJniMacros.h new file mode 100644 index 00000000..eace0d9a --- /dev/null +++ b/android/armeabi/include/anysdk/PluginJniMacros.h @@ -0,0 +1,156 @@ +#ifndef __PLUGIN_JNI_MACROS_H__ +#define __PLUGIN_JNI_MACROS_H__ + +#define return_if_fails(cond) if (!(cond)) return; +#define return_val_if_fails(cond, ret) if(!(cond)) return (ret); + +#define CALL_BASERET_JAVA_FUNC_WITH_PARAM(retType, paramCode, param, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID, param); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_BASERET_JAVA_FUNC(retType, paramCode, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_JAVA_FUNC_WITH_VALIST(retCode) \ +std::vector allParams; \ +if (NULL != param) \ +{ \ + allParams.push_back(param); \ + \ + va_list argp; \ + PluginParam* pArg = NULL; \ + va_start( argp, param ); \ + while (1) \ + { \ + pArg = va_arg(argp, PluginParam*); \ + if (pArg == NULL) \ + break; \ + \ + allParams.push_back(pArg); \ + } \ + va_end(argp); \ +} \ + \ +return call##retCode##FuncWithParam(funcName, allParams); \ + + +#define CALL_JAVA_FUNC(retType, retCode, defaultRet, jRetCode) \ +retType ret = defaultRet; \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(this); \ +if (NULL == pData) { \ + PluginUtils::outputLog(ANDROID_LOG_ERROR, "PluginProtocol", "Can't find java data for plugin : %s", this->getPluginName()); \ + return ret; \ +} \ + \ +std::string paramCode; \ +int nParamNum = params.size(); \ +if (0 == nParamNum) \ +{ \ + paramCode = "()"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName(this, funcName); \ +} else \ +{ \ + PluginParam* pRetParam = NULL; \ + bool needDel = false; \ + if (nParamNum == 1) { \ + pRetParam = params[0]; \ + } else { \ + std::map allParams; \ + for (int i = 0; i < nParamNum; i++) \ + { \ + PluginParam* pArg = params[i]; \ + if (pArg == NULL) \ + { \ + break; \ + } \ + \ + char strKey[8] = { 0 }; \ + sprintf(strKey, "Param%d", i + 1); \ + allParams[strKey] = pArg; \ + } \ + \ + pRetParam = new PluginParam(allParams); \ + needDel = true; \ + } \ + \ + switch(pRetParam->getCurrentType()) \ + { \ + case PluginParam::kParamTypeInt: \ + paramCode = "(I)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getIntValue()); \ + break; \ + case PluginParam::kParamTypeFloat: \ + paramCode = "(F)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getFloatValue()); \ + break; \ + case PluginParam::kParamTypeBool: \ + paramCode = "(Z)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getBoolValue()); \ + break; \ + case PluginParam::kParamTypeString: \ + { \ + jstring jstr = PluginJniHelper::newStringUTF(PluginUtils::getEnv(), pRetParam->getStringValue()); \ + paramCode = "(Ljava/lang/String;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jstr); \ + PluginUtils::getEnv()->DeleteLocalRef(jstr); \ + } \ + break; \ + case PluginParam::kParamTypeStringMap: \ + case PluginParam::kParamTypeMap: \ + { \ + jobject jMap = PluginUtils::getJObjFromParam(pRetParam); \ + paramCode = "(Lorg/json/JSONObject;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jMap); \ + PluginUtils::getEnv()->DeleteLocalRef(jMap); \ + } \ + break; \ + default: \ + break; \ + } \ + \ + if (needDel && pRetParam != NULL) \ + { \ + delete pRetParam; \ + pRetParam = NULL; \ + } \ +} \ +return ret; \ + + +#endif // __PLUGIN_JNI_MACROS_H__ diff --git a/android/armeabi/include/anysdk/PluginManager.h b/android/armeabi/include/anysdk/PluginManager.h new file mode 100644 index 00000000..93282ae7 --- /dev/null +++ b/android/armeabi/include/anysdk/PluginManager.h @@ -0,0 +1,51 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGINMANAGER_H__ +#define __CCX_PLUGINMANAGER_H__ + +#include "PluginProtocol.h" +#include "PluginFactory.h" +#include +#include + +namespace anysdk { namespace framework { + +/**    + *  @class  PluginManager   + */ +class PluginManager +{ +public: + virtual ~PluginManager(); + /** + @brief Get singleton of PluginManager + */ + static PluginManager* getInstance(); + /** + @brief Destory the instance of PluginManager + */ + static void end(); + + /** + @brief load the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* loadPlugin(const char* name, int pluginType); + /** + @brief unload the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + void unloadPlugin(const char* name, int pluginType = 0); + + +private: + PluginManager(void); + std::map _pluginsMap; +// bool _isDebug; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGINMANAGER_H__ */ diff --git a/android/armeabi/include/anysdk/PluginParam.h b/android/armeabi/include/anysdk/PluginParam.h new file mode 100644 index 00000000..1f35d4a7 --- /dev/null +++ b/android/armeabi/include/anysdk/PluginParam.h @@ -0,0 +1,126 @@ +/** @file PluginParam.h + */ +#ifndef __CCX_PLUGIN_PARAM_H__ +#define __CCX_PLUGIN_PARAM_H__ + +#include +#include +/// \typedef std::map StringMap +/// typedef YString. +typedef std::map StringMap; + +namespace anysdk { namespace framework { + +class PluginProtocol; +/**    + *  @class  PluginParam   + */ +class PluginParam +{ +public: + /** + @brief the default constructor of PluginParam + */ + PluginParam(); + + virtual ~PluginParam(); + /** + @brief the constructor of PluginParam + @param the value is Integer + */ + PluginParam(int nValue); + /** + @brief the constructor of PluginParam + @param the value is float + */ + PluginParam(float fValue); + /** + @brief the constructor of PluginParam + @param the value is boolean + */ + PluginParam(bool bValue); + /** + @brief the default constructor of PluginParam + @param the value is char + */ + PluginParam(const char* strValue); + /** + @brief the default constructor of PluginParam + @param the value is StringMap + */ + PluginParam(StringMap strMapValue); + + typedef enum{ + kParamTypeNull = 0, + kParamTypeInt, + kParamTypeFloat, + kParamTypeBool, + kParamTypeString, + kParamTypeStringMap, + kParamTypeMap, + } ParamType; + /** + @brief get the ParamType of value + */ + inline ParamType getCurrentType() { + return _type; + } + /** + @brief get the int value + */ + inline int getIntValue() { + return _intValue; + } + /** + @brief get the float value + */ + inline float getFloatValue() { + return _floatValue; + } + /** + @brief get the boolean value + */ + inline bool getBoolValue() { + return _boolValue; + } + /** + @brief get the char value + */ + inline const char* getStringValue() { + return _strValue.c_str(); + } + /** + @brief get the map of value + */ + inline std::map getMapValue() { + return _mapValue; + } + /** + @brief get the StringMap value + */ + inline StringMap getStrMapValue() { + return _strMapValue; + } + +private: + friend class PluginProtocol; + /** + @brief the constructor of PluginParam + @param the map of value + */ + PluginParam(std::map mapValue); + +private: + ParamType _type; + + int _intValue; + float _floatValue; + bool _boolValue; + std::string _strValue; + std::map _mapValue; + StringMap _strMapValue; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_PARAM_H__ */ diff --git a/android/armeabi/include/anysdk/PluginProtocol.h b/android/armeabi/include/anysdk/PluginProtocol.h new file mode 100644 index 00000000..95cf706d --- /dev/null +++ b/android/armeabi/include/anysdk/PluginProtocol.h @@ -0,0 +1,144 @@ +/** @file PluginProtocol.h + */ +#ifndef __CCX_IPLUGIN_H__ +#define __CCX_IPLUGIN_H__ + +#include "PluginParam.h" +#include + +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#elif _MSC_VER >= 1400 //vs 2005 or higher +#define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated) +#else +#define CC_DEPRECATED_ATTRIBUTE +#endif + +namespace anysdk { namespace framework { + +/** + * @class PluginProtocol + * @brief The super class for all plugins. + */ +class PluginProtocol +{ +public: + virtual ~PluginProtocol() {}; + + /** + *@brief set plugin name + *@param the name of plugin + */ + virtual void setPluginName(const char* name) = 0 ; + /** + *@brief get plugin name + *@return the name of plugin + */ + virtual const char* getPluginName() = 0 ; + + /** + *@brief get the version of plugin + *@return the version of plugin + */ + virtual std::string getPluginVersion(); + /** + *@brief get the version of sdk + *@return the version of sdk + */ + virtual std::string getSDKVersion(); + + /** + *@brief switch debug plug-in on/off + *@param the value of on/off + */ + CC_DEPRECATED_ATTRIBUTE virtual void setDebugMode(bool bDebug); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return void + */ + virtual void callFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return void + */ + virtual void callFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, std::vector params); + + /** + @brief Check function the plugin support or not + @param the name of plugin + @return if the function support ,return true + else retur false + */ + virtual bool isFunctionSupported(std::string functionName); + + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_IPLUGIN_H__ */ diff --git a/android/armeabi/include/anysdk/PluginUtils.h b/android/armeabi/include/anysdk/PluginUtils.h new file mode 100644 index 00000000..3742c161 --- /dev/null +++ b/android/armeabi/include/anysdk/PluginUtils.h @@ -0,0 +1,157 @@ +#ifndef __PLUGIN_UTILS_H__ +#define __PLUGIN_UTILS_H__ + +#include "PluginJniHelper.h" +#include "PluginJavaData.h" +#include +#include +#include "PluginParam.h" +#include "PluginJniMacros.h" +#include +//#include + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginUtils +{ +public: +//cjh static void initPluginWrapper(android_app* app); + static jobject createJavaMapObject(std::map* paramMap); + static jobject createJavaListObject(std::list* paramList); + static void initJavaPlugin(PluginProtocol* pPlugin, jobject jObj, const char* className, int type); + static JNIEnv* getEnv(); + + static PluginJavaData* getPluginJavaData(PluginProtocol* pKeyObj); + static void setPluginJavaData(PluginProtocol* pKeyObj, PluginJavaData* pData, int type); + static void erasePluginJavaData(PluginProtocol* pKeyObj,int type); + static void erasePluginJavaData(std::string key); + + static PluginProtocol* getPluginPtr(std::string className); + + static jobject getJObjFromParam(PluginParam* param); + + // methods have no return value + template + static void callJavaFunctionWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + return_if_fails(paramCode != NULL && strlen(paramCode) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + t.env->CallVoidMethod(pData->jobj, t.methodID, param); + t.env->DeleteLocalRef(t.classID); + } + } + static void callJavaFunctionWithName(PluginProtocol* thiz, const char* funcName) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()V")) + { + t.env->CallVoidMethod(pData->jobj, t.methodID); + t.env->DeleteLocalRef(t.classID); + } + } + + // methods return value is string + template + static std::string callJavaStringFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + jstring strRet = (jstring)t.env->CallObjectMethod(pData->jobj, t.methodID, param); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + static std::string callJavaStringFuncWithName(PluginProtocol* thiz, const char* funcName) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()Ljava/lang/String;")) + { + jstring strRet = (jstring) t.env->CallObjectMethod(pData->jobj, t.methodID); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + + // methods return value is int + template + static int callJavaIntFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(int, paramCode, param, Int, 0) + } + static int callJavaIntFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(int, "()I", Int, 0) + } + + // methods return value is float + template + static float callJavaFloatFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(float, paramCode, param, Float, 0.0f) + } + static float callJavaFloatFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(float, "()F", Float, 0.0f); + } + + // methods return value is bool + template + static bool callJavaBoolFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(bool, paramCode, param, Boolean, false) + } + static bool callJavaBoolFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(bool, "()Z", Boolean, false) + } + + static void callJavaFunctionWithName_string_map(PluginProtocol* thiz, const char* funcName, const char* keyParam, std::map* paramMap); + + static void outputLog(int type, const char* logTag, const char* pFormat, ...); + static void output(int type, const char* logTag, const char* contents); + + static void resetLogLevel(); +private: + static std::string _logLevel; +}; + +}} // namespace anysdk { namespace framework { + +#endif //__PLUGIN_UTILS_H__ diff --git a/android/armeabi/include/anysdk/ProtocolAdTracking.h b/android/armeabi/include/anysdk/ProtocolAdTracking.h new file mode 100644 index 00000000..6fc557a2 --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolAdTracking.h @@ -0,0 +1,58 @@ +/** @file ProtocolAdTracking.h + */ +#ifndef __CCX_PROTOCOL_ADTRACKING_H__ +#define __CCX_PROTOCOL_ADTRACKING_H__ + +#include "PluginProtocol.h" +#include +namespace anysdk { namespace framework { +/**    + *@class  ProtocolAdTracking + *@brief the interface of AdTracking   + */ +class ProtocolAdTracking : public PluginProtocol +{ +public: + + /** + * + * @Title: onRegister + * @Description: Call this method if you want to track register events as happening during a section. + * @param userId user identifier + * @return void + */ + virtual void onRegister(const char* userId) = 0; + + /** + * + * @Title: onLogin + * @Description:Call this method if you want to track login events as happening during a section. + * @param userInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onLogin(std::map userInfo) = 0; + + /** + * + * @Title: onPay + * @Description: Call this method if you want to track pay events as happening during a section. + * @param productInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onPay(std::map productInfo) = 0; + + /** + * + * @Title: trackEvent + * @Description: Call this method if you want to track custom events with parameters as happening during a section. + * @param eventId The custom event name. + * @param paramMap The details of this parameters are already covered by document. + */ + virtual void trackEvent(const char* eventId, std::map* paramMap = NULL) = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_ADTRACKING_H__ ----- */ diff --git a/android/armeabi/include/anysdk/ProtocolAds.h b/android/armeabi/include/anysdk/ProtocolAds.h new file mode 100644 index 00000000..8e29987f --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolAds.h @@ -0,0 +1,133 @@ +/** @file ProtocolAds.h + */ +#ifndef __CCX_PROTOCOL_ADS_H__ +#define __CCX_PROTOCOL_ADS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TAdsDeveloperInfo +/// typedef TAdsDeveloperInfo. +typedef std::map TAdsDeveloperInfo; +/// \typedef std::map TAdsInfo +/// typedef TAdsInfo. +typedef std::map TAdsInfo; +/** @brief AdsResultCode enum, with inline docs */ +typedef enum +{ + kAdsReceived = 0, /**< enum the callback: the ad is received is at center. */ + + kAdsShown, /**< enum the callback: the advertisement dismissed. */ + kAdsDismissed, /**< enum the callback: the advertisement dismissed. */ + + kPointsSpendSucceed, /**< enum the callback: the points spend succeed. */ + kPointsSpendFailed, /**< enum the callback: the points spend failed. */ + + kNetworkError, /**< enum the callback of Network error at center. */ + kUnknownError, /**< enum the callback of Unknown error. */ + kOfferWallOnPointsChanged, /**< enum the callback of Changing the point of offerwall. */ + kRewardedVideoWithReward,/**< enum the callback of receiving the reward of rewardedvideo. */ + kInAppPurchaseFinished,/**< enum the callback of finishing IAP ad. */ + kAdsClicked,/**< enum the callback of the advertisement clicked. */ + kAdsExtension = 40000 /**< enum value is extension code . */ +} AdsResultCode; +/** @brief AdsPos enum, with inline docs */ +typedef enum { + kPosCenter = 0,/**< enum the toolbar is at center. */ + kPosTop,/**< enum the toolbar is at top. */ + kPosTopLeft,/**< enum the toolbar is at topleft. */ + kPosTopRight,/**< enum the toolbar is at topright. */ + kPosBottom,/**< enum the toolbar is at bottom. */ + kPosBottomLeft,/**< enum the toolbar is at bottomleft. */ + kPosBottomRight,/**< enum the toolbar is at bottomright. */ +} AdsPos; +/** @brief AdsType enum, with inline docs */ +typedef enum { + AD_TYPE_BANNER = 0,/**< enum value is banner ads . */ + AD_TYPE_FULLSCREEN,/**< enum value is fullscreen ads . */ + AD_TYPE_MOREAPP,/**< enum value is moreapp ads . */ + AD_TYPE_OFFERWALL,/**< enum value is offerwall ads . */ + AD_TYPE_REWARDEDVIDEO,/**< enum value is rewarded video ads . */ + AD_TYPE_NATIVEEXPRESS,/**< enum value is Native express ads . */ + AD_TYPE_NATIVEADVANCED,/**< enum value is Native advanced ads . */ +} AdsType; + +class ProtocolAds; +class AdsListener +{ +public: + /** + *@brief The advertisement request result + *@param the id of callback + *@param the information of callback + */ + virtual void onAdsResult(AdsResultCode code, const char* msg) = 0; +}; + +class ProtocolAds : public PluginProtocol +{ +public: + + + + /** + @brief show adview + @param the type of ads + @param the idx of ads + */ + virtual void showAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief Hide the adview + @param the type of ads + @param the idx of ads + */ + virtual void hideAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief preload the adview + @param the type of ads + @param the idx of ads + */ + virtual void preloadAds(AdsType adsType, int idx = 1)= 0; + + /** + *@brief Query the points of player + *@return the point + */ + virtual float queryPoints() = 0; + + /** + *@brief Spend the points. + Use this method to notify server spend points. + *@param points Need spend number of points + */ + virtual void spendPoints(int points) = 0; + + /** + @brief set the Ads listener + @param pListener The callback object for Ads result + */ + virtual void setAdsListener(AdsListener* listener) = 0; + + /** + @brief get pListener The callback object for Ads result + @return the listener + */ + virtual AdsListener* getAdsListener() = 0; + + /** + @brief Is it supportive of this type of ads + @param the type of ads + @return if it is supportive ,return true + else retur false + */ + virtual bool isAdTypeSupported(AdsType adType) = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_ADS_H__ */ diff --git a/android/armeabi/include/anysdk/ProtocolAnalytics.h b/android/armeabi/include/anysdk/ProtocolAnalytics.h new file mode 100644 index 00000000..ce3372d6 --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolAnalytics.h @@ -0,0 +1,107 @@ +/** @file ProtocolAnalytics.h + */ +#ifndef __CCX_PROTOCOL_ANALYTICS_H__ +#define __CCX_PROTOCOL_ANALYTICS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map LogEventParamPair +/// typedef LogEventParamPair. +typedef std::pair< std::string, std::string > LogEventParamPair; +/// \typedef std::map LogEventParamMap +/// typedef LogEventParamMap. +typedef std::map< std::string, std::string > LogEventParamMap; +typedef enum { + ANONYMOUS,/**< enum value is anonymous typek. */ + REGISTED,/**< enum value is registed type. */ + SINA_WEIBO,/**< enum value is sineweibo type. */ + TENCENT_WEIBO,/**< enum value is tecentweibo type */ + QQ,/**< enum value is qq type */ + ND91,/**< enum value is nd91 type. */ +} AccountType; +typedef enum { + LOGIN,/**< enum value is the login operate. */ + LOGOUT,/**< enum value is the logout operate. */ + REGISTER,/**< enum value is the register operate. */ +} AccountOperate; +typedef enum { + MALE,/**< enum value is male. */ + FEMALE,/**< enum value is female. */ + UNKNOWN,/**< enum value is unknow. */ + +} AccountGender; +typedef enum { + GUIDE_LINE,/**< enum value is the guideline type.. */ + MAIN_LINE,/**< enum value is the mainline type.. */ + BRANCH_LINE,/** +#include + +namespace anysdk { namespace framework { + +class ProtocolCrash : public PluginProtocol +{ +public: + /** + * set user identifier + * + * @param userInfo + */ + virtual void setUserIdentifier(const char* identifier) = 0; + + /** + * The uploader captured in exception information + * + * @param message Set the custom information + * @param exception The exception + */ + virtual void reportException(const char* message, const char* exception) = 0; + + /** + * customize logging + * + * @param string Custom log + */ + virtual void leaveBreadcrumb(const char* breadcrumb) = 0; + + + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_CRASH_H__ */ diff --git a/android/armeabi/include/anysdk/ProtocolCustom.h b/android/armeabi/include/anysdk/ProtocolCustom.h new file mode 100644 index 00000000..dc92558e --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolCustom.h @@ -0,0 +1,50 @@ +/** @file ProtocolCustom.h + */ +#ifndef __CCX_PROTOCOL_CUSTOM_H__ +#define __CCX_PROTOCOL_CUSTOM_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +typedef enum +{ + kCustomExtension = 80000 /**< enum value is extension code . */ +} CustomResultCode; +/**    + *@class  CustomResultListener + *@brief the interface of share callback   + */ +class CustomResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onCustomResult(CustomResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolCustom + *@brief the interface of custom   + */ +class ProtocolCustom : public PluginProtocol +{ +public: + + /** + @breif set the result listener + @param pListener The callback object for custom result + @wraning Must invoke this interface before custom + */ + virtual void setResultListener(CustomResultListener* pListener) = 0; + + virtual CustomResultListener* getCustomListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_Custom_H__ ----- */ diff --git a/android/armeabi/include/anysdk/ProtocolIAP.h b/android/armeabi/include/anysdk/ProtocolIAP.h new file mode 100644 index 00000000..4a875b32 --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolIAP.h @@ -0,0 +1,119 @@ +/** @file ProtocolIAP.h + */ +#ifndef __CCX_PROTOCOL_IAP_H__ +#define __CCX_PROTOCOL_IAP_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TIAPDeveloperInfo +/// typedef TIAPDeveloperInfo. +typedef std::map TIAPDeveloperInfo; +/// \typedef std::map TProductInfo +/// typedef TProductInfo. +typedef std::map TProductInfo; +/// typedef TProductsInfo. +typedef std::map AllProductsInfo; +/** @brief PayResultCode enum, with inline docs */ +typedef enum +{ + kPaySuccess = 0,/**< enum value is callback of succeeding in paying . */ + kPayFail,/**< enum value is callback of failing to pay . */ + kPayCancel,/**< enum value is callback of canceling to pay . */ + kPayNetworkError,/**< enum value is callback of network error . */ + kPayProductionInforIncomplete,/**< enum value is callback of incompleting info . */ + kPayInitSuccess,/**< enum value is callback of succeeding in initing sdk . */ + kPayInitFail,/**< enum value is callback of failing to init sdk . */ + kPayNowPaying,/**< enum value is callback of paying now . */ + kPayRechargeSuccess,/**< enum value is callback of succeeding in recharging. */ + kPayExtension = 30000 /**< enum value is extension code . */ +} PayResultCode; +/** @brief RequestResultCode enum, with inline docs */ +typedef enum +{ + kRequestSuccess = 31000,/**< enum value is callback of succeeding in paying . */ + kRequestFail/**< enum value is callback of failing to pay . */ +} RequestResultCode; +/**    + *@class  PayResultListener + *@brief the interface of pay callback   + */ +class PayResultListener +{ +public: + /**    + *@brief the interface of pay callback  + *@param the id of callback + *@param the information of callback + *@param the info of pay + */ + virtual void onPayResult(PayResultCode ret, const char* msg, TProductInfo info) = 0; + /** + *@brief the interface of request callback + *@param the id of callback + *@param the information of callback + *@param the info of request product + */ + virtual void onRequestResult(RequestResultCode ret, const char* msg, AllProductsInfo info) {} +}; +/**    + *@class  ProtocolIAP + *@brief the interface of pay    + */ + +class ProtocolIAP : public PluginProtocol +{ +public: + + /** + @brief pay for product + @param info The info of product, must contains key: + productName The name of product + productPrice The price of product(must can be parse to float) + productDesc The description of product + @warning For different plugin, the parameter should have other keys to pay. + Look at the manual of plugins. + */ + virtual void payForProduct(TProductInfo info) = 0; + /** + @brief get order id + @return the order id + */ + virtual std::string getOrderId() = 0; + + /** + @breif set the result listener + @param pListener The callback object for pay result + @wraning Must invoke this interface before payForProduct. + */ + virtual void setResultListener(PayResultListener* pListener) = 0; + + virtual PayResultListener* getPayListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + /** + @brief change the state of paying + @param the state + */ + + static void resetPayState() + { + _paying = false; + } + static bool _paying; + + + +}; + + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_IAP_H__ */ diff --git a/android/armeabi/include/anysdk/ProtocolPush.h b/android/armeabi/include/anysdk/ProtocolPush.h new file mode 100644 index 00000000..e9e2fac8 --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolPush.h @@ -0,0 +1,104 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PROTOCOL_PUSH_H__ +#define __CCX_PROTOCOL_PUSH_H__ + +#include "PluginProtocol.h" +#include +#include +#include +using namespace std; + +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kPushReceiveMessage = 0,/**value is callback of Receiving Message . */ + kPushExtensionCode = 60000 /**< enum value is extension code . */ + + +} PushActionResultCode; +class ProtocolPush; +/**    + *@class  PushActionListener + *@brief the interface of Push callback   + */ +class PushActionListener +{ +public: + /**    + *@brief the interface of Push callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolPush   + */ +class ProtocolPush : public PluginProtocol +{ +public: + + + /** + *@brief start/register Push services + *@return void + */ + virtual void startPush() = 0 ; + + + /** + *@brief close Push services + *@return void + */ + virtual void closePush() = 0 ; + + + /** + *@brief set alias + *@param tags + *@return void + */ + virtual void setAlias(string alias) = 0; + + /** + *@brief del alias + *@param tags + *@return void + */ + virtual void delAlias(string alias) = 0; + + /** + *@brief set tag + *@param tags + *@return void + */ + virtual void setTags(list tags) = 0; + + /** + *@brief delete tag + *@param tags + *@return void + */ + virtual void delTags(list tags) = 0; + + /** + @brief set the result listener + @param pListener The callback object for push result + */ + virtual void setActionListener(PushActionListener* listener) = 0 ; + + /** + @brief get pListener The callback object for Push result + @return the listener + */ + virtual PushActionListener* getActionListener() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_PUSH_H__ */ diff --git a/android/armeabi/include/anysdk/ProtocolREC.h b/android/armeabi/include/anysdk/ProtocolREC.h new file mode 100644 index 00000000..b0db2c0d --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolREC.h @@ -0,0 +1,83 @@ +/** @file ProtocolREC.h + */ +#ifndef __CCX_PROTOCOL_REC_H__ +#define __CCX_PROTOCOL_REC_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { + +typedef std::map TVideoInfo; + +/** @brief RECResultCode enum, with inline docs */ +typedef enum +{ + kRECInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk . */ + kRECInitFail,/**< enum value is callback of failing to init sdk. */ + kRECStartRecording,/**< enum value is callback of starting to record. */ + kRECStopRecording,/**< enum value is callback of stoping to record. */ + kRECPauseRecording,/**< enum value is callback of pausing to record. */ + kRECResumeRecording,/**< enum value is callback of resuming to record. */ + kRECEnterSDKPage,/**< enum value is callback of entering SDK`s page. */ + kRECQuitSDKPage,/**< enum value is callback of quiting SDK`s page. */ + kRECShareSuccess,/**< enum value is callback of succeeding in sharing. */ + kRECShareFail,/**< enum value is callback of failing to share. */ + kRECExtension = 90000 /**< enum value is extension code . */ +} RECResultCode; +/**    + *@class  RECResultListener + *@brief the interface of REC callback   + */ +class RECResultListener +{ +public: + /**    + *@brief the interface of REC callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onRECResult(RECResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolREC + *@brief the interface of REC   + */ +class ProtocolREC : public PluginProtocol +{ +public: + + /** + * @Description: Start to record video + */ + virtual void startRecording() = 0; + + /** + * @Description: Stop to record video + */ + virtual void stopRecording() = 0; + + /** + * @Description: share video + * @Param info The info of share + */ + virtual void share(TVideoInfo info) = 0; + + + + /** + @breif set the result listener + @param pListener The callback object for REC result + @wraning Must invoke this interface before REC + */ + virtual void setResultListener(RECResultListener* pListener) = 0; + + virtual RECResultListener* getRECListener() = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/armeabi/include/anysdk/ProtocolShare.h b/android/armeabi/include/anysdk/ProtocolShare.h new file mode 100644 index 00000000..2215a4ff --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolShare.h @@ -0,0 +1,72 @@ +/** @file ProtocolShare.h + */ +#ifndef __CCX_PROTOCOL_SHARE_H__ +#define __CCX_PROTOCOL_SHARE_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TShareDeveloperInfo +/// typedef TShareDeveloperInfo. +typedef std::map TShareDeveloperInfo; +/// \typedef std::map TShareInfo +/// typedef TShareInfo. +typedef std::map TShareInfo; +/** @brief ShareResultCode enum, with inline docs */ +typedef enum +{ + kShareSuccess = 0,/**< enum value is callback of failing to sharing . */ + kShareFail,/**< enum value is callback of failing to share . */ + kShareCancel,/**< enum value is callback of canceling to share . */ + kShareNetworkError,/**< enum value is callback of network error . */ + kShareExtension = 10000 /**< enum value is extension code . */ +} ShareResultCode; +/**    + *@class  ShareResultListener + *@brief the interface of share callback   + */ +class ShareResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onShareResult(ShareResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolShare + *@brief the interface of share   + */ +class ProtocolShare : public PluginProtocol +{ +public: + + + + /** + @brief share information + @param info The info of share, contains key: + SharedText The text need to share + SharedImagePath The full path of image file need to share (optinal) + @warning For different plugin, the parameter should have other keys to share. + Look at the manual of plugins. */ + virtual void share(TShareInfo info) = 0; + + /** + @breif set the result listener + @param pListener The callback object for share result + @wraning Must invoke this interface before share + */ + virtual void setResultListener(ShareResultListener* pListener) = 0; + + virtual ShareResultListener* getShareListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/armeabi/include/anysdk/ProtocolSocial.h b/android/armeabi/include/anysdk/ProtocolSocial.h new file mode 100644 index 00000000..3fa5639b --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolSocial.h @@ -0,0 +1,105 @@ +/** @file ProtocolSocial.h + */ +#ifndef __CCX_PROTOCOL_SOCIAL_H__ +#define __CCX_PROTOCOL_SOCIAL_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TSocialDeveloperInfo +/// typedef TSocialDeveloperInfo. +typedef std::map TSocialDeveloperInfo; +/// \typedef std::map TAchievementInfo +/// typedef TAchievementInfo. +typedef std::map TAchievementInfo; +/** @brief SocialRetCode enum, with inline docs */ +typedef enum +{ + // code for leaderboard feature + kScoreSubmitSucceed =1,/**< enum value is callback of succeeding in submiting. */ + kScoreSubmitfail,/**< enum value is callback of failing to submit . */ + + // code for achievement feature + kAchUnlockSucceed,/**< enum value is callback of succeeding in unlocking. */ + kAchUnlockFail,/**< enum value is callback of failing to unlock. */ + + kSocialSignInSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignInFail,/**< enum value is callback of failing to login. */ + + kSocialSignOutSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignOutFail,/**< enum value is callback of failing to login. */ + kSocialGetGameFriends,/**< enum value is callback of getGameFriends. */ + kSocialExtensionCode = 20000 /**< enum value is extension code . */ + +} SocialRetCode; +/**    + *@class  SocialListener + *@brief the interface of social callback   + */ +class SocialListener +{ +public: + /**    + *@brief the interface of social callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onSocialResult(SocialRetCode code, const char* msg) = 0; +}; + +/**    + *@class  ProtocolSocial + *@brief the interface of social   + */ +class ProtocolSocial : public PluginProtocol +{ +public: + + /** + @brief user signIn + */ + virtual void signIn() = 0; + + /** + @brief user signOut + */ + virtual void signOut() = 0; + + /** + @brief submit the score + @param leaderboardID + @param the score + */ + virtual void submitScore(const char* leadboardID, long score) = 0; + /** + @brief show the id of Leaderboard page + @param leaderboardID + */ + virtual void showLeaderboard(const char* leaderboardID) = 0; + + /** + @brief methods of achievement feature + @param the info of achievement + */ + virtual void unlockAchievement(TAchievementInfo achInfo) = 0; + /** + @brief show the page of achievements + */ + virtual void showAchievements() = 0; + /** + @brief set pListener The callback object for social result + @param the listener + */ + virtual void setListener(SocialListener* listener) = 0; + /** + @brief get pListener The callback object for social result + @return the listener + */ + virtual SocialListener* getListener() = 0; +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SOCIAL_H__ ----- */ diff --git a/android/armeabi/include/anysdk/ProtocolUser.h b/android/armeabi/include/anysdk/ProtocolUser.h new file mode 100644 index 00000000..14752215 --- /dev/null +++ b/android/armeabi/include/anysdk/ProtocolUser.h @@ -0,0 +1,134 @@ +/** @file ProtocolUser.h + */ +#ifndef __CCX_PROTOCOL_USER_H__ +#define __CCX_PROTOCOL_USER_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TUserDeveloperInfo +/// typedef TUserDeveloperInfo. +typedef std::map TUserDeveloperInfo; +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk. */ + kInitFail,/**< enum value is callback of failing to init sdk. */ + kLoginSuccess,/**< enum value is callback of succeeding in login.*/ + kLoginNetworkError,/**< enum value is callback of network error*/ + kLoginNoNeed,/**< enum value is callback of no need login.*/ + kLoginFail,/**< enum value is callback of failing to login. */ + kLoginCancel,/**< enum value is callback of canceling to login. */ + kLogoutSuccess,/**< enum value is callback of succeeding in logout. */ + kLogoutFail,/**< enum value is callback of failing to logout. */ + kPlatformEnter,/**< enum value is callback after enter platform. */ + kPlatformBack,/**< enum value is callback after exit antiAddiction. */ + kPausePage,/**< enum value is callback after exit pause page. */ + kExitPage,/**< enum value is callback after exit exit page. */ + kAntiAddictionQuery,/**< enum value is callback after querying antiAddiction. */ + kRealNameRegister,/**< enum value is callback after registering realname. */ + kAccountSwitchSuccess,/**< enum value is callback of succeeding in switching account. */ + kAccountSwitchFail,/**< enum value is callback of failing to switch account. */ + kOpenShop,/**< enum value is callback of open the shop. */ + kAccountSwitchCancel,/**< enum value is callback of canceling to switch account. */ + kUserExtension = 50000 /**< enum value is extension code . */ + + +} UserActionResultCode; +/** @brief ToolBarPlace enum, with inline docs */ +typedef enum +{ + kToolBarTopLeft = 1,/**< enum the toolbar is at topleft. */ + kToolBarTopRight,/**< enum the toolbar is at topright. */ + kToolBarMidLeft,/**< enum the toolbar is at midleft. */ + kToolBarMidRight,/**< enum the toolbar is at midright. */ + kToolBarBottomLeft,/**< enum the toolbar is at bottomleft. */ + kToolBarBottomRight,/**< enum the toolbar is at bottomright. */ +} ToolBarPlace; + +class ProtocolUser; +/**    + *@class  UserActionListener + *@brief the interface of user callback   + */ +class UserActionListener +{ +public: + /**    + *@brief the interface of user callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolUser* pPlugin, UserActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolUser   + */ +class ProtocolUser : public PluginProtocol +{ +public: + + + /** + @brief User login + */ + virtual void login() = 0 ; + + /** + @brief User login + if the process of logining need to know the param of server_id , + you can use the function + and if you must change oauthloginserver, you can add the param of oauthLoginServer + @param server_id + @param oauthLoginServer + */ + + CC_DEPRECATED_ATTRIBUTE virtual void login(std::string server_id, std::string oauthLoginServer = "") = 0 ; + + /** + @brief User login + if the process of logining need to know the parameters , + you can use the function + @param the parameters + */ + virtual void login(std::map info) = 0 ; + + /** + @brief Check whether the user logined or not + @return If user logined, return value is true; + else return value is false. + */ + virtual bool isLogined() = 0 ; + + /** + @brief Get USER ID + @return If user logined, return value is userID; + else return value is empty string. + */ + virtual std::string getUserID() = 0 ; + /** + @brief set the result listener + @param pListener The callback object for user result + */ + virtual void setActionListener(UserActionListener* listener) = 0 ; + /** + @brief get pListener The callback object for user result + @return the listener + */ + virtual UserActionListener* getActionListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_USER_H__ */ diff --git a/android/armeabi/include/anysdk/Statistics.h b/android/armeabi/include/anysdk/Statistics.h new file mode 100644 index 00000000..bb389ff0 --- /dev/null +++ b/android/armeabi/include/anysdk/Statistics.h @@ -0,0 +1,18 @@ +#ifndef __STATISTICS_H__ +#define __STATISTICS_H__ + +#include +namespace anysdk { namespace framework { + +class Statistics +{ +public: + static void initInfo(); + static void createPlugin(std::string pluginName, int pluginType); + static void callFunction(std::string pluginName, std::string functionName); + +}; + +}} // namespace anysdk { namespace framework { + +#endif //__STATISTICS_H__ diff --git a/android/armeabi/libPluginProtocolStatic.a b/android/armeabi/libPluginProtocolStatic.a new file mode 100644 index 00000000..db674bbe Binary files /dev/null and b/android/armeabi/libPluginProtocolStatic.a differ diff --git a/android/x86/include/anysdk/AgentManager.h b/android/x86/include/anysdk/AgentManager.h new file mode 100644 index 00000000..092a9eaf --- /dev/null +++ b/android/x86/include/anysdk/AgentManager.h @@ -0,0 +1,245 @@ +/** @file AgentManager.h + */ + + +#ifndef __CCX_AGENTMANAGER_H__ +#define __CCX_AGENTMANAGER_H__ + +#include "PluginManager.h" +#include "ProtocolIAP.h" +#include "ProtocolAnalytics.h" +#include "ProtocolShare.h" +#include "ProtocolAds.h" +#include "ProtocolSocial.h" +#include "ProtocolUser.h" +#include "ProtocolPush.h" +#include "ProtocolCrash.h" +#include "ProtocolREC.h" +#include "ProtocolCustom.h" +#include "ProtocolAdTracking.h" +#include +#include +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum { + kPluginAds = 16,/**< enum value is the type of Ads. */ + kPluginAnalytics = 1,/**< enum value is the type of Analytics. */ + kPluginIAP = 8,/**< enum value is the type of IAP. */ + kPluginShare = 2,/**< enum value is the type of Share. */ + kPluginUser = 32,/**< enum value is the type of User. */ + kPluginSocial = 4,/**< enum value is the type of Social. */ + kPluginPush = 64,/**< enum value is the type of Push. */ + kPluginCrash = 128,/**< enum value is the type of Crash. */ + kPluginCustom = 256,/**< enum value is the type of Custom. */ + kPluginREC = 512,/**< enum value is the type of REC. */ + kPluginAdTracking = 1024,/**< enum value is the type of AdTracking. */ +}Plugin_type; +/**    + *  @class  AgentManager   + */ +class AgentManager +{ +public: + virtual ~AgentManager(); + /** + @brief Get singleton of AgentManager + */ + + static AgentManager* getInstance(); + /** + @brief Destory the instance of AgentManager + */ + static void end(); + + /** + @breif the init of AgentManager + @param the appKey of anysdk + @param the appSecret of anysdk + @param the privateKey of anysdk + @param the url of oauthLoginServer + @warning Must invoke this interface before loadAllPlugins + */ + void init(std::string appKey,std::string appSecret,std::string privateKey,std::string oauthLoginServer); + + /** + @brief load the plugins + */ + CC_DEPRECATED_ATTRIBUTE void loadALLPlugin(); + /** + @brief unload the plugins + */ + CC_DEPRECATED_ATTRIBUTE void unloadALLPlugin(); + + /** + @brief load the plugins + */ + void loadAllPlugins(); + + /** + @brief unload the plugins + */ + void unloadAllPlugins(); + + /** + @brief Get Analytics plugin + @return if Analytics plugin exist ,return value is Analytics plugin. + else return value is null pointer. + */ + ProtocolAnalytics* getAnalyticsPlugin(){return _pAnalytics;}; + + /** + @brief Get User plugin + @return if User plugin exist ,return value is User plugin. + else return value is null pointer. + */ + ProtocolUser* getUserPlugin(){return _pUser;}; + + /** + @brief Get IAP plugin + @return if IAP plugin exist ,return value is IAP plugin. + else return value is null pointer. + */ + std::map* getIAPPlugin(){return &_pluginsIAPMap;}; + + /** + @brief Get Share plugin + @return if Share plugin exist ,return value is Share plugin. + else return value is null pointer. + */ + ProtocolShare* getSharePlugin(){return _pShare;}; + + /** + @brief Get Social plugin + @return if Social plugin exist ,return value is Social plugin. + else return value is null pointer. + */ + ProtocolSocial* getSocialPlugin(){return _pSocial;}; + + /** + @brief Get Ads plugin + @return if Ads plugin exist ,return value is Ads plugin. + else return value is null pointer. + */ + ProtocolAds* getAdsPlugin(){return _pAds;}; + + /** + @brief Get Push plugin + @return if Push plugin exist ,return value is Push plugin. + else return value is null pointer. + */ + ProtocolPush* getPushPlugin(){return _pPush;}; + + /** + @brief Get Crash plugin + @return if Crash plugin exist ,return value is Crash plugin. + else return value is null pointer. + */ + ProtocolCrash* getCrashPlugin(){return _pCrash;}; + + /** + @brief Get Custom plugin + @return if Crash plugin exist ,return value is Custom plugin. + else return value is null pointer. + */ + ProtocolCustom* getCustomPlugin(){return _pCustom;}; + + + /** + @brief Get REC plugin + @return if REC plugin exist ,return value is REC plugin. + else return value is null pointer. + */ + ProtocolREC* getRECPlugin(){return _pREC;}; + + /** + @brief Get AdTracking plugin + @return if AdTracking plugin exist ,return value is AdTracking plugin. + else return value is null pointer. + */ + ProtocolAdTracking* getAdTrackingPlugin(){return _pAdTracking;}; + + /** + @brief Get channel ID + @return return value is channel ID. + */ + std::string getChannelId(); + + /** + @brief Get custom param + @return return value is custom param for channel. + */ + std::string getCustomParam(); + + /** + @brief Get framework version + @return return value is the version of AnySDKFramework. + */ + std::string getFrameworkVersion(); + + /** + @Title: setIsAnaylticsEnabled + @Description: choose to open or close + @param @param enabled true or false + @return void + */ + void setIsAnaylticsEnabled(bool value){bIsAnaylticsEnabled = value;}; + /** + @Title: isAnaylticsEnabled + @Description: the status of Anayltics + @param @return true or false + @return boolean + */ + bool isAnaylticsEnabled(){return bIsAnaylticsEnabled;}; + + + void loadPlugin(const char* nodeName,int type); +protected: + void setDebugMode(bool flag); + std::string getSupportPlugin(); + void release(); + + +private: + AgentManager(void); + + // Analytics plugin + ProtocolAnalytics* _pAnalytics; + + // user plugin + ProtocolUser* _pUser; + + // IAP plugins + // ProtocolIAP* _pIAP; + std::map _pluginsIAPMap; + + // Share plugin + ProtocolShare* _pShare; + + // Social plugin + ProtocolSocial* _pSocial; + + // Ads plugin + ProtocolAds* _pAds; + + // Push plugin + ProtocolPush* _pPush; + + // Crash plugin + ProtocolCrash* _pCrash; + + // Custom plugin + ProtocolCustom* _pCustom; + + // REC plugin + ProtocolREC* _pREC; + + // AdTracking plugin + ProtocolAdTracking* _pAdTracking; + + bool bIsAnaylticsEnabled; + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_AGENTMANAGER_H__ */ diff --git a/android/x86/include/anysdk/JSBRelation.h b/android/x86/include/anysdk/JSBRelation.h new file mode 100644 index 00000000..7775b0dc --- /dev/null +++ b/android/x86/include/anysdk/JSBRelation.h @@ -0,0 +1,31 @@ +/** @file JSBRelation.h + */ +#ifndef __CCX_JSBRELATION_H__ +#define __CCX_JSBRELATION_H__ + +#include "PluginProtocol.h" +#include +#include +#include + +using namespace std; + +namespace anysdk { namespace framework { + +/**    + *  @class  JSBRelation   + */ +class JSBRelation +{ +public: + static string getMethodsOfPlugin(PluginProtocol* plugin); + + + + +private: +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_JSBRELATION_H__ */ diff --git a/android/x86/include/anysdk/PluginFactory.h b/android/x86/include/anysdk/PluginFactory.h new file mode 100644 index 00000000..79922c97 --- /dev/null +++ b/android/x86/include/anysdk/PluginFactory.h @@ -0,0 +1,41 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGIN_FACTORY_H__ +#define __CCX_PLUGIN_FACTORY_H__ + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginManager; +/**    + *  @class  PluginFactory   + */ +class PluginFactory +{ +public: + virtual ~PluginFactory(); + /** + @brief Get singleton of PluginFactory + */ + static PluginFactory* getInstance(); + + /** + @brief Destory the instance of PluginFactory + */ + static void purgeFactory(); + +private: + friend class PluginManager; + PluginFactory(void); + + /** + @brief create the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* createPlugin(const char* name, int pluginType); +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_FACTORY_H__ */ diff --git a/android/x86/include/anysdk/PluginJavaData.h b/android/x86/include/anysdk/PluginJavaData.h new file mode 100644 index 00000000..bd37b745 --- /dev/null +++ b/android/x86/include/anysdk/PluginJavaData.h @@ -0,0 +1,17 @@ +#ifndef __PLUGIN_JAVA_DATA_H__ +#define __PLUGIN_JAVA_DATA_H__ + +#include +#include + +namespace anysdk { namespace framework { + +typedef struct _PluginJavaData_ +{ + jobject jobj; + std::string jclassName; +} PluginJavaData; + +}} //namespace anysdk { namespace framework { + +#endif // __PLUGIN_JAVA_DATA_H__ diff --git a/android/x86/include/anysdk/PluginJniHelper.h b/android/x86/include/anysdk/PluginJniHelper.h new file mode 100644 index 00000000..82981907 --- /dev/null +++ b/android/x86/include/anysdk/PluginJniHelper.h @@ -0,0 +1,43 @@ +#ifndef __PLUGIN_JNI_HELPER_H__ +#define __PLUGIN_JNI_HELPER_H__ + +#include +#include + +namespace anysdk {namespace framework{ + +typedef struct PluginJniMethodInfo_ +{ + JNIEnv * env; + jclass classID; + jmethodID methodID; +} PluginJniMethodInfo; + +class PluginJniHelper +{ +public: + static JavaVM* getJavaVM(); + static void setJavaVM(JavaVM *javaVM); + static JNIEnv* getEnv(); + + static bool getStaticMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static bool getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static std::string jstring2string(jstring jstr); + static jstring newStringUTF(JNIEnv* env, const std::string& utf8Str); + + static bool setClassLoaderFrom(jobject nativeActivityInstance); + + static jmethodID loadclassMethod_methodID; + static jobject classloader; + +private: + static JavaVM *_psJavaVM; + static bool getMethodInfo_DefaultClassLoader(PluginJniMethodInfo &methodinfo, + const char *className, + const char *methodName, + const char *paramCode); +}; + +}} + +#endif // __PLUGIN_JNI_HELPER_H__ diff --git a/android/x86/include/anysdk/PluginJniMacros.h b/android/x86/include/anysdk/PluginJniMacros.h new file mode 100644 index 00000000..eace0d9a --- /dev/null +++ b/android/x86/include/anysdk/PluginJniMacros.h @@ -0,0 +1,156 @@ +#ifndef __PLUGIN_JNI_MACROS_H__ +#define __PLUGIN_JNI_MACROS_H__ + +#define return_if_fails(cond) if (!(cond)) return; +#define return_val_if_fails(cond, ret) if(!(cond)) return (ret); + +#define CALL_BASERET_JAVA_FUNC_WITH_PARAM(retType, paramCode, param, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID, param); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_BASERET_JAVA_FUNC(retType, paramCode, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID); \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_JAVA_FUNC_WITH_VALIST(retCode) \ +std::vector allParams; \ +if (NULL != param) \ +{ \ + allParams.push_back(param); \ + \ + va_list argp; \ + PluginParam* pArg = NULL; \ + va_start( argp, param ); \ + while (1) \ + { \ + pArg = va_arg(argp, PluginParam*); \ + if (pArg == NULL) \ + break; \ + \ + allParams.push_back(pArg); \ + } \ + va_end(argp); \ +} \ + \ +return call##retCode##FuncWithParam(funcName, allParams); \ + + +#define CALL_JAVA_FUNC(retType, retCode, defaultRet, jRetCode) \ +retType ret = defaultRet; \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(this); \ +if (NULL == pData) { \ + PluginUtils::outputLog(ANDROID_LOG_ERROR, "PluginProtocol", "Can't find java data for plugin : %s", this->getPluginName()); \ + return ret; \ +} \ + \ +std::string paramCode; \ +int nParamNum = params.size(); \ +if (0 == nParamNum) \ +{ \ + paramCode = "()"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName(this, funcName); \ +} else \ +{ \ + PluginParam* pRetParam = NULL; \ + bool needDel = false; \ + if (nParamNum == 1) { \ + pRetParam = params[0]; \ + } else { \ + std::map allParams; \ + for (int i = 0; i < nParamNum; i++) \ + { \ + PluginParam* pArg = params[i]; \ + if (pArg == NULL) \ + { \ + break; \ + } \ + \ + char strKey[8] = { 0 }; \ + sprintf(strKey, "Param%d", i + 1); \ + allParams[strKey] = pArg; \ + } \ + \ + pRetParam = new PluginParam(allParams); \ + needDel = true; \ + } \ + \ + switch(pRetParam->getCurrentType()) \ + { \ + case PluginParam::kParamTypeInt: \ + paramCode = "(I)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getIntValue()); \ + break; \ + case PluginParam::kParamTypeFloat: \ + paramCode = "(F)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getFloatValue()); \ + break; \ + case PluginParam::kParamTypeBool: \ + paramCode = "(Z)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getBoolValue()); \ + break; \ + case PluginParam::kParamTypeString: \ + { \ + jstring jstr = PluginJniHelper::newStringUTF(PluginUtils::getEnv(), pRetParam->getStringValue()); \ + paramCode = "(Ljava/lang/String;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jstr); \ + PluginUtils::getEnv()->DeleteLocalRef(jstr); \ + } \ + break; \ + case PluginParam::kParamTypeStringMap: \ + case PluginParam::kParamTypeMap: \ + { \ + jobject jMap = PluginUtils::getJObjFromParam(pRetParam); \ + paramCode = "(Lorg/json/JSONObject;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jMap); \ + PluginUtils::getEnv()->DeleteLocalRef(jMap); \ + } \ + break; \ + default: \ + break; \ + } \ + \ + if (needDel && pRetParam != NULL) \ + { \ + delete pRetParam; \ + pRetParam = NULL; \ + } \ +} \ +return ret; \ + + +#endif // __PLUGIN_JNI_MACROS_H__ diff --git a/android/x86/include/anysdk/PluginManager.h b/android/x86/include/anysdk/PluginManager.h new file mode 100644 index 00000000..93282ae7 --- /dev/null +++ b/android/x86/include/anysdk/PluginManager.h @@ -0,0 +1,51 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGINMANAGER_H__ +#define __CCX_PLUGINMANAGER_H__ + +#include "PluginProtocol.h" +#include "PluginFactory.h" +#include +#include + +namespace anysdk { namespace framework { + +/**    + *  @class  PluginManager   + */ +class PluginManager +{ +public: + virtual ~PluginManager(); + /** + @brief Get singleton of PluginManager + */ + static PluginManager* getInstance(); + /** + @brief Destory the instance of PluginManager + */ + static void end(); + + /** + @brief load the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* loadPlugin(const char* name, int pluginType); + /** + @brief unload the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + void unloadPlugin(const char* name, int pluginType = 0); + + +private: + PluginManager(void); + std::map _pluginsMap; +// bool _isDebug; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGINMANAGER_H__ */ diff --git a/android/x86/include/anysdk/PluginParam.h b/android/x86/include/anysdk/PluginParam.h new file mode 100644 index 00000000..1f35d4a7 --- /dev/null +++ b/android/x86/include/anysdk/PluginParam.h @@ -0,0 +1,126 @@ +/** @file PluginParam.h + */ +#ifndef __CCX_PLUGIN_PARAM_H__ +#define __CCX_PLUGIN_PARAM_H__ + +#include +#include +/// \typedef std::map StringMap +/// typedef YString. +typedef std::map StringMap; + +namespace anysdk { namespace framework { + +class PluginProtocol; +/**    + *  @class  PluginParam   + */ +class PluginParam +{ +public: + /** + @brief the default constructor of PluginParam + */ + PluginParam(); + + virtual ~PluginParam(); + /** + @brief the constructor of PluginParam + @param the value is Integer + */ + PluginParam(int nValue); + /** + @brief the constructor of PluginParam + @param the value is float + */ + PluginParam(float fValue); + /** + @brief the constructor of PluginParam + @param the value is boolean + */ + PluginParam(bool bValue); + /** + @brief the default constructor of PluginParam + @param the value is char + */ + PluginParam(const char* strValue); + /** + @brief the default constructor of PluginParam + @param the value is StringMap + */ + PluginParam(StringMap strMapValue); + + typedef enum{ + kParamTypeNull = 0, + kParamTypeInt, + kParamTypeFloat, + kParamTypeBool, + kParamTypeString, + kParamTypeStringMap, + kParamTypeMap, + } ParamType; + /** + @brief get the ParamType of value + */ + inline ParamType getCurrentType() { + return _type; + } + /** + @brief get the int value + */ + inline int getIntValue() { + return _intValue; + } + /** + @brief get the float value + */ + inline float getFloatValue() { + return _floatValue; + } + /** + @brief get the boolean value + */ + inline bool getBoolValue() { + return _boolValue; + } + /** + @brief get the char value + */ + inline const char* getStringValue() { + return _strValue.c_str(); + } + /** + @brief get the map of value + */ + inline std::map getMapValue() { + return _mapValue; + } + /** + @brief get the StringMap value + */ + inline StringMap getStrMapValue() { + return _strMapValue; + } + +private: + friend class PluginProtocol; + /** + @brief the constructor of PluginParam + @param the map of value + */ + PluginParam(std::map mapValue); + +private: + ParamType _type; + + int _intValue; + float _floatValue; + bool _boolValue; + std::string _strValue; + std::map _mapValue; + StringMap _strMapValue; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_PARAM_H__ */ diff --git a/android/x86/include/anysdk/PluginProtocol.h b/android/x86/include/anysdk/PluginProtocol.h new file mode 100644 index 00000000..95cf706d --- /dev/null +++ b/android/x86/include/anysdk/PluginProtocol.h @@ -0,0 +1,144 @@ +/** @file PluginProtocol.h + */ +#ifndef __CCX_IPLUGIN_H__ +#define __CCX_IPLUGIN_H__ + +#include "PluginParam.h" +#include + +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#elif _MSC_VER >= 1400 //vs 2005 or higher +#define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated) +#else +#define CC_DEPRECATED_ATTRIBUTE +#endif + +namespace anysdk { namespace framework { + +/** + * @class PluginProtocol + * @brief The super class for all plugins. + */ +class PluginProtocol +{ +public: + virtual ~PluginProtocol() {}; + + /** + *@brief set plugin name + *@param the name of plugin + */ + virtual void setPluginName(const char* name) = 0 ; + /** + *@brief get plugin name + *@return the name of plugin + */ + virtual const char* getPluginName() = 0 ; + + /** + *@brief get the version of plugin + *@return the version of plugin + */ + virtual std::string getPluginVersion(); + /** + *@brief get the version of sdk + *@return the version of sdk + */ + virtual std::string getSDKVersion(); + + /** + *@brief switch debug plug-in on/off + *@param the value of on/off + */ + CC_DEPRECATED_ATTRIBUTE virtual void setDebugMode(bool bDebug); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return void + */ + virtual void callFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return void + */ + virtual void callFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, std::vector params); + + /** + @brief Check function the plugin support or not + @param the name of plugin + @return if the function support ,return true + else retur false + */ + virtual bool isFunctionSupported(std::string functionName); + + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_IPLUGIN_H__ */ diff --git a/android/x86/include/anysdk/PluginUtils.h b/android/x86/include/anysdk/PluginUtils.h new file mode 100644 index 00000000..3742c161 --- /dev/null +++ b/android/x86/include/anysdk/PluginUtils.h @@ -0,0 +1,157 @@ +#ifndef __PLUGIN_UTILS_H__ +#define __PLUGIN_UTILS_H__ + +#include "PluginJniHelper.h" +#include "PluginJavaData.h" +#include +#include +#include "PluginParam.h" +#include "PluginJniMacros.h" +#include +//#include + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginUtils +{ +public: +//cjh static void initPluginWrapper(android_app* app); + static jobject createJavaMapObject(std::map* paramMap); + static jobject createJavaListObject(std::list* paramList); + static void initJavaPlugin(PluginProtocol* pPlugin, jobject jObj, const char* className, int type); + static JNIEnv* getEnv(); + + static PluginJavaData* getPluginJavaData(PluginProtocol* pKeyObj); + static void setPluginJavaData(PluginProtocol* pKeyObj, PluginJavaData* pData, int type); + static void erasePluginJavaData(PluginProtocol* pKeyObj,int type); + static void erasePluginJavaData(std::string key); + + static PluginProtocol* getPluginPtr(std::string className); + + static jobject getJObjFromParam(PluginParam* param); + + // methods have no return value + template + static void callJavaFunctionWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + return_if_fails(paramCode != NULL && strlen(paramCode) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + t.env->CallVoidMethod(pData->jobj, t.methodID, param); + t.env->DeleteLocalRef(t.classID); + } + } + static void callJavaFunctionWithName(PluginProtocol* thiz, const char* funcName) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()V")) + { + t.env->CallVoidMethod(pData->jobj, t.methodID); + t.env->DeleteLocalRef(t.classID); + } + } + + // methods return value is string + template + static std::string callJavaStringFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + jstring strRet = (jstring)t.env->CallObjectMethod(pData->jobj, t.methodID, param); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + static std::string callJavaStringFuncWithName(PluginProtocol* thiz, const char* funcName) + { + std::string ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "()Ljava/lang/String;")) + { + jstring strRet = (jstring) t.env->CallObjectMethod(pData->jobj, t.methodID); + ret = PluginJniHelper::jstring2string(strRet); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + + // methods return value is int + template + static int callJavaIntFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(int, paramCode, param, Int, 0) + } + static int callJavaIntFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(int, "()I", Int, 0) + } + + // methods return value is float + template + static float callJavaFloatFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(float, paramCode, param, Float, 0.0f) + } + static float callJavaFloatFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(float, "()F", Float, 0.0f); + } + + // methods return value is bool + template + static bool callJavaBoolFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(bool, paramCode, param, Boolean, false) + } + static bool callJavaBoolFuncWithName(PluginProtocol* thiz, const char* funcName) + { + CALL_BASERET_JAVA_FUNC(bool, "()Z", Boolean, false) + } + + static void callJavaFunctionWithName_string_map(PluginProtocol* thiz, const char* funcName, const char* keyParam, std::map* paramMap); + + static void outputLog(int type, const char* logTag, const char* pFormat, ...); + static void output(int type, const char* logTag, const char* contents); + + static void resetLogLevel(); +private: + static std::string _logLevel; +}; + +}} // namespace anysdk { namespace framework { + +#endif //__PLUGIN_UTILS_H__ diff --git a/android/x86/include/anysdk/ProtocolAdTracking.h b/android/x86/include/anysdk/ProtocolAdTracking.h new file mode 100644 index 00000000..6fc557a2 --- /dev/null +++ b/android/x86/include/anysdk/ProtocolAdTracking.h @@ -0,0 +1,58 @@ +/** @file ProtocolAdTracking.h + */ +#ifndef __CCX_PROTOCOL_ADTRACKING_H__ +#define __CCX_PROTOCOL_ADTRACKING_H__ + +#include "PluginProtocol.h" +#include +namespace anysdk { namespace framework { +/**    + *@class  ProtocolAdTracking + *@brief the interface of AdTracking   + */ +class ProtocolAdTracking : public PluginProtocol +{ +public: + + /** + * + * @Title: onRegister + * @Description: Call this method if you want to track register events as happening during a section. + * @param userId user identifier + * @return void + */ + virtual void onRegister(const char* userId) = 0; + + /** + * + * @Title: onLogin + * @Description:Call this method if you want to track login events as happening during a section. + * @param userInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onLogin(std::map userInfo) = 0; + + /** + * + * @Title: onPay + * @Description: Call this method if you want to track pay events as happening during a section. + * @param productInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onPay(std::map productInfo) = 0; + + /** + * + * @Title: trackEvent + * @Description: Call this method if you want to track custom events with parameters as happening during a section. + * @param eventId The custom event name. + * @param paramMap The details of this parameters are already covered by document. + */ + virtual void trackEvent(const char* eventId, std::map* paramMap = NULL) = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_ADTRACKING_H__ ----- */ diff --git a/android/x86/include/anysdk/ProtocolAds.h b/android/x86/include/anysdk/ProtocolAds.h new file mode 100644 index 00000000..8e29987f --- /dev/null +++ b/android/x86/include/anysdk/ProtocolAds.h @@ -0,0 +1,133 @@ +/** @file ProtocolAds.h + */ +#ifndef __CCX_PROTOCOL_ADS_H__ +#define __CCX_PROTOCOL_ADS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TAdsDeveloperInfo +/// typedef TAdsDeveloperInfo. +typedef std::map TAdsDeveloperInfo; +/// \typedef std::map TAdsInfo +/// typedef TAdsInfo. +typedef std::map TAdsInfo; +/** @brief AdsResultCode enum, with inline docs */ +typedef enum +{ + kAdsReceived = 0, /**< enum the callback: the ad is received is at center. */ + + kAdsShown, /**< enum the callback: the advertisement dismissed. */ + kAdsDismissed, /**< enum the callback: the advertisement dismissed. */ + + kPointsSpendSucceed, /**< enum the callback: the points spend succeed. */ + kPointsSpendFailed, /**< enum the callback: the points spend failed. */ + + kNetworkError, /**< enum the callback of Network error at center. */ + kUnknownError, /**< enum the callback of Unknown error. */ + kOfferWallOnPointsChanged, /**< enum the callback of Changing the point of offerwall. */ + kRewardedVideoWithReward,/**< enum the callback of receiving the reward of rewardedvideo. */ + kInAppPurchaseFinished,/**< enum the callback of finishing IAP ad. */ + kAdsClicked,/**< enum the callback of the advertisement clicked. */ + kAdsExtension = 40000 /**< enum value is extension code . */ +} AdsResultCode; +/** @brief AdsPos enum, with inline docs */ +typedef enum { + kPosCenter = 0,/**< enum the toolbar is at center. */ + kPosTop,/**< enum the toolbar is at top. */ + kPosTopLeft,/**< enum the toolbar is at topleft. */ + kPosTopRight,/**< enum the toolbar is at topright. */ + kPosBottom,/**< enum the toolbar is at bottom. */ + kPosBottomLeft,/**< enum the toolbar is at bottomleft. */ + kPosBottomRight,/**< enum the toolbar is at bottomright. */ +} AdsPos; +/** @brief AdsType enum, with inline docs */ +typedef enum { + AD_TYPE_BANNER = 0,/**< enum value is banner ads . */ + AD_TYPE_FULLSCREEN,/**< enum value is fullscreen ads . */ + AD_TYPE_MOREAPP,/**< enum value is moreapp ads . */ + AD_TYPE_OFFERWALL,/**< enum value is offerwall ads . */ + AD_TYPE_REWARDEDVIDEO,/**< enum value is rewarded video ads . */ + AD_TYPE_NATIVEEXPRESS,/**< enum value is Native express ads . */ + AD_TYPE_NATIVEADVANCED,/**< enum value is Native advanced ads . */ +} AdsType; + +class ProtocolAds; +class AdsListener +{ +public: + /** + *@brief The advertisement request result + *@param the id of callback + *@param the information of callback + */ + virtual void onAdsResult(AdsResultCode code, const char* msg) = 0; +}; + +class ProtocolAds : public PluginProtocol +{ +public: + + + + /** + @brief show adview + @param the type of ads + @param the idx of ads + */ + virtual void showAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief Hide the adview + @param the type of ads + @param the idx of ads + */ + virtual void hideAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief preload the adview + @param the type of ads + @param the idx of ads + */ + virtual void preloadAds(AdsType adsType, int idx = 1)= 0; + + /** + *@brief Query the points of player + *@return the point + */ + virtual float queryPoints() = 0; + + /** + *@brief Spend the points. + Use this method to notify server spend points. + *@param points Need spend number of points + */ + virtual void spendPoints(int points) = 0; + + /** + @brief set the Ads listener + @param pListener The callback object for Ads result + */ + virtual void setAdsListener(AdsListener* listener) = 0; + + /** + @brief get pListener The callback object for Ads result + @return the listener + */ + virtual AdsListener* getAdsListener() = 0; + + /** + @brief Is it supportive of this type of ads + @param the type of ads + @return if it is supportive ,return true + else retur false + */ + virtual bool isAdTypeSupported(AdsType adType) = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_ADS_H__ */ diff --git a/android/x86/include/anysdk/ProtocolAnalytics.h b/android/x86/include/anysdk/ProtocolAnalytics.h new file mode 100644 index 00000000..ce3372d6 --- /dev/null +++ b/android/x86/include/anysdk/ProtocolAnalytics.h @@ -0,0 +1,107 @@ +/** @file ProtocolAnalytics.h + */ +#ifndef __CCX_PROTOCOL_ANALYTICS_H__ +#define __CCX_PROTOCOL_ANALYTICS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map LogEventParamPair +/// typedef LogEventParamPair. +typedef std::pair< std::string, std::string > LogEventParamPair; +/// \typedef std::map LogEventParamMap +/// typedef LogEventParamMap. +typedef std::map< std::string, std::string > LogEventParamMap; +typedef enum { + ANONYMOUS,/**< enum value is anonymous typek. */ + REGISTED,/**< enum value is registed type. */ + SINA_WEIBO,/**< enum value is sineweibo type. */ + TENCENT_WEIBO,/**< enum value is tecentweibo type */ + QQ,/**< enum value is qq type */ + ND91,/**< enum value is nd91 type. */ +} AccountType; +typedef enum { + LOGIN,/**< enum value is the login operate. */ + LOGOUT,/**< enum value is the logout operate. */ + REGISTER,/**< enum value is the register operate. */ +} AccountOperate; +typedef enum { + MALE,/**< enum value is male. */ + FEMALE,/**< enum value is female. */ + UNKNOWN,/**< enum value is unknow. */ + +} AccountGender; +typedef enum { + GUIDE_LINE,/**< enum value is the guideline type.. */ + MAIN_LINE,/**< enum value is the mainline type.. */ + BRANCH_LINE,/** +#include + +namespace anysdk { namespace framework { + +class ProtocolCrash : public PluginProtocol +{ +public: + /** + * set user identifier + * + * @param userInfo + */ + virtual void setUserIdentifier(const char* identifier) = 0; + + /** + * The uploader captured in exception information + * + * @param message Set the custom information + * @param exception The exception + */ + virtual void reportException(const char* message, const char* exception) = 0; + + /** + * customize logging + * + * @param string Custom log + */ + virtual void leaveBreadcrumb(const char* breadcrumb) = 0; + + + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_CRASH_H__ */ diff --git a/android/x86/include/anysdk/ProtocolCustom.h b/android/x86/include/anysdk/ProtocolCustom.h new file mode 100644 index 00000000..dc92558e --- /dev/null +++ b/android/x86/include/anysdk/ProtocolCustom.h @@ -0,0 +1,50 @@ +/** @file ProtocolCustom.h + */ +#ifndef __CCX_PROTOCOL_CUSTOM_H__ +#define __CCX_PROTOCOL_CUSTOM_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +typedef enum +{ + kCustomExtension = 80000 /**< enum value is extension code . */ +} CustomResultCode; +/**    + *@class  CustomResultListener + *@brief the interface of share callback   + */ +class CustomResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onCustomResult(CustomResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolCustom + *@brief the interface of custom   + */ +class ProtocolCustom : public PluginProtocol +{ +public: + + /** + @breif set the result listener + @param pListener The callback object for custom result + @wraning Must invoke this interface before custom + */ + virtual void setResultListener(CustomResultListener* pListener) = 0; + + virtual CustomResultListener* getCustomListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_Custom_H__ ----- */ diff --git a/android/x86/include/anysdk/ProtocolIAP.h b/android/x86/include/anysdk/ProtocolIAP.h new file mode 100644 index 00000000..4a875b32 --- /dev/null +++ b/android/x86/include/anysdk/ProtocolIAP.h @@ -0,0 +1,119 @@ +/** @file ProtocolIAP.h + */ +#ifndef __CCX_PROTOCOL_IAP_H__ +#define __CCX_PROTOCOL_IAP_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TIAPDeveloperInfo +/// typedef TIAPDeveloperInfo. +typedef std::map TIAPDeveloperInfo; +/// \typedef std::map TProductInfo +/// typedef TProductInfo. +typedef std::map TProductInfo; +/// typedef TProductsInfo. +typedef std::map AllProductsInfo; +/** @brief PayResultCode enum, with inline docs */ +typedef enum +{ + kPaySuccess = 0,/**< enum value is callback of succeeding in paying . */ + kPayFail,/**< enum value is callback of failing to pay . */ + kPayCancel,/**< enum value is callback of canceling to pay . */ + kPayNetworkError,/**< enum value is callback of network error . */ + kPayProductionInforIncomplete,/**< enum value is callback of incompleting info . */ + kPayInitSuccess,/**< enum value is callback of succeeding in initing sdk . */ + kPayInitFail,/**< enum value is callback of failing to init sdk . */ + kPayNowPaying,/**< enum value is callback of paying now . */ + kPayRechargeSuccess,/**< enum value is callback of succeeding in recharging. */ + kPayExtension = 30000 /**< enum value is extension code . */ +} PayResultCode; +/** @brief RequestResultCode enum, with inline docs */ +typedef enum +{ + kRequestSuccess = 31000,/**< enum value is callback of succeeding in paying . */ + kRequestFail/**< enum value is callback of failing to pay . */ +} RequestResultCode; +/**    + *@class  PayResultListener + *@brief the interface of pay callback   + */ +class PayResultListener +{ +public: + /**    + *@brief the interface of pay callback  + *@param the id of callback + *@param the information of callback + *@param the info of pay + */ + virtual void onPayResult(PayResultCode ret, const char* msg, TProductInfo info) = 0; + /** + *@brief the interface of request callback + *@param the id of callback + *@param the information of callback + *@param the info of request product + */ + virtual void onRequestResult(RequestResultCode ret, const char* msg, AllProductsInfo info) {} +}; +/**    + *@class  ProtocolIAP + *@brief the interface of pay    + */ + +class ProtocolIAP : public PluginProtocol +{ +public: + + /** + @brief pay for product + @param info The info of product, must contains key: + productName The name of product + productPrice The price of product(must can be parse to float) + productDesc The description of product + @warning For different plugin, the parameter should have other keys to pay. + Look at the manual of plugins. + */ + virtual void payForProduct(TProductInfo info) = 0; + /** + @brief get order id + @return the order id + */ + virtual std::string getOrderId() = 0; + + /** + @breif set the result listener + @param pListener The callback object for pay result + @wraning Must invoke this interface before payForProduct. + */ + virtual void setResultListener(PayResultListener* pListener) = 0; + + virtual PayResultListener* getPayListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + /** + @brief change the state of paying + @param the state + */ + + static void resetPayState() + { + _paying = false; + } + static bool _paying; + + + +}; + + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_IAP_H__ */ diff --git a/android/x86/include/anysdk/ProtocolPush.h b/android/x86/include/anysdk/ProtocolPush.h new file mode 100644 index 00000000..e9e2fac8 --- /dev/null +++ b/android/x86/include/anysdk/ProtocolPush.h @@ -0,0 +1,104 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PROTOCOL_PUSH_H__ +#define __CCX_PROTOCOL_PUSH_H__ + +#include "PluginProtocol.h" +#include +#include +#include +using namespace std; + +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kPushReceiveMessage = 0,/**value is callback of Receiving Message . */ + kPushExtensionCode = 60000 /**< enum value is extension code . */ + + +} PushActionResultCode; +class ProtocolPush; +/**    + *@class  PushActionListener + *@brief the interface of Push callback   + */ +class PushActionListener +{ +public: + /**    + *@brief the interface of Push callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolPush   + */ +class ProtocolPush : public PluginProtocol +{ +public: + + + /** + *@brief start/register Push services + *@return void + */ + virtual void startPush() = 0 ; + + + /** + *@brief close Push services + *@return void + */ + virtual void closePush() = 0 ; + + + /** + *@brief set alias + *@param tags + *@return void + */ + virtual void setAlias(string alias) = 0; + + /** + *@brief del alias + *@param tags + *@return void + */ + virtual void delAlias(string alias) = 0; + + /** + *@brief set tag + *@param tags + *@return void + */ + virtual void setTags(list tags) = 0; + + /** + *@brief delete tag + *@param tags + *@return void + */ + virtual void delTags(list tags) = 0; + + /** + @brief set the result listener + @param pListener The callback object for push result + */ + virtual void setActionListener(PushActionListener* listener) = 0 ; + + /** + @brief get pListener The callback object for Push result + @return the listener + */ + virtual PushActionListener* getActionListener() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_PUSH_H__ */ diff --git a/android/x86/include/anysdk/ProtocolREC.h b/android/x86/include/anysdk/ProtocolREC.h new file mode 100644 index 00000000..b0db2c0d --- /dev/null +++ b/android/x86/include/anysdk/ProtocolREC.h @@ -0,0 +1,83 @@ +/** @file ProtocolREC.h + */ +#ifndef __CCX_PROTOCOL_REC_H__ +#define __CCX_PROTOCOL_REC_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { + +typedef std::map TVideoInfo; + +/** @brief RECResultCode enum, with inline docs */ +typedef enum +{ + kRECInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk . */ + kRECInitFail,/**< enum value is callback of failing to init sdk. */ + kRECStartRecording,/**< enum value is callback of starting to record. */ + kRECStopRecording,/**< enum value is callback of stoping to record. */ + kRECPauseRecording,/**< enum value is callback of pausing to record. */ + kRECResumeRecording,/**< enum value is callback of resuming to record. */ + kRECEnterSDKPage,/**< enum value is callback of entering SDK`s page. */ + kRECQuitSDKPage,/**< enum value is callback of quiting SDK`s page. */ + kRECShareSuccess,/**< enum value is callback of succeeding in sharing. */ + kRECShareFail,/**< enum value is callback of failing to share. */ + kRECExtension = 90000 /**< enum value is extension code . */ +} RECResultCode; +/**    + *@class  RECResultListener + *@brief the interface of REC callback   + */ +class RECResultListener +{ +public: + /**    + *@brief the interface of REC callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onRECResult(RECResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolREC + *@brief the interface of REC   + */ +class ProtocolREC : public PluginProtocol +{ +public: + + /** + * @Description: Start to record video + */ + virtual void startRecording() = 0; + + /** + * @Description: Stop to record video + */ + virtual void stopRecording() = 0; + + /** + * @Description: share video + * @Param info The info of share + */ + virtual void share(TVideoInfo info) = 0; + + + + /** + @breif set the result listener + @param pListener The callback object for REC result + @wraning Must invoke this interface before REC + */ + virtual void setResultListener(RECResultListener* pListener) = 0; + + virtual RECResultListener* getRECListener() = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/x86/include/anysdk/ProtocolShare.h b/android/x86/include/anysdk/ProtocolShare.h new file mode 100644 index 00000000..2215a4ff --- /dev/null +++ b/android/x86/include/anysdk/ProtocolShare.h @@ -0,0 +1,72 @@ +/** @file ProtocolShare.h + */ +#ifndef __CCX_PROTOCOL_SHARE_H__ +#define __CCX_PROTOCOL_SHARE_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TShareDeveloperInfo +/// typedef TShareDeveloperInfo. +typedef std::map TShareDeveloperInfo; +/// \typedef std::map TShareInfo +/// typedef TShareInfo. +typedef std::map TShareInfo; +/** @brief ShareResultCode enum, with inline docs */ +typedef enum +{ + kShareSuccess = 0,/**< enum value is callback of failing to sharing . */ + kShareFail,/**< enum value is callback of failing to share . */ + kShareCancel,/**< enum value is callback of canceling to share . */ + kShareNetworkError,/**< enum value is callback of network error . */ + kShareExtension = 10000 /**< enum value is extension code . */ +} ShareResultCode; +/**    + *@class  ShareResultListener + *@brief the interface of share callback   + */ +class ShareResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onShareResult(ShareResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolShare + *@brief the interface of share   + */ +class ProtocolShare : public PluginProtocol +{ +public: + + + + /** + @brief share information + @param info The info of share, contains key: + SharedText The text need to share + SharedImagePath The full path of image file need to share (optinal) + @warning For different plugin, the parameter should have other keys to share. + Look at the manual of plugins. */ + virtual void share(TShareInfo info) = 0; + + /** + @breif set the result listener + @param pListener The callback object for share result + @wraning Must invoke this interface before share + */ + virtual void setResultListener(ShareResultListener* pListener) = 0; + + virtual ShareResultListener* getShareListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/android/x86/include/anysdk/ProtocolSocial.h b/android/x86/include/anysdk/ProtocolSocial.h new file mode 100644 index 00000000..3fa5639b --- /dev/null +++ b/android/x86/include/anysdk/ProtocolSocial.h @@ -0,0 +1,105 @@ +/** @file ProtocolSocial.h + */ +#ifndef __CCX_PROTOCOL_SOCIAL_H__ +#define __CCX_PROTOCOL_SOCIAL_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TSocialDeveloperInfo +/// typedef TSocialDeveloperInfo. +typedef std::map TSocialDeveloperInfo; +/// \typedef std::map TAchievementInfo +/// typedef TAchievementInfo. +typedef std::map TAchievementInfo; +/** @brief SocialRetCode enum, with inline docs */ +typedef enum +{ + // code for leaderboard feature + kScoreSubmitSucceed =1,/**< enum value is callback of succeeding in submiting. */ + kScoreSubmitfail,/**< enum value is callback of failing to submit . */ + + // code for achievement feature + kAchUnlockSucceed,/**< enum value is callback of succeeding in unlocking. */ + kAchUnlockFail,/**< enum value is callback of failing to unlock. */ + + kSocialSignInSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignInFail,/**< enum value is callback of failing to login. */ + + kSocialSignOutSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignOutFail,/**< enum value is callback of failing to login. */ + kSocialGetGameFriends,/**< enum value is callback of getGameFriends. */ + kSocialExtensionCode = 20000 /**< enum value is extension code . */ + +} SocialRetCode; +/**    + *@class  SocialListener + *@brief the interface of social callback   + */ +class SocialListener +{ +public: + /**    + *@brief the interface of social callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onSocialResult(SocialRetCode code, const char* msg) = 0; +}; + +/**    + *@class  ProtocolSocial + *@brief the interface of social   + */ +class ProtocolSocial : public PluginProtocol +{ +public: + + /** + @brief user signIn + */ + virtual void signIn() = 0; + + /** + @brief user signOut + */ + virtual void signOut() = 0; + + /** + @brief submit the score + @param leaderboardID + @param the score + */ + virtual void submitScore(const char* leadboardID, long score) = 0; + /** + @brief show the id of Leaderboard page + @param leaderboardID + */ + virtual void showLeaderboard(const char* leaderboardID) = 0; + + /** + @brief methods of achievement feature + @param the info of achievement + */ + virtual void unlockAchievement(TAchievementInfo achInfo) = 0; + /** + @brief show the page of achievements + */ + virtual void showAchievements() = 0; + /** + @brief set pListener The callback object for social result + @param the listener + */ + virtual void setListener(SocialListener* listener) = 0; + /** + @brief get pListener The callback object for social result + @return the listener + */ + virtual SocialListener* getListener() = 0; +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SOCIAL_H__ ----- */ diff --git a/android/x86/include/anysdk/ProtocolUser.h b/android/x86/include/anysdk/ProtocolUser.h new file mode 100644 index 00000000..14752215 --- /dev/null +++ b/android/x86/include/anysdk/ProtocolUser.h @@ -0,0 +1,134 @@ +/** @file ProtocolUser.h + */ +#ifndef __CCX_PROTOCOL_USER_H__ +#define __CCX_PROTOCOL_USER_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TUserDeveloperInfo +/// typedef TUserDeveloperInfo. +typedef std::map TUserDeveloperInfo; +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk. */ + kInitFail,/**< enum value is callback of failing to init sdk. */ + kLoginSuccess,/**< enum value is callback of succeeding in login.*/ + kLoginNetworkError,/**< enum value is callback of network error*/ + kLoginNoNeed,/**< enum value is callback of no need login.*/ + kLoginFail,/**< enum value is callback of failing to login. */ + kLoginCancel,/**< enum value is callback of canceling to login. */ + kLogoutSuccess,/**< enum value is callback of succeeding in logout. */ + kLogoutFail,/**< enum value is callback of failing to logout. */ + kPlatformEnter,/**< enum value is callback after enter platform. */ + kPlatformBack,/**< enum value is callback after exit antiAddiction. */ + kPausePage,/**< enum value is callback after exit pause page. */ + kExitPage,/**< enum value is callback after exit exit page. */ + kAntiAddictionQuery,/**< enum value is callback after querying antiAddiction. */ + kRealNameRegister,/**< enum value is callback after registering realname. */ + kAccountSwitchSuccess,/**< enum value is callback of succeeding in switching account. */ + kAccountSwitchFail,/**< enum value is callback of failing to switch account. */ + kOpenShop,/**< enum value is callback of open the shop. */ + kAccountSwitchCancel,/**< enum value is callback of canceling to switch account. */ + kUserExtension = 50000 /**< enum value is extension code . */ + + +} UserActionResultCode; +/** @brief ToolBarPlace enum, with inline docs */ +typedef enum +{ + kToolBarTopLeft = 1,/**< enum the toolbar is at topleft. */ + kToolBarTopRight,/**< enum the toolbar is at topright. */ + kToolBarMidLeft,/**< enum the toolbar is at midleft. */ + kToolBarMidRight,/**< enum the toolbar is at midright. */ + kToolBarBottomLeft,/**< enum the toolbar is at bottomleft. */ + kToolBarBottomRight,/**< enum the toolbar is at bottomright. */ +} ToolBarPlace; + +class ProtocolUser; +/**    + *@class  UserActionListener + *@brief the interface of user callback   + */ +class UserActionListener +{ +public: + /**    + *@brief the interface of user callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolUser* pPlugin, UserActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolUser   + */ +class ProtocolUser : public PluginProtocol +{ +public: + + + /** + @brief User login + */ + virtual void login() = 0 ; + + /** + @brief User login + if the process of logining need to know the param of server_id , + you can use the function + and if you must change oauthloginserver, you can add the param of oauthLoginServer + @param server_id + @param oauthLoginServer + */ + + CC_DEPRECATED_ATTRIBUTE virtual void login(std::string server_id, std::string oauthLoginServer = "") = 0 ; + + /** + @brief User login + if the process of logining need to know the parameters , + you can use the function + @param the parameters + */ + virtual void login(std::map info) = 0 ; + + /** + @brief Check whether the user logined or not + @return If user logined, return value is true; + else return value is false. + */ + virtual bool isLogined() = 0 ; + + /** + @brief Get USER ID + @return If user logined, return value is userID; + else return value is empty string. + */ + virtual std::string getUserID() = 0 ; + /** + @brief set the result listener + @param pListener The callback object for user result + */ + virtual void setActionListener(UserActionListener* listener) = 0 ; + /** + @brief get pListener The callback object for user result + @return the listener + */ + virtual UserActionListener* getActionListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_USER_H__ */ diff --git a/android/x86/include/anysdk/Statistics.h b/android/x86/include/anysdk/Statistics.h new file mode 100644 index 00000000..bb389ff0 --- /dev/null +++ b/android/x86/include/anysdk/Statistics.h @@ -0,0 +1,18 @@ +#ifndef __STATISTICS_H__ +#define __STATISTICS_H__ + +#include +namespace anysdk { namespace framework { + +class Statistics +{ +public: + static void initInfo(); + static void createPlugin(std::string pluginName, int pluginType); + static void callFunction(std::string pluginName, std::string functionName); + +}; + +}} // namespace anysdk { namespace framework { + +#endif //__STATISTICS_H__ diff --git a/android/x86/libPluginProtocolStatic.a b/android/x86/libPluginProtocolStatic.a new file mode 100644 index 00000000..dafd8ac7 Binary files /dev/null and b/android/x86/libPluginProtocolStatic.a differ diff --git a/ios/include/anysdk/AdsUtil.h b/ios/include/anysdk/AdsUtil.h new file mode 100644 index 00000000..15161729 --- /dev/null +++ b/ios/include/anysdk/AdsUtil.h @@ -0,0 +1,20 @@ +// +// AdsUtil.h +// PluginProtocol +// +// Created by cocos2dx on 14-9-23. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import + +@interface AdsUtil : NSObject + +/** + * get the parameters of ads system in special case + * + * @return return the parameters + */ ++ (NSMutableDictionary*)getAdsParams; + +@end diff --git a/ios/include/anysdk/AdsWrapper.h b/ios/include/anysdk/AdsWrapper.h new file mode 100644 index 00000000..a8bd2137 --- /dev/null +++ b/ios/include/anysdk/AdsWrapper.h @@ -0,0 +1,96 @@ +// +// AdsWrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-8-29. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import +#import + +typedef enum +{ + RESULT_CODE_AdsReceived = 0, // The ad is received + RESULT_CODE_AdsShown, // The advertisement shown + RESULT_CODE_AdsDismissed, // The advertisement + // dismissed + RESULT_CODE_PointsSpendSucceed, // The points + // spend succeed + RESULT_CODE_PointsSpendFailed, // The points + // spend failed + RESULT_CODE_NetworkError, // Network error + RESULT_CODE_UnknownError, // Unknown error + RESULT_CODE_OfferWallOnPointsChanged, // Change the point of offerwall + RESULT_CODE_RewardedVideoWithReward,//the callback of receiving the reward of rewardedvideo + RESULT_CODE_InAppPurchaseFinished,////the callback of finishing IAP ad + RESULT_CODE_AdsClicked, //the callback of the advertisement clicked + RESULT_CODE_ADSEXTENSION = 40000 //ads extension code + +}AD_RET_CODE; + +typedef enum +{ + AD_TYPE_BANNER = 0,/**< enum value is banner ads . */ + AD_TYPE_FULLSCREEN,/**< enum value is fullscreen ads . */ + AD_TYPE_MOREAPP,/**< enum value is moreapp ads . */ + AD_TYPE_OFFERWALL, /**< enum value is offerwall ads . */ + AD_TYPE_REWARDEDVIDEO,/**< enum value is rewarded video ads . */ + AD_TYPE_NATIVEEXPRESS,/**< enum value is Native express ads . */ + AD_TYPE_NATIVEADVANCED/**< enum value is Native advanced ads . */ +} ADS_TYPE; +typedef enum +{ + POS_CENTER = 0,/**< enum the toolbar is at center. */ + POS_TOP,/**< enum the toolbar is at top. */ + POS_TOP_LEFT,/**< enum the toolbar is at topleft. */ + POS_TOP_RIGHT,/**< enum the toolbar is at topright. */ + POS_BOTTOM,/**< enum the toolbar is at bottom. */ + POS_BOTTOM_LEFT,/**< enum the toolbar is at bottomleft. */ + POS_BOTTOM_RIGHT/**< enum the toolbar is at bottomright. */ + +}AD_POS; + +@interface AdsWrapper : NSObject + +/** + * get current RootViewController + * + * @return RootViewController + */ ++ (UIViewController *)getCurrentRootViewController; + +/** + * get top window + * + * @return return top window + */ ++ (UIWindow*) getTopWindow; + +/** + * The callback interface of pay system + * + * @param pPlugin the pay plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void)onAdsResult:(id)target retCode:(int)code msg:(NSString*)msg; + +/** + * add ad view + * + * @param view view + * @param pos position + */ ++ (void) addAdView:(UIView*) view atPos:(AD_POS) pos; + +/** + * get the name of the advertising types + * + * @param adType the type of the advertising + * + * @return the name of the advertising types + */ ++ (NSString*)getAdNameWithType:(int)adType; + +@end diff --git a/ios/include/anysdk/AgentManager.h b/ios/include/anysdk/AgentManager.h new file mode 100644 index 00000000..092a9eaf --- /dev/null +++ b/ios/include/anysdk/AgentManager.h @@ -0,0 +1,245 @@ +/** @file AgentManager.h + */ + + +#ifndef __CCX_AGENTMANAGER_H__ +#define __CCX_AGENTMANAGER_H__ + +#include "PluginManager.h" +#include "ProtocolIAP.h" +#include "ProtocolAnalytics.h" +#include "ProtocolShare.h" +#include "ProtocolAds.h" +#include "ProtocolSocial.h" +#include "ProtocolUser.h" +#include "ProtocolPush.h" +#include "ProtocolCrash.h" +#include "ProtocolREC.h" +#include "ProtocolCustom.h" +#include "ProtocolAdTracking.h" +#include +#include +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum { + kPluginAds = 16,/**< enum value is the type of Ads. */ + kPluginAnalytics = 1,/**< enum value is the type of Analytics. */ + kPluginIAP = 8,/**< enum value is the type of IAP. */ + kPluginShare = 2,/**< enum value is the type of Share. */ + kPluginUser = 32,/**< enum value is the type of User. */ + kPluginSocial = 4,/**< enum value is the type of Social. */ + kPluginPush = 64,/**< enum value is the type of Push. */ + kPluginCrash = 128,/**< enum value is the type of Crash. */ + kPluginCustom = 256,/**< enum value is the type of Custom. */ + kPluginREC = 512,/**< enum value is the type of REC. */ + kPluginAdTracking = 1024,/**< enum value is the type of AdTracking. */ +}Plugin_type; +/**    + *  @class  AgentManager   + */ +class AgentManager +{ +public: + virtual ~AgentManager(); + /** + @brief Get singleton of AgentManager + */ + + static AgentManager* getInstance(); + /** + @brief Destory the instance of AgentManager + */ + static void end(); + + /** + @breif the init of AgentManager + @param the appKey of anysdk + @param the appSecret of anysdk + @param the privateKey of anysdk + @param the url of oauthLoginServer + @warning Must invoke this interface before loadAllPlugins + */ + void init(std::string appKey,std::string appSecret,std::string privateKey,std::string oauthLoginServer); + + /** + @brief load the plugins + */ + CC_DEPRECATED_ATTRIBUTE void loadALLPlugin(); + /** + @brief unload the plugins + */ + CC_DEPRECATED_ATTRIBUTE void unloadALLPlugin(); + + /** + @brief load the plugins + */ + void loadAllPlugins(); + + /** + @brief unload the plugins + */ + void unloadAllPlugins(); + + /** + @brief Get Analytics plugin + @return if Analytics plugin exist ,return value is Analytics plugin. + else return value is null pointer. + */ + ProtocolAnalytics* getAnalyticsPlugin(){return _pAnalytics;}; + + /** + @brief Get User plugin + @return if User plugin exist ,return value is User plugin. + else return value is null pointer. + */ + ProtocolUser* getUserPlugin(){return _pUser;}; + + /** + @brief Get IAP plugin + @return if IAP plugin exist ,return value is IAP plugin. + else return value is null pointer. + */ + std::map* getIAPPlugin(){return &_pluginsIAPMap;}; + + /** + @brief Get Share plugin + @return if Share plugin exist ,return value is Share plugin. + else return value is null pointer. + */ + ProtocolShare* getSharePlugin(){return _pShare;}; + + /** + @brief Get Social plugin + @return if Social plugin exist ,return value is Social plugin. + else return value is null pointer. + */ + ProtocolSocial* getSocialPlugin(){return _pSocial;}; + + /** + @brief Get Ads plugin + @return if Ads plugin exist ,return value is Ads plugin. + else return value is null pointer. + */ + ProtocolAds* getAdsPlugin(){return _pAds;}; + + /** + @brief Get Push plugin + @return if Push plugin exist ,return value is Push plugin. + else return value is null pointer. + */ + ProtocolPush* getPushPlugin(){return _pPush;}; + + /** + @brief Get Crash plugin + @return if Crash plugin exist ,return value is Crash plugin. + else return value is null pointer. + */ + ProtocolCrash* getCrashPlugin(){return _pCrash;}; + + /** + @brief Get Custom plugin + @return if Crash plugin exist ,return value is Custom plugin. + else return value is null pointer. + */ + ProtocolCustom* getCustomPlugin(){return _pCustom;}; + + + /** + @brief Get REC plugin + @return if REC plugin exist ,return value is REC plugin. + else return value is null pointer. + */ + ProtocolREC* getRECPlugin(){return _pREC;}; + + /** + @brief Get AdTracking plugin + @return if AdTracking plugin exist ,return value is AdTracking plugin. + else return value is null pointer. + */ + ProtocolAdTracking* getAdTrackingPlugin(){return _pAdTracking;}; + + /** + @brief Get channel ID + @return return value is channel ID. + */ + std::string getChannelId(); + + /** + @brief Get custom param + @return return value is custom param for channel. + */ + std::string getCustomParam(); + + /** + @brief Get framework version + @return return value is the version of AnySDKFramework. + */ + std::string getFrameworkVersion(); + + /** + @Title: setIsAnaylticsEnabled + @Description: choose to open or close + @param @param enabled true or false + @return void + */ + void setIsAnaylticsEnabled(bool value){bIsAnaylticsEnabled = value;}; + /** + @Title: isAnaylticsEnabled + @Description: the status of Anayltics + @param @return true or false + @return boolean + */ + bool isAnaylticsEnabled(){return bIsAnaylticsEnabled;}; + + + void loadPlugin(const char* nodeName,int type); +protected: + void setDebugMode(bool flag); + std::string getSupportPlugin(); + void release(); + + +private: + AgentManager(void); + + // Analytics plugin + ProtocolAnalytics* _pAnalytics; + + // user plugin + ProtocolUser* _pUser; + + // IAP plugins + // ProtocolIAP* _pIAP; + std::map _pluginsIAPMap; + + // Share plugin + ProtocolShare* _pShare; + + // Social plugin + ProtocolSocial* _pSocial; + + // Ads plugin + ProtocolAds* _pAds; + + // Push plugin + ProtocolPush* _pPush; + + // Crash plugin + ProtocolCrash* _pCrash; + + // Custom plugin + ProtocolCustom* _pCustom; + + // REC plugin + ProtocolREC* _pREC; + + // AdTracking plugin + ProtocolAdTracking* _pAdTracking; + + bool bIsAnaylticsEnabled; + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_AGENTMANAGER_H__ */ diff --git a/ios/include/anysdk/AnalyticsWrapper.h b/ios/include/anysdk/AnalyticsWrapper.h new file mode 100644 index 00000000..c20d2d5b --- /dev/null +++ b/ios/include/anysdk/AnalyticsWrapper.h @@ -0,0 +1,41 @@ +// +// AnalyticsWrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-10-9. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import + +typedef enum { + ACCOUNT_TYPE_ANONYMOUS,/**< enum value is anonymous typek. */ + ACCOUNT_TYPE_REGISTED,/**< enum value is registed type. */ + ACCOUNT_TYPE_SINA_WEIBO,/**< enum value is sineweibo type. */ + ACCOUNT_TYPE_TENCENT_WEIBO,/**< enum value is tecentweibo type */ + ACCOUNT_TYPE_QQ,/**< enum value is qq type */ + ACCOUNT_TYPE_ND91,/**< enum value is nd91 type. */ +} ANALYTICS_ACCOUNT_TYPE; + +typedef enum { + ACCOUNT_OPERATE_LOGIN,/**< enum value is the login operate. */ + ACCOUNT_OPERATE_LOGOUT,/**< enum value is the logout operate. */ + ACCOUNT_OPERATE_REGISTER,/**< enum value is the register operate. */ +}ANALYTICS_ACCOUNT_OPERATE; + +typedef enum { + ACCOUNT_GENDER_MALE,/**< enum value is male. */ + ACCOUNT_GENDER_FEMALE,/**< enum value is female. */ + ACCOUNT_GENDER_UNKNOWN,/**< enum value is unknow. */ + +} ANALYTICS_ACCOUNT_GENDER; + +typedef enum { + TASK_TYPE_GUIDE_LINE,/**< enum value is the guideline type.. */ + TASK_TYPE_MAIN_LINE,/**< enum value is the mainline type.. */ + TASK_TYPE_BRANCH_LINE,/** + +@protocol CocosRuntimeSDKDelegate + +- (NSMutableArray*)getSupportForPlugins; +- (NSMutableDictionary*)getPluginParams; +- (NSString*)getDevelopInfo; + +@end + +#endif /* __CRT_SDK_DELEGATE_H */ diff --git a/ios/include/anysdk/CustomWrapper.h b/ios/include/anysdk/CustomWrapper.h new file mode 100644 index 00000000..2eaf6195 --- /dev/null +++ b/ios/include/anysdk/CustomWrapper.h @@ -0,0 +1,25 @@ +// +// CustomWrapper.h +// PluginProtocol +// +// + +#import + +typedef enum +{ + CUSTOMRESULT_CUSTOMEXTENSION = 80000 /**< enum value is extension code . */ +} CUSTOM_RET_CODE; + +@interface CustomWrapper : NSObject + +/** + * The callback interface of Custom system + * + * @param pPlugin the Custom plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void) onCustomResult:(id)pPlugin retCode:(int)ret retMsg:(NSString*)msg; + +@end diff --git a/ios/include/anysdk/IAPWrapper.h b/ios/include/anysdk/IAPWrapper.h new file mode 100644 index 00000000..05e55385 --- /dev/null +++ b/ios/include/anysdk/IAPWrapper.h @@ -0,0 +1,86 @@ +// +// IAPWrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-9-9. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import +typedef enum +{ + PAYRESULT_SUCCESS = 0,/**< enum value is callback of succeeding in paying . */ + PAYRESULT_FAIL,/**< enum value is callback of failing to pay . */ + PAYRESULT_CANCEL,/**< enum value is callback of canceling to pay . */ + PAYRESULT_NETWORK_ERROR,/**< enum value is callback of network error . */ + PAYRESULT_PRODUCTIONINFOR_INCOMPLETE,/**< enum value is callback of incompleting info . */ + PAYRESULT_INIT_SUCCESS,/**< enum value is callback of succeeding in initing sdk . */ + PAYRESULT_INIT_FAIL,/**< enum value is callback of failing to init sdk . */ + PAYRESULT_NOW_PAYING,/**< enum value is callback of paying now . */ + PAYRESULT_PAYEXTENSION = 30000 /**< enum value is extension code . */ +} PAY_RET_CODE; + +typedef enum +{ + REQUESTRESULT_SUCCESS = 31000,/**< enum value is callback of succeeding in paying . */ + REQUESTRESULT_FAIL/**< enum value is callback of failing to pay . */ +} REQUEST_RET_CODE; + +@interface IAPWrapper : NSObject + +/** + * get the identifier of order + * + * @param orderInfo payment info + * @param target callback object + * @param action callback function + */ ++ (void)getPayOrderId:(NSMutableDictionary*)orderInfo target:(id)target action:(SEL)action; + +/** + * get order info + * + * @param productInfo product info + * @param user identifier of user + * + * @return order info + */ ++ (NSMutableDictionary*) getOrderInfo:(NSMutableDictionary*)productInfo userID:(NSString*)user; + /** + * The callback interface of pay system + * + * @param pPlugin the pay plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void)onPayResult:(id)pPlugin retCode:(int)ret retMsg:(NSString*)msg; + +/** + * The callback interface of social system + * + * @param pPlugin the social plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void)onPayResult:(id)pPlugin retCode:(int)ret products:(NSMutableDictionary*)products; + +/** + * process the notify url + * + * @param class1 plugin + * @param url the source url + * + * @return the destination url + */ ++ (NSString*) replaceNotifyURL:(Class)class1 url:(NSString*)url; + +/** + * process the EE Domain + * + * @param domain + * + * @return void + */ ++ (void)replaceEEDomain:(NSString*)domain; + +@end diff --git a/ios/include/anysdk/InterfaceAdTracking.h b/ios/include/anysdk/InterfaceAdTracking.h new file mode 100644 index 00000000..1ec881cf --- /dev/null +++ b/ios/include/anysdk/InterfaceAdTracking.h @@ -0,0 +1,108 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@protocol InterfaceAdTracking + +@required +/** + * + * @Title: onRegister + * @Description: Call this method if you want to track register events as happening during a section. + * @param userInfo user identifier + * @return void + */ +- (void) onRegister: (NSString*) userId; + +/** + * + * @Title: onLogin + * @Description:Call this method if you want to track login events as happening during a section. + * @param userInfo The details of this parameters are already covered by document. + * @return void + */ +- (void) onLogin: (NSMutableDictionary*) userInfo; + +/** + * + * @Title: onPay + * @Description: Call this method if you want to track pay events as happening during a section. + * @param productInfo The details of this parameters are already covered by document. + * @return void + */ +- (void) onPay: (NSMutableDictionary*) productInfo; + +/** + * + * @Title: trackEvent + * @Description: Call this method if you want to track custom events as happening during a section. + * @param eventId The custom event name. + * @return void + */ +- (void) trackEvent: (NSString*) eventId; + +/** + * + * @Title: trackEvent + * @Description: Call this method if you want to track custom events with parameters as happening during a section. + * @param eventId The custom event name. + * @param paramMap The details of this parameters are already covered by document. + */ +- (void) trackEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + + +@end diff --git a/ios/include/anysdk/InterfaceAds.h b/ios/include/anysdk/InterfaceAds.h new file mode 100644 index 00000000..da8fba35 --- /dev/null +++ b/ios/include/anysdk/InterfaceAds.h @@ -0,0 +1,122 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@protocol InterfaceAds + +@required +/** + * show advertising + * + * @param info the parameters of the advertising + key:Param1 value:the type of advertising + key:Param2 value:the order of advertising + */ +- (void) showAds: (NSMutableDictionary*) info; + +/** + * hide advertising + * + * @param info the parameters of the advertising + key:Param1 value:the type of advertising + key:Param2 value:the order of advertising + */ +- (void) hideAds: (NSMutableDictionary*) info; + +/** + * preload advertising + * + * @param info the parameters of the advertising + key:Param1 value:the type of advertising + key:Param2 value:the order of advertising + */ +- (void) preloadAds: (NSMutableDictionary*) info; + +/** + * query the points + * + * @return points + */ +- (float) queryPoints; + +/** + * spend user`s points + * + * @param points the points of spending + */ +- (void) spendPoints: (int) points; + +/** + * Description + * + * @param adType the type of advertising + * + * @return if the type is supported ,return true + or if the type is supported ,return false + */ +- (BOOL) isAdTypeSupported: (int)adType; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + +/** + * set debug mode true or false + * + * @param debug the status of debug + */ +- (void) setDebugMode: (BOOL) debug; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + + +@end diff --git a/ios/include/anysdk/InterfaceAnalytics.h b/ios/include/anysdk/InterfaceAnalytics.h new file mode 100644 index 00000000..230e4c5a --- /dev/null +++ b/ios/include/anysdk/InterfaceAnalytics.h @@ -0,0 +1,132 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@protocol InterfaceAnalytics + +@required +/** + * start session analytics + */ +- (void) startSession; + +/** + * stop session analytics + */ +- (void) stopSession; + +/** + * Set the timeout for expiring a session. + * + * @param millis In milliseconds as the unit of time. + * @note It must be invoked before calling startSession. + */ +- (void) setSessionContinueMillis: (long) millis; + +/** + * Whether to catch uncaught exceptions to server. + * + * @warning This interface only worked on android. + */ +- (void) setCaptureUncaughtException: (BOOL) isEnabled; + +/** + * log an error + * + * @param errorId The identity of event + * @param message message for the error + */ +- (void) logError: (NSString*) errorId withMsg:(NSString*) message; + +/** + * log an event + * + * @param eventId The identity of event + */ +- (void) logEvent: (NSString*) eventId; + +/** + * log an event + * + * @param eventId The identity of event + * @param paramMap Extern parameters of the event + */ +- (void) logEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap; + +/** + * Track an event begin + * + * @param eventId The identity of event + */ +- (void) logTimedEventBegin: (NSString*) eventId; + +/** + * Track an event end. + * + * @param eventId The identity of event + */ +- (void) logTimedEventEnd: (NSString*) eventId; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + +/** + * set debug mode true or false + * + * @param debug the status of debug + */ +- (void) setDebugMode: (BOOL) debug; + + +@end diff --git a/ios/include/anysdk/InterfaceCrash.h b/ios/include/anysdk/InterfaceCrash.h new file mode 100644 index 00000000..669cdd1f --- /dev/null +++ b/ios/include/anysdk/InterfaceCrash.h @@ -0,0 +1,86 @@ +/**************************************************************************** + Copyright (c) 2012+2013 cocos2d+x.org + + http://www.cocos2d+x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +@protocol InterfaceCrash + +@required + +/** + * set user identifier + * + * @param userInfo + */ +- (void) setUserIdentifier: (NSString*)identifier ; + +/** + * The uploader captured in exception information + * + * @param message Set the custom information + * @param exception The exception + */ +- (void) reportException: (NSString*)message exception:(NSString*)exception; + +/** + * customize logging + * + * @param string Custom log + */ +- (void) leaveBreadcrumb: (NSString*)breadcrumb; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + + + +@end diff --git a/ios/include/anysdk/InterfaceCustom.h b/ios/include/anysdk/InterfaceCustom.h new file mode 100644 index 00000000..ea99750d --- /dev/null +++ b/ios/include/anysdk/InterfaceCustom.h @@ -0,0 +1,64 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +@protocol InterfaceCustom + +@required +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + + + + + +@end diff --git a/ios/include/anysdk/InterfaceIAP.h b/ios/include/anysdk/InterfaceIAP.h new file mode 100644 index 00000000..2157caf6 --- /dev/null +++ b/ios/include/anysdk/InterfaceIAP.h @@ -0,0 +1,102 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@protocol InterfaceIAP + +@required +/** + * pay for product + * + * @param profuctInfo the information of the product + key:Product_Id value: the identifier of product + key:Product_Name value: the name of product + key:Product_Price value: the price of product, denominated as the yuan. + key:Product_Count value: the count of product + key:Role_Id value:the identifier of role + key:Role_Name value: the name of role + key:Role_Grade value: the grade of role + key:Role_Balance value: the virtual currency amount of role + key:Server_Id value: the identifier of paying server + key:EXT value: Extended Parameters + * @note the rule of production maybe changes,please the description is subject to the wiki(http://docs.anysdk.com/IAPSystem#.E6.94.AF.E4.BB.98) + */ +- (void) payForProduct: (NSMutableDictionary*) productInfo; + +/** + * get the order identifier + * + * @return the order identifier + */ +- (NSString*) getOrderId; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +/** + * get the identifier of plugin + * + * @return the identifier of plugin + */ +- (NSString*) getPluginId; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + +/** + * set debug mode true or false + * + * @param debug the status of debug + */ +- (void) setDebugMode: (BOOL) debug; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + + +@end diff --git a/ios/include/anysdk/InterfacePush.h b/ios/include/anysdk/InterfacePush.h new file mode 100644 index 00000000..346bd863 --- /dev/null +++ b/ios/include/anysdk/InterfacePush.h @@ -0,0 +1,106 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +@protocol InterfacePush + +@required +/** + * start push service + */ +- (void) startPush; + +/** + * close push service + */ +- (void) closePush; + +/** + * set alias + * + * @param alias the value of alias + */ +- (void) setAlias: (NSString*)alias; + +/** + * delete alias + * + * @param alias the value of alias + */ +- (void) delAlias: (NSString*)alias; + +/** + * set tags + * + * @param tags the content of tags + */ +- (void) setTags: (NSMutableArray*)tags; + +/** + * delete tags + * + * @param tags the content of tags + */ +- (void) delTags: (NSMutableArray*)tags; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + +/** + * set debug mode true or false + * + * @param debug the status of debug + */ +- (void) setDebugMode: (BOOL) debug; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + + +@end diff --git a/ios/include/anysdk/InterfaceREC.h b/ios/include/anysdk/InterfaceREC.h new file mode 100644 index 00000000..43cb4635 --- /dev/null +++ b/ios/include/anysdk/InterfaceREC.h @@ -0,0 +1,95 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +@protocol InterfaceREC + +@required + +/** + * + * @Title: startRecording + * @Description: Start to record video + * @param @return None + * @return void + * @throws + */ +- (void) startRecording; + +/** + * + * @Title: stopRecording + * @Description: Stop to record video + * @param @return None + * @return void + * @throws + */ +- (void) stopRecording; + +/** + * + * @Title: share + * @Description: share video + * @param @param info the info of video + * @return void + * @throws + */ +- (void) share:(NSMutableDictionary *) info; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + + + + +@end diff --git a/ios/include/anysdk/InterfaceShare.h b/ios/include/anysdk/InterfaceShare.h new file mode 100644 index 00000000..dd88eea8 --- /dev/null +++ b/ios/include/anysdk/InterfaceShare.h @@ -0,0 +1,75 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +@protocol InterfaceShare + +@required +/** + * share + * + * @param shareInfo the content of share + * @note the description is subject to the wiki(http://docs.anysdk.com/IAPSystem#.E6.94.AF.E4.BB.98) + */ +- (void) share: (NSMutableDictionary*) shareInfo; +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + +/** + * set debug mode true or false + * + * @param debug the status of debug + */ +- (void) setDebugMode: (BOOL) debug; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + + +@end diff --git a/ios/include/anysdk/InterfaceSocial.h b/ios/include/anysdk/InterfaceSocial.h new file mode 100644 index 00000000..6f0a4e71 --- /dev/null +++ b/ios/include/anysdk/InterfaceSocial.h @@ -0,0 +1,102 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +@protocol InterfaceSocial + +/** + * login in socail system + */ +- (void) signIn; + +/** + * logout in socail system + */ +- (void) signOut; +/** + * submit the socre for leaderboard + * + * @param leaderboardID the identifier of leaderboard + * @param score the score + */ +- (void) submitScore: (NSString*) leaderboardID withScore: (long) score; + +/** + * show the leaderboard + * + * @param leaderboardID the identifier of leaderboard + */ +- (void) showLeaderboard: (NSString*) leaderboardID; + +/** + * unlock achievements of game + * + * @param achInfo the content of achievement + */ +- (void) unlockAchievement: (NSMutableDictionary*) achInfo; + +/** + * show achievements of game + */ +- (void) showAchievements; +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + +/** + * set debug mode true or false + * + * @param debug the status of debug + */ +- (void) setDebugMode: (BOOL) debug; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + + +@end diff --git a/ios/include/anysdk/InterfaceUser.h b/ios/include/anysdk/InterfaceUser.h new file mode 100644 index 00000000..f415e364 --- /dev/null +++ b/ios/include/anysdk/InterfaceUser.h @@ -0,0 +1,94 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +@protocol InterfaceUser + +@required +/** + * user login + */ +- (void) login; + +/** + * get the status of login + * + * @return status of login + */ +- (BOOL) isLogined; + +/** + * get user identifier + * + * @return user identifier + */ +- (NSString*) getUserID; + +/** + * get the version of SDK + * + * @return the version of SDK + */ +- (NSString*) getSDKVersion; + +/** + * get the version of plugin + * + * @return the version of plugin + */ +- (NSString*) getPluginVersion; + +/** + * get the identifier of plugin + * + * @return the identifier of plugin + */ +- (NSString*) getPluginId; + +/** + * whether function is supported + * + * @param functionName the name of function + * + * @return return If the function is supported, return true + or if the function is not supported, return false + */ +- (BOOL) isFunctionSupported : (NSString*) functionName; + +@optional +/** + * init SDK + * + * @param cpInfo the parameters of SDK + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; + +/** + * set debug mode true or false + * + * @param debug the status of debug + */ +- (void) setDebugMode: (BOOL) debug; + + +@end diff --git a/ios/include/anysdk/JSBRelation.h b/ios/include/anysdk/JSBRelation.h new file mode 100644 index 00000000..7775b0dc --- /dev/null +++ b/ios/include/anysdk/JSBRelation.h @@ -0,0 +1,31 @@ +/** @file JSBRelation.h + */ +#ifndef __CCX_JSBRELATION_H__ +#define __CCX_JSBRELATION_H__ + +#include "PluginProtocol.h" +#include +#include +#include + +using namespace std; + +namespace anysdk { namespace framework { + +/**    + *  @class  JSBRelation   + */ +class JSBRelation +{ +public: + static string getMethodsOfPlugin(PluginProtocol* plugin); + + + + +private: +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_JSBRELATION_H__ */ diff --git a/ios/include/anysdk/JsonParser.h b/ios/include/anysdk/JsonParser.h new file mode 100644 index 00000000..c9f4b127 --- /dev/null +++ b/ios/include/anysdk/JsonParser.h @@ -0,0 +1,26 @@ +// +// JsonParser.h +// PluginProtocol +// +// Created by cocos2dx on 14-9-17. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import + +@interface JsonParser : NSObject + ++(NSString*)parseJsonForNSKey:(NSString*)data key:(NSString*)key __attribute__((deprecated)); + ++(NSString*)parseJsonForNSKey:(NSString*)data key:(NSString*)key key2:(NSString*)key2 __attribute__((deprecated)); + ++(NSString*)parseJsonForNSKey:(NSString*)data key:(NSString*)key key2:(NSString*)key2 key3:(NSString*)key3 __attribute__((deprecated)); + + ++(const char*)parseJsonForKey:(const char*)data key:(const char*)key __attribute__((deprecated)); + ++(const char*)parseJsonForKey:(const char*)data key:(const char*)key key2:(const char*)key2 __attribute__((deprecated)); + ++(const char*)parseJsonForKey:(const char*)data key:(const char*)key key2:(const char*)key2 key3:(const char*)key3 __attribute__((deprecated)); + +@end diff --git a/ios/include/anysdk/PluginApplicationDelegate.h b/ios/include/anysdk/PluginApplicationDelegate.h new file mode 100644 index 00000000..c714a50b --- /dev/null +++ b/ios/include/anysdk/PluginApplicationDelegate.h @@ -0,0 +1,53 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#import +@protocol PluginApplicationDelegate + +@optional +//about user system + +- (void)applicationDidEnterBackground:(UIApplication *)application ; +- (void)applicationWillEnterForeground:(UIApplication *)application ; + + +//about iap system +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation ; + +- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; + + +//about push system +- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken ; + +- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error ; + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo; + +- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler ; + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler ; + + + +@end \ No newline at end of file diff --git a/ios/include/anysdk/PluginFactory.h b/ios/include/anysdk/PluginFactory.h new file mode 100644 index 00000000..79922c97 --- /dev/null +++ b/ios/include/anysdk/PluginFactory.h @@ -0,0 +1,41 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGIN_FACTORY_H__ +#define __CCX_PLUGIN_FACTORY_H__ + +namespace anysdk { namespace framework { + +class PluginProtocol; +class PluginManager; +/**    + *  @class  PluginFactory   + */ +class PluginFactory +{ +public: + virtual ~PluginFactory(); + /** + @brief Get singleton of PluginFactory + */ + static PluginFactory* getInstance(); + + /** + @brief Destory the instance of PluginFactory + */ + static void purgeFactory(); + +private: + friend class PluginManager; + PluginFactory(void); + + /** + @brief create the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* createPlugin(const char* name, int pluginType); +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_FACTORY_H__ */ diff --git a/ios/include/anysdk/PluginHelper.h b/ios/include/anysdk/PluginHelper.h new file mode 100644 index 00000000..406fc278 --- /dev/null +++ b/ios/include/anysdk/PluginHelper.h @@ -0,0 +1,130 @@ +// +// PluginHelper.h +// PluginProtocol +// +// Created by cocos2dx on 14-8-29. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import +#import + +@interface PluginHelper : NSObject + +/** + * get the parameters of SDK + * + * @return the parameters of SDK + */ ++ (NSMutableDictionary*) getParamsInfo; + +/** + * + * @Title: getDebugModeStatus + * @Description: get the status of DebugMode + * @param @return status + * @return BOOL yes or no + */ ++ (BOOL) getDebugModeStatus; + +/** + * + * @Title: getLogLevel + * @Description: get the level of log + * @param @return level + * @return "verbose" "debug" "info" "warning" "error" + */ ++ (NSString*) getLogLevel; + +/** + * get the status of network + * + * @return if the network is reachable ,return true + or if the network is reachable,return false + */ ++ (BOOL) networkReachable; + +/** + * get current RootViewController + * + * @return RootViewController + */ ++ (UIViewController *)getCurrentRootViewController; + +/** + * network transmission in plugin + * + * @param data content transmitted over the network + * @param target callback object + * @param sel callback function + * @note the content must contain the value that key is "server_url" + * @note http use post + */ ++ (void) pluginHttp:(NSMutableDictionary*)data target:(id)target sel:(SEL)sel; + +/** + * log output ,the lever is verbose + * + * @param message the message about this log + */ ++ (void) logVerbose:(NSString*)format,...; + +/** + * log output ,the lever is error + * + * @param message the message about this log + */ ++ (void) logError:(NSString*)format,...; + + +/** + * log output ,the lever is debug + * + * @param message the message about this log + */ ++ (void) logDebug:(NSString*)format,...; + +/** + * log output ,the lever is info + * + * @param message the message about this log + */ ++ (void) logInfo:(NSString*)format,...; + +/** + * get the game identifier + * + * @return name + */ ++ (NSString*) getGameId; + +/** + * get the application name + * + * @return name + */ ++ (NSString*) getApplicationName; + +/** + * get the application orientation + * + * @return multiple orientation + */ ++ (NSArray*) getApplicationOrientation; + + +/** + * get the application version + * + * @return version + */ ++ (NSString*) getApplicationVersion; + +/** + * Parsing XML file + * @param the name of XML file + * @return NSMutableDictionary the content of XML file + */ ++ (NSMutableDictionary*) getXMLInfoByFileName:(NSString*)fileName; + +@end \ No newline at end of file diff --git a/ios/include/anysdk/PluginManager.h b/ios/include/anysdk/PluginManager.h new file mode 100644 index 00000000..93282ae7 --- /dev/null +++ b/ios/include/anysdk/PluginManager.h @@ -0,0 +1,51 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PLUGINMANAGER_H__ +#define __CCX_PLUGINMANAGER_H__ + +#include "PluginProtocol.h" +#include "PluginFactory.h" +#include +#include + +namespace anysdk { namespace framework { + +/**    + *  @class  PluginManager   + */ +class PluginManager +{ +public: + virtual ~PluginManager(); + /** + @brief Get singleton of PluginManager + */ + static PluginManager* getInstance(); + /** + @brief Destory the instance of PluginManager + */ + static void end(); + + /** + @brief load the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + PluginProtocol* loadPlugin(const char* name, int pluginType); + /** + @brief unload the plugin by name and type + @param the name of plugin + @param the type of plugin + */ + void unloadPlugin(const char* name, int pluginType = 0); + + +private: + PluginManager(void); + std::map _pluginsMap; +// bool _isDebug; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGINMANAGER_H__ */ diff --git a/ios/include/anysdk/PluginParam.h b/ios/include/anysdk/PluginParam.h new file mode 100644 index 00000000..1f35d4a7 --- /dev/null +++ b/ios/include/anysdk/PluginParam.h @@ -0,0 +1,126 @@ +/** @file PluginParam.h + */ +#ifndef __CCX_PLUGIN_PARAM_H__ +#define __CCX_PLUGIN_PARAM_H__ + +#include +#include +/// \typedef std::map StringMap +/// typedef YString. +typedef std::map StringMap; + +namespace anysdk { namespace framework { + +class PluginProtocol; +/**    + *  @class  PluginParam   + */ +class PluginParam +{ +public: + /** + @brief the default constructor of PluginParam + */ + PluginParam(); + + virtual ~PluginParam(); + /** + @brief the constructor of PluginParam + @param the value is Integer + */ + PluginParam(int nValue); + /** + @brief the constructor of PluginParam + @param the value is float + */ + PluginParam(float fValue); + /** + @brief the constructor of PluginParam + @param the value is boolean + */ + PluginParam(bool bValue); + /** + @brief the default constructor of PluginParam + @param the value is char + */ + PluginParam(const char* strValue); + /** + @brief the default constructor of PluginParam + @param the value is StringMap + */ + PluginParam(StringMap strMapValue); + + typedef enum{ + kParamTypeNull = 0, + kParamTypeInt, + kParamTypeFloat, + kParamTypeBool, + kParamTypeString, + kParamTypeStringMap, + kParamTypeMap, + } ParamType; + /** + @brief get the ParamType of value + */ + inline ParamType getCurrentType() { + return _type; + } + /** + @brief get the int value + */ + inline int getIntValue() { + return _intValue; + } + /** + @brief get the float value + */ + inline float getFloatValue() { + return _floatValue; + } + /** + @brief get the boolean value + */ + inline bool getBoolValue() { + return _boolValue; + } + /** + @brief get the char value + */ + inline const char* getStringValue() { + return _strValue.c_str(); + } + /** + @brief get the map of value + */ + inline std::map getMapValue() { + return _mapValue; + } + /** + @brief get the StringMap value + */ + inline StringMap getStrMapValue() { + return _strMapValue; + } + +private: + friend class PluginProtocol; + /** + @brief the constructor of PluginParam + @param the map of value + */ + PluginParam(std::map mapValue); + +private: + ParamType _type; + + int _intValue; + float _floatValue; + bool _boolValue; + std::string _strValue; + std::map _mapValue; + StringMap _strMapValue; +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_PLUGIN_PARAM_H__ */ diff --git a/ios/include/anysdk/PluginProtocol.h b/ios/include/anysdk/PluginProtocol.h new file mode 100644 index 00000000..95cf706d --- /dev/null +++ b/ios/include/anysdk/PluginProtocol.h @@ -0,0 +1,144 @@ +/** @file PluginProtocol.h + */ +#ifndef __CCX_IPLUGIN_H__ +#define __CCX_IPLUGIN_H__ + +#include "PluginParam.h" +#include + +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +#define CC_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#elif _MSC_VER >= 1400 //vs 2005 or higher +#define CC_DEPRECATED_ATTRIBUTE __declspec(deprecated) +#else +#define CC_DEPRECATED_ATTRIBUTE +#endif + +namespace anysdk { namespace framework { + +/** + * @class PluginProtocol + * @brief The super class for all plugins. + */ +class PluginProtocol +{ +public: + virtual ~PluginProtocol() {}; + + /** + *@brief set plugin name + *@param the name of plugin + */ + virtual void setPluginName(const char* name) = 0 ; + /** + *@brief get plugin name + *@return the name of plugin + */ + virtual const char* getPluginName() = 0 ; + + /** + *@brief get the version of plugin + *@return the version of plugin + */ + virtual std::string getPluginVersion(); + /** + *@brief get the version of sdk + *@return the version of sdk + */ + virtual std::string getSDKVersion(); + + /** + *@brief switch debug plug-in on/off + *@param the value of on/off + */ + CC_DEPRECATED_ATTRIBUTE virtual void setDebugMode(bool bDebug); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return void + */ + virtual void callFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return void + */ + virtual void callFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return string + */ + virtual std::string callStringFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return int + */ + virtual int callIntFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return bool + */ + virtual bool callBoolFuncWithParam(const char* funcName, std::vector params); + + /** + *@brief methods for reflections + *@param function name + *@param PluginParam* param + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...); + /** + *@brief methods for reflections + *@param function name + *@param std::vector params + *@return float + */ + virtual float callFloatFuncWithParam(const char* funcName, std::vector params); + + /** + @brief Check function the plugin support or not + @param the name of plugin + @return if the function support ,return true + else retur false + */ + virtual bool isFunctionSupported(std::string functionName); + + +}; + +}} //namespace anysdk { namespace framework { + +#endif /* __CCX_IPLUGIN_H__ */ diff --git a/ios/include/anysdk/PluginWrapper.h b/ios/include/anysdk/PluginWrapper.h new file mode 100644 index 00000000..cbdc0b34 --- /dev/null +++ b/ios/include/anysdk/PluginWrapper.h @@ -0,0 +1,39 @@ +// +// PluginWrapper.h +// PluginProtocol +// +#import + +#import +#import "PluginApplicationDelegate.h" +@interface PluginWrapper : NSObject + +@property (nonatomic, strong) NSMutableArray * arrayDelegate; + ++ (PluginWrapper*) getInstance; + +- (void) setDelegate:(id)delegate; + +//about user system + +- (void)applicationDidEnterBackground:(UIApplication *)application ; +- (void)applicationWillEnterForeground:(UIApplication *)application ; + +//about iap system +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation ; + +- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; + + +//about push system +- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken ; + +- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo ; + +- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler ; + +- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; + +@end diff --git a/ios/include/anysdk/ProtocolAdTracking.h b/ios/include/anysdk/ProtocolAdTracking.h new file mode 100644 index 00000000..6fc557a2 --- /dev/null +++ b/ios/include/anysdk/ProtocolAdTracking.h @@ -0,0 +1,58 @@ +/** @file ProtocolAdTracking.h + */ +#ifndef __CCX_PROTOCOL_ADTRACKING_H__ +#define __CCX_PROTOCOL_ADTRACKING_H__ + +#include "PluginProtocol.h" +#include +namespace anysdk { namespace framework { +/**    + *@class  ProtocolAdTracking + *@brief the interface of AdTracking   + */ +class ProtocolAdTracking : public PluginProtocol +{ +public: + + /** + * + * @Title: onRegister + * @Description: Call this method if you want to track register events as happening during a section. + * @param userId user identifier + * @return void + */ + virtual void onRegister(const char* userId) = 0; + + /** + * + * @Title: onLogin + * @Description:Call this method if you want to track login events as happening during a section. + * @param userInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onLogin(std::map userInfo) = 0; + + /** + * + * @Title: onPay + * @Description: Call this method if you want to track pay events as happening during a section. + * @param productInfo The details of this parameters are already covered by document. + * @return void + */ + virtual void onPay(std::map productInfo) = 0; + + /** + * + * @Title: trackEvent + * @Description: Call this method if you want to track custom events with parameters as happening during a section. + * @param eventId The custom event name. + * @param paramMap The details of this parameters are already covered by document. + */ + virtual void trackEvent(const char* eventId, std::map* paramMap = NULL) = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_ADTRACKING_H__ ----- */ diff --git a/ios/include/anysdk/ProtocolAds.h b/ios/include/anysdk/ProtocolAds.h new file mode 100644 index 00000000..8e29987f --- /dev/null +++ b/ios/include/anysdk/ProtocolAds.h @@ -0,0 +1,133 @@ +/** @file ProtocolAds.h + */ +#ifndef __CCX_PROTOCOL_ADS_H__ +#define __CCX_PROTOCOL_ADS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TAdsDeveloperInfo +/// typedef TAdsDeveloperInfo. +typedef std::map TAdsDeveloperInfo; +/// \typedef std::map TAdsInfo +/// typedef TAdsInfo. +typedef std::map TAdsInfo; +/** @brief AdsResultCode enum, with inline docs */ +typedef enum +{ + kAdsReceived = 0, /**< enum the callback: the ad is received is at center. */ + + kAdsShown, /**< enum the callback: the advertisement dismissed. */ + kAdsDismissed, /**< enum the callback: the advertisement dismissed. */ + + kPointsSpendSucceed, /**< enum the callback: the points spend succeed. */ + kPointsSpendFailed, /**< enum the callback: the points spend failed. */ + + kNetworkError, /**< enum the callback of Network error at center. */ + kUnknownError, /**< enum the callback of Unknown error. */ + kOfferWallOnPointsChanged, /**< enum the callback of Changing the point of offerwall. */ + kRewardedVideoWithReward,/**< enum the callback of receiving the reward of rewardedvideo. */ + kInAppPurchaseFinished,/**< enum the callback of finishing IAP ad. */ + kAdsClicked,/**< enum the callback of the advertisement clicked. */ + kAdsExtension = 40000 /**< enum value is extension code . */ +} AdsResultCode; +/** @brief AdsPos enum, with inline docs */ +typedef enum { + kPosCenter = 0,/**< enum the toolbar is at center. */ + kPosTop,/**< enum the toolbar is at top. */ + kPosTopLeft,/**< enum the toolbar is at topleft. */ + kPosTopRight,/**< enum the toolbar is at topright. */ + kPosBottom,/**< enum the toolbar is at bottom. */ + kPosBottomLeft,/**< enum the toolbar is at bottomleft. */ + kPosBottomRight,/**< enum the toolbar is at bottomright. */ +} AdsPos; +/** @brief AdsType enum, with inline docs */ +typedef enum { + AD_TYPE_BANNER = 0,/**< enum value is banner ads . */ + AD_TYPE_FULLSCREEN,/**< enum value is fullscreen ads . */ + AD_TYPE_MOREAPP,/**< enum value is moreapp ads . */ + AD_TYPE_OFFERWALL,/**< enum value is offerwall ads . */ + AD_TYPE_REWARDEDVIDEO,/**< enum value is rewarded video ads . */ + AD_TYPE_NATIVEEXPRESS,/**< enum value is Native express ads . */ + AD_TYPE_NATIVEADVANCED,/**< enum value is Native advanced ads . */ +} AdsType; + +class ProtocolAds; +class AdsListener +{ +public: + /** + *@brief The advertisement request result + *@param the id of callback + *@param the information of callback + */ + virtual void onAdsResult(AdsResultCode code, const char* msg) = 0; +}; + +class ProtocolAds : public PluginProtocol +{ +public: + + + + /** + @brief show adview + @param the type of ads + @param the idx of ads + */ + virtual void showAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief Hide the adview + @param the type of ads + @param the idx of ads + */ + virtual void hideAds(AdsType adsType, int idx = 1) = 0; + + /** + @brief preload the adview + @param the type of ads + @param the idx of ads + */ + virtual void preloadAds(AdsType adsType, int idx = 1)= 0; + + /** + *@brief Query the points of player + *@return the point + */ + virtual float queryPoints() = 0; + + /** + *@brief Spend the points. + Use this method to notify server spend points. + *@param points Need spend number of points + */ + virtual void spendPoints(int points) = 0; + + /** + @brief set the Ads listener + @param pListener The callback object for Ads result + */ + virtual void setAdsListener(AdsListener* listener) = 0; + + /** + @brief get pListener The callback object for Ads result + @return the listener + */ + virtual AdsListener* getAdsListener() = 0; + + /** + @brief Is it supportive of this type of ads + @param the type of ads + @return if it is supportive ,return true + else retur false + */ + virtual bool isAdTypeSupported(AdsType adType) = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_ADS_H__ */ diff --git a/ios/include/anysdk/ProtocolAnalytics.h b/ios/include/anysdk/ProtocolAnalytics.h new file mode 100644 index 00000000..ce3372d6 --- /dev/null +++ b/ios/include/anysdk/ProtocolAnalytics.h @@ -0,0 +1,107 @@ +/** @file ProtocolAnalytics.h + */ +#ifndef __CCX_PROTOCOL_ANALYTICS_H__ +#define __CCX_PROTOCOL_ANALYTICS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map LogEventParamPair +/// typedef LogEventParamPair. +typedef std::pair< std::string, std::string > LogEventParamPair; +/// \typedef std::map LogEventParamMap +/// typedef LogEventParamMap. +typedef std::map< std::string, std::string > LogEventParamMap; +typedef enum { + ANONYMOUS,/**< enum value is anonymous typek. */ + REGISTED,/**< enum value is registed type. */ + SINA_WEIBO,/**< enum value is sineweibo type. */ + TENCENT_WEIBO,/**< enum value is tecentweibo type */ + QQ,/**< enum value is qq type */ + ND91,/**< enum value is nd91 type. */ +} AccountType; +typedef enum { + LOGIN,/**< enum value is the login operate. */ + LOGOUT,/**< enum value is the logout operate. */ + REGISTER,/**< enum value is the register operate. */ +} AccountOperate; +typedef enum { + MALE,/**< enum value is male. */ + FEMALE,/**< enum value is female. */ + UNKNOWN,/**< enum value is unknow. */ + +} AccountGender; +typedef enum { + GUIDE_LINE,/**< enum value is the guideline type.. */ + MAIN_LINE,/**< enum value is the mainline type.. */ + BRANCH_LINE,/** +#include + +namespace anysdk { namespace framework { + +class ProtocolCrash : public PluginProtocol +{ +public: + /** + * set user identifier + * + * @param userInfo + */ + virtual void setUserIdentifier(const char* identifier) = 0; + + /** + * The uploader captured in exception information + * + * @param message Set the custom information + * @param exception The exception + */ + virtual void reportException(const char* message, const char* exception) = 0; + + /** + * customize logging + * + * @param string Custom log + */ + virtual void leaveBreadcrumb(const char* breadcrumb) = 0; + + + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_CRASH_H__ */ diff --git a/ios/include/anysdk/ProtocolCustom.h b/ios/include/anysdk/ProtocolCustom.h new file mode 100644 index 00000000..dc92558e --- /dev/null +++ b/ios/include/anysdk/ProtocolCustom.h @@ -0,0 +1,50 @@ +/** @file ProtocolCustom.h + */ +#ifndef __CCX_PROTOCOL_CUSTOM_H__ +#define __CCX_PROTOCOL_CUSTOM_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +typedef enum +{ + kCustomExtension = 80000 /**< enum value is extension code . */ +} CustomResultCode; +/**    + *@class  CustomResultListener + *@brief the interface of share callback   + */ +class CustomResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onCustomResult(CustomResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolCustom + *@brief the interface of custom   + */ +class ProtocolCustom : public PluginProtocol +{ +public: + + /** + @breif set the result listener + @param pListener The callback object for custom result + @wraning Must invoke this interface before custom + */ + virtual void setResultListener(CustomResultListener* pListener) = 0; + + virtual CustomResultListener* getCustomListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_Custom_H__ ----- */ diff --git a/ios/include/anysdk/ProtocolIAP.h b/ios/include/anysdk/ProtocolIAP.h new file mode 100644 index 00000000..4a875b32 --- /dev/null +++ b/ios/include/anysdk/ProtocolIAP.h @@ -0,0 +1,119 @@ +/** @file ProtocolIAP.h + */ +#ifndef __CCX_PROTOCOL_IAP_H__ +#define __CCX_PROTOCOL_IAP_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TIAPDeveloperInfo +/// typedef TIAPDeveloperInfo. +typedef std::map TIAPDeveloperInfo; +/// \typedef std::map TProductInfo +/// typedef TProductInfo. +typedef std::map TProductInfo; +/// typedef TProductsInfo. +typedef std::map AllProductsInfo; +/** @brief PayResultCode enum, with inline docs */ +typedef enum +{ + kPaySuccess = 0,/**< enum value is callback of succeeding in paying . */ + kPayFail,/**< enum value is callback of failing to pay . */ + kPayCancel,/**< enum value is callback of canceling to pay . */ + kPayNetworkError,/**< enum value is callback of network error . */ + kPayProductionInforIncomplete,/**< enum value is callback of incompleting info . */ + kPayInitSuccess,/**< enum value is callback of succeeding in initing sdk . */ + kPayInitFail,/**< enum value is callback of failing to init sdk . */ + kPayNowPaying,/**< enum value is callback of paying now . */ + kPayRechargeSuccess,/**< enum value is callback of succeeding in recharging. */ + kPayExtension = 30000 /**< enum value is extension code . */ +} PayResultCode; +/** @brief RequestResultCode enum, with inline docs */ +typedef enum +{ + kRequestSuccess = 31000,/**< enum value is callback of succeeding in paying . */ + kRequestFail/**< enum value is callback of failing to pay . */ +} RequestResultCode; +/**    + *@class  PayResultListener + *@brief the interface of pay callback   + */ +class PayResultListener +{ +public: + /**    + *@brief the interface of pay callback  + *@param the id of callback + *@param the information of callback + *@param the info of pay + */ + virtual void onPayResult(PayResultCode ret, const char* msg, TProductInfo info) = 0; + /** + *@brief the interface of request callback + *@param the id of callback + *@param the information of callback + *@param the info of request product + */ + virtual void onRequestResult(RequestResultCode ret, const char* msg, AllProductsInfo info) {} +}; +/**    + *@class  ProtocolIAP + *@brief the interface of pay    + */ + +class ProtocolIAP : public PluginProtocol +{ +public: + + /** + @brief pay for product + @param info The info of product, must contains key: + productName The name of product + productPrice The price of product(must can be parse to float) + productDesc The description of product + @warning For different plugin, the parameter should have other keys to pay. + Look at the manual of plugins. + */ + virtual void payForProduct(TProductInfo info) = 0; + /** + @brief get order id + @return the order id + */ + virtual std::string getOrderId() = 0; + + /** + @breif set the result listener + @param pListener The callback object for pay result + @wraning Must invoke this interface before payForProduct. + */ + virtual void setResultListener(PayResultListener* pListener) = 0; + + virtual PayResultListener* getPayListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + /** + @brief change the state of paying + @param the state + */ + + static void resetPayState() + { + _paying = false; + } + static bool _paying; + + + +}; + + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_IAP_H__ */ diff --git a/ios/include/anysdk/ProtocolPush.h b/ios/include/anysdk/ProtocolPush.h new file mode 100644 index 00000000..e9e2fac8 --- /dev/null +++ b/ios/include/anysdk/ProtocolPush.h @@ -0,0 +1,104 @@ +/** @file PluginFactory.h + */ +#ifndef __CCX_PROTOCOL_PUSH_H__ +#define __CCX_PROTOCOL_PUSH_H__ + +#include "PluginProtocol.h" +#include +#include +#include +using namespace std; + +namespace anysdk { namespace framework { +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kPushReceiveMessage = 0,/**value is callback of Receiving Message . */ + kPushExtensionCode = 60000 /**< enum value is extension code . */ + + +} PushActionResultCode; +class ProtocolPush; +/**    + *@class  PushActionListener + *@brief the interface of Push callback   + */ +class PushActionListener +{ +public: + /**    + *@brief the interface of Push callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolPush* pPlugin, PushActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolPush   + */ +class ProtocolPush : public PluginProtocol +{ +public: + + + /** + *@brief start/register Push services + *@return void + */ + virtual void startPush() = 0 ; + + + /** + *@brief close Push services + *@return void + */ + virtual void closePush() = 0 ; + + + /** + *@brief set alias + *@param tags + *@return void + */ + virtual void setAlias(string alias) = 0; + + /** + *@brief del alias + *@param tags + *@return void + */ + virtual void delAlias(string alias) = 0; + + /** + *@brief set tag + *@param tags + *@return void + */ + virtual void setTags(list tags) = 0; + + /** + *@brief delete tag + *@param tags + *@return void + */ + virtual void delTags(list tags) = 0; + + /** + @brief set the result listener + @param pListener The callback object for push result + */ + virtual void setActionListener(PushActionListener* listener) = 0 ; + + /** + @brief get pListener The callback object for Push result + @return the listener + */ + virtual PushActionListener* getActionListener() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_PUSH_H__ */ diff --git a/ios/include/anysdk/ProtocolREC.h b/ios/include/anysdk/ProtocolREC.h new file mode 100644 index 00000000..b0db2c0d --- /dev/null +++ b/ios/include/anysdk/ProtocolREC.h @@ -0,0 +1,83 @@ +/** @file ProtocolREC.h + */ +#ifndef __CCX_PROTOCOL_REC_H__ +#define __CCX_PROTOCOL_REC_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { + +typedef std::map TVideoInfo; + +/** @brief RECResultCode enum, with inline docs */ +typedef enum +{ + kRECInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk . */ + kRECInitFail,/**< enum value is callback of failing to init sdk. */ + kRECStartRecording,/**< enum value is callback of starting to record. */ + kRECStopRecording,/**< enum value is callback of stoping to record. */ + kRECPauseRecording,/**< enum value is callback of pausing to record. */ + kRECResumeRecording,/**< enum value is callback of resuming to record. */ + kRECEnterSDKPage,/**< enum value is callback of entering SDK`s page. */ + kRECQuitSDKPage,/**< enum value is callback of quiting SDK`s page. */ + kRECShareSuccess,/**< enum value is callback of succeeding in sharing. */ + kRECShareFail,/**< enum value is callback of failing to share. */ + kRECExtension = 90000 /**< enum value is extension code . */ +} RECResultCode; +/**    + *@class  RECResultListener + *@brief the interface of REC callback   + */ +class RECResultListener +{ +public: + /**    + *@brief the interface of REC callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onRECResult(RECResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolREC + *@brief the interface of REC   + */ +class ProtocolREC : public PluginProtocol +{ +public: + + /** + * @Description: Start to record video + */ + virtual void startRecording() = 0; + + /** + * @Description: Stop to record video + */ + virtual void stopRecording() = 0; + + /** + * @Description: share video + * @Param info The info of share + */ + virtual void share(TVideoInfo info) = 0; + + + + /** + @breif set the result listener + @param pListener The callback object for REC result + @wraning Must invoke this interface before REC + */ + virtual void setResultListener(RECResultListener* pListener) = 0; + + virtual RECResultListener* getRECListener() = 0; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/ios/include/anysdk/ProtocolShare.h b/ios/include/anysdk/ProtocolShare.h new file mode 100644 index 00000000..2215a4ff --- /dev/null +++ b/ios/include/anysdk/ProtocolShare.h @@ -0,0 +1,72 @@ +/** @file ProtocolShare.h + */ +#ifndef __CCX_PROTOCOL_SHARE_H__ +#define __CCX_PROTOCOL_SHARE_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TShareDeveloperInfo +/// typedef TShareDeveloperInfo. +typedef std::map TShareDeveloperInfo; +/// \typedef std::map TShareInfo +/// typedef TShareInfo. +typedef std::map TShareInfo; +/** @brief ShareResultCode enum, with inline docs */ +typedef enum +{ + kShareSuccess = 0,/**< enum value is callback of failing to sharing . */ + kShareFail,/**< enum value is callback of failing to share . */ + kShareCancel,/**< enum value is callback of canceling to share . */ + kShareNetworkError,/**< enum value is callback of network error . */ + kShareExtension = 10000 /**< enum value is extension code . */ +} ShareResultCode; +/**    + *@class  ShareResultListener + *@brief the interface of share callback   + */ +class ShareResultListener +{ +public: + /**    + *@brief the interface of share callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onShareResult(ShareResultCode ret, const char* msg) = 0; +}; +/**    + *@class  ProtocolShare + *@brief the interface of share   + */ +class ProtocolShare : public PluginProtocol +{ +public: + + + + /** + @brief share information + @param info The info of share, contains key: + SharedText The text need to share + SharedImagePath The full path of image file need to share (optinal) + @warning For different plugin, the parameter should have other keys to share. + Look at the manual of plugins. */ + virtual void share(TShareInfo info) = 0; + + /** + @breif set the result listener + @param pListener The callback object for share result + @wraning Must invoke this interface before share + */ + virtual void setResultListener(ShareResultListener* pListener) = 0; + + virtual ShareResultListener* getShareListener() = 0; + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SHARE_H__ ----- */ diff --git a/ios/include/anysdk/ProtocolSocial.h b/ios/include/anysdk/ProtocolSocial.h new file mode 100644 index 00000000..3fa5639b --- /dev/null +++ b/ios/include/anysdk/ProtocolSocial.h @@ -0,0 +1,105 @@ +/** @file ProtocolSocial.h + */ +#ifndef __CCX_PROTOCOL_SOCIAL_H__ +#define __CCX_PROTOCOL_SOCIAL_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TSocialDeveloperInfo +/// typedef TSocialDeveloperInfo. +typedef std::map TSocialDeveloperInfo; +/// \typedef std::map TAchievementInfo +/// typedef TAchievementInfo. +typedef std::map TAchievementInfo; +/** @brief SocialRetCode enum, with inline docs */ +typedef enum +{ + // code for leaderboard feature + kScoreSubmitSucceed =1,/**< enum value is callback of succeeding in submiting. */ + kScoreSubmitfail,/**< enum value is callback of failing to submit . */ + + // code for achievement feature + kAchUnlockSucceed,/**< enum value is callback of succeeding in unlocking. */ + kAchUnlockFail,/**< enum value is callback of failing to unlock. */ + + kSocialSignInSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignInFail,/**< enum value is callback of failing to login. */ + + kSocialSignOutSucceed,/**< enum value is callback of succeeding to login. */ + kSocialSignOutFail,/**< enum value is callback of failing to login. */ + kSocialGetGameFriends,/**< enum value is callback of getGameFriends. */ + kSocialExtensionCode = 20000 /**< enum value is extension code . */ + +} SocialRetCode; +/**    + *@class  SocialListener + *@brief the interface of social callback   + */ +class SocialListener +{ +public: + /**    + *@brief the interface of social callback  + *@param the id of callback + *@param the information of callback + */ + virtual void onSocialResult(SocialRetCode code, const char* msg) = 0; +}; + +/**    + *@class  ProtocolSocial + *@brief the interface of social   + */ +class ProtocolSocial : public PluginProtocol +{ +public: + + /** + @brief user signIn + */ + virtual void signIn() = 0; + + /** + @brief user signOut + */ + virtual void signOut() = 0; + + /** + @brief submit the score + @param leaderboardID + @param the score + */ + virtual void submitScore(const char* leadboardID, long score) = 0; + /** + @brief show the id of Leaderboard page + @param leaderboardID + */ + virtual void showLeaderboard(const char* leaderboardID) = 0; + + /** + @brief methods of achievement feature + @param the info of achievement + */ + virtual void unlockAchievement(TAchievementInfo achInfo) = 0; + /** + @brief show the page of achievements + */ + virtual void showAchievements() = 0; + /** + @brief set pListener The callback object for social result + @param the listener + */ + virtual void setListener(SocialListener* listener) = 0; + /** + @brief get pListener The callback object for social result + @return the listener + */ + virtual SocialListener* getListener() = 0; +}; + +}} // namespace anysdk { namespace framework { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SOCIAL_H__ ----- */ diff --git a/ios/include/anysdk/ProtocolUser.h b/ios/include/anysdk/ProtocolUser.h new file mode 100644 index 00000000..14752215 --- /dev/null +++ b/ios/include/anysdk/ProtocolUser.h @@ -0,0 +1,134 @@ +/** @file ProtocolUser.h + */ +#ifndef __CCX_PROTOCOL_USER_H__ +#define __CCX_PROTOCOL_USER_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace anysdk { namespace framework { +/// \typedef std::map TUserDeveloperInfo +/// typedef TUserDeveloperInfo. +typedef std::map TUserDeveloperInfo; +/** @brief Plugin_type enum, with inline docs */ +typedef enum +{ + kInitSuccess = 0,/**< enum value is callback of succeeding in initing sdk. */ + kInitFail,/**< enum value is callback of failing to init sdk. */ + kLoginSuccess,/**< enum value is callback of succeeding in login.*/ + kLoginNetworkError,/**< enum value is callback of network error*/ + kLoginNoNeed,/**< enum value is callback of no need login.*/ + kLoginFail,/**< enum value is callback of failing to login. */ + kLoginCancel,/**< enum value is callback of canceling to login. */ + kLogoutSuccess,/**< enum value is callback of succeeding in logout. */ + kLogoutFail,/**< enum value is callback of failing to logout. */ + kPlatformEnter,/**< enum value is callback after enter platform. */ + kPlatformBack,/**< enum value is callback after exit antiAddiction. */ + kPausePage,/**< enum value is callback after exit pause page. */ + kExitPage,/**< enum value is callback after exit exit page. */ + kAntiAddictionQuery,/**< enum value is callback after querying antiAddiction. */ + kRealNameRegister,/**< enum value is callback after registering realname. */ + kAccountSwitchSuccess,/**< enum value is callback of succeeding in switching account. */ + kAccountSwitchFail,/**< enum value is callback of failing to switch account. */ + kOpenShop,/**< enum value is callback of open the shop. */ + kAccountSwitchCancel,/**< enum value is callback of canceling to switch account. */ + kUserExtension = 50000 /**< enum value is extension code . */ + + +} UserActionResultCode; +/** @brief ToolBarPlace enum, with inline docs */ +typedef enum +{ + kToolBarTopLeft = 1,/**< enum the toolbar is at topleft. */ + kToolBarTopRight,/**< enum the toolbar is at topright. */ + kToolBarMidLeft,/**< enum the toolbar is at midleft. */ + kToolBarMidRight,/**< enum the toolbar is at midright. */ + kToolBarBottomLeft,/**< enum the toolbar is at bottomleft. */ + kToolBarBottomRight,/**< enum the toolbar is at bottomright. */ +} ToolBarPlace; + +class ProtocolUser; +/**    + *@class  UserActionListener + *@brief the interface of user callback   + */ +class UserActionListener +{ +public: + /**    + *@brief the interface of user callback  + *@param the adatper of plugin + *@param the id of callback + *@param the information of callback + */ + virtual void onActionResult(ProtocolUser* pPlugin, UserActionResultCode code, const char* msg) = 0; +}; +/**    + *  @class  ProtocolUser   + */ +class ProtocolUser : public PluginProtocol +{ +public: + + + /** + @brief User login + */ + virtual void login() = 0 ; + + /** + @brief User login + if the process of logining need to know the param of server_id , + you can use the function + and if you must change oauthloginserver, you can add the param of oauthLoginServer + @param server_id + @param oauthLoginServer + */ + + CC_DEPRECATED_ATTRIBUTE virtual void login(std::string server_id, std::string oauthLoginServer = "") = 0 ; + + /** + @brief User login + if the process of logining need to know the parameters , + you can use the function + @param the parameters + */ + virtual void login(std::map info) = 0 ; + + /** + @brief Check whether the user logined or not + @return If user logined, return value is true; + else return value is false. + */ + virtual bool isLogined() = 0 ; + + /** + @brief Get USER ID + @return If user logined, return value is userID; + else return value is empty string. + */ + virtual std::string getUserID() = 0 ; + /** + @brief set the result listener + @param pListener The callback object for user result + */ + virtual void setActionListener(UserActionListener* listener) = 0 ; + /** + @brief get pListener The callback object for user result + @return the listener + */ + virtual UserActionListener* getActionListener() = 0 ; + + /** + @brief get plugin id + @return the plugin id + */ + virtual std::string getPluginId() = 0 ; + + +}; + +}} // namespace anysdk { namespace framework { + +#endif /* __CCX_PROTOCOL_USER_H__ */ diff --git a/ios/include/anysdk/PushWrapper.h b/ios/include/anysdk/PushWrapper.h new file mode 100644 index 00000000..f2d53fe2 --- /dev/null +++ b/ios/include/anysdk/PushWrapper.h @@ -0,0 +1,28 @@ +// +// PushWrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-10-9. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import + +typedef enum +{ + ACTION_RET_RECEIVEMESSAGE = 0,/**value is callback of Receiving Message . */ + ACTION_RET_PUSHEXTENSION = 60000 /**value is extension code . */ +} PUSH_RET_CODE; + +@interface PushWrapper : NSObject + +/** + * the callback interface of push system + * + * @param pPlugin the push plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void) onActionResult:(id)pPlugin retCode:(int)ret retMsg:(NSString*)msg; + +@end diff --git a/ios/include/anysdk/RECWrapper.h b/ios/include/anysdk/RECWrapper.h new file mode 100644 index 00000000..f6243a05 --- /dev/null +++ b/ios/include/anysdk/RECWrapper.h @@ -0,0 +1,34 @@ +// +// RECWrapper.h +// PluginProtocol +// + + +#import +typedef enum +{ + RECRESULT_RECINITSUCCESSS = 0,/**< enum value is callback of succeeding in initing sdk . */ + RECRESULT_RECINITFAIL,/**< enum value is callback of failing to init sdk. */ + RECRESULT_RECSTARTRECORDING,/**< enum value is callback of starting to record. */ + RECRESULT_RECSTOPRECORDING,/**< enum value is callback of stoping to record. */ + RECRESULT_RECPAUSEECORDING,/**< enum value is callback of pausing to record. */ + RECRESULT_RECRESUMERECORDING,/**< enum value is callback of resuming to record. */ + RECRESULT_RECENTERSDKPAGE,/**< enum value is callback of entering SDK`s page. */ + RECRESULT_RECQUITSDKPAGE,/**< enum value is callback of quiting SDK`s page. */ + RECRESULT_RECSHARESUCCESS,/**< enum value is callback of succeeding in sharing. */ + RECRESULT_RECSHAREFAIL,/**< enum value is callback of failing to share. */ + RECRESULT_RECEXTENSION = 90000 /**< enum value is extension code . */ +} REC_RET_CODE; + +@interface RECWrapper : NSObject + +/** + * The callback interface of REC system + * + * @param pPlugin the REC plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void) onRECResult:(id)pPlugin retCode:(int)ret retMsg:(NSString*)msg; + +@end diff --git a/ios/include/anysdk/SdkHttpListener.h b/ios/include/anysdk/SdkHttpListener.h new file mode 100644 index 00000000..43945413 --- /dev/null +++ b/ios/include/anysdk/SdkHttpListener.h @@ -0,0 +1,26 @@ +// +// SdkHttpListener.h +// PluginProtocol +// +// Created by cocos2dx on 14-9-9. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import + +//@protocol +@protocol SdkHttpListener + +/** + * network response + * + * @param response the response message + */ +- (void) onResponse:(NSString*)response; + +/** + * network return error + */ +- (void) onError; + +@end diff --git a/ios/include/anysdk/ShareWrapper.h b/ios/include/anysdk/ShareWrapper.h new file mode 100644 index 00000000..00009774 --- /dev/null +++ b/ios/include/anysdk/ShareWrapper.h @@ -0,0 +1,31 @@ +// +// ShareWrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-11-12. +// Copyright (c) 2014年 zhangbin. All rights reserved. +// + +#import + +typedef enum +{ + SHARERESULT_SUCCESS = 0,/**< enum value is callback of failing to sharing . */ + SHARERESULT_FAIL,/**< enum value is callback of failing to share . */ + SHARERESULT_CANCEL,/**< enum value is callback of canceling to share . */ + SHARERESULT_NETWORK_ERROR, /**< enum value is callback of network error . */ + SHARERESULT_SHAREEXTENSION = 10000 /**< enum value is extension code . */ +} SHARE_RET_CODE; + +@interface ShareWrapper : NSObject + +/** + * The callback interface of share system + * + * @param pPlugin the share plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void) onShareResult:(id)pPlugin retCode:(int)ret retMsg:(NSString*)msg; + +@end diff --git a/ios/include/anysdk/SocialWrapper.h b/ios/include/anysdk/SocialWrapper.h new file mode 100644 index 00000000..1eb2ea84 --- /dev/null +++ b/ios/include/anysdk/SocialWrapper.h @@ -0,0 +1,38 @@ +// +// SocialWrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-10-9. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import + +typedef enum +{ + // code for leaderboard feature + SOCIAL_SUBMITSCORE_SUCCEED = 0,/**< enum value is callback of succeeding in submiting. */ + SOCIAL_SUBMITSCORE_FAIL,/**< enum value is callback of failing to submit . */ + // code for achievement feature + SOCIAL_UNLOCKACH_SUCCEED,/**< enum value is callback of succeeding in unlocking. */ + SOCIAL_UNLOCKACH_FAIL,/**< enum value is callback of failing to unlock. */ + SOCIAL_SIGNIN_SUCCEED,/**< enum value is callback of succeeding to login. */ + SOCIAL_SIGNIN_FAIL,/**< enum value is callback of failing to login. */ + SOCIAL_SIGNOUT_SUCCEED,/**< enum value is callback of succeeding to login. */ + SOCIAL_SIGNOUT_FAIL ,/**< enum value is callback of failing to login. */ + SOCIAL_GET_GAME_FRIENDS,/**< enum value is callback of getGameFriends. */ + SOCIAL_SOCIALEXTENSION = 20000/**< enum value is extension code . */ +} SOCIAL_RET_CODE; + +@interface SocialWrapper : NSObject + +/** + * The callback interface of social system + * + * @param pPlugin the social plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void) onSocialResult:(id)pPlugin retCode:(int)ret retMsg:(NSString*)msg; + +@end diff --git a/ios/include/anysdk/UserWrapper.h b/ios/include/anysdk/UserWrapper.h new file mode 100644 index 00000000..126a9a96 --- /dev/null +++ b/ios/include/anysdk/UserWrapper.h @@ -0,0 +1,67 @@ +// +// UserWrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-9-4. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import +#import "InterfaceUser.h" + + +typedef enum +{ + ACTION_RET_INIT_SUCCESS = 0,/**< enum value is callback of succeeding in initing sdk. */ + ACTION_RET_INIT_FAIL,/**< enum value is callback of failing to init sdk. */ + ACTION_RET_LOGIN_SUCCESS,/**< enum value is callback of succeeding in login.*/ + ACTION_RET_LOGIN_TIMEOUT,/**< enum value is callback of network error*/ + ACTION_RET_LOGIN_NO_NEED,/**< enum value is callback of no need login.*/ + ACTION_RET_LOGIN_FAIL,/**< enum value is callback of failing to login. */ + ACTION_RET_LOGIN_CANCEL,/**< enum value is callback of canceling to login. */ + ACTION_RET_LOGOUT_SUCCESS,/**< enum value is callback of succeeding in logout. */ + ACTION_RET_LOGOUT_FAIL,/**< enum value is callback of failing to logout. */ + ACTION_RET_PLATFORM_ENTER,/**< enum value is callback after enter platform. */ + ACTION_RET_PLATFORM_BACK,/**< enum value is callback after exit antiAddiction. */ + ACTION_RET_PAUSE_PAGE,/**< enum value is callback after exit pause page. */ + ACTION_RET_EXIT_PAGE,/**< enum value is callback after exit exit page. */ + ACTION_RET_ANTIADDICTIONQUERY,/**< enum value is callback after querying antiAddiction. */ + ACTION_RET_REALNAMEREGISTER,/**< enum value is callback after registering realname. */ + ACTION_RET_ACCOUNTSWITCH_SUCCESS,/**< enum value is callback of succeeding in switching account. */ + ACTION_RET_ACCOUNTSWITCH_FAIL,/**< enum value is callback of failing to switch account. */ + ACTION_RET_OPENSHOP,/**< enum value is callback of open the shop. */ + ACTION_RET_ACCOUNTSWITCH_CANCEL,/**< enum value is callback of canceling to switch account. */ + ACTION_RET_USEREXTENSION = 50000 /**< enum value is extension code . */ + +} USER_RET_CODE; + +@interface UserWrapper : NSObject +/** + * The callback interface of user system + * + * @param pPlugin the user plugin + * @param ret the code of callback + * @param msg the message of callback + */ ++ (void) onActionResult:(id)pPlugin retCode:(int)ret retMsg:(NSString*)msg; + +/** + * The login authentication + * + * @param data the parameters + * @param target target description + * @param sel sel description + */ ++ (void) getAccessToken:(NSMutableDictionary*)data target:(id)target sel:(SEL)sel; + +/** + * + * @Title: relaceLoginOauthURL + * @Description:According to server,it changes login oauth url http://changed_host/ + * @return replace url + */ ++ (NSString*)replaceLoginOauthURL:url; + + +@end + diff --git a/ios/include/anysdk/Wrapper.h b/ios/include/anysdk/Wrapper.h new file mode 100644 index 00000000..cc4d410b --- /dev/null +++ b/ios/include/anysdk/Wrapper.h @@ -0,0 +1,110 @@ +// +// Wrapper.h +// PluginProtocol +// +// Created by cocos2dx on 14-8-29. +// Copyright (c) 2014年 cocos2dx. All rights reserved. +// + +#import +#import "CocosRuntimeDelegate.h" + +@interface Wrapper : NSObject + +/** + * init developer.xml + */ ++ (void) analysisDeveloperInfo; + +/** + * check application + * + * @param appKey the value of appkey from AnySDK Client + * @param appSeceret the value of appSeceret from AnySDK Client + * @param privateKey the value of privateKey from AnySDK Client + * @param oauthLoginServer the value of appkey from AnySDK Client + */ ++ (void) setAppParam:(const char*)appKey AppSecret:(const char*)appSeceret PrivateKey:(const char*)privateKey OauthLoginServer:(const char*)oauthLoginServer; + +/** + * get the parameters of SDK + * + * @return the parameters of SDK + */ ++ (NSMutableDictionary*) getDeveloperInfo; + +/** + * get the information of channel + * + * @return the information of channel + */ ++ (NSMutableDictionary*) getChannelInfo; + +/** + * get the information of game + * + * @return the information of game + */ ++ (NSMutableDictionary*) getGameInfo; + +/** + * get the information of plugin + * + * @return the information of plugin + */ ++ (NSMutableDictionary*) getPluginInfo; + +/** + * get the information of tool + * + * @return the information of tool + */ ++ (NSMutableDictionary*) getToolInfo; + +/** + * get support for plug-ins + * + * @return support for plug-ins + */ ++ (NSMutableArray*) getSupportForPlugins; + +/** + * NSMutableDictionary change to NSString + * + * @param dict NSMutableDictionary value + * + * @return NSString value + */ ++ (NSString*)dictToNSString:(NSMutableDictionary*)dict; + +/** + * get the identifier of value + * + * @return the identifier of value + */ ++ (NSString*)getChannelId; + +/** + * get custom parameter from AnySDK Client + * + * @return return value description + */ ++ (NSString*) getCustomParam; + ++ (BOOL)networkReachable; + ++ (NSString*) replaceNotifyURL:(Class)class1 url:(NSString*)url; + ++ (void)reset; + +//about cocos runtime ++ (id)getCocosRuntimeSDKProxy; + ++ (void)setCocosRuntimeSDKProxy:(id)runtimeProxy; + ++ (int)getCocosRuntimeSDKVersionCode; + ++ (void)setCocosRuntimeSDKVersionCode:(int)sdkVersionCode; + + +@end diff --git a/ios/libs/libPluginProtocol.a b/ios/libs/libPluginProtocol.a new file mode 100644 index 00000000..3e9ef23c Binary files /dev/null and b/ios/libs/libPluginProtocol.a differ diff --git a/versions.txt b/versions.txt index 94dc441f..683a5597 100644 --- a/versions.txt +++ b/versions.txt @@ -45,3 +45,9 @@ spider monkey win32: v33 ios: v33 android: v33 + +anysdk + mac: -- + win32: -- + android 2.2.1 + ios 2.2.1