cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lorinb...@apache.org
Subject [26/51] [partial] [BlackBerry10] Added support for new platform
Date Tue, 07 May 2013 15:24:31 GMT
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifier.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifier.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifier.h
new file mode 100644
index 0000000..143f052
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifier.h
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef PPSNOTIFIER_H_
+#define PPSNOTIFIER_H_
+
+#include <string>
+
+#include "../utils/Thread.h"
+
+namespace jpps {
+
+/**
+ * PPSNotifier is an encapsulation of an open PPS .notify object. PPSNotifier has a
+ * blocking thread dedicated to reading from its .notify object. The thread constantly
+ * waits for new notifications in the .notify object.
+ *
+ * The way the PPS notify mechanism works is that on the first open/read of a .notify object,
+ * PPS provides a notify group id. This group id can be used when opening any PPS object to make
+ * the PPS object join the notify group.
+ *
+ * For example, you open a .notify file and the group id returned is "2a3".
+ * You subsequently open a PPS object and make it join that notify group:
+ *
+ * ::open("/pps/myppsobj?notify=2a3:someUniqueValueIDecide");
+ *
+ * Now, every time myppsobj changes, the .notify file will be updated in the following manner:
+ *
+ * <code>Notify 2a3:someUniqueValueIDecide</code>
+ *
+ * For a change to the file. And
+ *
+ * <code>-2a3:someUniqueValueIDecide</code>
+ *
+ * if myppsobj is closed.
+ *
+ * When PPSNotifier reads a notification, the unique value is actually a unique identifier for a
+ * PPSInterface object that can be looked up in a global PPSInterface lookup table. Getting the
+ * PPSInterface object designated by the unique identifier, PPSNotifier calls PPSInterface::onNotify()
+ * to inform the PPSInterface object that there is new data pending or that the file has closed.
+ * It is then up to the PPSInterface to decide how to proceed to get that data from myppsobj.
+ */
+class PPSNotifier {
+
+public:
+
+	/**
+	 * Constructor.
+	 */
+	PPSNotifier();
+
+	/**
+	 * Destructor. Note that this destructor will attempt to close the .notify
+	 * object's file.
+	 */
+	virtual ~PPSNotifier();
+
+	/**
+	 * Start the notify thread.
+	 */
+	void startNotifyLoop();
+
+	/**
+	 * Get the .notify object's path.
+	 *
+	 * @return The path to the .notify object.
+	 */
+	inline std::string getNotifyObjPath() const { return m_notifyObjPath; }
+
+	/**
+	 * Set the .notify object's path.
+	 *
+	 * @param path The path of the .notify object (note that this should not include the
+	 * .notify object name).
+	 */
+	inline void setNotifyOjbPath(const std::string& path) { m_notifyObjPath = path; }
+
+	/**
+	 * Get the .notify object's file descriptor.
+	 *
+	 * @return The file descriptor for the open .notify object.
+	 */
+	inline int getObjFd() const { return m_notifyObjFd; }
+
+	/**
+	 * Set the .notify object's file descriptor.
+	 *
+	 * @param The file descriptor for the open .notify object.
+	 */
+	inline void setObjFd(const int fd) { m_notifyObjFd = fd; }
+
+	/**
+	 * Set this notifier's .notify group ID (assigned by PPS).
+	 *
+	 * @param The .notify object's group ID, which is returned by PPS on the first read
+	 * of the .notify object.
+	 */
+	inline std::string getNotifyGroupId() const { return m_notifyGroupId; }
+
+	/**
+	 * Get this notifier's .notify group ID (assigned by PPS).
+	 *
+	 * @return The .notify object's group ID.
+	 */
+	inline void setNotifyGroupId(const std::string& id) { m_notifyGroupId = id; }
+
+private:
+
+	// Disable the copy constructor
+	PPSNotifier(const PPSNotifier& manager);
+
+	// Disable the assignment operator
+	PPSNotifier& operator=(const PPSNotifier& rhs);
+
+	/**
+	 * Function used to start the thread. Pass this into the Thread::start() function.
+	 *
+	 * @param pArg A pointer to a PPSNotifier.
+	 */
+	static void* _notifyLoop(void* pArg);
+
+	/**
+	 * The main thread loop. Blocks on reading the .notify file.
+	 */
+	void notifyLoop();
+
+	/** The path of the .notify file we're monitoring to know when to get data. */
+	std::string m_notifyObjPath;
+
+	/** The file descriptor of the .notify file we're monitoring to know when to get data. */
+	int m_notifyObjFd;
+
+	/** The .notify group ID assigned by PPS when the group was created. */
+	std::string m_notifyGroupId;
+
+	/** The thread I'm running on. */
+	Thread m_thread;
+};
+
+} /* namespace jpps */
+#endif /* PPSNOTIFIER_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.cpp b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.cpp
new file mode 100644
index 0000000..5392ca8
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+#include "PPSNotifyGroupManager.h"
+
+#include <fcntl.h>
+
+#include "PPSNotifier.h"
+
+namespace jpps {
+
+typedef std::map<std::string, PPSNotifier*>::iterator groupIter;
+typedef std::map<std::string, PPSNotifier*>::const_iterator const_groupIter;
+typedef std::pair<std::string, PPSNotifier*> groupValue;
+
+pthread_mutex_t PPSNotifyGroupManager::sm_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+PPSNotifyGroupManager::PPSNotifyGroupManager()
+{
+
+}
+
+PPSNotifyGroupManager::~PPSNotifyGroupManager()
+{
+	// Delete the allocated memory for all the PPSNotifiers
+	for (groupIter it = m_notifyGroups.begin(); it != m_notifyGroups.end(); it++) {
+
+		if ((*it).second != NULL) {
+
+			delete (*it).second;
+			(*it).second = NULL;
+		}
+	}
+}
+
+PPSNotifyGroupManager& PPSNotifyGroupManager::getInstance()
+{
+	// The one and only PPSNotifyGroupManager
+	static PPSNotifyGroupManager manager;
+	return manager;
+}
+
+bool PPSNotifyGroupManager::joinNotifyGroup(const std::string& path, std::string& groupId)
+{
+	std::string notifyFile;
+	std::string notifyPath(path);
+	std::size_t nPos = notifyPath.rfind('/');
+
+	// Search through the directories in the string until we find a valid .notify object
+	while (nPos != std::string::npos) {
+
+		// Chop off everything after the last '/' to get the path without the PPS object name
+		notifyPath = notifyPath.substr(0, nPos);
+
+		// Do we already have a notify group for this path?
+		const_groupIter it = m_notifyGroups.find(notifyPath);
+
+		// We found a match!
+		if (it != m_notifyGroups.end() && (*it).second != NULL) {
+
+			groupId = (*it).second->getNotifyGroupId();
+			return true;
+		}
+
+		// Add ".notify?wait" to the notify path, to make it a real file
+		notifyFile = notifyPath + "/.notify?wait";
+
+		// Try to open this .notify object
+		int fd = ::open(notifyFile.c_str(), O_RDONLY);
+
+		// This is the .notify object to use
+		if (fd >= 0) {
+
+			char data[20];
+			int len = ::read(fd, data, sizeof(data) - 1);
+			// Terminate string to remove the newline char
+			data[len > 0 ? len - 1 : 0] = '\0';
+
+			PPSNotifier* pNotifier = new PPSNotifier();
+			pNotifier->setNotifyGroupId(std::string(data));
+			pNotifier->setNotifyOjbPath(notifyPath);
+			pNotifier->setObjFd(::dup(fd));
+                        ::close(fd);
+
+			// Add this badboy to our cache of notify groups
+			m_notifyGroups.insert(groupValue(notifyPath, pNotifier));
+
+			// Start the notify reading thread
+			pNotifier->startNotifyLoop();
+
+			groupId = pNotifier->getNotifyGroupId();
+			return true;
+		}
+		// Keep looking
+		else {
+
+			nPos = notifyPath.rfind('/');
+		}
+	}
+
+	// We didn't find a notify group
+	groupId = "";
+	return false;
+}
+
+} /* namespace jpps */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.h
new file mode 100644
index 0000000..03b0e3e
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSNotifyGroupManager.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef PPSNOTIFYGROUPMANAGER_H_
+#define PPSNOTIFYGROUPMANAGER_H_
+
+#include <map>
+#include <string>
+#include <pthread.h>
+
+namespace jpps {
+
+// Forward declaration
+class PPSNotifier;
+
+
+/**
+ * The PPSNotifyGroupManager is used to manage a global pool of .notify objects. PPS has a mechanism
+ * where every folder can contain a special PPS object ".notify". Opening the .notify object will return
+ * a group id on the first read of the .notify object. The group id is used to open the real PPS object
+ * for which we desire to receive notifications. Once this is done, the .notify object is the one that will
+ * receive change notifications for the real PPS object. In this model, the real PPS object DOES NOT
+ * open in blocking read or ionotify/select mode. The .notify object is the one responsible for blocking
+ * on read and tracking data publishing.
+ *
+ * This object is a global singleton - any access to it needs to be wrapped in a mutex to prevent
+ * concurrency problems. Two functions mutex_lock() and mutex_unlock() are provided for this purpose.
+ */
+class PPSNotifyGroupManager
+{
+public:
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~PPSNotifyGroupManager();
+
+	/**
+	 * Get the one and only instance of the PPSNotifier.Always wrap calls to getInstance() in a call to
+	 * PPSNotifyGroupManager::mutexLock()/mutexUnlock().
+	 */
+	static PPSNotifyGroupManager& getInstance();
+
+	/**
+	 * Use this function to get the notify group id of the "closest" .notify object in the /pps hierarchy
+	 * that contains path.
+	 *
+	 * The function will go backwards through the directories in path looking for a .notify object. It will return
+	 * the group id of the first .notify object it finds on this path. It is the responsibility of the caller
+	 * to have the PPS object in path join the notify group by opening the object with the "notify=groupId:val"
+	 * option set.
+	 *
+	 * PPSNotifyGroupManager maintains a pool of opened .notify objects. It is possible for a single .notify object
+	 * to have a very disparate (and numerous) set of PPS objects that it monitors. In order to tweak performance
+	 * it is advisable that .notify object be created in strategic directories in the /pps directory hierarchy, in
+	 * order to spread the load of notification monitoring. Each .notify object opened will spawn a thread that blocks
+	 * on reading from the .notify object. Having several .notify objects means having several threads that read
+	 * notifications.
+	 *
+	 * Note that joinNotifyGroup() will NOT create any .notify PPS objects. The /pps/.notify object always exists,
+	 * and if the /pps directory hierarchy contains no other .notify objects, /pps/.notify will end up being the
+	 * notification group that all objects join.
+	 *
+	 * Always wrap calls to joinNotifyGroup() in a call to PPSNotifyGroupManager::mutexLock()/mutexUnlock().
+	 *
+	 * @param The PPS object that wants to join the notify group.
+	 * @param groupId The id of the notify group joined. This is an output parameter.
+	 * @return True if a notify group was successfully joined, false otherwise. If true, then the groupId
+	 * variable will be set.
+	 */
+	bool joinNotifyGroup(const std::string& path, std::string& groupId);
+
+	/**
+	 * Returns how many notification groups the manager is managing.
+	 *
+	 * @return The number of notification groups (i.e. open .notify objects) in use.
+	 */
+	inline std::size_t getNumGroups() const { return m_notifyGroups.size(); }
+
+	/**
+	 * Should be used to wrap all calls to PPSNotifyGroupManager APIs. Because this is a singleton global
+	 * object, multiple threads may try to access this object at one time. It is therefore important to
+	 * mutex lock all access to this object.
+	 */
+	static inline void mutexLock() { pthread_mutex_lock(&sm_mutex); }
+
+	/**
+	 * Should be used to wrap all calls to PPSNotifyGroupManager APIs. Because this is a singleton global
+	 * object, multiple threads may try to access this object at one time. It is therefore important to
+	 * mutex lock all access to this object.
+	 */
+	static inline void mutexUnlock() { pthread_mutex_unlock(&sm_mutex); }
+
+private:
+
+	/**
+	 * Constructor. Private as part of the singleton pattern of this object.
+	 */
+	PPSNotifyGroupManager();
+
+	// Disable the copy constructor.
+	PPSNotifyGroupManager(const PPSNotifyGroupManager& manager);
+
+	// Disable the assignment operator.
+	PPSNotifyGroupManager& operator=(const PPSNotifyGroupManager& rhs);
+
+	/** This is a cache of all the .notify objects. */
+	std::map<std::string, PPSNotifier*> m_notifyGroups;
+
+	/** Mutex used to prevent threads from clobbering each other. */
+	static pthread_mutex_t sm_mutex;
+};
+
+} /* namespace jpps */
+#endif /* PPSNOTIFYGROUPMANAGER_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSTypes.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSTypes.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSTypes.h
new file mode 100644
index 0000000..362d236
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/core/PPSTypes.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef PPSTYPES_H_
+#define PPSTYPES_H_
+
+#include <map>
+
+namespace jpps {
+
+class PPSEvent;
+
+/**
+ * A struct representing an attribute of a PPS object.
+ */
+struct ppsAttribute {
+
+	/** The attribute name. */
+	std::string name;
+	/** The attribute value. */
+	std::string value;
+	/** The attribute encoding. */
+	std::string encoding;
+	/** Flags associated to the attribute. */
+	int flags;
+	/** Attribute options. */
+	int options;
+	/** The attribute options mask. */
+	int optionMask;
+};
+
+/**
+ * A struct representing a PPS object.
+ */
+struct ppsObject {
+
+	/** The PPS object name. */
+	std::string name;
+	/** The PPS object flags. */
+	int flags;
+	/** The PPS object options. */
+	int options;
+	/** The PPS object option mask. */
+	int optionMask;
+	/** The attributes of this PPS object. */
+	std::map<std::string, ppsAttribute> attributes;
+};
+
+/**
+ * Typedef for ppsAttribute iterator.
+ */
+typedef std::map<std::string, ppsAttribute>::iterator ppsAttrIter;
+
+/**
+ * Typedef for ppsAttribute const iterator.
+ */
+typedef std::map<std::string, ppsAttribute>::const_iterator const_ppsAttrIter;
+
+/**
+ * A pair used to insert attributes into the map.
+ */
+typedef std::pair<std::string, ppsAttribute> ppsAttrPair;
+
+/**
+ * This is the definition of the notify function clients of PPSInterface use in order
+ * to be informed of events the PPSInterface generates.
+ *
+ * @param pArg A user defined parameter. This value can be passed in to PPSInterface::setEventFunc()
+ * and will be passed back with the event handler every time it is called. PPSInterface will not
+ * modify this value.
+ *
+ * @aparam event The PPS event being broadcast.
+ */
+typedef void (PPSEventFunc)(void* pArg, const PPSEvent& event);
+
+};
+
+#endif /* PPSTYPES_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.cpp b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.cpp
new file mode 100644
index 0000000..9b5d711
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.cpp
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+#include "JPPSPlugin.h"
+
+#include <string>
+#include <sstream>
+
+namespace jpps {
+
+const char* JPPSPlugin::CLASS_NAME = "PPS";
+const std::string JPPSPlugin::METHOD_OPEN = "Open";
+const std::string JPPSPlugin::METHOD_CLOSE = "Close";
+const std::string JPPSPlugin::METHOD_WRITE = "Write";
+const std::string JPPSPlugin::METHOD_READ = "Read";
+const std::string JPPSPlugin::METHOD_SET_VERBOSE = "SetVerbose";
+
+JPPSPlugin::JPPSPlugin(const std::string& jnextObjectId)
+: m_jnextObjId(jnextObjectId)
+, m_ppsInterface()
+{
+	// We only have one event handler, we'll use it for all events
+	m_ppsInterface.callbackInit(this,
+								onEvent,
+								onEvent,
+								onEvent,
+								onEvent,
+								onEvent,
+								onEvent,
+								onEvent);
+}
+
+JPPSPlugin::~JPPSPlugin()
+{
+
+}
+
+std::string JPPSPlugin::InvokeMethod(const std::string& strCommand)
+{
+	// Parameter sanity check
+	if (strCommand == "")
+		return std::string(szERROR) + " JPPSPlugin::InvokeMethod() called with no method to invoke.";
+
+	// Tokenize the stream of input information
+	std::stringstream args(strCommand);
+	std::string method;
+	args >> method;
+
+	// Invoke the method requested
+	if (method == JPPSPlugin::METHOD_WRITE) {
+		return write(args);
+	}
+	else if (method == JPPSPlugin::METHOD_READ) {
+		return read();
+	}
+	else if (method == JPPSPlugin::METHOD_OPEN) {
+		return open(args);
+	}
+	else if (method == JPPSPlugin::METHOD_CLOSE) {
+		return close();
+	}
+	else if (method == JPPSPlugin::METHOD_SET_VERBOSE) {
+		return setVerbose(args);
+	}
+
+	return std::string(szERROR) + m_jnextObjId + " JPPSPlugin::InvokeMethod() - unknown method \"" + method + "\"";
+}
+
+std::string JPPSPlugin::open(std::stringstream& args)
+{
+	// We don't have enough args
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSPlugin::open() - invalid number of arguments.";
+
+	// Get the arguments
+	// 1st arg, the path
+	std::string path;
+	args >> path;
+
+	// Missing argument
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSPlugin::open() - invalid number of arguments.";
+
+	// 2nd arg, the open flags (i.e. O_RDONLY O_CREAT, etc.)
+	int oflags = 0;
+	args >> oflags;
+
+	bool bRet = m_ppsInterface.open(path, oflags);
+
+	return bRet ? std::string(szOK) + m_jnextObjId : std::string(szERROR) + m_jnextObjId + " JPPSPlugin::open() - failed to open \"" + path + "\".";
+}
+
+std::string JPPSPlugin::close()
+{
+	m_ppsInterface.close();
+	return szOK + m_jnextObjId;
+}
+
+std::string JPPSPlugin::write(std::stringstream& args)
+{
+	// We don't have enough args
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSPlugin::write() - invalid number of arguments.";
+
+	// This truncates the buffer from the current position onwards (if you don't do this, you keep
+	// the method name that's at the beginning of the args stream)
+	args.seekg(1, std::ios_base::cur); 	// Skip the initial whitespace that was between the method name and the parameter
+	std::stringstream tmp;
+	tmp << args.rdbuf();
+
+	m_ppsInterface.write(tmp.str());
+	return szOK + m_jnextObjId;
+}
+
+std::string JPPSPlugin::read() const
+{
+	return std::string(szOK) + m_ppsInterface.read();
+}
+
+std::string JPPSPlugin::setVerbose(std::stringstream& args)
+{
+	unsigned short verbosity = 0;
+
+	// If no param was passed, default to 0, else read the value
+	if (!args.eof())
+		args >> verbosity;
+
+	m_ppsInterface.setVerbose(verbosity);
+	return szOK;
+}
+
+void JPPSPlugin::onEvent(const std::string& sEvent) const
+{
+	// We have to add our object Id to the event
+	std::string pluginEvent = m_jnextObjId + " " + sEvent;
+	SendPluginEvent(pluginEvent.c_str(), m_pContext);
+}
+
+void JPPSPlugin::onEvent(void* pArg, const std::string& sEvent)
+{
+	// Cast pArg back to JPPSPlugin and invoke onEvent()
+	JPPSPlugin* pPlugin = static_cast<JPPSPlugin*>(pArg);
+
+	if (pPlugin != NULL)
+		pPlugin->onEvent(sEvent);
+}
+
+} /* namespace jpps */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.h
new file mode 100644
index 0000000..1a56ab2
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSPlugin.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef JPPSPLUGIN_H_
+#define JPPSPLUGIN_H_
+
+#include "../common/plugin.h"
+#include "PPSInterfaceGlue.h"
+
+namespace jpps {
+
+/**
+ * JPPSPlugin is a JNext extension which provides PPS support to JavaScript.
+ * This class is merely a wrapper for PPSInterfaceGlue, providing the necessary
+ * JNext interface and performing string-parameter encoding and decoding.
+ *
+ * The intention is that this class will be replaced with a different plug-in framework.
+ */
+class JPPSPlugin : public JSExt {
+
+public:
+
+	// Constants
+
+	/** The only class supported by this plugin. */
+	static const char* CLASS_NAME;
+
+	// List of object methods supported by this extension
+
+	/** Open a PPS object/directory. */
+	static const std::string METHOD_OPEN;
+	/** Close a PPS object/directory. */
+	static const std::string METHOD_CLOSE;
+	/** Write a PPS object. */
+	static const std::string METHOD_WRITE;
+	/** Read a PPS object. */
+	static const std::string METHOD_READ;
+	/** Adjust output verbosity. */
+	static const std::string METHOD_SET_VERBOSE;
+
+	/**
+	 * Constructor.
+	 */
+	JPPSPlugin(const std::string& jnextObjectId);
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~JPPSPlugin();
+
+	// Inherited from JSExt
+	virtual std::string InvokeMethod(const std::string& strCommand);
+	virtual inline bool CanDelete(void) { return true; }
+
+	/**
+	 *  Static callback method, changes pArg back into a JPPSPlugin and invokes
+	 *  the non-static version of onEvent().
+	 */
+	static void onEvent(void* pArg, const std::string& sEvent);
+
+private:
+
+	// Disable the default constructor
+	JPPSPlugin();
+
+	/**
+	 * The non-static version of onEvent. Handler for the PPSInterfaceGlue class' events.
+	 */
+	void onEvent(const std::string& sEvent) const;
+
+	/**
+	 * Open a PPS object.
+	 */
+	std::string open(std::stringstream& args);
+
+	/**
+	 * Close the PPS object.
+	 */
+	std::string close();
+
+	/**
+	 * Write data to the PPS object.
+	 */
+	std::string write(std::stringstream& args);
+
+	/**
+	 * Read the cached PPS data from the last read.
+	 */
+	std::string read() const;
+
+	/**
+	 * Set the verbosity level for logging to slog.
+	 */
+	std::string setVerbose(std::stringstream& args);
+
+	/** A unique JNext id for this object */
+	std::string m_jnextObjId;
+
+	/** The PPS object. */
+	PPSInterfaceGlue m_ppsInterface;
+};
+
+} /* namespace jpps */
+#endif /* JPPSPLUGIN_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.cpp b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.cpp
new file mode 100644
index 0000000..6c3bc2d
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.cpp
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+#include "JPPSServerPlugin.h"
+
+#include <sstream>
+
+namespace jpps {
+
+const char* JPPSServerPlugin::CLASS_NAME = "PPSServer";
+
+const std::string JPPSServerPlugin::METHOD_OPEN = "Open";
+const std::string JPPSServerPlugin::METHOD_CLOSE = "Close";
+const std::string JPPSServerPlugin::METHOD_SET_VERBOSE = "SetVerbose";
+const std::string JPPSServerPlugin::METHOD_SEND_MESSAGE = "SendMessage";
+const std::string JPPSServerPlugin::METHOD_BROADCAST_MESSAGE = "BroadcastMessage";
+
+JPPSServerPlugin::JPPSServerPlugin(const std::string& jnextObjectId)
+: m_jnextObjId(jnextObjectId)
+, m_ppsServer()
+{
+	m_ppsServer.callbackInit(this,
+							 onEvent,
+							 onEvent,
+							 onEvent,
+							 onEvent,
+							 onEvent,
+							 onEvent,
+							 onEvent,
+							 onEvent);
+}
+
+JPPSServerPlugin::~JPPSServerPlugin()
+{
+}
+
+std::string JPPSServerPlugin::InvokeMethod(const std::string& strCommand)
+{
+	// Parameter sanity check
+	if (strCommand == "")
+		return std::string(szERROR) + " JPPSServerPlugin::InvokeMethod() called with no method to invoke.";
+
+	// Tokenize the stream of input information
+	std::stringstream args(strCommand);
+	std::string method;
+	args >> method;
+
+	// Invoke the method requested
+	if (method == JPPSServerPlugin::METHOD_OPEN) {
+		return open(args);
+	}
+	else if (method == JPPSServerPlugin::METHOD_CLOSE) {
+		return close();
+	}
+	else if (method == JPPSServerPlugin::METHOD_SET_VERBOSE) {
+		return setVerbose(args);
+	}
+	else if (method == JPPSServerPlugin::METHOD_SEND_MESSAGE) {
+		return sendMessage(args);
+	}
+	else if (method == JPPSServerPlugin::METHOD_BROADCAST_MESSAGE) {
+		return broadcastMessage(args);
+	}
+
+	return std::string(szERROR) + m_jnextObjId + " JPPSServerPlugin::InvokeMethod() - unknown method \"" + method + "\"";
+}
+
+std::string JPPSServerPlugin::open(std::stringstream& args)
+{
+	// We don't have enough args
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSServerPlugin::open() - invalid number of arguments.";
+
+	// Get the arguments
+	// 1st arg, the path
+	std::string path;
+	args >> path;
+
+	// Missing argument
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSServerPlugin::open() - invalid number of arguments.";
+
+	// 2nd arg, the open flags (i.e. O_RDONLY O_CREAT, etc.)
+	int oflags = 0;
+	args >> oflags;
+
+	bool bRet = m_ppsServer.open(path, oflags);
+
+	return bRet ? std::string(szOK) + m_jnextObjId : std::string(szERROR) + m_jnextObjId + " JPPSServerPlugin::open() - failed to open \"" + path + "\".";
+}
+
+std::string JPPSServerPlugin::close()
+{
+	m_ppsServer.close();
+	return szOK + m_jnextObjId;
+}
+
+std::string JPPSServerPlugin::setVerbose(std::stringstream& args)
+{
+	unsigned short verbosity = 0;
+
+	// If no param was passed, default to 0, else read the value
+	if (!args.eof())
+		args >> verbosity;
+
+	m_ppsServer.setVerbose(verbosity);
+	return szOK + m_jnextObjId;
+}
+
+std::string JPPSServerPlugin::sendMessage(std::stringstream& args)
+{
+	// We don't have enough args
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSServerPlugin::sendMessage() - invalid number of arguments.";
+
+	// Get the arguments
+	// 1st arg, the clientId
+	std::string clientId;
+	args >> clientId;
+
+	// We don't have enough args
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSServerPlugin::sendMessage() - invalid number of arguments.";
+
+	// This truncates the buffer from the current position onwards (if you don't do this, you keep
+	// the method name that's at the beginning of the args stream)
+	args.seekg(1, std::ios_base::cur); 	// Skip the whitespace that was between the clientID and the message
+	std::stringstream tmp;
+	tmp << args.rdbuf();
+
+	m_ppsServer.sendMessage(clientId, tmp.str());
+	return szOK + m_jnextObjId;
+}
+
+std::string JPPSServerPlugin::broadcastMessage(std::stringstream& args)
+{
+	// We don't have enough args
+	if (args.eof())
+		return std::string(szERROR) + m_jnextObjId + " JPPSServerPlugin::broadcastMessage() - invalid number of arguments.";
+
+	// This truncates the buffer from the current position onwards (if you don't do this, you keep
+	// the method name that's at the beginning of the args stream)
+	args.seekg(1, std::ios_base::cur); 	// Skip the whitespace that was between the method name and the message
+	std::stringstream tmp;
+	tmp << args.rdbuf();
+
+	m_ppsServer.broadcastMessage(tmp.str());
+	return szOK + m_jnextObjId;
+}
+
+void JPPSServerPlugin::onEvent(const std::string& sEvent) const
+{
+	// We have to add our object Id to the event
+	std::string pluginEvent = m_jnextObjId + " " + sEvent;
+	SendPluginEvent(pluginEvent.c_str(), m_pContext);
+}
+
+void JPPSServerPlugin::onEvent(void* pArg, const std::string& sEvent)
+{
+	// Cast pArg back to JPPSPlugin and invoke onEvent()
+	JPPSServerPlugin* pPlugin = static_cast<JPPSServerPlugin*>(pArg);
+
+	if (pPlugin != NULL)
+		pPlugin->onEvent(sEvent);
+}
+
+} /* namespace jpps */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.h
new file mode 100644
index 0000000..ea5b18f
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/JPPSServerPlugin.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef JPPSSERVERPLUGIN_H_
+#define JPPSSERVERPLUGIN_H_
+
+#include "../common/plugin.h"
+#include "PPSServerGlue.h"
+
+namespace jpps {
+
+class JPPSServerPlugin: public JSExt {
+
+public:
+
+	// Constants
+
+	/** The only class supported by this plugin. */
+	static const char* CLASS_NAME;
+
+	// List of object methods supported by this extension
+
+	/** Open a PPS object/directory. */
+	static const std::string METHOD_OPEN;
+	/** Close a PPS object/directory. */
+	static const std::string METHOD_CLOSE;
+	/** Adjust output verbosity. */
+	static const std::string METHOD_SET_VERBOSE;
+	/** Send a message to a particular client. */
+	static const std::string METHOD_SEND_MESSAGE;
+	/** Send a message to all clients. */
+	static const std::string METHOD_BROADCAST_MESSAGE;
+
+	/**
+	 * Constructor.
+	 */
+	JPPSServerPlugin(const std::string& jnextObjectId);
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~JPPSServerPlugin();
+
+	// Inherited from JSExt
+	virtual std::string InvokeMethod(const std::string& strCommand);
+	virtual inline bool CanDelete(void) { return true; }
+
+	/**
+	 *  Static callback method, changes pArg back into a JPPSServerPlugin and invokes
+	 *  the non-static version of onEvent().
+	 */
+	static void onEvent(void* pArg, const std::string& sEvent);
+
+private:
+
+	// Disable default constructor.
+	JPPSServerPlugin();
+
+	/**
+	 * The non-static version of onEvent. Handler for the PPSServerGlue class' events.
+	 */
+	void onEvent(const std::string& sEvent) const;
+
+	/**
+	 * Open a PPS object.
+	 */
+	std::string open(std::stringstream& args);
+
+	/**
+	 * Close the PPS object.
+	 */
+	std::string close();
+
+	/**
+	 * Set the verbosity level for logging to slog.
+	 */
+	std::string setVerbose(std::stringstream& args);
+
+	/**
+	 * Send a message to a particular client.
+	 */
+	std::string sendMessage(std::stringstream& args);
+
+	/**
+	 * Send a message to all clients.
+	 */
+	std::string broadcastMessage(std::stringstream& args);
+
+	/** A unique JNext id for this object */
+	std::string m_jnextObjId;
+
+	/** The PPS object. */
+	PPSServerGlue m_ppsServer;
+};
+
+} /* namespace jpps */
+#endif /* JPPSSERVERPLUGIN_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.cpp b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.cpp
new file mode 100644
index 0000000..83616b8
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.cpp
@@ -0,0 +1,355 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+#include "PPSInterfaceGlue.h"
+
+#include <json/value.h>
+#include <json/writer.h>
+#include <json/reader.h>
+
+#include <vector>
+#include <sstream>
+
+#include <ppsparse.h>
+
+#include "../core/PPSEvent.h"
+
+namespace jpps {
+
+const std::string PPSInterfaceGlue::EVENT_OPEN = "ppsOpened";
+const std::string PPSInterfaceGlue::EVENT_OPEN_FAILED = "ppsOpenFailed";
+const std::string PPSInterfaceGlue::EVENT_FIRST_READ = "ppsFirstRead";
+const std::string PPSInterfaceGlue::EVENT_NEW_DATA = "OnChange";//"ppsNewData";
+const std::string PPSInterfaceGlue::EVENT_CLOSE = "ppsClosed";
+const std::string PPSInterfaceGlue::EVENT_WRITE_FAILED = "ppsWriteFailed";
+const std::string PPSInterfaceGlue::EVENT_READ_FAILED = "ppsReadFailed";
+
+const std::string PPSInterfaceGlue::ENCODING_N = "n";
+const std::string PPSInterfaceGlue::ENCODING_B = "b";
+const std::string PPSInterfaceGlue::ENCODING_JSON = "json";
+
+const Json::StaticString PPSInterfaceGlue::JSON_REMOVE("remove");
+const Json::StaticString PPSInterfaceGlue::JSON_CHANGED("changed");
+const Json::StaticString PPSInterfaceGlue::JSON_DATA("data");
+const Json::StaticString PPSInterfaceGlue::JSON_OBJNAME("objName");
+const Json::StaticString PPSInterfaceGlue::JSON_CHANGE_DATA("changeData");
+const Json::StaticString PPSInterfaceGlue::JSON_ALL_DATA("allData");
+
+
+PPSInterfaceGlue::PPSInterfaceGlue()
+: m_interface()
+, m_pArg(NULL)
+, m_handleOpen(NULL)
+, m_handleFirstRead(NULL)
+, m_handleNewData(NULL)
+, m_handleClose(NULL)
+, m_handleOpenFailed(NULL)
+, m_handleWriteFailed(NULL)
+, m_handleReadFailed(NULL)
+{
+	m_interface.setEventFunc(onEvent, this);
+}
+
+PPSInterfaceGlue::~PPSInterfaceGlue()
+{
+	m_interface.setEventFunc(NULL);
+}
+
+void PPSInterfaceGlue::callbackInit(void* pArg,
+								    callback* handleOpen,
+								    callback* handleFirstRead,
+								    callback* handleNewData,
+								    callback* handleClose,
+								    callback* handleOpenFailed,
+								    callback* handleWriteFailed,
+								    callback* handleReadFailed)
+{
+	m_pArg = pArg;
+	m_handleOpen = handleOpen;
+	m_handleFirstRead = handleFirstRead;
+	m_handleNewData = handleNewData;
+	m_handleClose = handleClose;
+	m_handleOpenFailed = handleOpenFailed;
+	m_handleWriteFailed = handleWriteFailed;
+	m_handleReadFailed = handleReadFailed;
+}
+
+void PPSInterfaceGlue::setVerbose(unsigned short v)
+{
+	m_interface.setVerbose(v);
+}
+
+bool PPSInterfaceGlue::open(const std::string& path, int oflags)
+{
+	// We don't expose the "mode" to the JS layer - always create in 0666 mode
+	return m_interface.open(path, oflags, 0666, false);
+}
+
+void PPSInterfaceGlue::close()
+{
+	m_interface.close();
+}
+
+void PPSInterfaceGlue::sync()
+{
+	m_interface.sync();
+}
+
+void PPSInterfaceGlue::onEvent(void* pArg, const PPSEvent& event)
+{
+	PPSInterfaceGlue* pGlue = static_cast<PPSInterfaceGlue*>(pArg);
+
+	if (pGlue != NULL)
+		pGlue->onEvent(event);
+}
+
+void PPSInterfaceGlue::onEvent(const PPSEvent& event)
+{
+	callback* pFunc = NULL;
+	std::string sArg;
+
+	switch (event.getEventType()) {
+
+	case PPSEvent::PPS_EVENT_OPENED:
+		pFunc = m_handleOpen;
+		sArg = EVENT_OPEN;
+		break;
+
+	case PPSEvent::PPS_EVENT_FIRST_READ_COMPLETE:
+		pFunc = m_handleFirstRead;
+		sArg = EVENT_FIRST_READ + " " + handleNewData(event.getNewData());
+		break;
+
+	case PPSEvent::PPS_EVENT_NEW_DATA:
+		pFunc = m_handleNewData;
+		sArg = EVENT_NEW_DATA + " " + handleNewData(event.getNewData());
+		break;
+
+	case PPSEvent::PPS_EVENT_CLOSED:
+		pFunc = m_handleClose;
+		sArg = EVENT_CLOSE;
+		break;
+
+	case PPSEvent::PPS_EVENT_OPEN_FAILED:
+		pFunc = m_handleOpenFailed;
+		sArg = EVENT_OPEN_FAILED + " " + event.getMessage();
+		break;
+
+	case PPSEvent::PPS_EVENT_WRITE_FAILED:
+		pFunc = m_handleWriteFailed;
+		sArg = EVENT_WRITE_FAILED + " " + event.getMessage();
+		break;
+
+	case PPSEvent::PPS_EVENT_READ_FAILED:
+		pFunc = m_handleReadFailed;
+		sArg = EVENT_READ_FAILED + " " + event.getMessage();
+		break;
+	}
+
+	if (pFunc != NULL)
+		pFunc(m_pArg, sArg);
+}
+
+std::string PPSInterfaceGlue::handleNewData(const ppsObject& newData)
+{
+	Json::Value data(Json::nullValue);
+	data[JSON_CHANGE_DATA] = JSONEncodeNewData(newData);
+	data[JSON_ALL_DATA] = JSONEncodeRead(m_interface.read());
+
+	Json::FastWriter writer;
+	return writer.write(data);
+}
+
+std::string PPSInterfaceGlue::read() const
+{
+	Json::Value data = JSONEncodeRead(m_interface.read());
+	Json::FastWriter writer;
+	return writer.write(data);
+}
+
+Json::Value PPSInterfaceGlue::JSONEncodeRead(const ppsObject& ppsObj) const
+{
+	// If the ppsObj is empty, we can't encode it
+	if (ppsObj.name.empty())
+		return "";
+
+	Json::Value readData(Json::nullValue);
+
+	for (const_ppsAttrIter it = ppsObj.attributes.begin(); it != ppsObj.attributes.end(); it++) {
+
+		ppsAttribute ppsAttrib = (*it).second;
+
+		// An attribute was deleted: update the JSON data structure and the event data
+		if (ppsAttrib.flags & PPS_DELETED) {
+
+			readData.removeMember(ppsAttrib.name);
+		}
+		else {
+
+			// The value is a number
+			if (ppsAttrib.encoding == ENCODING_N) {
+
+				// Convert the value to floating point
+				// istringstream is locale aware - we shouldn't need to perform any special
+				// processing in order to properly convert the data to a floating point
+				// TODO: test that the istringstream conversion works with a locale
+				//       that uses alternate floating point number encoding
+				std::istringstream stream(ppsAttrib.value);
+				double doubleValue;
+
+				// Try to convert the value to a floating point
+				if (!(stream >> doubleValue)) {
+
+					std::string err = EVENT_READ_FAILED + " Failed to convert the string \"" + ppsAttrib.value + "\" to a real number.";
+					m_handleReadFailed(m_pArg, err);
+					return "";
+				}
+
+				readData[ppsAttrib.name] = doubleValue;
+			}
+			// The value is a boolean
+			else if (ppsAttrib.encoding == ENCODING_B) {
+
+				readData[ppsAttrib.name] = (ppsAttrib.value == "true");
+			}
+			// The value is JSON data
+			else if (ppsAttrib.encoding == ENCODING_JSON) {
+
+				Json::Reader reader;
+				reader.parse(ppsAttrib.value, readData[ppsAttrib.name]);
+			}
+			// Just pass the value through as a straight string
+			else {
+
+				readData[ppsAttrib.name] = ppsAttrib.value;
+			}
+		}
+	}
+
+	return readData;
+}
+
+Json::Value PPSInterfaceGlue::JSONEncodeNewData(const ppsObject& ppsObj) const
+{
+	// If the ppsObj is empty, we can't encode it
+	if (ppsObj.name.empty())
+		return "";
+
+	Json::Value eventData(Json::nullValue);
+
+	// Set the PPS object name
+	eventData[JSON_OBJNAME] = ppsObj.name.substr(1); // PR 159829 : Remove the pre-pending '@' symbol
+
+	for (const_ppsAttrIter it = ppsObj.attributes.begin(); it != ppsObj.attributes.end(); it++) {
+
+		ppsAttribute ppsAttrib = (*it).second;
+
+		// An attribute was deleted: update the JSON data structure and the event data
+		if (ppsAttrib.flags & PPS_DELETED) {
+
+			eventData[JSON_REMOVE][ppsAttrib.name] = true;
+		}
+		else {
+
+			eventData[JSON_CHANGED][ppsAttrib.name] = true;
+
+			// The value is a number
+			if (ppsAttrib.encoding == ENCODING_N) {
+
+				// Convert the value to floating point
+				// istringstream is locale aware - we shouldn't need to perform any special
+				// processing in order to properly convert the data to a floating point
+				// TODO: test that the istringstream conversion works with a locale
+				//       that uses alternate floating point number encoding
+				std::istringstream stream(ppsAttrib.value);
+				double doubleValue;
+
+				// Try to convert the value to a floating point
+				if (!(stream >> doubleValue)) {
+
+					std::string err = EVENT_READ_FAILED + " Failed to convert the string \"" + ppsAttrib.value + "\" to a real number.";
+					m_handleReadFailed(m_pArg, err);
+					return "";
+				}
+
+				eventData[JSON_DATA][ppsAttrib.name] = doubleValue;
+			}
+			// The value is a boolean
+			else if (ppsAttrib.encoding == ENCODING_B) {
+
+				eventData[JSON_DATA][ppsAttrib.name] = (ppsAttrib.value == "true");
+			}
+			// The value is JSON data
+			else if (ppsAttrib.encoding == ENCODING_JSON) {
+
+				Json::Reader reader;
+				reader.parse(ppsAttrib.value, eventData[JSON_DATA][ppsAttrib.name]);
+			}
+			// Just pass the value through as a straight string
+			else {
+
+				eventData[JSON_DATA][ppsAttrib.name] = ppsAttrib.value;
+			}
+		}
+	}
+
+	return eventData;
+}
+
+void PPSInterfaceGlue::write(const std::string& data)
+{
+    Json::Reader reader;
+    Json::Value root;
+
+	bool parsingSuccessful = reader.parse(data, root);
+
+    // If parsing the JSON string fails, return a write error
+    if (!parsingSuccessful) {
+
+    	std::string err = EVENT_WRITE_FAILED + " JSON failed to parse the string (\"" + data + "\") to be written. (" + reader.getFormatedErrorMessages() + ")";
+        m_handleWriteFailed(m_pArg, err);
+        return;
+    }
+
+	Json::Value::Members memberNames = root.getMemberNames();
+
+	std::ostringstream output;
+	output.precision(15);
+
+	Json::Value member;
+
+	for (unsigned int i = 0; i < memberNames.size(); i++) {
+
+		output << memberNames[i] << ":";
+		member = root[memberNames[i]];
+
+		if (member.isObject() || member.isArray()) {
+
+			Json::FastWriter writer;
+			output << ENCODING_JSON << ":" << writer.write(member); // write() adds an \n
+		}
+		else if (member.isBool()) {
+
+			output << ENCODING_B << ":" << member.asString() << std::endl;
+		}
+		else if (member.isNumeric()) {
+
+			output << ENCODING_N << ":" << member.asDouble() << std::endl;
+		}
+		else if (member.isString()) {
+
+			output << ":" << member.asString() << std::endl;
+		}
+		else {
+
+			std::string err = EVENT_WRITE_FAILED + " The string passed in (\"" + data + "\") contains an invalid JSON type.";
+			m_handleWriteFailed(m_pArg, err);
+			return;
+		}
+	}
+
+	m_interface.write(output.str());
+}
+
+} /* namespace jpps */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.h
new file mode 100644
index 0000000..fafbacd
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSInterfaceGlue.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef PPSINTERFACEGLUE_H_
+#define PPSINTERFACEGLUE_H_
+
+#include "../core/PPSInterface.h"
+#include "PluginTypes.h"
+
+#include <json/value.h>
+
+#include <string>
+
+namespace jpps {
+class PPSEvent;
+struct ppsObject;
+}
+
+namespace jpps {
+
+/**
+ * This class bridges JavaScript and the native PPSInterface code.
+ */
+class PPSInterfaceGlue {
+
+public:
+
+	/**
+	 * Constructor.
+	 */
+	PPSInterfaceGlue();
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~PPSInterfaceGlue();
+
+	/**
+	 * The browser plugin should set these handlers.
+	 *
+	 * @param pArg pArg will be passed back to each callback function when it is called.
+	 */
+	void callbackInit(void* pArg,
+					  callback* handleOpen,
+					  callback* handleFirstRead,
+					  callback* handleNewData,
+					  callback* handleClose,
+					  callback* handleOpenFailed,
+					  callback* handleWriteFailed,
+					  callback* handleReadFailed);
+
+	/**
+	 * Set the verbosity of logging to the slog.
+	 */
+	void setVerbose(unsigned short v);
+
+	/**
+	 * Open a PPS object.
+	 */
+	bool open(const std::string& path, int oflags);
+
+	/**
+	 * Write to a PPS object.
+	 */
+	void write(const std::string& data);
+
+	/**
+	 * Read from the PPS object. This actually returns the cached value of the last
+	 * onNewData event from PPSInteraface, then encodes it as JSON.
+	 */
+	std::string read() const;
+
+	/**
+	 * Close this PPS object.
+	 */
+	void close();
+
+	/**
+	 * Forces all queued I/O operations for this object to finish, synchronizing the file's state.
+	 * The function blocks until this is finished.
+	 */
+	void sync();
+
+	/**
+	 * The function that the PPSInterface will call when an event happens.
+	 * This is the static function that is used as a function pointer for
+	 * PPSInterface::setEventFunc().
+	 *
+	 * @param event The event PPSInterface is sending.
+	 * @param pArg A pointer to a PPSInterfaceGlue object, passed in during
+	 * object construction.
+	 */
+	static void onEvent(void* pArg, const PPSEvent& event);
+
+private:
+
+	/**
+	 * The static PPSInterfaceGlue::onEvent() calls this onEvent to do the actual work.
+	 */
+	void onEvent(const PPSEvent& event);
+
+	/**
+	 * Handle a new data event.
+	 */
+	std::string handleNewData(const ppsObject& newData);
+
+	/**
+	 * Take a ppsObject and turn it into a JSON string to send back to the JavaScript
+	 * with a new data event. This structures the JSON with changed properties and the
+	 * data that has changed.
+	 */
+	Json::Value JSONEncodeNewData(const ppsObject& ppsObj) const;
+
+	/**
+	 * Take a ppsObject and turn it into a JSON string to send back to the JavaScript
+	 * when a call to read() is made.
+	 */
+	Json::Value JSONEncodeRead(const ppsObject& ppsObj) const;
+
+	// String names for the various events
+	static const std::string EVENT_OPEN;
+	static const std::string EVENT_OPEN_FAILED;
+	static const std::string EVENT_FIRST_READ;
+	static const std::string EVENT_NEW_DATA;
+	static const std::string EVENT_CLOSE;
+	static const std::string EVENT_READ_FAILED;
+	static const std::string EVENT_WRITE_FAILED;
+
+	/** Custom PPS encoding value: an "n" means a real number. */
+	static const std::string ENCODING_N;
+	/** Custom PPS encoding value: a "b" means a boolean value. */
+	static const std::string ENCODING_B;
+	/** Custom PPS encoding value: the data is encoded using JSON. */
+	static const std::string ENCODING_JSON;
+
+	// JSON constants
+	static const Json::StaticString JSON_REMOVE;
+	static const Json::StaticString JSON_CHANGED;
+	static const Json::StaticString JSON_DATA;
+	static const Json::StaticString JSON_OBJNAME;
+	static const Json::StaticString JSON_CHANGE_DATA;
+	static const Json::StaticString JSON_ALL_DATA;
+
+	/** The interface this object wraps. */
+	PPSInterface m_interface;
+
+	// Handlers for various events
+	void* m_pArg;
+	callback* m_handleOpen;
+	callback* m_handleFirstRead;
+	callback* m_handleNewData;
+	callback* m_handleClose;
+	callback* m_handleOpenFailed;
+	callback* m_handleWriteFailed;
+	callback* m_handleReadFailed;
+};
+
+} /* namespace jpps */
+#endif /* PPSINTERFACEGLUE_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.cpp b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.cpp
new file mode 100644
index 0000000..2eb4552
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.cpp
@@ -0,0 +1,300 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+#include "PPSServerGlue.h"
+
+#include <json/value.h>
+#include <json/writer.h>
+#include <json/reader.h>
+
+#include <sstream>
+
+#include <ppsparse.h>
+#include <fcntl.h>
+
+namespace jpps {
+
+const std::string PPSServerGlue::EVENT_OPEN = "onOpen";
+const std::string PPSServerGlue::EVENT_CLOSE = "onClose";
+const std::string PPSServerGlue::EVENT_CLIENT_CONNECT = "onClientConnect";
+const std::string PPSServerGlue::EVENT_CLIENT_DISCONNECT = "onClientDisconnect";
+const std::string PPSServerGlue::EVENT_MESSAGE = "onMessage";
+const std::string PPSServerGlue::EVENT_OPEN_FAILED = "onOpenFailed";
+const std::string PPSServerGlue::EVENT_SEND_MESSAGE_FAILED = "onSendMessageFailed";
+const std::string PPSServerGlue::EVENT_RECEIVE_MESSAGE_FAILED = "onReceiveMessageFailed";
+
+const std::string PPSServerGlue::ENCODING_N = "n";
+const std::string PPSServerGlue::ENCODING_B = "b";
+const std::string PPSServerGlue::ENCODING_JSON = "json";
+
+const Json::StaticString PPSServerGlue::JSON_DATA("data");
+const Json::StaticString PPSServerGlue::JSON_CONNECTION_ID("clientId");
+
+PPSServerGlue::PPSServerGlue()
+: m_interface()
+, m_pArg(NULL)
+, m_handleOpen(NULL)
+, m_handleClose(NULL)
+, m_handleClientConnect(NULL)
+, m_handleClientDisconnect(NULL)
+, m_handleMessage(NULL)
+, m_handleOpenFailed(NULL)
+, m_handleSendMessageFailed(NULL)
+, m_handleReceiveMessageFailed(NULL)
+{
+	m_interface.setEventFunc(onEvent, this);
+}
+
+PPSServerGlue::~PPSServerGlue()
+{
+	m_interface.setEventFunc(NULL);
+}
+
+void PPSServerGlue::callbackInit(void* pArg,
+					  callback* handleOpen,
+					  callback* handleClose,
+					  callback* handleClientConnect,
+					  callback* handleClientDisconnect,
+					  callback* handleMessage,
+					  callback* handleOpenFailed,
+					  callback* handleSendMessageFailed,
+					  callback* handleReceiveMessageFailed)
+{
+	m_pArg = pArg;
+	m_handleOpen = handleOpen;
+	m_handleClose = handleClose;
+	m_handleClientConnect = handleClientConnect;
+	m_handleClientDisconnect = handleClientDisconnect;
+	m_handleMessage = handleMessage;
+	m_handleOpenFailed = handleOpenFailed;
+	m_handleSendMessageFailed = handleSendMessageFailed;
+	m_handleReceiveMessageFailed = handleReceiveMessageFailed;
+}
+
+
+void PPSServerGlue::setVerbose(unsigned short v)
+{
+	m_interface.setVerbose(v);
+}
+
+bool PPSServerGlue::open(const std::string& path, int oflags)
+{
+	// Make sure we're creating the server, if it doesn't exist
+	if (!(oflags & O_CREAT))
+		oflags &= O_CREAT;
+
+	// We don't expose the "mode" to the JS layer - always create in 0666 mode
+	return m_interface.open(path, oflags, 0666, true);
+}
+
+void PPSServerGlue::close()
+{
+	m_interface.close();
+}
+
+void PPSServerGlue::sendMessage(const std::string& clientID, const std::string& msg)
+{
+	std::string decodedMsg = JSONDecodeData(msg);
+	std::string message(clientID + "\n" + decodedMsg);
+	m_interface.write(message);
+}
+
+void PPSServerGlue::broadcastMessage(const std::string& msg)
+{
+	m_interface.write(JSONDecodeData(msg));
+}
+
+void PPSServerGlue::onEvent(void* pArg, const PPSEvent& event)
+{
+	PPSServerGlue* pGlue = static_cast<PPSServerGlue*>(pArg);
+
+	if (pGlue != NULL)
+		pGlue->onEvent(event);
+}
+
+void PPSServerGlue::onEvent(const PPSEvent& event)
+{
+	callback* pFunc = NULL;
+	std::string sArg;
+
+	switch (event.getEventType()) {
+
+	case PPSEvent::PPS_EVENT_OPENED:
+		pFunc = m_handleOpen;
+		sArg = EVENT_OPEN;
+		break;
+
+	// The server doesn't do anything with this event
+	case PPSEvent::PPS_EVENT_FIRST_READ_COMPLETE:
+		break;
+
+	case PPSEvent::PPS_EVENT_NEW_DATA:
+	{
+		ppsObject data(event.getNewData());
+
+		// This means a new connection
+		if (data.flags & PPS_CREATED) {
+			sArg = EVENT_CLIENT_CONNECT;
+			pFunc = m_handleClientConnect;
+		}
+		// This means a connection is closed
+		else if (data.flags & PPS_DELETED) {
+			sArg = EVENT_CLIENT_DISCONNECT;
+			pFunc = m_handleClientDisconnect;
+		}
+		// We're getting data from the connection
+		else {
+			sArg = EVENT_MESSAGE;
+			pFunc = m_handleMessage;
+		}
+
+		sArg += " " + JSONEncodeData(data);
+
+		break;
+	}
+
+	case PPSEvent::PPS_EVENT_CLOSED:
+		pFunc = m_handleClose;
+		sArg = EVENT_CLOSE;
+		break;
+
+	case PPSEvent::PPS_EVENT_OPEN_FAILED:
+		pFunc = m_handleOpenFailed;
+		sArg = EVENT_OPEN_FAILED + " " + event.getMessage();
+		break;
+
+	case PPSEvent::PPS_EVENT_WRITE_FAILED:
+		pFunc = m_handleSendMessageFailed;
+		sArg = EVENT_SEND_MESSAGE_FAILED + " " + event.getMessage();
+		break;
+
+	case PPSEvent::PPS_EVENT_READ_FAILED:
+		pFunc = m_handleReceiveMessageFailed;
+		sArg = EVENT_RECEIVE_MESSAGE_FAILED + event.getMessage();
+		break;
+	}
+
+	if (pFunc != NULL)
+		pFunc(m_pArg, sArg);
+
+}
+
+std::string PPSServerGlue::JSONEncodeData(const ppsObject& ppsObj) const
+{
+	// If the ppsObj is empty, we can't encode it
+	if (ppsObj.name.empty())
+		return "";
+
+	Json::Value eventData(Json::nullValue);
+
+	// Set the client id
+	// Chop off the '+' or '-' if it's there
+	eventData[JSON_CONNECTION_ID] = ppsObj.name;
+
+	for (const_ppsAttrIter it = ppsObj.attributes.begin(); it != ppsObj.attributes.end(); it++) {
+
+		ppsAttribute ppsAttrib = (*it).second;
+
+		// The value is a number
+		if (ppsAttrib.encoding == ENCODING_N) {
+
+			// Convert the value to floating point
+			// istringstream is locale aware - we shouldn't need to perform any special
+			// processing in order to properly convert the data to a floating point
+			// TODO: test that the istringstream conversion works with a locale
+			//       that uses alternate floating point number encoding
+			std::istringstream stream(ppsAttrib.value);
+			double doubleValue;
+
+			// Try to convert the value to a floating point
+			if (!(stream >> doubleValue)) {
+
+				std::string err = EVENT_RECEIVE_MESSAGE_FAILED + " Failed to convert the string \"" + ppsAttrib.value + "\" to a real number.";
+				m_handleReceiveMessageFailed(m_pArg, err);
+				return "";
+			}
+
+			eventData[JSON_DATA][ppsAttrib.name] = doubleValue;
+		}
+		// The value is a boolean
+		else if (ppsAttrib.encoding == ENCODING_B) {
+
+			eventData[JSON_DATA][ppsAttrib.name] = (ppsAttrib.value == "true");
+		}
+		// The value is JSON data
+		else if (ppsAttrib.encoding == ENCODING_JSON) {
+
+			Json::Reader reader;
+			reader.parse(ppsAttrib.value, eventData[JSON_DATA][ppsAttrib.name]);
+		}
+		// Just pass the value through as a straight string
+		else {
+
+			eventData[JSON_DATA][ppsAttrib.name] = ppsAttrib.value;
+		}
+	}
+
+	Json::FastWriter writer;
+	return writer.write(eventData);
+}
+
+std::string PPSServerGlue::JSONDecodeData(const std::string& data) const
+{
+	 Json::Reader reader;
+	Json::Value root;
+
+	bool parsingSuccessful = reader.parse(data, root);
+
+	// If parsing the JSON string fails, return a write error
+	if (!parsingSuccessful) {
+
+		std::string err = EVENT_SEND_MESSAGE_FAILED + " JSON failed to parse the string (\"" + data + "\") to be written. (" + reader.getFormatedErrorMessages() + ")";
+		m_handleSendMessageFailed(m_pArg, err);
+		return "";
+	}
+
+	Json::Value::Members memberNames = root.getMemberNames();
+
+	std::ostringstream output;
+	output.precision(15);
+
+	Json::Value member;
+
+	for (unsigned int i = 0; i < memberNames.size(); i++) {
+
+		output << memberNames[i] << ":";
+		member = root[memberNames[i]];
+
+		if (member.isObject() || member.isArray()) {
+
+			Json::FastWriter writer;
+			output << ENCODING_JSON << ":" << writer.write(member);
+		}
+		else if (member.isBool()) {
+
+			output << ENCODING_B << ":" << member.asString();
+		}
+		else if (member.isNumeric()) {
+
+			output << ENCODING_N << ":" << member.asDouble();
+		}
+		else if (member.isString()) {
+
+			output << ":" << member.asString();
+		}
+		else {
+
+			std::string err = EVENT_SEND_MESSAGE_FAILED + " The string passed in (\"" + data + "\") contains an invalid JSON type.";
+			m_handleSendMessageFailed(m_pArg, err);
+			return "";
+		}
+
+		// Make sure we terminate the line
+		output << std::endl;
+	}
+
+	return output.str();
+}
+
+} /* namespace jpps */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.h
new file mode 100644
index 0000000..8891829
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PPSServerGlue.h
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef PPSSERVERGLUE_H_
+#define PPSSERVERGLUE_H_
+
+#include "../core/PPSInterface.h"
+#include "PluginTypes.h"
+
+// Forward declaration
+namespace Json {
+class StaticString;
+}
+namespace jpps {
+class PPSEvent;
+struct ppsObject;
+}
+
+namespace jpps {
+
+/**
+ * Act as glue between jpps Server class an the PPSInterface.
+ * This class encapsulates a PPS object as a PPS server.
+ * TODO: write a better comment
+ */
+class PPSServerGlue {
+
+public:
+
+	/**
+	 * Constructor.
+	 */
+	PPSServerGlue();
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~PPSServerGlue();
+
+	/**
+	 * The browser plugin should set these handlers.
+	 *
+	 * @param pArg pArg will be passed back to each callback function when it is called.
+	 */
+	void callbackInit(void* pArg,
+					  callback* handleOpen,
+					  callback* handleClose,
+					  callback* handleClientConnect,
+					  callback* handleClientDisconnect,
+					  callback* handleMessage,
+					  callback* handleOpenFailed,
+					  callback* handleSendMessageFailed,
+					  callback* handleReceiveMessageFailed);
+
+	/**
+	 * Set the verbosity of logging to the slog.
+	 */
+	void setVerbose(unsigned short v);
+
+	/**
+	 * Open a PPS server object.
+	 */
+	bool open(const std::string& path, int oflags);
+
+	/**
+	 * Close this PPS server object.
+	 */
+	void close();
+
+	/**
+	 * Send a message to a particular client.
+	 */
+	void sendMessage(const std::string& clientID, const std::string& msg);
+
+	/**
+	 * Send a message to all clients.
+	 */
+	void broadcastMessage(const std::string& msg);
+
+	/**
+	 * The function that the PPSInterface will call when an event happens.
+	 * This is the static function that is used as a function pointer for
+	 * PPSInterface::setEventFunc().
+	 *
+	 * @param event The event PPSInterface is sending.
+	 * @param pArg A pointer to a PPSInterfaceGlue object, passed in during
+	 * object construction.
+	 */
+	static void onEvent(void* pArg, const PPSEvent& event);
+
+private:
+
+	/**
+	 * The static PPSInterfaceGlue::onEvent() calls this onEvent to do the actual work.
+	 */
+	void onEvent(const PPSEvent& event);
+
+	/**
+	 * Take a ppsObject and turn it into a JSON string to send back to the JavaScript
+	 * with a onMessage event.
+	 */
+	std::string JSONEncodeData(const ppsObject& ppsObj) const;
+
+	/**
+	 * Take a JSON string and change it into a PPS consumable string.
+	 */
+	std::string JSONDecodeData(const std::string& data) const;
+
+	// String names for the various events
+	static const std::string EVENT_OPEN;
+	static const std::string EVENT_CLOSE;
+	static const std::string EVENT_CLIENT_CONNECT;
+	static const std::string EVENT_CLIENT_DISCONNECT;
+	static const std::string EVENT_MESSAGE;
+	static const std::string EVENT_OPEN_FAILED;
+	static const std::string EVENT_SEND_MESSAGE_FAILED;
+	static const std::string EVENT_RECEIVE_MESSAGE_FAILED;
+
+	/** Custom PPS encoding value: an "n" means a real number. */
+	static const std::string ENCODING_N;
+	/** Custom PPS encoding value: a "b" means a boolean value. */
+	static const std::string ENCODING_B;
+	/** Custom PPS encoding value: the data is encoded using JSON. */
+	static const std::string ENCODING_JSON;
+
+	// JSON constants
+	static const Json::StaticString JSON_DATA;
+	static const Json::StaticString JSON_CONNECTION_ID;
+
+	/** The interface this object wraps. */
+	PPSInterface m_interface;
+
+	// Handlers for various events
+	void* m_pArg;
+	callback* m_handleOpen;
+	callback* m_handleClose;
+	callback* m_handleClientConnect;
+	callback* m_handleClientDisconnect;
+	callback* m_handleMessage;
+	callback* m_handleOpenFailed;
+	callback* m_handleSendMessageFailed;
+	callback* m_handleReceiveMessageFailed;
+
+};
+
+} /* namespace jpps */
+#endif /* PPSSERVERGLUE_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PluginTypes.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PluginTypes.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PluginTypes.h
new file mode 100644
index 0000000..9ce6b32
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/PluginTypes.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef PLUGINTYPES_H_
+#define PLUGINTYPES_H_
+
+namespace jpps {
+
+/**
+ * Function type for setting handles between JNext plug-in and glue classes.
+ */
+typedef void (callback)(void* pArg, const std::string&);
+
+}
+
+
+#endif /* PLUGINTYPES_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/pluginManifest.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/pluginManifest.cpp b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/pluginManifest.cpp
new file mode 100644
index 0000000..e06ad4c
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/plugin/pluginManifest.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#include "JPPSPlugin.h"
+#include "JPPSServerPlugin.h"
+
+#include <string>
+
+/**
+ * This callback must be implemented by all JSExt objects. It is invoked from
+ * plugin.cpp.
+ *
+ * @return A comma separated list of classes supported by this JNEXT extension
+ */
+char* onGetObjList(void)
+{
+	static char* ppsclasses = NULL;
+
+	if (ppsclasses == NULL) {
+
+		// Get the length of all the strings, +1 for the ',' +1 for the \0
+		int size = std::strlen(jpps::JPPSPlugin::CLASS_NAME) + std::strlen(jpps::JPPSServerPlugin::CLASS_NAME) + 1 + 1;
+		ppsclasses = new char[size];
+		std::strcpy(ppsclasses, jpps::JPPSPlugin::CLASS_NAME);
+		std::strcat(ppsclasses, ",");
+		std::strcat(ppsclasses, jpps::JPPSServerPlugin::CLASS_NAME);
+		ppsclasses[size] = '\0';
+	}
+    // Return a comma separated list of classes known to this plugin
+    return ppsclasses;
+}
+
+/**
+ * This callback must be implemented by all JSExt objects. It is invoked from
+ * plugin.cpp.
+ *
+ * @param strClassName Name of the class requested to be created Valid named are those
+ * that are returned in onGetObjList
+ *
+ * @param strObjId The unique object id for the class
+ *
+ * @return A pointer to the created extension object
+ */
+JSExt* onCreateObject(const std::string& strClassName, const std::string& strObjId)
+{
+    // Given a class name and identifier, create the relevant object.
+    if (strClassName == jpps::JPPSPlugin::CLASS_NAME) {
+        return new jpps::JPPSPlugin(strObjId);;
+    }
+    else if (strClassName == jpps::JPPSServerPlugin::CLASS_NAME) {
+    	return new jpps::JPPSServerPlugin(strObjId);
+    }
+
+    // Any other name is invalid
+    return NULL;
+}
+
+

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Logger.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Logger.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Logger.h
new file mode 100644
index 0000000..37a9d17
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Logger.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef LOGGER_H_
+#define LOGGER_H_
+
+#include <string>
+
+#include <sys/slog.h>
+#include <sys/slogcodes.h>
+
+namespace jpps {
+
+/**
+ * The Logger class writes messages to the system log. It has a verbosity setting
+ * in order to prevent cluttering the slog during normal operation.
+ */
+class Logger {
+
+public:
+
+	enum slogType {
+		info = _SLOG_INFO,
+		warning = _SLOG_WARNING,
+		error = _SLOG_ERROR,
+		critical = _SLOG_CRITICAL,
+		debug = _SLOG_DEBUG1
+	};
+
+	/**
+	 * Default constructor. Sets the verbosity to 0;
+	 */
+	Logger() : m_verbosity(0) {}
+
+	/**
+	 * Destructor.
+	 */
+	~Logger() {}
+
+	/**
+	 * Set the desired level of verbosity. A value of 0 means that only warning,
+	 * error and critical messages will appear in the slog. A verbosity of 1 adds
+	 * info messages. A verbosity of 2 adds debug messages.
+	 */
+	inline void setVerbosity(unsigned short value) { m_verbosity = value; }
+
+	/**
+	 * Get the current level of verbosity.
+	 */
+	inline unsigned short getVerbosity() const { return m_verbosity; }
+
+	/**
+	 * Used to send messages to the system log (slog).
+	 *
+	 * @param type The type of slog message.
+	 * @param message The message to put in the slog.
+	 */
+	void slog(const slogType& type, const std::string& message) const {
+
+		// Don't display info or debug when verbosity is set to 0
+		if (m_verbosity == 0 && (type == info || type == debug)) return;
+		// Don't display debug when verbosity is set to 1
+		if (m_verbosity == 1 && type == debug) return;
+
+		::slogf(_SLOG_SETCODE(_SLOGC_GRAPHICS, 300), type, "%s", message.c_str());
+	}
+
+private:
+
+	/** The verbosity level.  */
+	unsigned short m_verbosity;
+};
+
+}
+
+#endif /* LOGGER_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.cpp
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.cpp b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.cpp
new file mode 100644
index 0000000..82ab5d1
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+#include "Thread.h"
+#include <pthread.h>
+#include "Logger.h"
+#include <sstream>
+#include <string.h>
+#include <errno.h>
+
+namespace jpps {
+
+Thread::Thread()
+: m_threadID(-1)
+{
+	// Init the thread with all defaults
+	pthread_attr_init(&m_attrib);
+}
+
+Thread::~Thread()
+{
+	// Dispose of the thread attributes
+	pthread_attr_destroy(&m_attrib);
+}
+
+void Thread::start(void* (*start_routine)(void*), void* arg, const std::string& thread_name)
+{
+	// If this thread is already started, you can't start a new one
+	if (m_threadID != -1) {
+		return;
+	}
+
+	// Create a new thread
+	if (pthread_create(&m_threadID, &m_attrib, start_routine, arg) != 0) {
+
+		std::ostringstream ostream;
+		ostream << "Thread::start() Failed - Failed to create a new thread. "
+				<< " (" << errno << ": " << strerror(errno) << ")";
+
+		Logger logger;
+		logger.slog(Logger::warning, ostream.str());
+	}
+
+	if (!thread_name.empty())
+		pthread_setname_np(m_threadID, thread_name.c_str());
+}
+
+void Thread::stop()
+{
+	// If the thread wasn't running, we can't stop it
+	if (m_threadID == -1) {
+		return;
+	}
+
+	// Cancel the thread
+	if (pthread_cancel(m_threadID) != 0) {
+
+		std::ostringstream ostream;
+		ostream << "Thread::stop() Failed - Failed to cancel thread " << m_threadID << "."
+				<< " (" << errno << ": " << strerror(errno) << ")";
+
+		Logger logger;
+		logger.slog(Logger::warning, ostream.str());
+	}
+
+	// Reset the thread ID
+	m_threadID = -1;
+}
+
+} /* namespace jpps */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.h
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.h b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.h
new file mode 100644
index 0000000..79cc62a
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/JPPS/native/src/utils/Thread.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ */
+
+/*
+ * $QNXLicenseC:
+ * Copyright 2009, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software.   Free development
+ * licenses are available for evaluation and non-commercial purposes.  For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others.  Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ */
+
+#ifndef THREAD_H_
+#define THREAD_H_
+
+#include <sys/types.h>
+#include <string>
+
+namespace jpps {
+
+/**
+ * Simple wrapper to simplify thread management.
+ */
+class Thread {
+
+public:
+
+	/**
+	 * Constructor.
+	 */
+	Thread();
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~Thread();
+
+	/**
+	 * Start a thread with the given function. If the thread is already running and has not
+	 * been stopped, this does nothing.
+	 */
+	void start(void* (*start_routine)(void*), void* arg, const std::string& thread_name = "");
+
+	/**
+	 * Stop the thread. If the thread isn't running, this does nothing.
+	 */
+	void stop();
+
+	/**
+	 * Is the thread running?
+	 */
+	inline bool isRunning() const { return (m_threadID >= 0); }
+
+private:
+
+	/** The id of this thread. */
+	pthread_t m_threadID;
+
+	/** The attributes of this thread. */
+	pthread_attr_t m_attrib;
+};
+
+} /* namespace jpps */
+#endif /* THREAD_H_ */

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Logger/index.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Logger/index.js b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Logger/index.js
new file mode 100644
index 0000000..497f477
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Logger/index.js
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2010-2011 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.
+ */
+
+module.exports = {
+    logLevel: function (success, fail, args, env) {
+        var result = new PluginResult(args, env),
+            level = JSON.parse(decodeURIComponent(args[0])),
+            message = JSON.parse(decodeURIComponent(args[1]));
+        console.log(level + ": " + message);
+        result.noResult(false);
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/NetworkStatus/index.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/NetworkStatus/index.js b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/NetworkStatus/index.js
new file mode 100644
index 0000000..5a991fe
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/NetworkStatus/index.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010-2011 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.
+ */
+
+//map from BB10 to cordova connection types:
+//https://github.com/apache/cordova-js/blob/master/lib/common/plugin/Connection.js
+function mapConnectionType(con) {
+    switch (con.type) {
+    case 'wired':
+        return 'ethernet';
+    case 'wifi':
+        return 'wifi';
+    case 'none':
+        return 'none';
+    case 'cellular':
+        switch (con.technology) {
+        case 'edge':
+        case 'gsm':
+            return '2g';
+        case 'evdo':
+            return '3g';
+        case 'umts':
+            return '3g';
+        case 'lte':
+            return '4g';
+        }
+        return "cellular";
+    }
+    return 'unknown';
+}
+
+function currentConnectionType() {
+    try {
+        //possible for webplatform to throw pps exception
+        return mapConnectionType(window.qnx.webplatform.device.activeConnection || { type : 'none' });
+    }
+    catch (e) {
+        return 'unknown';
+    }
+}
+
+module.exports = {
+    getConnectionInfo: function (success, fail, args, env) {
+        var result = new PluginResult(args, env);
+        result.ok(currentConnectionType());
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Notification/index.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Notification/index.js b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Notification/index.js
new file mode 100644
index 0000000..497170b
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Notification/index.js
@@ -0,0 +1,91 @@
+/*
+* Copyright 2013 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.
+*/
+
+function showDialog(args, dialogType, result) {
+    //Unpack and map the args
+    var msg = JSON.parse(decodeURIComponent(args[0])),
+    title = JSON.parse(decodeURIComponent(args[1])),
+    btnLabel = JSON.parse(decodeURIComponent(args[2]));
+
+    if (!Array.isArray(btnLabel)) {
+        //Converts to array for (string) and (string,string, ...) cases
+        btnLabel = btnLabel.split(",");
+    }
+
+    if (msg && typeof msg === "string") {
+        msg = msg.replace(/^"|"$/g, "").replace(/\\"/g, '"').replace(/\\\\/g, '\\');
+    } else {
+        result.error("message is undefined");
+        return;
+    }
+
+    var messageObj = {
+        title : title,
+        htmlmessage :  msg,
+        dialogType : dialogType,
+        optionalButtons : btnLabel
+    };
+
+    //TODO replace with getOverlayWebview() when available in webplatform
+    qnx.webplatform.getWebViews()[2].dialog.show(messageObj, function (data) {
+        if (typeof data === "number") {
+            //Confirm dialog call back needs to be called with one-based indexing [1,2,3 etc]
+            result.callbackOk(++data, false);
+        } else {
+            //Prompt dialog callback expects object
+            result.callbackOk({
+                buttonIndex: data.ok ? 1 : 0,
+                input1: (data.oktext) ? decodeURIComponent(data.oktext) : null
+            }, false);
+        }
+    });
+
+    result.noResult(true);
+}
+
+module.exports = {
+    alert: function (success, fail, args, env) {
+        var result = new PluginResult(args, env);
+
+        if (Object.keys(args).length < 3) {
+            result.error("Notification action - alert arguments not found.");
+        } else {
+            showDialog(args, "CustomAsk", result);
+        }
+    },
+    confirm: function (success, fail, args, env) {
+        var result = new PluginResult(args, env);
+
+        if (Object.keys(args).length < 3) {
+            result.error("Notification action - confirm arguments not found.");
+        } else {
+            showDialog(args, "CustomAsk", result);
+        }
+    },
+    prompt: function (success, fail, args, env) {
+        var result = new PluginResult(args, env);
+
+        if (Object.keys(args).length < 3) {
+            result.error("Notification action - prompt arguments not found.");
+        } else {
+            showDialog(args, "JavaScriptPrompt", result);
+        }
+    },
+    beep: function (success, fail, args, env) {
+        var result = new PluginResult(args, env);
+        result.error("Beep not supported");
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/SplashScreen/index.js
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/SplashScreen/index.js b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/SplashScreen/index.js
new file mode 100644
index 0000000..bd7e48c
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/SplashScreen/index.js
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2013 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.
+ */
+
+module.exports = {
+    show: function (success, fail, args, env) {
+        var result = new PluginResult(args, env);
+        result.error("Not supported on platform", false);
+    },
+
+    hide: function (success, fail, args, env) {
+        var result = new PluginResult(args, env);
+        window.qnx.webplatform.getApplication().windowVisible = true;
+        result.ok(undefined, false);
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6831bed4/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Utils/native/Makefile
----------------------------------------------------------------------
diff --git a/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Utils/native/Makefile b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Utils/native/Makefile
new file mode 100644
index 0000000..0cc5eae
--- /dev/null
+++ b/lib/cordova-blackberry/blackberry10/bin/templates/project/plugins/Utils/native/Makefile
@@ -0,0 +1,8 @@
+LIST=CPU
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)


Mime
View raw message