You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2012/07/27 02:29:16 UTC
[51/78] [abbrv] [partial] added platform specs and basic work
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Accelerometer.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Accelerometer.cpp b/lib/cordova-1.9.0/lib/bada/src/Accelerometer.cpp
deleted file mode 100755
index 2f54d98..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Accelerometer.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Accelerometer.cpp
- *
- * Created on: Mar 8, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "Accelerometer.h"
-
-Accelerometer::Accelerometer() {
- __sensorMgr.Construct();
- started = false;
-}
-
-Accelerometer::Accelerometer(Web* pWeb): CordovaCommand(pWeb) {
- __sensorMgr.Construct();
- started = false;
- x = y = z = 0.0;
- timestamp = 0;
-}
-
-Accelerometer::~Accelerometer() {
-}
-
-void
-Accelerometer::Run(const String& command) {
- if (!command.IsEmpty()) {
- Uri commandUri;
- commandUri.SetUri(command);
- String method = commandUri.GetHost();
- StringTokenizer strTok(commandUri.GetPath(), L"/");
- if(strTok.GetTokenCount() == 1) {
- strTok.GetNextToken(callbackId);
- AppLogDebug("Method %S, CallbackId: %S", method.GetPointer(), callbackId.GetPointer());
- }
- if(method == L"org.apache.cordova.Accelerometer.watchAcceleration" && !callbackId.IsEmpty() && !IsStarted()) {
- StartSensor();
- }
- if(method == L"org.apache.cordova.Accelerometer.clearWatch" && IsStarted()) {
- StopSensor();
- }
- if(method == L"org.apache.cordova.Accelerometer.getCurrentAcceleration" && !callbackId.IsEmpty() && !IsStarted()) {
- GetLastAcceleration();
- }
- AppLogDebug("Acceleration command %S completed", command.GetPointer());
- } else {
- AppLogDebug("Can't run empty command");
- }
-}
-
-bool
-Accelerometer::StartSensor(void) {
- result r = E_SUCCESS;
-
- if(__sensorMgr.IsAvailable(SENSOR_TYPE_ACCELERATION)) {
- r = __sensorMgr.AddSensorListener(*this, SENSOR_TYPE_ACCELERATION, 50, true);
- if(IsFailed(r)) {
- return false;
- }
- } else {
- AppLogException("Acceleration sensor is not available");
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].fail({message:'Acceleration sensor is not available',code:'001'});");
- pWeb->EvaluateJavascriptN(res);
- return false;
- }
- started = true;
- AppLogDebug("Start Watching Sensor");
- return true;
-}
-
-bool
-Accelerometer::StopSensor(void) {
- result r = E_SUCCESS;
-
- r = __sensorMgr.RemoveSensorListener(*this, SENSOR_TYPE_ACCELERATION);
- if(IsFailed(r)) {
- return false;
- }
- started = false;
- AppLogDebug("Stopped Watching Sensor");
- return true;
-}
-
-bool
-Accelerometer::IsStarted() {
- return started;
-}
-
-void
-Accelerometer::GetLastAcceleration() {
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(), x, y, z, timestamp);
- pWeb->EvaluateJavascriptN(res);
-
- res.Clear();
- res.Format(256, L"navigator.accelerometer.lastAcceleration = new Acceleration(%f,%f,%f,%d});", x, y, z, timestamp);
- pWeb->EvaluateJavascriptN(res);
-}
-
-void
-Accelerometer::OnDataReceived(SensorType sensorType, SensorData& sensorData, result r) {
-
- sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_TIMESTAMP, timestamp);
- sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_X, x);
- sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_Y, y);
- sensorData.GetValue((SensorDataKey)ACCELERATION_DATA_KEY_Z, z);
-
- AppLogDebug("x: %f, y: %f, z: %f timestamp: %d", x, y, z, timestamp);
-
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(), x, y, z, timestamp);
- pWeb->EvaluateJavascriptN(res);
-
- res.Clear();
- res.Format(256, L"navigator.accelerometer.lastAcceleration = new Acceleration(%f,%f,%f,%d});", x, y, z, timestamp);
- pWeb->EvaluateJavascriptN(res);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Compass.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Compass.cpp b/lib/cordova-1.9.0/lib/bada/src/Compass.cpp
deleted file mode 100755
index ab334cd..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Compass.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Compass.cpp
- *
- * Created on: Mar 25, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "../inc/Compass.h"
-
-Compass::Compass(Web* pWeb) : CordovaCommand(pWeb) {
- __sensorMgr.Construct();
- started = false;
- x = y = z = 0.0;
- timestamp = 0;
-}
-
-Compass::~Compass() {
-}
-
-void
-Compass::Run(const String& command) {
- if (!command.IsEmpty()) {
- String args;
- String delim(L"/");
- command.SubString(String(L"gap://").GetLength(), args);
- StringTokenizer strTok(args, delim);
- if(strTok.GetTokenCount() < 2) {
- AppLogDebug("Not Enough Params");
- return;
- }
- String method;
- strTok.GetNextToken(method);
- // Getting callbackId
- strTok.GetNextToken(callbackId);
- AppLogDebug("Method %S, callbackId: %S", method.GetPointer(), callbackId.GetPointer());
- // used to determine callback ID
- if(method == L"org.apache.cordova.Compass.watchHeading" && !callbackId.IsEmpty() && !IsStarted()) {
- AppLogDebug("watching compass...");
- StartSensor();
- }
- if(method == L"org.apache.cordova.Compass.clearWatch" && !callbackId.IsEmpty() && IsStarted()) {
- AppLogDebug("stop watching compass...");
- StopSensor();
- }
- if(method == L"org.apache.cordova.Compass.getCurrentHeading" && !callbackId.IsEmpty() && !IsStarted()) {
- AppLogDebug("getting current compass...");
- GetLastHeading();
- }
- AppLogDebug("Compass command %S completed", command.GetPointer());
- } else {
- AppLogDebug("Can't run empty command");
- }
-}
-
-bool
-Compass::StartSensor(void) {
- result r = E_SUCCESS;
-
- if(__sensorMgr.IsAvailable(SENSOR_TYPE_MAGNETIC)) {
- r = __sensorMgr.AddSensorListener(*this, SENSOR_TYPE_MAGNETIC, 50, true);
- if(IsFailed(r)) {
- return false;
- }
- } else {
- AppLogException("Compass sensor is not available");
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].fail({message:'Magnetic sensor is not available',code:'001'});", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(res);
- return false;
- }
- started = true;
- AppLogDebug("Start Watching Sensor");
- return true;
-}
-
-bool
-Compass::StopSensor(void) {
- result r = E_SUCCESS;
-
- r = __sensorMgr.RemoveSensorListener(*this, SENSOR_TYPE_MAGNETIC);
- if(IsFailed(r)) {
- return false;
- }
- started = false;
- AppLogDebug("Stopped Watching Sensor");
- return true;
-}
-
-bool
-Compass::IsStarted() {
- return started;
-}
-
-void
-Compass::GetLastHeading() {
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(), x, y, z, timestamp);
- pWeb->EvaluateJavascriptN(res);
-}
-
-void
-Compass::OnDataReceived(SensorType sensorType, SensorData& sensorData, result r) {
-
- sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_TIMESTAMP, timestamp);
- sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_X, x);
- sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_Y, y);
- sensorData.GetValue((SensorDataKey)MAGNETIC_DATA_KEY_Z, z);
-
- AppLogDebug("x: %f, y: %f, z: %f timestamp: %d", x, y, z, timestamp);
-
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].success({x:%f,y:%f,z:%f,timestamp:%d});", callbackId.GetPointer(), x, y, z, timestamp);
- pWeb->EvaluateJavascriptN(res);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Contacts.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Contacts.cpp b/lib/cordova-1.9.0/lib/bada/src/Contacts.cpp
deleted file mode 100755
index 7a24f32..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Contacts.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-/*
- * Contacts.cpp
- *
- * Created on: Mar 25, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "../inc/Contacts.h"
-
-Contacts::Contacts(Web* pWeb) : CordovaCommand(pWeb) {
-}
-
-Contacts::~Contacts() {
-}
-
-void
-Contacts::Run(const String& command) {
- if(!command.IsEmpty()) {
- Uri commandUri;
- commandUri.SetUri(command);
- String method = commandUri.GetHost();
- StringTokenizer strTok(commandUri.GetPath(), L"/");
- if(strTok.GetTokenCount() < 2) {
- AppLogException("Not enough params");
- return;
- }
- strTok.GetNextToken(callbackId);
- // Saving a new contact
- if(method == L"org.apache.cordova.Contacts.save" && !callbackId.IsEmpty()) {
- String contactId;
- strTok.GetNextToken(contactId);
- int cid = -1;
- result r = E_SUCCESS;
- r = Integer::Parse(contactId, cid);
- if(IsFailed(r)) {
- AppLogException("Could not retrieve contact ID");
- }
- AppLogDebug("Method %S callbackId %S contactId %d", method.GetPointer(), callbackId.GetPointer(), cid);
- Create(cid);
- // Finding an exisiting contact by Name/Phone Number/Email
- } else if(method == L"org.apache.cordova.Contacts.find" && !callbackId.IsEmpty()) {
- String filter;
- strTok.GetNextToken(filter);
- AppLogDebug("Method %S callbackId %S filter %S", method.GetPointer(), callbackId.GetPointer(), filter.GetPointer());
- Find(filter);
- } else if(method == L"org.apache.cordova.Contacts.remove" && !callbackId.IsEmpty()) {
- String id;
- strTok.GetNextToken(id);
- AppLogDebug("Method %S callbackId %S ID to remove %S", method.GetPointer(), callbackId.GetPointer(), id.GetPointer());
- Remove(id);
- }
-
- }
-}
-
-void
-Contacts::SetNickname(Contact& contact, const int cid) {
- String* value = NULL;
- String eval;
- eval.Format(128, L"navigator.service.contacts.records[%d].nickname", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("nickname: %S", value->GetPointer());
- contact.SetValue(CONTACT_PROPERTY_ID_NICK_NAME, *value);
- }
- delete value;
-}
-
-void
-Contacts::SetFirstName(Contact& contact, const int cid) {
- String* value = NULL;
- String eval;
- eval.Format(128, L"navigator.service.contacts.records[%d].name.givenName", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("First Name: %S", value->GetPointer());
- contact.SetValue(CONTACT_PROPERTY_ID_FIRST_NAME, *value);
- }
- delete value;
-}
-
-void
-Contacts::SetLastName(Contact& contact, const int cid) {
- String* value = NULL;
- String eval;
- eval.Format(128, L"navigator.service.contacts.records[%d].name.familyName", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("Last Name: %S", value->GetPointer());
- contact.SetValue(CONTACT_PROPERTY_ID_LAST_NAME, *value);
- }
- delete value;
-}
-
-void
-Contacts::SetPhoneNumbers(Contact& contact, const int cid) {
- // Getting phone numbers length
- String* lengthStr = NULL;
- String eval;
- eval.Format(128, L"navigator.service.contacts.records[%d].phoneNumbers.length", cid);
- lengthStr = pWeb->EvaluateJavascriptN(eval);
- if(!lengthStr->IsEmpty()) {
- int length;
- result r = Integer::Parse(*lengthStr, length);
- if(IsFailed(r)) {
- AppLogException("Could not get phoneNumbers length");
- return;
- }
- delete lengthStr;
- for(int i = 0 ; i < length ; i++) {
- String* type = NULL;
- String* number = NULL;
-
- // Getting phone number type
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].phoneNumbers[%d].type", cid, i);
- type = pWeb->EvaluateJavascriptN(eval);
-
- // Getting phone number
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].phoneNumbers[%d].value", cid, i);
- number = pWeb->EvaluateJavascriptN(eval);
-
- if(!type->IsEmpty() && !number->IsEmpty()) {
- if(*type == "Home") {
- AppLogDebug("Adding HOME phone number %S", number->GetPointer());
- PhoneNumber phoneNumber(PHONENUMBER_TYPE_HOME, *number);
- contact.AddPhoneNumber(phoneNumber);
- } else if(*type == "Mobile") {
- AppLogDebug("Adding MOBILE phone number %S", number->GetPointer());
- PhoneNumber phoneNumber(PHONENUMBER_TYPE_MOBILE, *number);
- contact.AddPhoneNumber(phoneNumber);
- } else if(*type == "Pager") {
- AppLogDebug("Adding PAGER phone number %S", number->GetPointer());
- PhoneNumber phoneNumber(PHONENUMBER_TYPE_PAGER, *number);
- contact.AddPhoneNumber(phoneNumber);
- } else if(*type == "Work") {
- AppLogDebug("Adding WORK phone number %S", number->GetPointer());
- PhoneNumber phoneNumber(PHONENUMBER_TYPE_WORK, *number);
- contact.AddPhoneNumber(phoneNumber);
- } else if(*type == "Other") {
- AppLogDebug("Adding OTHER phone number %S", number->GetPointer());
- PhoneNumber phoneNumber(PHONENUMBER_TYPE_OTHER, *number);
- contact.AddPhoneNumber(phoneNumber);
- }
- }
- delete type;
- delete number;
- }
- }
-}
-
-void
-Contacts::SetEmails(Contact& contact, const int cid) {
- // Getting emails length
- String* lengthStr = NULL;
- String eval;
- eval.Format(128, L"navigator.service.contacts.records[%d].emails.length", cid);
- lengthStr = pWeb->EvaluateJavascriptN(eval);
- if(!lengthStr->IsEmpty()) {
- int length;
- result r = Integer::Parse(*lengthStr, length);
- if(IsFailed(r)) {
- AppLogException("Could not get emails length");
- return;
- }
- delete lengthStr;
- for(int i = 0 ; i < length ; i++) {
- String* type = NULL;
- String* address = NULL;
-
- // Getting email type
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].emails[%d].type", cid, i);
- type = pWeb->EvaluateJavascriptN(eval);
-
- // Getting email
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].emails[%d].value", cid, i);
- address = pWeb->EvaluateJavascriptN(eval);
-
- if(!type->IsEmpty() && !address->IsEmpty()) {
- if(*type == "Personal") {
- AppLogDebug("Adding PERSONAL email %S", address->GetPointer());
- Email email(EMAIL_TYPE_PERSONAL, *address);
- contact.AddEmail(email);
- } else if(*type == "Work") {
- AppLogDebug("Adding WORK email %S", address->GetPointer());
- Email email(EMAIL_TYPE_WORK, *address);
- contact.AddEmail(email);
- } else if(*type == "Other") {
- AppLogDebug("Adding OTHER email %S", address->GetPointer());
- Email email(EMAIL_TYPE_OTHER, *address);
- contact.AddEmail(email);
- }
- }
- delete type;
- delete address;
- }
- }
-}
-
-void
-Contacts::SetUrls(Contact& contact, const int cid) {
- // Getting emails length
- String* lengthStr = NULL;
- String eval;
- eval.Format(128, L"navigator.service.contacts.records[%d].urls.length", cid);
- lengthStr = pWeb->EvaluateJavascriptN(eval);
- if(!lengthStr->IsEmpty()) {
- int length;
- result r = Integer::Parse(*lengthStr, length);
- if(IsFailed(r)) {
- AppLogException("Could not get urls length");
- return;
- }
- delete lengthStr;
- for(int i = 0 ; i < length ; i++) {
- String* type = NULL;
- String* address = NULL;
-
- // Getting url type
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].urls[%d].type", cid, i);
- type = pWeb->EvaluateJavascriptN(eval);
-
- // Getting url
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].urls[%d].value", cid, i);
- address = pWeb->EvaluateJavascriptN(eval);
-
- if(!type->IsEmpty() && !address->IsEmpty()) {
- if(*type == "Personal") {
- AppLogDebug("Adding PERSONAL URL %S", address->GetPointer());
- Url url(URL_TYPE_PERSONAL, *address);
- contact.AddUrl(url);
- } else if(*type == "Work") {
- AppLogDebug("Adding WORK URL %S", address->GetPointer());
- Url url(URL_TYPE_WORK, *address);
- contact.AddUrl(url);
- } else if(*type == "Other") {
- AppLogDebug("Adding OTHER URL %S", address->GetPointer());
- Url url(URL_TYPE_OTHER, *address);
- contact.AddUrl(url);
- }
- }
- delete type;
- delete address;
- }
- }
-}
-
-void
-Contacts::SetOrganization(Contact& contact, const int cid) {
- // Setting Organization Name
- String* value = NULL;
- String eval;
- eval.Format(128, L"navigator.service.contacts.records[%d].organization.name", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("Organization Name: %S", value->GetPointer());
- contact.SetValue(CONTACT_PROPERTY_ID_COMPANY, *value);
- }
- delete value;
-
- // Setting Organization Title
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].organization.title", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("Organization Title: %S", value->GetPointer());
- contact.SetValue(CONTACT_PROPERTY_ID_JOB_TITLE, *value);
- }
- delete value;
-}
-void
-Contacts::SetBirthday(Contact& contact, const int cid) {
- String* value;
- String eval;
- int year, month, day;
- DateTime birthday;
-
- // Setting Year
- eval.Format(128, L"navigator.service.contacts.records[%d].birthday.getFullYear()", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- result r = Integer::Parse(*value, year);
- if(IsFailed(r)) {
- AppLogException("Could not get birthday Year");
- return;
- }
- AppLogDebug("Birthday Year: %S", value->GetPointer());
- }
- delete value;
-
- // Setting Month
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].birthday.getMonth() + 1", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- result r = Integer::Parse(*value, month);
- if(IsFailed(r)) {
- AppLogException("Could not get birthday Month");
- return;
- }
- AppLogDebug("Birthday Month: %S", value->GetPointer());
- }
- delete value;
-
- // Setting Day
- eval.Clear();
- eval.Format(128, L"navigator.service.contacts.records[%d].birthday.getDate()", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- result r = Integer::Parse(*value, day);
- if(IsFailed(r)) {
- AppLogException("Could not get birthday Day");
- return;
- }
- AppLogDebug("Birthday Day: %S", value->GetPointer());
- }
- delete value;
-
- birthday.SetValue(year, month, day);
- contact.SetValue(CONTACT_PROPERTY_ID_BIRTHDAY, birthday);
- AppLogDebug("Birthday %d/%d/%d added", year, month, day);
-}
-
-void
-Contacts::SetAddress(Contact& contact, const int cid) {
- Address address;
- String* value;
- String eval;
- // Setting Street Address
- eval.Format(128, L"navigator.service.contacts.records[%d].address.streetAddress", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("Street Address: %S", value->GetPointer());
- address.SetStreet(*value);
- }
- delete value;
-
- // Setting City
- eval.Format(128, L"navigator.service.contacts.records[%d].address.locality", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("City: %S", value->GetPointer());
- address.SetCity(*value);
- }
- delete value;
-
- // Setting State
- eval.Format(128, L"navigator.service.contacts.records[%d].address.region", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("State: %S", value->GetPointer());
- address.SetState(*value);
- }
- delete value;
-
- // Setting Postal Code
- eval.Format(128, L"navigator.service.contacts.records[%d].address.postalCode", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("Postal Code: %S", value->GetPointer());
- address.SetPostalCode(*value);
- }
- delete value;
-
- // Setting Country
- eval.Format(128, L"navigator.service.contacts.records[%d].address.country", cid);
- value = pWeb->EvaluateJavascriptN(eval);
- if(!value->IsEmpty()) {
- AppLogDebug("County: %S", value->GetPointer());
- address.SetPostalCode(*value);
- }
- delete value;
-
- contact.AddAddress(address);
- AppLogDebug("Address Added");
-}
-
-void
-Contacts::Create(const int cid) {
- result r = E_SUCCESS;
- Addressbook addressbook;
-
- r = addressbook.Construct();
-
- if(IsFailed(r)) {
- AppLogException("Could not create AddressBook");
- return;
- }
-
- Contact contact;
- SetNickname(contact, cid);
- SetFirstName(contact, cid);
- SetLastName(contact, cid);
- SetPhoneNumbers(contact, cid);
- SetEmails(contact, cid);
- SetUrls(contact, cid);
- SetOrganization(contact, cid);
- SetBirthday(contact, cid);
- SetAddress(contact, cid);
-
- r = addressbook.AddContact(contact);
-
- String eval;
-
- if(IsFailed(r)) {
- AppLogException("Could not add contact");
- eval.Format(128, L"Cordova.callbacks['%S'].fail({message:'%s',code:%d})", callbackId.GetPointer(), r, GetErrorMessage(r));
- pWeb->EvaluateJavascriptN(eval);
- } else {
- AppLogDebug("Contact Successfully Added");
- eval.Format(128, L"Cordova.callbacks['%S'].success({message:'Contact added successfully'})", callbackId.GetPointer());
- AppLogDebug("%S", eval.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- }
-}
-
-void
-Contacts::UpdateSearch(Contact* pContact) const {
- // TODO: update this add other fields too (emails, urls, phonenumbers, etc...)
- String eval, displayName, firstName, lastName;
- RecordId recordId = pContact->GetRecordId();
- LongLong test(recordId);
- pContact->GetValue(CONTACT_PROPERTY_ID_DISPLAY_NAME, displayName);
- pContact->GetValue(CONTACT_PROPERTY_ID_FIRST_NAME, firstName);
- pContact->GetValue(CONTACT_PROPERTY_ID_LAST_NAME, lastName);
- eval.Format(256, L"navigator.service.contacts._findCallback({id:'%S', displayName:'%S', name:{firstName:'%S',lastName:'%S'}})",
- test.ToString().GetPointer(),
- displayName.GetPointer(),
- firstName.GetPointer(),
- lastName.GetPointer());
- //AppLogDebug("%S", eval.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
-}
-
-void
-Contacts::FindByName(const String& filter) {
- Addressbook addressbook;
- Contact* pContact = null;
- IList* pContactList = null;
- IEnumerator* pContactEnum = null;
- String displayName, firstName, lastName;
-
- result r = addressbook.Construct();
- if(IsFailed(r))
- {
- return;
- }
-
- // Searching by Email
- pContactList = addressbook.SearchContactsByNameN(filter);
- AppLogDebug("Names Matched %d", pContactList->GetCount());
- pContactEnum = pContactList->GetEnumeratorN();
- while (E_SUCCESS == pContactEnum->MoveNext())
- {
- pContact = (Contact*) pContactEnum->GetCurrent();
- UpdateSearch(pContact);
- }
- delete pContactEnum;
- pContactList->RemoveAll(true);
- delete pContactList;
-}
-void
-Contacts::FindByEmail(const String& filter) {
- Addressbook addressbook;
- Contact* pContact = null;
- IList* pContactList = null;
- IEnumerator* pContactEnum = null;
- String displayName, firstName, lastName;
-
- result r = addressbook.Construct();
- if(IsFailed(r))
- {
- return;
- }
-
- // Searching by Email
- pContactList = addressbook.SearchContactsByEmailN(filter);
- AppLogDebug("Emails Matched %d", pContactList->GetCount());
- pContactEnum = pContactList->GetEnumeratorN();
- while (E_SUCCESS == pContactEnum->MoveNext())
- {
- pContact = (Contact*) pContactEnum->GetCurrent();
- UpdateSearch(pContact);
- }
- delete pContactEnum;
- pContactList->RemoveAll(true);
- delete pContactList;
-}
-void
-Contacts::FindByPhoneNumber(const String& filter) {
- Addressbook addressbook;
- Contact* pContact = null;
- IList* pContactList = null;
- IEnumerator* pContactEnum = null;
- String displayName, firstName, lastName;
-
- result r = addressbook.Construct();
- if(IsFailed(r))
- {
- return;
- }
- // Searching by Email
- pContactList = addressbook.SearchContactsByPhoneNumberN(filter);
- AppLogDebug("Phone Number Matched %d", pContactList->GetCount());
- pContactEnum = pContactList->GetEnumeratorN();
- while (E_SUCCESS == pContactEnum->MoveNext())
- {
- pContact = (Contact*) pContactEnum->GetCurrent();
- UpdateSearch(pContact);
- }
- delete pContactEnum;
- pContactList->RemoveAll(true);
- delete pContactList;
-}
-
-void
-Contacts::Find(const String& filter) {
- String eval;
- String* value;
- int length = 0;
-
- // Resetting previous results
- pWeb->EvaluateJavascriptN(L"navigator.service.contacts.results = new Array();");
-
- // Searching by Name
- FindByName(filter);
- // Searching by PhoneNumber
- FindByPhoneNumber(filter);
- // Searching by Email
- FindByEmail(filter);
-
- value = pWeb->EvaluateJavascriptN(L"navigator.service.contacts.results.length");
- AppLogDebug("Results length: %S", value->GetPointer());
- result r = Integer::Parse(*value, length);
- if(IsFailed(r)) {
- AppLogException("Could not get Contact Results Length");
- return;
- }
-
- delete value;
- if(length > 0) {
- eval.Format(128, L"Cordova.callbacks['%S'].success(navigator.service.contacts.results)", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- } else {
- eval.Format(128, L"Cordova.callbacks['%S'].fail({message:'no contacts found',code:00})", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- }
-}
-
-void
-Contacts::Remove(const String& idStr) {
- String eval;
- Addressbook addressbook;
- RecordId id;
- result r = addressbook.Construct();
- if(IsFailed(r))
- {
- AppLogException("Could not construct Address Book");
- return;
- }
- r = LongLong::Parse(idStr, id);
- if(IsFailed(r)) {
- AppLogException("Could not parse ID");
- } else {
- AppLogDebug("Trying to remove contact with ID %S", idStr.GetPointer());
- r = addressbook.RemoveContact(id);
- if(IsFailed(r)) {
- AppLogDebug("Contact Could not be removed %s %d", GetErrorMessage(r), r);
- eval.Format(256, L"Cordova.callbacks['%S'].fail({message:'%s', code:ContactError.NOT_FOUND_ERROR})",
- callbackId.GetPointer(), GetErrorMessage(r));
- pWeb->EvaluateJavascriptN(eval);
- } else {
- AppLogDebug("Contact %S removed", idStr.GetPointer());
- eval.Format(256, L"Cordova.callbacks['%S'].success({message:'Contact with ID %d removed', code:01})", callbackId.GetPointer(), id);
- pWeb->EvaluateJavascriptN(eval);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Cordova.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Cordova.cpp b/lib/cordova-1.9.0/lib/bada/src/Cordova.cpp
deleted file mode 100755
index 67bcce0..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Cordova.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#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-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/CordovaCommand.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/CordovaCommand.cpp b/lib/cordova-1.9.0/lib/bada/src/CordovaCommand.cpp
deleted file mode 100755
index 6147c51..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/CordovaCommand.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * CordovaCommand.cpp
- *
- * Created on: Mar 7, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#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-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/CordovaEntry.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/CordovaEntry.cpp b/lib/cordova-1.9.0/lib/bada/src/CordovaEntry.cpp
deleted file mode 100755
index c87a023..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/CordovaEntry.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#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-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/DebugConsole.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/DebugConsole.cpp b/lib/cordova-1.9.0/lib/bada/src/DebugConsole.cpp
deleted file mode 100755
index 10d9f8e..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/DebugConsole.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * DebugConsole.cpp
- *
- * Created on: Mar 24, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "../inc/DebugConsole.h"
-
-DebugConsole::DebugConsole(Web* pWeb): CordovaCommand(pWeb) {
- // TODO Auto-generated constructor stub
-}
-
-DebugConsole::~DebugConsole() {
- // TODO Auto-generated destructor stub
-}
-
-void
-DebugConsole::CleanUp(String& str) {
- Uri uri;
- uri.SetUri(str);
- str.Clear();
- str.Append(uri.ToString());
-}
-
-void
-DebugConsole::Run(const String& command) {
- if(!command.IsEmpty()) {
- String args;
- String delim(L"/");
- command.SubString(String(L"gap://").GetLength(), args);
- StringTokenizer strTok(args, delim);
- if(strTok.GetTokenCount() < 3) {
- AppLogDebug("Not enough params");
- return;
- }
- String method;
- String statement(64);
- String logLevel;
- strTok.GetNextToken(method);
- strTok.GetNextToken(statement);
- CleanUp(statement);
- strTok.GetNextToken(logLevel);
- //AppLogDebug("method %S statement %S loglevel %S", method.GetPointer(), statement.GetPointer(), logLevel.GetPointer());
- if(method == L"org.apache.cordova.DebugConsole.log") {
- Log(statement, logLevel);
- }
- }
-}
-
-void
-DebugConsole::Log(String& statement, String& logLevel) {
- if(!statement.IsEmpty()) {
- if(logLevel == L"INFO" || logLevel == L"WARN") {
- AppLog("[%S] %S", logLevel.GetPointer(), statement.GetPointer());
- }
- else if(logLevel == "DEBUG") {
- AppLogDebug("[%S] %S", logLevel.GetPointer(), statement.GetPointer());
- }
- else if(logLevel == L"ERROR") {
- AppLogException("[%S] %S", logLevel.GetPointer(), statement.GetPointer());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Device.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Device.cpp b/lib/cordova-1.9.0/lib/bada/src/Device.cpp
deleted file mode 100755
index 4fb2d0e..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Device.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Device.cpp
- *
- * Created on: Mar 8, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "../inc/Device.h"
-
-Device::Device() {
- // TODO Auto-generated constructor stub
-
-}
-
-Device::Device(Web* pWeb): CordovaCommand(pWeb) {
-
-}
-
-Device::~Device() {
- // TODO Auto-generated destructor stub
-}
-
-void
-Device::Run(const String& command) {
-
-}
-
-result
-Device::SetDeviceInfo() {
- result r = E_SUCCESS;
- String platformVersion;
- String apiVersion;
- String imei;
- int screen_height = 0;
- int screen_width = 0;
-
- /*screen*/
- r = SystemInfo::GetValue("ScreenWidth", screen_width);
- TryCatch(r == E_SUCCESS, , "SystemInfo: To get a value is failed");
-
- r = SystemInfo::GetValue("ScreenHeight", screen_height);
- TryCatch(r == E_SUCCESS, , "SystemInfo: To get a value is failed");
-
- r = SystemInfo::GetValue("PlatformVersion", platformVersion);
- TryCatch(r == E_SUCCESS, , "SystemInfo: To get a value is failed");
-
- r = SystemInfo::GetValue("APIVersion", apiVersion);
- TryCatch(r == E_SUCCESS, , "SystemInfo: To get a value is failed");
-
- r = SystemInfo::GetValue("IMEI", imei);
- TryCatch(r == E_SUCCESS, , "SystemInfo: To get a value is failed");
-
- if(r == E_SUCCESS) {
- String res;
- res.Format(1024, L"window.device={platform:'bada',version:'%S',name:'n/a',cordova:'1.9.0',uuid:'%S'}", platformVersion.GetPointer(), imei.GetPointer());
- //AppLogDebug("%S", res.GetPointer());
- pWeb->EvaluateJavascriptN(res);
- }
- return r;
-
-CATCH:
- AppLog("Error = %s\n", GetErrorMessage(r));
- return r;
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/GeoLocation.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/GeoLocation.cpp b/lib/cordova-1.9.0/lib/bada/src/GeoLocation.cpp
deleted file mode 100755
index 0c854d8..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/GeoLocation.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * GeoLocation.cpp
- *
- * Created on: Mar 7, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "GeoLocation.h"
-
-GeoLocation::GeoLocation() {
- // TODO Auto-generated constructor stub
-
-}
-
-GeoLocation::GeoLocation(Web* pWeb): CordovaCommand(pWeb) {
- locProvider = new LocationProvider();
- locProvider->Construct(LOC_METHOD_HYBRID);
- watching = false;
-}
-
-GeoLocation::~GeoLocation() {
- delete locProvider;
-}
-
-void
-GeoLocation::Run(const String& command) {
- if(!command.IsEmpty()) {
- Uri commandUri;
- commandUri.SetUri(command);
- String method = commandUri.GetHost();
- StringTokenizer strTok(commandUri.GetPath(), L"/");
- if(strTok.GetTokenCount() > 1) {
- strTok.GetNextToken(callbackId);
- AppLogDebug("Method %S, CallbackId: %S", method.GetPointer(), callbackId.GetPointer());
- }
- AppLogDebug("Method %S, Callback: %S", method.GetPointer(), callbackId.GetPointer());
- // used to determine callback ID
- if(method == L"org.apache.cordova.Geolocation.watchPosition" && !callbackId.IsEmpty() && !IsWatching()) {
- AppLogDebug("watching position...");
- StartWatching();
- }
- if(method == L"org.apache.cordova.Geolocation.stop" && IsWatching()) {
- AppLogDebug("stop watching position...");
- StopWatching();
- }
- if(method == L"org.apache.cordova.Geolocation.getCurrentPosition" && !callbackId.IsEmpty() && !IsWatching()) {
- AppLogDebug("getting current position...");
- GetLastKnownLocation();
- }
- AppLogDebug("GeoLocation command %S completed", command.GetPointer());
- }
-}
-
-void
-GeoLocation::StartWatching() {
- locProvider->RequestLocationUpdates(*this, 5, false);
- watching = true;
- AppLogDebug("Start Watching Location");
-}
-
-void
-GeoLocation::StopWatching() {
- locProvider->CancelLocationUpdates();
- watching = false;
- AppLogDebug("Stop Watching Location");
-}
-
-bool
-GeoLocation::IsWatching() {
- return watching;
-}
-
-void
-GeoLocation::GetLastKnownLocation() {
- Location *location = locProvider->GetLastKnownLocationN();
- if(location->GetQualifiedCoordinates() != null) {
- const QualifiedCoordinates *q = location->GetQualifiedCoordinates();
- double latitude = q->GetLatitude();
- double longitude = q->GetLongitude();
- float altitude = q->GetAltitude();
- float accuracy = q->GetHorizontalAccuracy();
- float heading = q->GetVerticalAccuracy();
- float speed = location->GetSpeed();
- long long timestamp = location->GetTimestamp();
- AppLogDebug("new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude, speed, accuracy, heading);
- String coordinates;
- coordinates.Format(256, L"new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude, speed, accuracy, heading);
- String res;
- res.Format(512, L"Cordova.callbacks['%S'].success(new Position(%S,%d))", callbackId.GetPointer(), coordinates.GetPointer(), timestamp);
- pWeb->EvaluateJavascriptN(res);
- } else {
- AppLogDebug("Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))", callbackId.GetPointer());
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(res);
- }
-}
-
-void
-GeoLocation::OnLocationUpdated(Location& location) {
- if(location.GetQualifiedCoordinates() != null) {
- const QualifiedCoordinates *q = location.GetQualifiedCoordinates();
- double latitude = q->GetLatitude();
- double longitude = q->GetLongitude();
- float altitude = q->GetAltitude();
- float accuracy = q->GetHorizontalAccuracy();
- float heading = q->GetVerticalAccuracy();
- float speed = location.GetSpeed();
- long long timestamp = location.GetTimestamp();
- AppLogDebug("new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude, speed, accuracy, heading);
- String coordinates;
- coordinates.Format(256, L"new Coordinates(%d,%d,%f,%f,%f,%f)", latitude, longitude, altitude, speed, accuracy, heading);
- String res;
- res.Format(512, L"Cordova.callbacks['%S'].success(new Position(%S,%d))", callbackId.GetPointer(), coordinates.GetPointer(), timestamp);
- pWeb->EvaluateJavascriptN(res);
- } else {
- AppLogDebug("Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))", callbackId.GetPointer());
- String res;
- res.Format(256, L"Cordova.callbacks['%S'].fail(new PositionError(0001,'Could not get location'))", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(res);
- }
-}
-
-void
-GeoLocation::OnProviderStateChanged(LocProviderState newState) {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Kamera.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Kamera.cpp b/lib/cordova-1.9.0/lib/bada/src/Kamera.cpp
deleted file mode 100755
index f2a84c9..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Kamera.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Kamera.cpp
- *
- * Created on: Apr 19, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "../inc/Kamera.h"
-
-Kamera::Kamera(Web* pWeb) : CordovaCommand(pWeb) {
-}
-
-Kamera::~Kamera() {
-}
-
-void
-Kamera::Run(const String& command) {
- if(!command.IsEmpty()) {
- Uri commandUri;
- commandUri.SetUri(command);
- String method = commandUri.GetHost();
- StringTokenizer strTok(commandUri.GetPath(), L"/");
- if(strTok.GetTokenCount() < 1) {
- AppLogException("Not enough params");
- return;
- }
- strTok.GetNextToken(callbackId);
- if(method == "org.apache.cordova.Camera.getPicture" && !callbackId.IsEmpty()) {
- GetPicture();
- }
- }
-}
-
-void
-Kamera::GetPicture() {
- AppLogDebug("Taking picture");
-
- ArrayList* pDataList = null;
- pDataList = new ArrayList();
- pDataList->Construct();
-
- String* pData = null;
- pData = new String(L"type:camera");
- pDataList->Add(*pData);
-
- AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_CAMERA, OPERATION_CAPTURE);
- if(pAc)
- {
- pAc->Start(pDataList, this);
- delete pAc;
- }
- pDataList->RemoveAll(true);
- delete pDataList;
-}
-
-void
-Kamera::OnAppControlCompleted (const String &appControlId, const String &operationId, const IList *pResultList) {
- //This method is invoked when an application control callback event occurs.
-
- String* pCaptureResult = null;
- if (appControlId.Equals(APPCONTROL_CAMERA) && operationId.Equals(OPERATION_CAPTURE))
- {
- pCaptureResult = (Osp::Base::String*)pResultList->GetAt(0);
- if (pCaptureResult->Equals(String(APPCONTROL_RESULT_SUCCEEDED)))
- {
- String eval;
- AppLog("Camera capture success.");
- String* pCapturePath = (String*)pResultList->GetAt(1);
-
- // copying to app Home Folder
- String homeFilename;
- homeFilename.Format(128, L"/Home/%S", File::GetFileName(*pCapturePath).GetPointer());
- result r = File::Copy(*pCapturePath, homeFilename, true);
-
- if(IsFailed(r)) {
- AppLogException("Could not copy picture");
- eval.Format(512, L"Cordova.callbacks['%S'].fail('Could not copy picture')", callbackId.GetPointer());
- AppLogDebug("%S", eval.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- }
-
-// Uri imageUri;
-// imageUri.setUri(homeFilename);
- eval.Clear();
- eval.Format(512, L"Cordova.callbacks['%S'].success('file://%S')", callbackId.GetPointer(), homeFilename.GetPointer());
- AppLogDebug("%S", eval.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- }
- else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_CANCELED)))
- {
- AppLog("Camera capture canceled.");
- String eval;
- eval.Format(512, L"Cordova.callbacks['%S'].fail('Camera capture canceled')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- }
- else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_FAILED)))
- {
- AppLog("Camera capture failed.");
- String eval;
- eval.Format(512, L"Cordova.callbacks['%S'].fail('Camera capture failed')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Network.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Network.cpp b/lib/cordova-1.9.0/lib/bada/src/Network.cpp
deleted file mode 100755
index 5674d1d..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Network.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Network.cpp
- *
- * Created on: Mar 23, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "../inc/Network.h"
-
-Network::Network(Web* pWeb) : CordovaCommand(pWeb) {
-}
-
-Network::~Network() {
- delete __pHttpSession;
-}
-
-void
-Network::Run(const String& command) {
- if (!command.IsEmpty()) {
- String args;
- String delim(L"/");
- command.SubString(String(L"gap://").GetLength(), args);
- StringTokenizer strTok(args, delim);
- if(strTok.GetTokenCount() < 3) {
- AppLogDebug("Not enough params");
- return;
- }
- String method;
- String hostAddr;
- strTok.GetNextToken(method);
- strTok.GetNextToken(callbackId);
- strTok.GetNextToken(hostAddr);
-
- // URL decoding
- Uri uri;
- uri.SetUri(hostAddr);
- AppLogDebug("Method %S, callbackId %S, hostAddr %S URI %S", method.GetPointer(), callbackId.GetPointer(), hostAddr.GetPointer(), uri.ToString().GetPointer());
- if(method == L"org.apache.cordova.Network.isReachable") {
- IsReachable(uri.ToString());
- }
- AppLogDebug("Network command %S completed", command.GetPointer());
- } else {
- AppLogDebug("Can't run empty command");
- }
-}
-
-void
-Network::IsReachable(const String& hostAddr) {
- String* pProxyAddr = null;
- //String hostAddr = L"http://localhost:port";
- AppLogDebug("Trying to reach...%S", hostAddr.GetPointer());
- __pHttpSession = new HttpSession();
- __pHttpSession->Construct(NET_HTTP_SESSION_MODE_NORMAL, pProxyAddr, hostAddr, null);
- HttpTransaction* pHttpTransaction = __pHttpSession->OpenTransactionN();
- pHttpTransaction->AddHttpTransactionListener(*this);
- HttpRequest* pHttpRequest = pHttpTransaction->GetRequest();
- pHttpRequest->SetMethod(NET_HTTP_METHOD_GET);
- pHttpRequest->SetUri(hostAddr);
- pHttpTransaction->Submit();
-}
-
-void
-Network::OnTransactionAborted (HttpSession &httpSession, HttpTransaction &httpTransaction, result r) {
- AppLogDebug("Transaction Aborted");
- String res;
- res.Format(128, L"Cordova.callbacks['%S'].fail({code:%d,message:'%s'});", callbackId.GetPointer(), r, GetErrorMessage(r));
- AppLogDebug("%S", res.GetPointer());
- pWeb->EvaluateJavascriptN(res);
-}
-
-void
-Network::OnTransactionCompleted (HttpSession &httpSession, HttpTransaction &httpTransaction) {
- HttpResponse* pHttpResponse = httpTransaction.GetResponse();
- NetHttpStatusCode statusCode = pHttpResponse->GetStatusCode();
- int status = 1; // Default is DATA NETWORK
-
- // FIXME: Bada has no standard/apparent way of knowing the current network type
- // We have to get the network type from the system info
- // ...and if Wifi is enabled we override the setting to Wifi
-
- String key(L"NetworkType");
- String networkType;
-
- result r = SystemInfo::GetValue(key, networkType);
-
- if(r == E_SUCCESS && networkType != L"NoService" && networkType != L"Emergency") {
- AppLogDebug("Data Enabled, Network Type %S, Status Code: %d", networkType.GetPointer(), statusCode);
- status = 1;
- }
-
- Wifi::WifiManager manager;
- if(manager.IsActivated() && manager.IsConnected()) {
- AppLogDebug("Wifi Enabled");
- status = 2;
- }
-
- String res;
-
- res.Format(256, L"navigator.network.updateReachability({code:%d,http_code:%d});", status, statusCode);
- AppLogDebug("%S", res.GetPointer());
- pWeb->EvaluateJavascriptN(res);
-
- res.Format(128, L"Cordova.callbacks['%S'].success({code:%d,http_code:%d});", callbackId.GetPointer(), status, statusCode);
- AppLogDebug("%S", res.GetPointer());
- pWeb->EvaluateJavascriptN(res);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/Notification.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/Notification.cpp b/lib/cordova-1.9.0/lib/bada/src/Notification.cpp
deleted file mode 100755
index 3c44294..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/Notification.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Notification.cpp
- *
- * Created on: Apr 5, 2011
- * Author: Anis Kadri <an...@adobe.com>
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "../inc/Notification.h"
-
-Notification::Notification(Web* pWeb) : CordovaCommand(pWeb) {
-}
-
-Notification::~Notification() {
-}
-
-void
-Notification::Run(const String& command) {
- if(!command.IsEmpty()) {
- Uri commandUri;
- commandUri.SetUri(command);
- String method = commandUri.GetHost();
- StringTokenizer strTok(commandUri.GetPath(), L"/");
- if(strTok.GetTokenCount() < 1) {
- AppLogException("Not enough params");
- return;
- }
- if((method == L"org.apache.cordova.Notification.alert" || method == L"org.apache.cordova.Notification.confirm")) {
- strTok.GetNextToken(callbackId);
- AppLogDebug("%S %S", method.GetPointer(), callbackId.GetPointer());
- if(!callbackId.IsEmpty()) {
- Dialog();
- }
- } else if(method == L"org.apache.cordova.Notification.vibrate") {
- long duration;
- String durationStr;
-
- strTok.GetNextToken(durationStr);
- AppLogDebug("%S %S", method.GetPointer(), durationStr.GetPointer());
- // Parsing duration
- result r = Long::Parse(durationStr, duration);
- if(IsFailed(r)) {
- AppLogException("Could not parse duration");
- return;
- }
- Vibrate(duration);
- } else if(method == L"org.apache.cordova.Notification.beep") {
- int count;
- String countStr;
-
- strTok.GetNextToken(countStr);
- AppLogDebug("%S %S", method.GetPointer(), countStr.GetPointer());
- // Parsing count
- result r = Integer::Parse(countStr, count);
- if(IsFailed(r)) {
- AppLogException("Could not parse count");
- return;
- }
-
- Beep(count);
- }
- }
-}
-
-void
-Notification::Dialog() {
- MessageBox messageBox;
- String* title;
- String* message;
- String* styleStr;
- String eval;
-
- title = pWeb->EvaluateJavascriptN(L"navigator.notification.messageBox.title");
- message = pWeb->EvaluateJavascriptN(L"navigator.notification.messageBox.message");
- styleStr = pWeb->EvaluateJavascriptN(L"navigator.notification.messageBox.messageBoxStyle");
-
- AppLogDebug("title %S message %S styleStr %S", title->GetPointer(), message->GetPointer(), styleStr->GetPointer());
- if(!title->IsEmpty() && !message->IsEmpty() && !styleStr->IsEmpty()) {
- int style;
- int modalResult = 0;
- if(Integer::Parse(*styleStr, style) != E_SUCCESS) {
- AppLogException("Could not get dialog style");
- return;
- }
- messageBox.Construct(*title, *message, (MessageBoxStyle)style, 0);
- messageBox.ShowAndWait(modalResult);
- switch(modalResult) {
- case MSGBOX_RESULT_CLOSE:
- eval.Format(128, L"Cordova.callbacks['%S'].success('Close')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_OK:
- eval.Format(128, L"Cordova.callbacks['%S'].success('OK')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_CANCEL:
- eval.Format(128, L"Cordova.callbacks['%S'].success('Cancel')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_YES:
- eval.Format(128, L"Cordova.callbacks['%S'].success('Yes')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_NO:
- eval.Format(128, L"Cordova.callbacks['%S'].success('No')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_ABORT:
- eval.Format(128, L"Cordova.callbacks['%S'].success('Abort')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_TRY:
- eval.Format(128, L"Cordova.callbacks['%S'].success('Try')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_RETRY:
- eval.Format(128, L"Cordova.callbacks['%S'].success('Retry')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_IGNORE:
- eval.Format(128, L"Cordova.callbacks['%S'].success('Ignore')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- case MSGBOX_RESULT_CONTINUE:
- eval.Format(64, L"Cordova.callbacks['%S'].success('Continue')", callbackId.GetPointer());
- pWeb->EvaluateJavascriptN(eval);
- break;
- }
-
- } else {
- AppLogException("Could not construct MessageBox");
- }
- delete title;
- delete message;
- delete styleStr;
-}
-void Notification::Vibrate(const long milliseconds) {
- AppLogDebug("Trying to vibrate the device for %d", milliseconds);
- Vibrator vibrator;
- vibrator.Construct();
- vibrator.Start(milliseconds, 99);
- Osp::Base::Runtime::Thread::Sleep(milliseconds + 1000);
-}
-
-void Notification::Beep(const int count) {
- AppLogDebug("Trying to beep the device");
- result r = E_SUCCESS;
-
- TouchEffect *pTouchEffect = null;
- pTouchEffect = new Osp::Uix::TouchEffect();
-
- r = pTouchEffect->Construct();
-
- if(r == E_SUCCESS) {
- for(int i = 0 ; i < count && r == E_SUCCESS ; i++) {
- r = pTouchEffect->Play(TOUCH_EFFECT_SOUND);
- Osp::Base::Runtime::Thread::Sleep(1000);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/bada/src/WebForm.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/bada/src/WebForm.cpp b/lib/cordova-1.9.0/lib/bada/src/WebForm.cpp
deleted file mode 100755
index 57b1373..0000000
--- a/lib/cordova-1.9.0/lib/bada/src/WebForm.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "WebForm.h"
-
-WebForm::WebForm(void)
- :__pWeb(null), __cordovaCommand(null)
-{
- geolocation = null;
- device = null;
- accel = null;
- network = null;
- console = null;
- compass = null;
- contacts = null;
-}
-
-WebForm::~WebForm(void) {
-}
-
-bool
-WebForm::Initialize()
-{
- return true;
-}
-
-result
-WebForm::OnInitializing(void)
-{
- result r = E_SUCCESS;
-
- // TODO: Add your initialization code here
-
- r = CreateWebControl();
- if (IsFailed(r))
- {
- AppLog("CreateMainForm() has failed.\n");
- goto CATCH;
- }
-
- __pWeb->LoadUrl("file:///Res/index.html");
- //__pWeb->LoadUrl("file:///Res/mobile-spec/index.html");
-
- return r;
-
-CATCH:
- return false;
-}
-
-result
-WebForm::OnTerminating(void)
-{
- result r = E_SUCCESS;
-
-// delete __cordovaCommand;
-// delete geolocation;
-// delete device;
-// delete accel;
-// delete network;
-// delete console;
-// delete compass;
-// delete contacts;
-// delete notification;
-// delete camera;
- return r;
-}
-
-void
-WebForm::OnActionPerformed(const Osp::Ui::Control& source, int actionId)
-{
- switch(actionId)
- {
- default:
- break;
- }
-}
-
-void
-WebForm::LaunchBrowser(const String& url) {
- ArrayList* pDataList = null;
- pDataList = new ArrayList();
- pDataList->Construct();
-
- String* pData = null;
- pData = new String(L"url:");
- pData->Append(url);
- AppLogDebug("Launching Stock Browser with %S", pData->GetPointer());
- pDataList->Add(*pData);
-
- AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_BROWSER, "");
- if(pAc) {
- pAc->Start(pDataList, null);
- delete pAc;
- }
- pDataList->RemoveAll(true);
- delete pDataList;
-}
-
-bool
-WebForm::OnLoadingRequested (const Osp::Base::String& url, WebNavigationType type) {
- AppLogDebug("URL REQUESTED %S", url.GetPointer());
- if(url.StartsWith("gap://", 0)) {
-// __cordovaCommand = null;
-
- __cordovaCommand = new String(url);
- // FIXME: for some reason this does not work if we return true. Web freezes.
-// __pWeb->StopLoading();
-// String* test;
-// test = __pWeb->EvaluateJavascriptN(L"'test'");
-// AppLogDebug("String is %S", test->GetPointer());
-// delete test;
-// return true;
- return false;
- } else if(url.StartsWith("http://", 0) || url.StartsWith("https://", 0)) {
- AppLogDebug("Non Cordova command. External URL. Launching WebBrowser");
- LaunchBrowser(url);
- return false;
- }
-
- return false;
-}
-
-void
-WebForm::OnLoadingCompleted() {
- // Setting DeviceInfo to initialize Cordova (should be done only once) and firing onNativeReady event
- String* deviceInfo;
- deviceInfo = __pWeb->EvaluateJavascriptN(L"window.device.uuid");
- if(deviceInfo->IsEmpty()) {
- device->SetDeviceInfo();
- __pWeb->EvaluateJavascriptN("Cordova.onNativeReady.fire();");
- } else {
- //AppLogDebug("DeviceInfo = %S;", deviceInfo->GetPointer());
- }
- delete deviceInfo;
-
- // Analyzing Cordova command
- if(__cordovaCommand) {
- if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Geolocation", 0)) {
- geolocation->Run(*__cordovaCommand);
- }
- else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Accelerometer", 0)) {
- accel->Run(*__cordovaCommand);
- }
- else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Network", 0)) {
- network->Run(*__cordovaCommand);
- }
- else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.DebugConsole", 0)) {
- console->Run(*__cordovaCommand);
- }
- else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Compass", 0)) {
- compass->Run(*__cordovaCommand);
- }
- else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Contacts", 0)) {
- contacts->Run(*__cordovaCommand);
- }
- else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Notification", 0)) {
- notification->Run(*__cordovaCommand);
- }
- else if(__cordovaCommand->StartsWith(L"gap://org.apache.cordova.Camera", 0)) {
- camera->Run(*__cordovaCommand);
- }
- // Tell the JS code that we got this command, and we're ready for another
- __pWeb->EvaluateJavascriptN(L"Cordova.queue.ready = true;");
- delete __cordovaCommand;
- __cordovaCommand = null;
- }
- else {
- AppLogDebug("Non Cordova command completed");
- }
-}
-
-result
-WebForm::CreateWebControl(void)
-{
- result r = E_SUCCESS;
- int screen_width = 0;
- int screen_height = 0;
-
- /*screen*/
- r = SystemInfo::GetValue("ScreenWidth", screen_width);
- TryCatch(r == E_SUCCESS, , "SystemInfo: To get a value is failed");
-
- r = SystemInfo::GetValue("ScreenHeight", screen_height);
- TryCatch(r == E_SUCCESS, , "SystemInfo: To get a value is failed");
-
- /*Web*/
- __pWeb = new Web();
- r = __pWeb->Construct(Rectangle(0, 0, screen_width, screen_height - 38));
- TryCatch(r == E_SUCCESS, ,"Web is not constructed\n ");
-
- r = this->AddControl(*__pWeb);
- TryCatch(r == E_SUCCESS, ,"Web is not attached\n ");
-
- __pWeb->SetLoadingListener(this);
-
- __pWeb->SetFocus();
-
- if(__pWeb) {
- geolocation = new GeoLocation(__pWeb);
- device = new Device(__pWeb);
- accel = new Accelerometer(__pWeb);
- network = new Network(__pWeb);
- console = new DebugConsole(__pWeb);
- compass = new Compass(__pWeb);
- contacts = new Contacts(__pWeb);
- notification = new Notification(__pWeb);
- camera = new Kamera(__pWeb);
- }
- return r;
-
-CATCH:
- AppLog("Error = %s\n", GetErrorMessage(r));
- return r;
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type4.png
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type4.png b/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type4.png
deleted file mode 100755
index 5d6a28a..0000000
Binary files a/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type4.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type5.png
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type5.png b/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type5.png
deleted file mode 100755
index bd64f76..0000000
Binary files a/lib/cordova-1.9.0/lib/badaWac/Icons/codova_bada_wac_splash_type5.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_icon_type5.png
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_icon_type5.png b/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_icon_type5.png
deleted file mode 100755
index 8ad8bac..0000000
Binary files a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_icon_type5.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type3.png
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type3.png b/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type3.png
deleted file mode 100755
index 9138092..0000000
Binary files a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type3.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type4.png
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type4.png b/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type4.png
deleted file mode 100755
index f86a27a..0000000
Binary files a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_icon_type4.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_splash_type3.png
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_splash_type3.png b/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_splash_type3.png
deleted file mode 100755
index ea15693..0000000
Binary files a/lib/cordova-1.9.0/lib/badaWac/Icons/cordova_bada_wac_splash_type3.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/LICENSE
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/LICENSE b/lib/cordova-1.9.0/lib/badaWac/LICENSE
deleted file mode 100755
index 261eeb9..0000000
--- a/lib/cordova-1.9.0/lib/badaWac/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/NOTICE
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/NOTICE b/lib/cordova-1.9.0/lib/badaWac/NOTICE
deleted file mode 100755
index bf15476..0000000
--- a/lib/cordova-1.9.0/lib/badaWac/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Cordova Bada WAC
-Copyright 2012 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/244fae11/lib/cordova-1.9.0/lib/badaWac/README.md
----------------------------------------------------------------------
diff --git a/lib/cordova-1.9.0/lib/badaWac/README.md b/lib/cordova-1.9.0/lib/badaWac/README.md
deleted file mode 100755
index d2d61e7..0000000
--- a/lib/cordova-1.9.0/lib/badaWac/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-Cordova for Bada WAC
-====================
-
-Supports: Acceleration, Geolocation, Connection, Device, Compass, Capture, Camera, Events (deviceready)
-
-Build steps
-===========
-1. clone repository
-2. import into IDE as Bada Flash / C++ application
-3. HTML/CSS/Javascript live in the Res folder
-4. Run on Target device or Emulator
-5. Done!