You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/05/24 01:41:28 UTC
[07/38] updated android, ios,
bb libraries to 2.8.x branch. fixed a few assertions with project
changes. removed blackberry support until create script can be finalized.
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/com.blackberry.utils/plugin.xml
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/com.blackberry.utils/plugin.xml b/lib/cordova-blackberry/plugins/com.blackberry.utils/plugin.xml
new file mode 100644
index 0000000..746fa76
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/com.blackberry.utils/plugin.xml
@@ -0,0 +1,30 @@
+<!--
+ 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.
+-->
+<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
+ id="com.blackberry.utils"
+ version="1.0.0">
+
+ <platform name="blackberry10">
+ <lib-file src="src/blackberry10/native/device/libutils.so" arch="device"/>
+ <lib-file src="src/blackberry10/native/simulator/libutils.so" arch="simulator"/>
+ <config-file target="www/config.xml" parent="/widget">
+ <feature name="com.blackberry.utils"/>
+ </config-file>
+ </platform>
+</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so b/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so
new file mode 100644
index 0000000..126d02c
Binary files /dev/null and b/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/device/libutils.so differ
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so b/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so
new file mode 100644
index 0000000..392ad33
Binary files /dev/null and b/lib/cordova-blackberry/plugins/com.blackberry.utils/src/blackberry10/native/simulator/libutils.so differ
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml
new file mode 100644
index 0000000..474077e
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/plugin.xml
@@ -0,0 +1,31 @@
+
+<!--
+ 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.
+-->
+<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
+ id="org.apache.cordova.blackberry10.pimlib"
+ version="1.0.0">
+
+ <platform name="blackberry10">
+ <lib-file src="src/blackberry10/native/device/libpimcontacts.so" arch="device"></lib-file>
+ <lib-file src="src/blackberry10/native/simulator/libpimcontacts.so" arch="simulator"></lib-file>
+ <config-file target="www/config.xml" parent="/widget">
+ <feature name="org.apache.cordova.blackberry10.pimlib"></feature>
+ </config-file>
+ </platform>
+</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile
new file mode 100644
index 0000000..0cc5eae
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/Makefile
@@ -0,0 +1,8 @@
+LIST=CPU
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile
new file mode 100644
index 0000000..0e22650
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/Makefile
@@ -0,0 +1,8 @@
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile
new file mode 100644
index 0000000..2c76089
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/Makefile
@@ -0,0 +1 @@
+include ../../common.mk
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so
new file mode 100755
index 0000000..f90047f
Binary files /dev/null and b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/arm/so.le-v7/libpimcontacts.so differ
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk
new file mode 100644
index 0000000..7bc06fb
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/common.mk
@@ -0,0 +1,18 @@
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME=pimcontacts
+PLUGIN=yes
+UTILS=yes
+
+include ../../../../../../meta.mk
+
+SRCS+=pim_contacts_qt.cpp \
+ pim_contacts_js.cpp \
+ contact_account.cpp
+
+include $(MKFILES_ROOT)/qtargets.mk
+
+LIBS+=bbpim bbcascadespickers QtCore img
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp
new file mode 100644
index 0000000..3476e70
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * 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.
+ */
+
+#include <webworks_utils.hpp>
+#include "contact_account.hpp"
+
+ContactAccount& ContactAccount::GetAccountInstance()
+{
+ static ContactAccount ca;
+ return ca;
+}
+
+ContactAccount::ContactAccount()
+{
+ fetchContactAccounts();
+}
+
+ContactAccount::~ContactAccount()
+{}
+
+QList<bb::pim::account::Account> ContactAccount::GetContactAccounts(bool fresh)
+{
+ if (fresh) {
+ fetchContactAccounts();
+ }
+ return _accounts;
+}
+
+bb::pim::account::Account ContactAccount::GetAccount(bb::pim::account::AccountKey id, bool fresh)
+{
+ if (fresh) {
+ fetchContactAccounts();
+ }
+ return _accountMap.value(id);
+}
+
+Json::Value ContactAccount::Account2Json(const bb::pim::account::Account& account)
+{
+ Json::Value jsonAccount;
+ jsonAccount["id"] = webworks::Utils::intToStr(account.id());
+ jsonAccount["name"] = account.displayName().isEmpty() ? account.provider().name().toStdString() : account.displayName().toStdString();
+ jsonAccount["enterprise"] = account.isEnterprise() == 1 ? true : false;
+
+ return jsonAccount;
+}
+
+void ContactAccount::fetchContactAccounts()
+{
+ QList<bb::pim::account::Account> accounts = _accountService.accounts(bb::pim::account::Service::Contacts);
+
+ _accounts.clear();
+ _accountMap.clear();
+ for (QList<bb::pim::account::Account>::const_iterator it = accounts.begin(); it != accounts.end(); ++it) {
+ if ((it->id() != ID_UNIFIED_ACCOUNT) && (it->id() != ID_ENHANCED_ACCOUNT)) {
+ _accounts.append(*it);
+ _accountMap.insert(it->id(), (bb::pim::account::Account)(*it));
+ }
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp
new file mode 100644
index 0000000..3910de8
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/contact_account.hpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * 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.
+ */
+
+#ifndef _CONTACT_ACCOUNT_HPP_
+#define _CONTACT_ACCOUNT_HPP_
+
+#include <bb/pim/account/Account>
+#include <bb/pim/account/AccountService>
+#include <bb/pim/account/Provider>
+
+#include <json/value.h>
+#include <QList>
+#include <QDebug>
+
+class ContactAccount
+{
+public:
+ static ContactAccount& GetAccountInstance();
+
+ // get all available accounts which provide contact service
+ QList<bb::pim::account::Account> GetContactAccounts(bool fresh = false);
+ // get the contact account with the specific id
+ bb::pim::account::Account GetAccount(bb::pim::account::AccountKey id, bool fresh = false);
+ // serialize account to json object
+ static Json::Value Account2Json(const bb::pim::account::Account& account);
+
+private:
+ ContactAccount();
+ ~ContactAccount();
+ explicit ContactAccount(ContactAccount const&);
+ void operator=(ContactAccount const&);
+ // Refresh the accounts list and map
+ void fetchContactAccounts();
+ QMap<bb::pim::account::AccountKey, bb::pim::account::Account> _accountMap;
+ QList<bb::pim::account::Account> _accounts;
+ bb::pim::account::AccountService _accountService;
+ static const int ID_UNIFIED_ACCOUNT = 4;
+ static const int ID_ENHANCED_ACCOUNT = 6;
+};
+
+#endif // end of _CONTACT_ACCOUNT_HPP_
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so
new file mode 100644
index 0000000..f90047f
Binary files /dev/null and b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/device/libpimcontacts.so differ
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp
new file mode 100644
index 0000000..4788bd1
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.cpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * 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.
+ */
+
+#include <json/reader.h>
+#include <json/writer.h>
+#include <string>
+#include "pim_contacts_js.hpp"
+#include "pim_contacts_qt.hpp"
+
+PimContacts::PimContacts(const std::string& id) : m_id(id)
+{
+}
+
+char* onGetObjList()
+{
+ // Return list of classes in the object
+ static char name[] = "PimContacts";
+ return name;
+}
+
+JSExt* onCreateObject(const std::string& className, const std::string& id)
+{
+ // Make sure we are creating the right class
+ if (className != "PimContacts") {
+ return 0;
+ }
+
+ return new PimContacts(id);
+}
+
+std::string PimContacts::InvokeMethod(const std::string& command)
+{
+ unsigned int index = command.find_first_of(" ");
+
+ string strCommand;
+ string jsonObject;
+ Json::Value *obj;
+
+ if (index != std::string::npos) {
+ strCommand = command.substr(0, index);
+ jsonObject = command.substr(index + 1, command.length());
+
+ // Parse the JSON
+ obj = new Json::Value;
+ bool parse = Json::Reader().parse(jsonObject, *obj);
+
+ if (!parse) {
+ return "Cannot parse JSON object";
+ }
+ } else {
+ strCommand = command;
+ obj = NULL;
+ }
+
+ if (strCommand == "find") {
+ startThread(FindThread, obj);
+ } else if (strCommand == "save") {
+ startThread(SaveThread, obj);
+ } else if (strCommand == "remove") {
+ startThread(RemoveThread, obj);
+ } else if (strCommand == "getContact") {
+ std::string result = Json::FastWriter().write(webworks::PimContactsQt().GetContact(*obj));
+ delete obj;
+ return result;
+ } else if (strCommand == "invokePicker") {
+ Json::Value result = webworks::PimContactsQt::InvokePicker(*obj);
+ delete obj;
+
+ std::string event = Json::FastWriter().write(result);
+ NotifyEvent("invokeContactPicker.invokeEventId", event);
+ } else if (strCommand == "getContactAccounts") {
+ return Json::FastWriter().write(webworks::PimContactsQt::GetContactAccounts());
+ }
+
+ return "";
+}
+
+bool PimContacts::CanDelete()
+{
+ return true;
+}
+
+// Notifies JavaScript of an event
+void PimContacts::NotifyEvent(const std::string& eventId, const std::string& event)
+{
+ std::string eventString = m_id + " result ";
+ eventString.append(eventId);
+ eventString.append(" ");
+ eventString.append(event);
+ SendPluginEvent(eventString.c_str(), m_pContext);
+}
+
+bool PimContacts::startThread(ThreadFunc threadFunction, Json::Value *jsonObj) {
+ webworks::PimContactsThreadInfo *thread_info = new webworks::PimContactsThreadInfo;
+ thread_info->parent = this;
+ thread_info->jsonObj = jsonObj;
+ thread_info->eventId = jsonObj->removeMember("_eventId").asString();
+
+ pthread_attr_t thread_attr;
+ pthread_attr_init(&thread_attr);
+ pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+
+ pthread_t thread;
+ pthread_create(&thread, &thread_attr, threadFunction, static_cast<void *>(thread_info));
+ pthread_attr_destroy(&thread_attr);
+
+ if (!thread) {
+ return false;
+ }
+
+ return true;
+}
+
+
+// Static functions:
+
+void* PimContacts::FindThread(void *args)
+{
+ webworks::PimContactsThreadInfo *thread_info = static_cast<webworks::PimContactsThreadInfo *>(args);
+
+ webworks::PimContactsQt pim_qt;
+ Json::Value result = pim_qt.Find(*(thread_info->jsonObj));
+ delete thread_info->jsonObj;
+
+ std::string event = Json::FastWriter().write(result);
+ thread_info->parent->NotifyEvent(thread_info->eventId, event);
+ delete thread_info;
+
+ return NULL;
+}
+
+void* PimContacts::SaveThread(void *args)
+{
+ webworks::PimContactsThreadInfo *thread_info = static_cast<webworks::PimContactsThreadInfo *>(args);
+
+ webworks::PimContactsQt pim_qt;
+ Json::Value result = pim_qt.Save(*(thread_info->jsonObj));
+ delete thread_info->jsonObj;
+
+ std::string event = Json::FastWriter().write(result);
+ thread_info->parent->NotifyEvent(thread_info->eventId, event);
+ delete thread_info;
+
+ return NULL;
+}
+
+void* PimContacts::RemoveThread(void *args)
+{
+ webworks::PimContactsThreadInfo *thread_info = static_cast<webworks::PimContactsThreadInfo *>(args);
+
+ webworks::PimContactsQt pim_qt;
+ Json::Value result = pim_qt.DeleteContact(*(thread_info->jsonObj));
+ delete thread_info->jsonObj;
+
+ std::string event = Json::FastWriter().write(result);
+ thread_info->parent->NotifyEvent(thread_info->eventId, event);
+ delete thread_info;
+
+ return NULL;
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/88ad654c/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp
new file mode 100644
index 0000000..df8bbd7
--- /dev/null
+++ b/lib/cordova-blackberry/plugins/org.apache.cordova.blackberry10.pimlib/src/blackberry10/native/pim_contacts_js.hpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2012 Research In Motion Limited.
+ *
+ * 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.
+ */
+
+#ifndef PIM_CONTACTS_JS_H_
+#define PIM_CONTACTS_JS_H_
+
+#include <json/value.h>
+#include <pthread.h>
+#include <string>
+#include "../common/plugin.h"
+
+typedef void* ThreadFunc(void *args);
+
+class PimContacts : public JSExt
+{
+public:
+ explicit PimContacts(const std::string& id);
+ virtual ~PimContacts() {}
+ virtual std::string InvokeMethod(const std::string& command);
+ virtual bool CanDelete();
+ void NotifyEvent(const std::string& eventId, const std::string& event);
+
+ static void* FindThread(void *args);
+ static void* SaveThread(void *args);
+ static void* RemoveThread(void *args);
+private:
+ bool startThread(ThreadFunc threadFunction, Json::Value *jsonObj);
+
+ std::string m_id;
+};
+
+#endif // PIM_CONTACTS_JS_H_