platform/shared/common/RhodesApp.h in rhodes-2.0.3 vs platform/shared/common/RhodesApp.h in rhodes-2.1.0

- old
+ new

@@ -1,121 +1,117 @@ #pragma once +#include "RhodesAppBase.h" + #ifdef __cplusplus -#include "logging/RhoLog.h" -#include "common/RhoThread.h" #include "net/INetRequest.h" -#include "common/IRhoClassFactory.h" + #include "net/HttpServer.h" -#include "rubyext/GeoLocation.h" #include "SplashScreen.h" #include "AppMenu.h" + #undef DEFAULT_LOGCATEGORY #define DEFAULT_LOGCATEGORY "RhodesApp" -struct shttpd_ctx; - namespace rho { namespace common { -class CRhodesApp : public common::CRhoThread +class CRhodesApp : public CRhodesAppBase { public: DEFINE_LOGCLASS; private: - static CRhodesApp* m_pInstance; CRhodesApp(const String& strRootPath); boolean m_bExit; common::CAutoPtr<common::IRhoClassFactory> m_ptrFactory; common::CAutoPtr<net::INetRequest> m_NetRequest; String m_strListeningPorts; + common::CAutoPtr<net::CHttpServer> m_httpServer; - String m_strRhoRootPath, m_strLoadingPagePath, m_strLoadingPngPath, m_strBlobsDirPath, m_strDBDirPath; - String m_strHomeUrl, m_strStartUrl, m_strOptionsUrl, m_strRhobundleReloadUrl, m_strFirstStartUrl; + CSplashScreen m_oSplashScreen; + CAppMenu m_oAppMenu; + + String m_strLoadingPagePath, m_strLoadingPngPath; + String m_strStartUrl, m_strOptionsUrl, m_strRhobundleReloadUrl, m_strFirstStartUrl; String m_strRhoMessage; int m_currentTabIndex; String m_currentUrls[5]; String m_strAppBackUrl, m_strAppBackUrlOrig; Vector<ICallbackObject*> m_arCallbackObjects; - rubyext::CGeoLocation m_oGeoLocation; - CSplashScreen m_oSplashScreen; common::CMutex m_mxPushCallback; String m_strPushCallback, m_strPushCallbackParams; common::CMutex m_mxScreenRotationCallback; String m_strScreenRotationCallback, m_strScreenRotationCallbackParams; + + boolean m_bDeactivationMode; - CAppMenu m_oAppMenu; - public: ~CRhodesApp(void); static CRhodesApp* Create(const String& strRootPath); static void Destroy(); - static CRhodesApp* getInstance(){ return m_pInstance; } + static CRhodesApp* getInstance(){ return (CRhodesApp*)m_pInstance; } void startApp(); void stopApp(); - String canonicalizeRhoUrl(const String& strUrl) ; void keepLastVisitedUrl(String strUrl); void navigateToUrl( const String& strUrl); void navigateBack(); + + boolean deactivationMode() const {return m_bDeactivationMode;} const String& getRhobundleReloadUrl(); const String& getStartUrl(); const String& getOptionsUrl(); const String& getCurrentUrl(int index = 0); const String& getFirstStartUrl(); - const String& getHomeUrl(){ return m_strHomeUrl; } const String& getLoadingPngPath(){return m_strLoadingPngPath;} const String& getLoadingPagePath(){return m_strLoadingPagePath; } - const String& getBlobsDirPath(){return m_strBlobsDirPath; } - const String& getDBDirPath(){return m_strDBDirPath; } - String resolveDBFilesPath(const String& strFilePath); - const String& getRhoRootPath(){return m_strRhoRootPath;} const String& getAppBackUrl(){return m_strAppBackUrl;} void setAppBackUrl(const String& url); String getAppTitle(); void callCameraCallback(String strCallbackUrl, const String& strImagePath, const String& strError, boolean bCancel ); + void callSignatureCallback(String strCallbackUrl, const String& strSignaturePath, const String& strError, boolean bCancel ); void callDateTimeCallback(String strCallbackUrl, long lDateTime, const char* szData, int bCancel ); void callAppActiveCallback(boolean bActive); void callPopupCallback(String strCallbackUrl, const String &id, const String &title); CAppMenu& getAppMenu (void) { return m_oAppMenu; } - + CSplashScreen& getSplashScreen(){return m_oSplashScreen;} + boolean sendLog(); String addCallbackObject(ICallbackObject* pCallbackObject, String strName); unsigned long getCallbackObject(int nIndex); const String& getRhoMessage(int nError, const char* szName); - rubyext::CGeoLocation& getGeo(){ return m_oGeoLocation;} - CSplashScreen& getSplashScreen(){return m_oSplashScreen;} - void runCallbackInThread(const String& strCallback, const String& strBody); void setPushNotification(String strUrl, String strParams ); boolean callPushCallback(String strData); void setScreenRotationNotification(String strUrl, String strParams); void callScreenRotationCallback(int width, int height, int degrees); void loadUrl(String url); -private: + boolean isLocalServerStarted(); + +protected: virtual void run(); void initHttpServer(); void initAppUrls(); @@ -135,11 +131,10 @@ #endif //__cplusplus void rho_rhodesapp_create(const char* szRootPath); void rho_rhodesapp_start(); void rho_rhodesapp_destroy(); -const char* rho_native_rhopath(); const char* rho_rhodesapp_getstarturl(); const char* rho_rhodesapp_getfirststarturl(); const char* rho_rhodesapp_gethomeurl(); @@ -160,10 +155,12 @@ char* rho_http_normalizeurl(const char* szUrl); void rho_http_free(void* data); void rho_rhodesapp_callCameraCallback(const char* strCallbackUrl, const char* strImagePath, const char* strError, int bCancel ); +void rho_rhodesapp_callSignatureCallback(const char* strCallbackUrl, const char* strSignaturePath, + const char* strError, int bCancel ); void rho_rhodesapp_callDateTimeCallback(const char* strCallbackUrl, long lDateTime, const char* szData, int bCancel ); void rho_rhodesapp_callAppActiveCallback(int nActive); unsigned long rho_rhodesapp_GetCallbackObject(int nIndex); void rho_rhodesapp_setViewMenu(unsigned long valMenu); @@ -180,9 +177,13 @@ int rho_base64_decode(const char *src, int srclen, char *dst); void rho_net_request(const char *url); void rho_rhodesapp_load_url(const char *url); + +int rho_rhodesapp_check_mode(); + +int rho_is_local_server_started(); #ifdef __cplusplus }; #endif //__cplusplus