Updated Branches: refs/heads/master 916f0afbd -> 06a6095c4
CB-219 Rename PhoneGap to Cordova Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/commit/06a6095c Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/tree/06a6095c Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/diff/06a6095c Branch: refs/heads/master Commit: 06a6095c4ed2fed3028d9beebde8ead7b247f0fb Parents: 009f631 Author: Anis Kadri <anis.ka...@gmail.com> Authored: Wed Feb 8 16:22:19 2012 -0800 Committer: Anis Kadri <anis.ka...@gmail.com> Committed: Wed Feb 8 16:22:19 2012 -0800 ---------------------------------------------------------------------- .project | 2 +- inc/Accelerometer.h | 4 +- inc/Compass.h | 4 +- inc/Contacts.h | 4 +- inc/Cordova.h | 61 ++++++++++++++++++++ inc/CordovaCommand.h | 29 ++++++++++ inc/DebugConsole.h | 4 +- inc/Device.h | 4 +- inc/GeoLocation.h | 4 +- inc/Kamera.h | 4 +- inc/Network.h | 4 +- inc/Notification.h | 4 +- inc/PhoneGap.h | 61 -------------------- inc/PhoneGapCommand.h | 29 ---------- inc/WebForm.h | 4 +- src/Accelerometer.cpp | 2 +- src/Compass.cpp | 2 +- src/Contacts.cpp | 2 +- src/Cordova.cpp | 127 ++++++++++++++++++++++++++++++++++++++++++ src/CordovaCommand.cpp | 16 +++++ src/CordovaEntry.cpp | 45 +++++++++++++++ src/DebugConsole.cpp | 2 +- src/Device.cpp | 2 +- src/GeoLocation.cpp | 2 +- src/Kamera.cpp | 2 +- src/Network.cpp | 2 +- src/Notification.cpp | 2 +- src/PhoneGap.cpp | 127 ------------------------------------------ src/PhoneGapCommand.cpp | 16 ----- src/PhoneGapEntry.cpp | 45 --------------- src/WebForm.cpp | 46 ++++++++-------- 31 files changed, 331 insertions(+), 331 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/.project ---------------------------------------------------------------------- diff --git a/.project b/.project index 659de2c..98aa230 100755 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>PhoneGap</name> + <name>Cordova</name> <comment></comment> <projects> </projects> http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Accelerometer.h ---------------------------------------------------------------------- diff --git a/inc/Accelerometer.h b/inc/Accelerometer.h index 47b59d7..ca43939 100755 --- a/inc/Accelerometer.h +++ b/inc/Accelerometer.h @@ -8,12 +8,12 @@ #ifndef ACCELEROMETER_H_ #define ACCELEROMETER_H_ -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" #include <FUix.h> using namespace Osp::Uix; -class Accelerometer: public PhoneGapCommand, ISensorEventListener +class Accelerometer: public CordovaCommand, ISensorEventListener { public: Accelerometer(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Compass.h ---------------------------------------------------------------------- diff --git a/inc/Compass.h b/inc/Compass.h index c6775cc..ee9f6b2 100755 --- a/inc/Compass.h +++ b/inc/Compass.h @@ -9,11 +9,11 @@ #define COMPASS_H_ #include <FUix.h> -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" using namespace Osp::Uix; -class Compass: public PhoneGapCommand, ISensorEventListener { +class Compass: public CordovaCommand, ISensorEventListener { public: Compass(Web* pWeb); virtual ~Compass(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Contacts.h ---------------------------------------------------------------------- diff --git a/inc/Contacts.h b/inc/Contacts.h index bf95102..71dad11 100755 --- a/inc/Contacts.h +++ b/inc/Contacts.h @@ -9,11 +9,11 @@ #define CONTACTS_H_ #include <FSocial.h> -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" using namespace Osp::Social; using namespace Osp::Base::Collection; -class Contacts: public PhoneGapCommand { +class Contacts: public CordovaCommand { public: Contacts(Web* pWeb); virtual ~Contacts(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Cordova.h ---------------------------------------------------------------------- diff --git a/inc/Cordova.h b/inc/Cordova.h new file mode 100755 index 0000000..0c95c9f --- /dev/null +++ b/inc/Cordova.h @@ -0,0 +1,61 @@ +#ifndef __CORDOVA_H__ +#define __CORDOVA_H__ + + +#include <FApp.h> +#include <FBase.h> +#include <FSystem.h> +#include <FUi.h> + +/** + * [WebBasedApp] application must inherit from Application class + * which provides basic features necessary to define an application. + */ +class Cordova : + public Osp::App::Application, + public Osp::System::IScreenEventListener +{ +public: + + /** + * [Cordova] application must have a factory method that creates an instance of itself. + */ + static Osp::App::Application* CreateInstance(void); + + +public: + Cordova(); + ~Cordova(); + + +public: + + + // Called when the application is initializing. + bool OnAppInitializing(Osp::App::AppRegistry& appRegistry); + + // Called when the application is terminating. + bool OnAppTerminating(Osp::App::AppRegistry& appRegistry, bool forcedTermination = false); + + + // Called when the application's frame moves to the top of the screen. + void OnForeground(void); + + + // Called when this application's frame is moved from top of the screen to the background. + void OnBackground(void); + + // Called when the system memory is not sufficient to run the application any further. + void OnLowMemory(void); + + // Called when the battery level changes. + void OnBatteryLevelChanged(Osp::System::BatteryLevel batteryLevel); + + // Called when the screen turns on. + void OnScreenOn (void); + + // Called when the screen turns off. + void OnScreenOff (void); +}; + +#endif //__CORDOVA_H__ http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/CordovaCommand.h ---------------------------------------------------------------------- diff --git a/inc/CordovaCommand.h b/inc/CordovaCommand.h new file mode 100755 index 0000000..5f18b01 --- /dev/null +++ b/inc/CordovaCommand.h @@ -0,0 +1,29 @@ +/* + * CordovaCommand.h + * + * Created on: Mar 7, 2011 + * Author: Anis Kadri + */ + +#ifndef CORDOVACOMMAND_H_ +#define CORDOVACOMMAND_H_ + +#include <FWeb.h> +#include <FBase.h> + +using namespace Osp::Web::Controls; +using namespace Osp::Base; +using namespace Osp::Base::Utility; + +class CordovaCommand { +public: + CordovaCommand(); + CordovaCommand(Web* pWeb); + virtual ~CordovaCommand(); +protected: + Web* pWeb; +public: + virtual void Run(const String& command) =0; +}; + +#endif /* CORDOVACOMMAND_H_ */ http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/DebugConsole.h ---------------------------------------------------------------------- diff --git a/inc/DebugConsole.h b/inc/DebugConsole.h index 71d7d08..21493da 100755 --- a/inc/DebugConsole.h +++ b/inc/DebugConsole.h @@ -8,9 +8,9 @@ #ifndef DEBUGCONSOLE_H_ #define DEBUGCONSOLE_H_ -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" -class DebugConsole: public PhoneGapCommand { +class DebugConsole: public CordovaCommand { public: DebugConsole(Web* pWeb); virtual ~DebugConsole(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Device.h ---------------------------------------------------------------------- diff --git a/inc/Device.h b/inc/Device.h index 32d31fe..47e5dcb 100755 --- a/inc/Device.h +++ b/inc/Device.h @@ -8,12 +8,12 @@ #ifndef DEVICE_H_ #define DEVICE_H_ -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" #include <FSystem.h> using namespace Osp::System; -class Device: public PhoneGapCommand { +class Device: public CordovaCommand { public: Device(); Device(Web* pWeb); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/GeoLocation.h ---------------------------------------------------------------------- diff --git a/inc/GeoLocation.h b/inc/GeoLocation.h index 3f637b5..e157f6c 100755 --- a/inc/GeoLocation.h +++ b/inc/GeoLocation.h @@ -8,12 +8,12 @@ #ifndef GEOLOCATION_H_ #define GEOLOCATION_H_ -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" #include <FLocations.h> using namespace Osp::Locations; -class GeoLocation: public PhoneGapCommand, ILocationListener { +class GeoLocation: public CordovaCommand, ILocationListener { private: LocationProvider* locProvider; bool watching; http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Kamera.h ---------------------------------------------------------------------- diff --git a/inc/Kamera.h b/inc/Kamera.h index aef22bd..0814831 100755 --- a/inc/Kamera.h +++ b/inc/Kamera.h @@ -8,7 +8,7 @@ #ifndef KAMERA_H_ #define KAMERA_H_ -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" #include <FApp.h> #include <FIo.h> @@ -16,7 +16,7 @@ using namespace Osp::App; using namespace Osp::Base::Collection; using namespace Osp::Io; -class Kamera: public PhoneGapCommand, IAppControlEventListener { +class Kamera: public CordovaCommand, IAppControlEventListener { public: Kamera(Web* pWeb); virtual ~Kamera(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Network.h ---------------------------------------------------------------------- diff --git a/inc/Network.h b/inc/Network.h index 2e483ea..be173ec 100755 --- a/inc/Network.h +++ b/inc/Network.h @@ -8,7 +8,7 @@ #ifndef NETWORK_H_ #define NETWORK_H_ -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" #include <FNet.h> #include <FSystem.h> @@ -16,7 +16,7 @@ using namespace Osp::Net; using namespace Osp::Net::Http; using namespace Osp::System; -class Network: public PhoneGapCommand, public IHttpTransactionEventListener { +class Network: public CordovaCommand, public IHttpTransactionEventListener { public: Network(Web* pWeb); virtual ~Network(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/Notification.h ---------------------------------------------------------------------- diff --git a/inc/Notification.h b/inc/Notification.h index d6094f7..0756d08 100755 --- a/inc/Notification.h +++ b/inc/Notification.h @@ -11,13 +11,13 @@ #include <FUi.h> #include <FUix.h> #include <FSystem.h> -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" using namespace Osp::System; using namespace Osp::Ui; using namespace Osp::Ui::Controls; using namespace Osp::Uix; -class Notification: public PhoneGapCommand { +class Notification: public CordovaCommand { public: Notification(Web* pWeb); virtual ~Notification(); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/PhoneGap.h ---------------------------------------------------------------------- diff --git a/inc/PhoneGap.h b/inc/PhoneGap.h deleted file mode 100755 index 19f17db..0000000 --- a/inc/PhoneGap.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __PHONEGAP_H__ -#define __PHONEGAP_H__ - - -#include <FApp.h> -#include <FBase.h> -#include <FSystem.h> -#include <FUi.h> - -/** - * [WebBasedApp] application must inherit from Application class - * which provides basic features necessary to define an application. - */ -class PhoneGap : - public Osp::App::Application, - public Osp::System::IScreenEventListener -{ -public: - - /** - * [PhoneGap] application must have a factory method that creates an instance of itself. - */ - static Osp::App::Application* CreateInstance(void); - - -public: - PhoneGap(); - ~PhoneGap(); - - -public: - - - // Called when the application is initializing. - bool OnAppInitializing(Osp::App::AppRegistry& appRegistry); - - // Called when the application is terminating. - bool OnAppTerminating(Osp::App::AppRegistry& appRegistry, bool forcedTermination = false); - - - // Called when the application's frame moves to the top of the screen. - void OnForeground(void); - - - // Called when this application's frame is moved from top of the screen to the background. - void OnBackground(void); - - // Called when the system memory is not sufficient to run the application any further. - void OnLowMemory(void); - - // Called when the battery level changes. - void OnBatteryLevelChanged(Osp::System::BatteryLevel batteryLevel); - - // Called when the screen turns on. - void OnScreenOn (void); - - // Called when the screen turns off. - void OnScreenOff (void); -}; - -#endif //__PHONEGAP_H__ http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/PhoneGapCommand.h ---------------------------------------------------------------------- diff --git a/inc/PhoneGapCommand.h b/inc/PhoneGapCommand.h deleted file mode 100755 index d780c4b..0000000 --- a/inc/PhoneGapCommand.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * PhoneGapCommand.h - * - * Created on: Mar 7, 2011 - * Author: Anis Kadri - */ - -#ifndef PHONEGAPCOMMAND_H_ -#define PHONEGAPCOMMAND_H_ - -#include <FWeb.h> -#include <FBase.h> - -using namespace Osp::Web::Controls; -using namespace Osp::Base; -using namespace Osp::Base::Utility; - -class PhoneGapCommand { -public: - PhoneGapCommand(); - PhoneGapCommand(Web* pWeb); - virtual ~PhoneGapCommand(); -protected: - Web* pWeb; -public: - virtual void Run(const String& command) =0; -}; - -#endif /* PHONEGAPCOMMAND_H_ */ http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/inc/WebForm.h ---------------------------------------------------------------------- diff --git a/inc/WebForm.h b/inc/WebForm.h index 2afada6..90b8d35 100755 --- a/inc/WebForm.h +++ b/inc/WebForm.h @@ -6,7 +6,7 @@ #include <FUi.h> #include <FWeb.h> #include <FSystem.h> -#include "PhoneGapCommand.h" +#include "CordovaCommand.h" #include "GeoLocation.h" #include "Device.h" #include "Accelerometer.h" @@ -52,7 +52,7 @@ private: Contacts* contacts; Notification* notification; Kamera* camera; - String* __phonegapCommand; + String* __cordovaCommand; public: virtual result OnInitializing(void); http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Accelerometer.cpp ---------------------------------------------------------------------- diff --git a/src/Accelerometer.cpp b/src/Accelerometer.cpp index 710a0e6..75c7aee 100755 --- a/src/Accelerometer.cpp +++ b/src/Accelerometer.cpp @@ -12,7 +12,7 @@ Accelerometer::Accelerometer() { started = false; } -Accelerometer::Accelerometer(Web* pWeb): PhoneGapCommand(pWeb) { +Accelerometer::Accelerometer(Web* pWeb): CordovaCommand(pWeb) { __sensorMgr.Construct(); started = false; x = y = z = 0.0; http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Compass.cpp ---------------------------------------------------------------------- diff --git a/src/Compass.cpp b/src/Compass.cpp index 54b6119..b2f6de7 100755 --- a/src/Compass.cpp +++ b/src/Compass.cpp @@ -7,7 +7,7 @@ #include "../inc/Compass.h" -Compass::Compass(Web* pWeb) : PhoneGapCommand(pWeb) { +Compass::Compass(Web* pWeb) : CordovaCommand(pWeb) { __sensorMgr.Construct(); started = false; x = y = z = 0.0; http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Contacts.cpp ---------------------------------------------------------------------- diff --git a/src/Contacts.cpp b/src/Contacts.cpp index 3feb854..8ef29e7 100755 --- a/src/Contacts.cpp +++ b/src/Contacts.cpp @@ -7,7 +7,7 @@ #include "../inc/Contacts.h" -Contacts::Contacts(Web* pWeb) : PhoneGapCommand(pWeb) { +Contacts::Contacts(Web* pWeb) : CordovaCommand(pWeb) { } Contacts::~Contacts() { http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Cordova.cpp ---------------------------------------------------------------------- diff --git a/src/Cordova.cpp b/src/Cordova.cpp new file mode 100755 index 0000000..d32a8f3 --- /dev/null +++ b/src/Cordova.cpp @@ -0,0 +1,127 @@ +/** + * Name : PhoneGap + * Version : + * Vendor : + * Description : + */ + +#include "Cordova.h" +#include "WebForm.h" + +using namespace Osp::App; +using namespace Osp::Base; +using namespace Osp::System; +using namespace Osp::Ui; +using namespace Osp::Ui::Controls; + +Cordova::Cordova() +{ +} + +Cordova::~Cordova() +{ +} + +Application* +Cordova::CreateInstance(void) +{ + // Create the instance through the constructor. + return new Cordova(); +} + +bool +Cordova::OnAppInitializing(AppRegistry& appRegistry) +{ + // TODO: + // Initialize UI resources and application specific data. + // The application's permanent data and context can be obtained from the appRegistry. + // + // If this method is successful, return true; otherwise, return false. + // If this method returns false, the application will be terminated. + + // Uncomment the following statement to listen to the screen on/off events. + //PowerManager::SetScreenEventListener(*this); + + Frame *pFrame = null; + result r = E_SUCCESS; + + // Create a form + WebForm *pWebForm = new WebForm(); + + r = pWebForm->Construct(FORM_STYLE_INDICATOR); + if (IsFailed(r)) + { + AppLog("WebForm Construct() has failed.\n"); + goto CATCH; + } + + // Add the form to the frame + pFrame = GetAppFrame()->GetFrame(); + pFrame->AddControl(*pWebForm); + + // Set the current form + pFrame->SetCurrentForm(*pWebForm); + + // Draw and Show the form + pWebForm->Draw(); + pWebForm->Show(); + + return true; + +CATCH: + return false; +} + +bool +Cordova::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) +{ + // TODO: + // Deallocate resources allocated by this application for termination. + // The application's permanent data and context can be saved via appRegistry. + return true; +} + +void +Cordova::OnForeground(void) +{ + // TODO: + // Start or resume drawing when the application is moved to the foreground. +} + +void +Cordova::OnBackground(void) +{ + // TODO: + // Stop drawing when the application is moved to the background. +} + +void +Cordova::OnLowMemory(void) +{ + // TODO: + // Free unused resources or close the application. +} + +void +Cordova::OnBatteryLevelChanged(BatteryLevel batteryLevel) +{ + // TODO: + // Handle any changes in battery level here. + // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL. +} + +void +Cordova::OnScreenOn (void) +{ + // TODO: + // Get the released resources or resume the operations that were paused or stopped in OnScreenOff(). +} + +void +Cordova::OnScreenOff (void) +{ + // TODO: + // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device to enter the sleep mode to save the battery. + // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a callback before the device enters the sleep mode. + // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one. +} http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/CordovaCommand.cpp ---------------------------------------------------------------------- diff --git a/src/CordovaCommand.cpp b/src/CordovaCommand.cpp new file mode 100755 index 0000000..2831e6a --- /dev/null +++ b/src/CordovaCommand.cpp @@ -0,0 +1,16 @@ +/* + * CordovaCommand.cpp + * + * Created on: Mar 7, 2011 + * Author: Anis Kadri + */ + +#include "CordovaCommand.h" + +CordovaCommand::CordovaCommand() : pWeb(null) { +} +CordovaCommand::CordovaCommand(Web* pWeb) : pWeb(pWeb) { +} + +CordovaCommand::~CordovaCommand() { +} http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/CordovaEntry.cpp ---------------------------------------------------------------------- diff --git a/src/CordovaEntry.cpp b/src/CordovaEntry.cpp new file mode 100755 index 0000000..78fbba4 --- /dev/null +++ b/src/CordovaEntry.cpp @@ -0,0 +1,45 @@ +/** + * This file contains the bada application entry point. + */ +#include "Cordova.h" + +using namespace Osp::Base; +using namespace Osp::Base::Collection; + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +_EXPORT_ int OspMain(int argc, char *pArgv[]); + +/** + * The entry function of bada application called by the operating system. + */ +int +OspMain(int argc, char *pArgv[]) +{ + result r = E_SUCCESS; + + AppLog("Application started."); + ArrayList* pArgs = new ArrayList(); + pArgs->Construct(); + for (int i = 0; i < argc; i++) + pArgs->Add(*(new String(pArgv[i]))); + + r = Osp::App::Application::Execute(Cordova::CreateInstance, pArgs); + if (IsFailed(r)) + { + AppLogException("Application execution failed-[%s].", GetErrorMessage(r)); + r &= 0x0000FFFF; + } + + pArgs->RemoveAll(true); + delete pArgs; + AppLog("Application finished."); + + return static_cast<int>(r); +} +#ifdef __cplusplus +} +#endif // __cplusplus http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/DebugConsole.cpp ---------------------------------------------------------------------- diff --git a/src/DebugConsole.cpp b/src/DebugConsole.cpp index f77684a..e068670 100755 --- a/src/DebugConsole.cpp +++ b/src/DebugConsole.cpp @@ -7,7 +7,7 @@ #include "../inc/DebugConsole.h" -DebugConsole::DebugConsole(Web* pWeb): PhoneGapCommand(pWeb) { +DebugConsole::DebugConsole(Web* pWeb): CordovaCommand(pWeb) { // TODO Auto-generated constructor stub } http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Device.cpp ---------------------------------------------------------------------- diff --git a/src/Device.cpp b/src/Device.cpp index 9c2b7af..97835d2 100755 --- a/src/Device.cpp +++ b/src/Device.cpp @@ -12,7 +12,7 @@ Device::Device() { } -Device::Device(Web* pWeb): PhoneGapCommand(pWeb) { +Device::Device(Web* pWeb): CordovaCommand(pWeb) { } http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/GeoLocation.cpp ---------------------------------------------------------------------- diff --git a/src/GeoLocation.cpp b/src/GeoLocation.cpp index da9c673..d02de27 100755 --- a/src/GeoLocation.cpp +++ b/src/GeoLocation.cpp @@ -12,7 +12,7 @@ GeoLocation::GeoLocation() { } -GeoLocation::GeoLocation(Web* pWeb): PhoneGapCommand(pWeb) { +GeoLocation::GeoLocation(Web* pWeb): CordovaCommand(pWeb) { locProvider = new LocationProvider(); locProvider->Construct(LOC_METHOD_HYBRID); watching = false; http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Kamera.cpp ---------------------------------------------------------------------- diff --git a/src/Kamera.cpp b/src/Kamera.cpp index 5728803..5bf71a2 100755 --- a/src/Kamera.cpp +++ b/src/Kamera.cpp @@ -7,7 +7,7 @@ #include "../inc/Kamera.h" -Kamera::Kamera(Web* pWeb) : PhoneGapCommand(pWeb) { +Kamera::Kamera(Web* pWeb) : CordovaCommand(pWeb) { } Kamera::~Kamera() { http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Network.cpp ---------------------------------------------------------------------- diff --git a/src/Network.cpp b/src/Network.cpp index e2e7715..1b321ab 100755 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -7,7 +7,7 @@ #include "../inc/Network.h" -Network::Network(Web* pWeb) : PhoneGapCommand(pWeb) { +Network::Network(Web* pWeb) : CordovaCommand(pWeb) { } Network::~Network() { http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/Notification.cpp ---------------------------------------------------------------------- diff --git a/src/Notification.cpp b/src/Notification.cpp index 2727c12..bb5f958 100755 --- a/src/Notification.cpp +++ b/src/Notification.cpp @@ -7,7 +7,7 @@ #include "../inc/Notification.h" -Notification::Notification(Web* pWeb) : PhoneGapCommand(pWeb) { +Notification::Notification(Web* pWeb) : CordovaCommand(pWeb) { } Notification::~Notification() { http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/PhoneGap.cpp ---------------------------------------------------------------------- diff --git a/src/PhoneGap.cpp b/src/PhoneGap.cpp deleted file mode 100755 index 806e940..0000000 --- a/src/PhoneGap.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Name : PhoneGap - * Version : - * Vendor : - * Description : - */ - -#include "PhoneGap.h" -#include "WebForm.h" - -using namespace Osp::App; -using namespace Osp::Base; -using namespace Osp::System; -using namespace Osp::Ui; -using namespace Osp::Ui::Controls; - -PhoneGap::PhoneGap() -{ -} - -PhoneGap::~PhoneGap() -{ -} - -Application* -PhoneGap::CreateInstance(void) -{ - // Create the instance through the constructor. - return new PhoneGap(); -} - -bool -PhoneGap::OnAppInitializing(AppRegistry& appRegistry) -{ - // TODO: - // Initialize UI resources and application specific data. - // The application's permanent data and context can be obtained from the appRegistry. - // - // If this method is successful, return true; otherwise, return false. - // If this method returns false, the application will be terminated. - - // Uncomment the following statement to listen to the screen on/off events. - //PowerManager::SetScreenEventListener(*this); - - Frame *pFrame = null; - result r = E_SUCCESS; - - // Create a form - WebForm *pWebForm = new WebForm(); - - r = pWebForm->Construct(FORM_STYLE_INDICATOR); - if (IsFailed(r)) - { - AppLog("WebForm Construct() has failed.\n"); - goto CATCH; - } - - // Add the form to the frame - pFrame = GetAppFrame()->GetFrame(); - pFrame->AddControl(*pWebForm); - - // Set the current form - pFrame->SetCurrentForm(*pWebForm); - - // Draw and Show the form - pWebForm->Draw(); - pWebForm->Show(); - - return true; - -CATCH: - return false; -} - -bool -PhoneGap::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) -{ - // TODO: - // Deallocate resources allocated by this application for termination. - // The application's permanent data and context can be saved via appRegistry. - return true; -} - -void -PhoneGap::OnForeground(void) -{ - // TODO: - // Start or resume drawing when the application is moved to the foreground. -} - -void -PhoneGap::OnBackground(void) -{ - // TODO: - // Stop drawing when the application is moved to the background. -} - -void -PhoneGap::OnLowMemory(void) -{ - // TODO: - // Free unused resources or close the application. -} - -void -PhoneGap::OnBatteryLevelChanged(BatteryLevel batteryLevel) -{ - // TODO: - // Handle any changes in battery level here. - // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL. -} - -void -PhoneGap::OnScreenOn (void) -{ - // TODO: - // Get the released resources or resume the operations that were paused or stopped in OnScreenOff(). -} - -void -PhoneGap::OnScreenOff (void) -{ - // TODO: - // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device to enter the sleep mode to save the battery. - // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a callback before the device enters the sleep mode. - // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one. -} http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/PhoneGapCommand.cpp ---------------------------------------------------------------------- diff --git a/src/PhoneGapCommand.cpp b/src/PhoneGapCommand.cpp deleted file mode 100755 index 9f743e8..0000000 --- a/src/PhoneGapCommand.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * PhoneGapCommand.cpp - * - * Created on: Mar 7, 2011 - * Author: Anis Kadri - */ - -#include "PhoneGapCommand.h" - -PhoneGapCommand::PhoneGapCommand() : pWeb(null) { -} -PhoneGapCommand::PhoneGapCommand(Web* pWeb) : pWeb(pWeb) { -} - -PhoneGapCommand::~PhoneGapCommand() { -} http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/PhoneGapEntry.cpp ---------------------------------------------------------------------- diff --git a/src/PhoneGapEntry.cpp b/src/PhoneGapEntry.cpp deleted file mode 100755 index 453b544..0000000 --- a/src/PhoneGapEntry.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This file contains the bada application entry point. - */ -#include "PhoneGap.h" - -using namespace Osp::Base; -using namespace Osp::Base::Collection; - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -_EXPORT_ int OspMain(int argc, char *pArgv[]); - -/** - * The entry function of bada application called by the operating system. - */ -int -OspMain(int argc, char *pArgv[]) -{ - result r = E_SUCCESS; - - AppLog("Application started."); - ArrayList* pArgs = new ArrayList(); - pArgs->Construct(); - for (int i = 0; i < argc; i++) - pArgs->Add(*(new String(pArgv[i]))); - - r = Osp::App::Application::Execute(PhoneGap::CreateInstance, pArgs); - if (IsFailed(r)) - { - AppLogException("Application execution failed-[%s].", GetErrorMessage(r)); - r &= 0x0000FFFF; - } - - pArgs->RemoveAll(true); - delete pArgs; - AppLog("Application finished."); - - return static_cast<int>(r); -} -#ifdef __cplusplus -} -#endif // __cplusplus http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada/blob/06a6095c/src/WebForm.cpp ---------------------------------------------------------------------- diff --git a/src/WebForm.cpp b/src/WebForm.cpp index 84c5f59..52494c0 100755 --- a/src/WebForm.cpp +++ b/src/WebForm.cpp @@ -1,7 +1,7 @@ #include "WebForm.h" WebForm::WebForm(void) - :__pWeb(null), __phonegapCommand(null) + :__pWeb(null), __cordovaCommand(null) { geolocation = null; device = null; @@ -49,7 +49,7 @@ WebForm::OnTerminating(void) { result r = E_SUCCESS; -// delete __phonegapCommand; +// delete __cordovaCommand; // delete geolocation; // delete device; // delete accel; @@ -97,9 +97,9 @@ bool WebForm::OnLoadingRequested (const Osp::Base::String& url, WebNavigationType type) { AppLogDebug("URL REQUESTED %S", url.GetPointer()); if(url.StartsWith("gap://", 0)) { -// __phonegapCommand = null; +// __cordovaCommand = null; - __phonegapCommand = new String(url); + __cordovaCommand = new String(url); // FIXME: for some reason this does not work if we return true. Web freezes. // __pWeb->StopLoading(); // String* test; @@ -131,35 +131,35 @@ WebForm::OnLoadingCompleted() { delete deviceInfo; // Analyzing PhoneGap command - if(__phonegapCommand) { - if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Geolocation", 0)) { - geolocation->Run(*__phonegapCommand); + if(__cordovaCommand) { + if(__cordovaCommand->StartsWith(L"gap://com.phonegap.Geolocation", 0)) { + geolocation->Run(*__cordovaCommand); } - else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Accelerometer", 0)) { - accel->Run(*__phonegapCommand); + else if(__cordovaCommand->StartsWith(L"gap://com.phonegap.Accelerometer", 0)) { + accel->Run(*__cordovaCommand); } - else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Network", 0)) { - network->Run(*__phonegapCommand); + else if(__cordovaCommand->StartsWith(L"gap://com.phonegap.Network", 0)) { + network->Run(*__cordovaCommand); } - else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.DebugConsole", 0)) { - console->Run(*__phonegapCommand); + else if(__cordovaCommand->StartsWith(L"gap://com.phonegap.DebugConsole", 0)) { + console->Run(*__cordovaCommand); } - else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Compass", 0)) { - compass->Run(*__phonegapCommand); + else if(__cordovaCommand->StartsWith(L"gap://com.phonegap.Compass", 0)) { + compass->Run(*__cordovaCommand); } - else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Contacts", 0)) { - contacts->Run(*__phonegapCommand); + else if(__cordovaCommand->StartsWith(L"gap://com.phonegap.Contacts", 0)) { + contacts->Run(*__cordovaCommand); } - else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Notification", 0)) { - notification->Run(*__phonegapCommand); + else if(__cordovaCommand->StartsWith(L"gap://com.phonegap.Notification", 0)) { + notification->Run(*__cordovaCommand); } - else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Camera", 0)) { - camera->Run(*__phonegapCommand); + else if(__cordovaCommand->StartsWith(L"gap://com.phonegap.Camera", 0)) { + camera->Run(*__cordovaCommand); } // Tell the JS code that we got this command, and we're ready for another __pWeb->EvaluateJavascriptN(L"PhoneGap.queue.ready = true;"); - delete __phonegapCommand; - __phonegapCommand = null; + delete __cordovaCommand; + __cordovaCommand = null; } else { AppLogDebug("Non PhoneGap command completed");