cordova-plugin-mas-connecta
Advanced tools
Comparing version
@@ -1,13 +0,21 @@ | ||
# Version 1.8.00 | ||
# Version 1.9.00 | ||
## Bug fixes | ||
- None. | ||
### New features | ||
- None. | ||
### Deprecated methods | ||
- None | ||
# Version 1.8.00 | ||
## Bug fixes | ||
- None. | ||
### New features | ||
- None. | ||
### Deprecated methods | ||
- None | ||
@@ -19,11 +27,8 @@ | ||
## Bug fixes | ||
- None. | ||
### New features | ||
- None. | ||
### Deprecated methods | ||
- None | ||
@@ -35,16 +40,10 @@ | ||
## Bug fixes | ||
- None | ||
### New features | ||
- Dependencies are now downloaded from NPM repository instead of Github. | ||
- Config file preference to specify the iOS deployment target. | ||
- CocoaPods integration with framework podspec for iOS 'MASConnecta' framework. | ||
### Deprecated methods | ||
- None | ||
@@ -55,7 +54,8 @@ | ||
### Bug fixes | ||
- Post subscription, send message to topic fails giving "Unknown error"[DE348742] | ||
DE348742 - Post subscription, send message to topic fails giving "Unknown error" | ||
### New features | ||
- None | ||
### Deprecated methods | ||
- None | ||
@@ -66,20 +66,20 @@ | ||
### Bug fixes | ||
- None | ||
### New features | ||
- None | ||
### Deprecated methods | ||
- None | ||
# Version 1.5 | ||
### Bug fixes | ||
- None | ||
### New features | ||
- Now available as npm package "cordova-plugin-mas-connecta". | ||
### Deprecated methods | ||
- None | ||
@@ -89,10 +89,10 @@ # Version 1.4 | ||
### Bug fixes | ||
- . | ||
- None | ||
### New features | ||
- Initial Release of Cordova Messaging and Pub/Sub Plugin | ||
### Deprecated methods | ||
- None | ||
[mag]: https://docops.ca.com/mag | ||
@@ -99,0 +99,0 @@ [mas.ca.com]: http://mas.ca.com/ |
@@ -0,0 +0,0 @@ # Contribute to the Cordova Mobile SDK |
@@ -0,0 +0,0 @@ /*global document */ |
@@ -0,0 +0,0 @@ |
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", | ||
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); |
@@ -0,0 +0,0 @@ var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; |
{ | ||
"name": "cordova-plugin-mas-connecta", | ||
"version": "1.8.00", | ||
"version": "1.9.00", | ||
"description": "Cordova MAS Connecta Plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -25,3 +25,3 @@ # Cordova-MAS-Connecta | ||
The Cordova reference documents are available at our [mas.ca.com]( http://mas.ca.com/docs/cordova/1.4.00/sdk/) site. | ||
The Cordova reference documents are available at our [mas.ca.com]( http://mas.ca.com/docs/cordova/latest/sdk/) site. | ||
@@ -28,0 +28,0 @@ Example: |
@@ -0,0 +0,0 @@ /** |
@@ -8,22 +8,24 @@ /* | ||
/* | ||
* Pub/Sub Architecture with MQTTClient implementation. | ||
*/ | ||
var MASPluginMQTTClient = require("./MASPluginMQTTClient"); | ||
var MASPluginMQTTMessage = require("./MASPluginMQTTMessage"); | ||
var MASPluginMQTTConstants = require("./MASPluginMQTTConstants"); | ||
/* | ||
* MASUser Messaging architecture | ||
*/ | ||
var MASConnectaPluginConstants = require("./MASConnectaPluginConstants"); | ||
var MASConnectaPluginMessage = require("./MASConnectaPluginMessage"); | ||
/** | ||
* @class MASPluginUser | ||
* @hideconstructor | ||
* @classdesc An extension of cordova-plugin-mas-core.MASPluginUser that exposes the new APIs for MAS Messaging. The methods are static hence can be called directly on MASPluginUser class. | ||
*/ | ||
var MASPluginUser = require("cordova-plugin-mas-core.MASPluginUser"); | ||
{ | ||
/** | ||
* Subscribe (starts Listening) to user's own custom topic. Topic name defaults to userid of the logged in user | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
*/ | ||
* Subscribes (starts Listening) to user's own custom topic. Topic name defaults to userid of the logged in user | ||
* @memberOf MASPluginUser | ||
* @function startListeningToMyMessages | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @example | ||
* MASConnectaPlugin.MASUser.startListeningToMyMessages(successHandler, errorHandler); | ||
*/ | ||
MASPluginUser.startListeningToMyMessages = function(successHandler, errorHandler) { | ||
@@ -33,7 +35,11 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "startListeningToMyMessages", []); | ||
/** | ||
* Unsubscribe (stop Listening) to user's own custom topic. Topic name defaults to userid of the logged in user | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
*/ | ||
/** | ||
* Unsubscribes (stop Listening) to user's own custom topic. Topic name defaults to userid of the logged in user. | ||
* @memberOf MASPluginUser | ||
* @function stopListeningToMyMessages | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @example | ||
* MASConnectaPlugin.MASUser.stopListeningToMyMessages(successHandler, errorHandler); | ||
*/ | ||
MASPluginUser.stopListeningToMyMessages = function(successHandler, errorHandler) { | ||
@@ -43,9 +49,13 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "stopListeningToMyMessages", []); | ||
/** | ||
* Send message to a user | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {string} message message to be sent (String / MASPluginMessage) | ||
* @param {string} userObjectId Unique Id of the user to whom the message is intended to | ||
*/ | ||
/** | ||
* Send message to a user | ||
* @memberOf MASPluginUser | ||
* @function sendMessageToUser | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} message message to be sent (String / MASPluginMessage) | ||
* @param {string} userObjectId Unique ID of the user to whom the message is intended to | ||
* @example | ||
* MASConnectaPlugin.MASUser.sendMessageToUser(successHandler, errorHandler,message,userObjectId); | ||
*/ | ||
MASPluginUser.sendMessageToUser = function(successHandler, errorHandler, message, userObjectId) { | ||
@@ -56,9 +66,13 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "sendMessageToUser", [message, userObjectId]); | ||
/** | ||
* Send message to a user on a topic | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {string} message message to be sent (String / MASPluginMessage) | ||
* @param {string} topicName topic on which the user wants to send the message | ||
* @param {string} userObjectId Unique Id of the user to whom the message is intended to | ||
*/ | ||
* Send message to a user on a topic | ||
* @memberOf MASPluginUser | ||
* @function sendMessageToUserOnTopic | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} message message to be sent (String / MASPluginMessage) | ||
* @param {string} topicName topic on which the user wants to send the message | ||
* @param {string} userObjectId Unique ID of the user to whom the message is intended to | ||
* @example | ||
* MASConnectaPlugin.MASUser.sendMessageToUserOnTopic(successHandler, errorHandler,message, userObjectId, topicName); | ||
*/ | ||
MASPluginUser.sendMessageToUserOnTopic = function(successHandler, errorHandler, message, userObjectId, topicName) { | ||
@@ -69,32 +83,52 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "sendMessageToUserOnTopic", [message, userObjectId, topicName]); | ||
/** | ||
* @class MASConnectaPlugin | ||
* @hideconstructor | ||
* @classdesc The parent Connecta interface to get the objects of MAS Messaging and PubSub interfaces. | ||
* @example | ||
* <caption>To get instance of {@link MASPluginMQTTConstants} : An interface that contains the required MQTT connection options for MQTT broker</caption> | ||
var masMQTTConstants = new MASConnectaPlugin.MASMQTTConstants(host, port, false, ""); | ||
* @example | ||
* <caption>To get instance of {@link MASPluginMQTTClient}: An interface that corresponds to a Public Broker including MAG</caption> | ||
var masMQTTClient = new MASConnectaPlugin.MASMQTTClient(clientId, masMQTTConstants); | ||
* @example | ||
* <caption>Access {@link MASConnectaPluginConstants}: A static utility that contains the plugin related constants and Global callbacks</caption> | ||
var MASConnetaConstants = MASConnectaPlugin.MASConnetaConstants; | ||
* @example | ||
* <caption>To get instance of {@link MASConnectaPluginMessage}: An interface that is mapped to the native MASMessage structure</caption> | ||
var MASConnectaMessage = new MASConnectaPlugin.MASConnectaMessage(); | ||
* @example | ||
* <caption>MASConnecta {@link MASPluginUser} APIs are static API that are called directly using the class reference as follows</caption> | ||
* MASConnectaPlugin.MASUser.sendMessageToUser(successHandler, errorHandler, message, userObjectId); | ||
*/ | ||
var MASConnectaPlugin = { | ||
/** | ||
MASMQTTClient which corresponds to any Public Broker including MAG | ||
*/ | ||
MASMQTTClient: MASPluginMQTTClient, | ||
/** | ||
MASMQTTMessage which has the interfaces mapped to the native MASMessage structure | ||
*/ | ||
MASMQTTMessage: MASPluginMQTTMessage, | ||
/** | ||
MASMQTTConstants which contains required MQTT connection options for any MQTT broker | ||
*/ | ||
MASMQTTConstants: MASPluginMQTTConstants, | ||
/** | ||
MASMQTTConstants which contains required MQTT connection options for any MQTT broker | ||
*/ | ||
MASConnetaConstants: MASConnectaPluginConstants, | ||
/** | ||
MASConnectaMessage which contains utility for creating MAS Message | ||
*/ | ||
MASConnectaMessage: MASConnectaPluginMessage, | ||
/** | ||
MASUser which has the interfaces mapped to the native MASConneta extenstion for MASUser class | ||
MASUser: MASPluginUser, | ||
/** | ||
* Call this function before using the MASConnecta messaging APIs. This API registers the notification receiver for observing the messages that are intended for the client. | ||
* @memberOf MASConnectaPlugin | ||
* @function MASRegisterListener | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @example | ||
* <caption>Initializing and registering the listener</caption> | ||
MASConnectaPlugin.MASRegisterListener( | ||
function(success) { | ||
if (null != success.Payload) { | ||
var toAlert = {}; | ||
toAlert.sender = success.SenderId; | ||
var payload = (success.Payload!=null?success.Payload:success.payload); | ||
toAlert.payload = atob(payload); | ||
toAlert.topic = success.Topic; | ||
alert(JSON.stringify(toAlert)); | ||
} | ||
}, function(error) { | ||
console.log("Listener registration failed!!!:" + JSON.stringify(error)); | ||
} | ||
); | ||
*/ | ||
MASUser: MASPluginUser, | ||
/** | ||
MASRegisterListener : Funtion must to be called before using MASConnecta. This API register the notification receiver for observing the message intended to this client | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
*/ | ||
MASRegisterListener: function(successHandler, errorHandler) { | ||
@@ -104,3 +138,2 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "registerReceiver", []); | ||
}; | ||
module.exports = MASConnectaPlugin; |
@@ -8,33 +8,18 @@ /* | ||
/** | ||
* @class MASConnectaPluginConstants | ||
* @hideconstructor | ||
* @classdesc MAS Connecta constansts. | ||
* <table> | ||
* <tr bgcolor="#D3D3D3"><th>How to access this class's variables</th></tr> | ||
* <tr><td><i>var QosVal = MASConnectaPlugin.MASConnetaConstants.MQTTQualityOfService.AtLeastOnce;</i></td></tr> | ||
* </table> | ||
*/ | ||
var MASConnectaPluginConstants = { | ||
/** | ||
* Message Sender Type | ||
*/ | ||
MASPluginSenderType: { | ||
/** | ||
* Unknown | ||
*/ | ||
MASSenderTypeUnknown: -1, | ||
/** | ||
* MASApplication | ||
*/ | ||
MASSenderTypeApplication: 0, | ||
/** | ||
* MASDevice | ||
*/ | ||
MASSenderTypeDevice: 1, | ||
/** | ||
* MASGroup | ||
*/ | ||
MASSenderTypeGroup: 2, | ||
/** | ||
* MASUser | ||
*/ | ||
MASSenderTypeUser: 3 | ||
@@ -44,10 +29,33 @@ }, | ||
MASSenderTypeApplicationValue: "APPLICATION", | ||
MASSenderTypeDeviceValue: "DEVICE", | ||
MASSenderTypeGroupValue: "GROUP", | ||
MASSenderTypeUserValue: "USER", | ||
MASSenderTypeUserValue: "USER" | ||
/** | ||
* The Quality of Service constant (QoS) | ||
* @typedef {Object} MQTTQualityOfService | ||
* @memberOf MASConnectaPluginConstants | ||
* @property {number} AtMostOnce=0 The message should be tried at the most one time. | ||
* @property {number} AtLeastOnce=1 The message should be tried at least one time. | ||
* @property {number} ExactlyOnce=2 The message should be tried only once. | ||
*/ | ||
MQTTQualityOfService : { | ||
AtMostOnce: 0, | ||
AtLeastOnce: 1, | ||
ExactlyOnce: 2 | ||
} | ||
}; | ||
/** | ||
* A user defined success callback function. The contract of the function is out of scope for Mobile SDK, but the object passed to that function by Mobile SDK will conform to a structure based on operation type. | ||
* @callback successCallbackFunction | ||
* @param {Object} result The result object can take any form. It can be an object, or a plain string, a boolean or a number based on the API. | ||
* Developer may check for existance of result object to define success in such case and must not rely on the exact response format.<br> | ||
* To know about specific result for each API see {@link http://mas.ca.com/docs/cordova/latest/guides} | ||
*/ | ||
/** | ||
* A user defined error callback function. The contract of the function is out of scope for Mobile SDK, but the object passed to that function by Mobile SDK will conform to a strict structure. | ||
* @callback errorCallbackFunction | ||
* @param {Object} error A Json Object with below structure <br>{<br> "errorCode": <The error code. For ex. 3003123>,<br> "errorMessage": "<The error message>"<br> "errorInfo":"<The Error Info>"<br>}<br> | ||
*/ | ||
module.exports = MASConnectaPluginConstants; |
@@ -10,14 +10,25 @@ /* | ||
/** | ||
* @class MASConnectaPluginMessage | ||
* @hideconstructor | ||
* @classdesc A Utility class that helps in creating and managing a MQTT Message. Specific to Cordova-iOS only. | ||
* <table> | ||
* <tr bgcolor="#D3D3D3"><th>MASConnectaPluginMessage Construtor</th></tr> | ||
* <tr><td><i>var MASConnectaMessage = new MASConnectaPlugin.MASConnectaMessage();</i></td></tr> | ||
* </table> | ||
*/ | ||
var MASConnectaPluginMessage = function() { | ||
/** | ||
* The version of the message format | ||
* @member {string} | ||
*/ | ||
* The version of the message format | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} version | ||
* @instance | ||
*/ | ||
this.version; | ||
/** | ||
* The topic of the message | ||
* @member {string} | ||
* The topic of the message | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} topic | ||
* @instance | ||
*/ | ||
@@ -28,3 +39,5 @@ this.topic; | ||
* The object identifier of the message receiver | ||
* @member {string} | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} receiverObjectId | ||
* @instance | ||
*/ | ||
@@ -35,3 +48,5 @@ this.receiverObjectId; | ||
* The MASPluginSenderType that represents the sender | ||
* @member {string} | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} senderType | ||
* @instance | ||
*/ | ||
@@ -42,3 +57,5 @@ this.senderType; | ||
* The object identifier of the message sender | ||
* @member {string} | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} senderObjectId | ||
* @instance | ||
*/ | ||
@@ -48,4 +65,6 @@ this.senderObjectId; | ||
/** | ||
* The DisplayName (field in the /UserInfo mapping in the Gateway) of the message sender | ||
* @member {string} | ||
* The DisplayName (field in the /UserInfo mapping in the Gateway) of the message sender | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} senderDisplayName | ||
* @instance | ||
*/ | ||
@@ -56,3 +75,5 @@ this.senderDisplayName; | ||
* The timestamp in UTC format when the message was sent | ||
* @member {integer} | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {integer} sentTime | ||
* @instance | ||
*/ | ||
@@ -63,3 +84,5 @@ this.sentTime; | ||
* The payload in binary format | ||
* @member {binary} | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {byte[]} payload | ||
* @instance | ||
*/ | ||
@@ -70,3 +93,5 @@ this.payload; | ||
* The content type of the payload | ||
* @member {string} | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} contentType | ||
* @instance | ||
*/ | ||
@@ -77,19 +102,19 @@ this.contentType; | ||
* The content encoding of the payload | ||
* @member {string} | ||
* @memberOf MASConnectaPluginMessage | ||
* @member {string} contentEncoding | ||
* @instance | ||
*/ | ||
this.contentEncoding; | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/// @name Lifecycle | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/** | ||
* Initialize a message with a payload | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {binary} payload payload as binary | ||
* Initialize a message with a payload | ||
* @memberOf MASConnectaPluginMessage | ||
* @function initializeWithPayloadData | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {byte[]} payload payload as binary | ||
* @param {string} contentType The content type of the message | ||
*/ | ||
this.initializeWithPayloadData = function(successHandler, errorHandler, payload, contentType) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMessage", "initializeWithPayloadData", [payload, contentType]); | ||
@@ -99,9 +124,12 @@ }; | ||
/** | ||
* Initialize a message with a payload | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {string} payload payload as a string | ||
* Initialize a message with a payload | ||
* @memberOf MASConnectaPluginMessage | ||
* @function initializeWithPayloadString | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} payload payload as a string | ||
* @param {string} contentType The content type of the message | ||
*/ | ||
this.initializeWithPayloadString = function(successHandler, errorHandler, payload, contentType) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMessage", "initializeWithPayloadString", [payload, contentType]); | ||
@@ -111,25 +139,25 @@ }; | ||
/** | ||
* Initialize a message with a payload | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {base64} payload payload as an image | ||
* Initialize a message with a payload | ||
* @memberOf MASConnectaPluginMessage | ||
* @function initializeWithPayloadImage | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} payload payload of an image as a Base64 String. | ||
* @param {string} contentType The content type of the message | ||
*/ | ||
this.initializeWithPayloadImage = function(successHandler, errorHandler, payload, contentType) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMessage", "initializeWithPayloadImage", [payload, contentType]); | ||
}; | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/// @name Public | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/** | ||
* The payload property in a string format | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @return String | ||
*/ | ||
* The payload property in a string format | ||
* @memberOf MASConnectaPluginMessage | ||
* @function payloadTypeAsString | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @return String | ||
*/ | ||
this.payloadTypeAsString = function(successHandler, errorHandler) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMessage", "payloadTypeAsString", []); | ||
@@ -139,9 +167,11 @@ }; | ||
/** | ||
* The payload property in an image src format | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @return base64 string | ||
*/ | ||
* The payload property in an image src format | ||
* @memberOf MASConnectaPluginMessage | ||
* @function payloadTypeAsImage | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @return base64 string | ||
*/ | ||
this.payloadTypeAsImage = function(successHandler, errorHandler) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMessage", "payloadTypeAsImage", []); | ||
@@ -151,9 +181,11 @@ }; | ||
/** | ||
* The senderType property in a string format | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @return String | ||
*/ | ||
* The senderType property in a string format | ||
* @memberOf MASConnectaPluginMessage | ||
* @function senderTypeAsString | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @return String | ||
*/ | ||
this.senderTypeAsString = function(successHandler, errorHandler) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMessage", "senderTypeAsString", []); | ||
@@ -163,10 +195,12 @@ }; | ||
/** | ||
* The MASConnectaPluginConstants.MASSenderType in a string format | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {MASConnectaPluginConstants.MASSenderType} masSenderType specify the MAS sender type | ||
* @return String | ||
*/ | ||
* The MASConnectaPluginConstants.MASSenderType in a string format | ||
* @memberOf MASConnectaPluginMessage | ||
* @function stringFromSenderType | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {MASConnectaPluginConstants.MASSenderType} masSenderType specify the MAS sender type | ||
* @return String | ||
*/ | ||
this.stringFromSenderType = function(successHandler, errorHandler, masSenderType) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMessage", "stringFromSenderType", [masSenderType]); | ||
@@ -173,0 +207,0 @@ }; |
@@ -10,26 +10,11 @@ /* | ||
/** | ||
* @class MASPluginMQTTClient | ||
* @classdesc The MAS Messaging client that connects to any Public Broker including MAG | ||
* @param {string} clientId Unique broker-client ID for this client. Default clientId is the one picked from msso_config.json | ||
* @param {MASPluginMQTTConstants} masMQTTConstants An instance of populated MASPluginMQTTConstants object. | ||
*/ | ||
var MASPluginMQTTClient = function (clientId, masMQTTConstants) { | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/// @name Lifecycle | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/** | ||
* Initializes the MQTT client | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {string} clientId specifies the client ID to initialize the client | ||
* @param {boolean} cleanSession specifies whether to clean the previous session | ||
*/ | ||
this.initializeMQTTClient = function(successHandler, errorHandler, clientId, cleanSession) { | ||
return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "initializeMQTTClient", [clientId, cleanSession]); | ||
}; | ||
/** | ||
* Client ID of the current object | ||
* @member {string} | ||
*/ | ||
this.clientId = clientId; | ||
this.clientId = clientId; | ||
this.masMQTTConstants = masMQTTConstants; | ||
@@ -42,10 +27,24 @@ | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/// @name Properties | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/** | ||
* Initializes the MQTT client. | ||
* @memberOf MASPluginMQTTClient | ||
* @function initializeMQTTClient | ||
* @private | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} clientId specifies the client ID to initialize the client | ||
* @param {boolean} cleanSession specifies whether to clean the previous session | ||
*/ | ||
this.initializeMQTTClient = function(successHandler, errorHandler, clientId, cleanSession) { | ||
return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "initializeMQTTClient", [clientId, cleanSession]); | ||
}; | ||
/** | ||
* Checks if device is connected to client | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* Checks if device is connected to the MQTT broker. | ||
* @memberOf MASPluginMQTTClient | ||
* @function isConnected | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
*/ | ||
@@ -56,13 +55,10 @@ this.isConnected = function(successHandler, errorHandler) { | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/// @name MQTT Connection methods | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/** | ||
* Connects to a message broker using the connect options and client id | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {masConnectaOptions} masConnectaOptions MQTT connect options for client initialization. Use the MASConnectaPlugin.MASConnectOptions() method to create it. | ||
* @param {string} clientId Client ID of the MQTT client i.e. this device's identification. This value must be unique per broker. If not provided, client_id from msso_config.json is used | ||
*/ | ||
* Connects to a message broker using the MASPluginMQTTConstants that is provided during construction of this object. | ||
* @memberOf MASPluginMQTTClient | ||
* @function connect | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
*/ | ||
this.connect = function(successHandler, errorHandler) { | ||
@@ -73,6 +69,9 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "connect", [this.clientId, this.masMQTTConstants]); | ||
/** | ||
* Disconnects from the existing connected message broker | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
*/ | ||
* Disconnects from the connected message broker | ||
* @memberOf MASPluginMQTTClient | ||
* @function disconnect | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
*/ | ||
this.disconnect = function(successHandler,errorHandler){ | ||
@@ -82,14 +81,12 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "disconnect", []); | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/// @name Subscribe methods | ||
///------------------------------------------------------------------------------------------------------------------ | ||
/** | ||
* Subscribe to a topic using the broker connected via connect call | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {string} topicName topic to which the user needs to subscribe | ||
* @param {integer} QoS Quality of Service for message delivery.0-> At most once,1-> At least once, 2: Exactly once. Default is 2. | ||
*/ | ||
* Subscribes to a topic via the connected MQTT broker. | ||
* @memberOf MASPluginMQTTClient | ||
* @function subscribe | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} topicName topic to which the user wants to subscribe | ||
* @param {MASConnectaPluginConstants.MQTTQualityOfService} QoS Quality of Service for message delivery.Default value is 2. | ||
*/ | ||
this.subscribe = function(successHandler, errorHandler, topicName, QoS){ | ||
@@ -100,7 +97,10 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "subscribe", [topicName, QoS]); | ||
/** | ||
* Unsubscribe from a topic | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {string} topicName topic to which the user needs to unsubscribe. | ||
*/ | ||
* Unsubscribe from a topic | ||
* @memberOf MASPluginMQTTClient | ||
* @function unsubscribe | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} topicName topic to which the user needs to unsubscribe. | ||
*/ | ||
this.unsubscribe = function(successHandler, errorHandler, topicName){ | ||
@@ -111,10 +111,13 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "unsubscribe", [topicName]); | ||
/** | ||
* Publish to a topic using the broker connected via connect call | ||
* @param {function} successHandler user defined success callback | ||
* @param {function} errorHandler user defined error callback | ||
* @param {string} topicName topic to which the user sends the message | ||
* @param {string} message specified the message to be sent. The message bytes should be a base64 encoded string to support sending images | ||
* @param {integer} QoS Quality of Service for message delivery.0-> At most once,1-> At least once, 2: Exactly once. Default is 2 | ||
* @param {boolean} retain indication for the broker to persist the messages for a client | ||
*/ | ||
* Publish to a topic via the connected MQTT broker. | ||
* @memberOf MASPluginMQTTClient | ||
* @function publish | ||
* @instance | ||
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. | ||
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. | ||
* @param {string} topicName topic to which the user sends the message | ||
* @param {string} message specifies the message to be sent. The message bytes should be a base64 encoded string to support sending images | ||
* @param {integer} QoS Quality of Service for message delivery.0-> At most once,1-> At least once, 2: Exactly once. Default is 2 | ||
* @param {boolean} retain indication for the broker to persist the messages for a client | ||
*/ | ||
this.publish = function(successHandler, errorHandler, topic, message, QoS, retain) { | ||
@@ -121,0 +124,0 @@ return Cordova.exec(successHandler, errorHandler, "MASConnectaPlugin", "publish", [topic, message, QoS, retain]); |
@@ -8,3 +8,10 @@ /* | ||
/** | ||
* @class MASPluginMQTTConstants | ||
* @classdesc The Class definition of a generic MQTT message structure. | ||
* @param {string} host Hostname of the MQTT broker. | ||
* @param {number} port Port on which the MQTT broker is listening. | ||
* @param {boolean} enableTLS Enable TLS support for the connection. | ||
* @param {string} sslCACert Base64 encoded certificate, if the MQTT broker requires client certificate. | ||
*/ | ||
var MASPluginMQTTConstants = function(host, port, enableTLS, sslCACert) { | ||
@@ -22,28 +29,71 @@ this.host = host ? host : ""; | ||
this.will = { | ||
message: "", | ||
topic: "", | ||
QoS: 1, | ||
retain: false | ||
message: "", | ||
topic: "", | ||
QoS: 1, | ||
retain: false | ||
}; | ||
/** | ||
* Sets the clean session property of the client. | ||
* @memberOf MASPluginMQTTConstants | ||
* @function setCleanSession | ||
* @instance | ||
* @param {boolean} mCleanSession specifies whether to clean the previous session | ||
*/ | ||
this.setCleanSession = function(mCleanSession){ | ||
this.cleanSession = mCleanSession; | ||
this.cleanSession = mCleanSession; | ||
}; | ||
/** | ||
* Sets the connection timeout for the MQTT client. | ||
* @memberOf MASPluginMQTTConstants | ||
* @function setConnectionTimeOut | ||
* @instance | ||
* @param {number} timeOutSeconds Timeout in seconds. | ||
*/ | ||
this.setConnectionTimeOut = function(timeOutSeconds) { | ||
this.connectionTimeOut = timeOutSeconds; | ||
this.connectionTimeOut = timeOutSeconds; | ||
}; | ||
/** | ||
* Sets the keep alive property of the client session. | ||
* @memberOf MASPluginMQTTConstants | ||
* @function setKeepAlive | ||
* @instance | ||
* @param {number} keepAliveSeconds keepAlive in seconds. | ||
*/ | ||
this.setKeepAlive = function(keepAliveSeconds) { | ||
this.keepAlive = keepAliveSeconds; | ||
this.keepAlive = keepAliveSeconds; | ||
}; | ||
/** | ||
* Sets the will of the MQTT message. | ||
* @memberOf MASPluginMQTTConstants | ||
* @function setWillToTopic | ||
* @instance | ||
* @param {string} payload The final message that broker sends to all the connected clients before it dies due to abrupt reasons. | ||
* @param {string} toTopic Name of the Last Will topic. | ||
* @param {number} willQoS Quality of service for the Last Will. | ||
* @param {boolean} retain Whether to retain the message if sending fails or not. | ||
*/ | ||
this.setWillToTopic = function(payload, toTopic, willQoS, retain) { | ||
this.will.message = payload; | ||
this.will.topic = toTopic; | ||
this.will.QoS = willQoS; | ||
this.will.retain = retain; | ||
this.will.message = payload; | ||
this.will.topic = toTopic; | ||
this.will.QoS = willQoS; | ||
this.will.retain = retain; | ||
}; | ||
/** | ||
* Sets the credentials if the broker connection requires authentication. | ||
* @memberOf MASPluginMQTTConstants | ||
* @function setUserCredentials | ||
* @instance | ||
* @param {string} userName Broker Account username | ||
* @param {string} password Broker Account password | ||
*/ | ||
this.setUserCredentials = function(userName, password) { | ||
this.userName = userName; | ||
this.password = password; | ||
this.userName = userName; | ||
this.password = password; | ||
}; | ||
}; | ||
module.exports = MASPluginMQTTConstants; |
@@ -9,7 +9,4 @@ /* | ||
var MQTTQualityOfService = { | ||
AtMostOnce: 0, | ||
AtLeastOnce: 1, | ||
ExactlyOnce: 2 | ||
@@ -20,16 +17,10 @@ }; | ||
var MASPluginMQTTMessage = function (mid, topic, payload, qos, retained) { | ||
var MASPluginMQTTMessage = function (mid, topic, payload, qos, retained) { | ||
this.mid = mid ? mid : NaN; | ||
this.topic = topic ? topic : ""; | ||
this.payload = payload ? payload : undefined; | ||
this.qos = qos ? qos : MQTTQualityOfService.ExactlyOnce; | ||
this.retained = retained ? true : false; | ||
this.initialize = function(successHandler, errorHandler, topic, payload, qos, retained, mid) { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMQTTMessage", "initialize", [topic, payload, qos, retained, mid]); | ||
@@ -39,3 +30,2 @@ }; | ||
if (this.mid && this.topic && this.payload) { | ||
this.initialize(function(){}, function(){}, this.mid, this.topic, this.payload); | ||
@@ -45,3 +35,2 @@ } | ||
this.payloadString = function() { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMQTTMessage", "payloadString", [this.mid]); | ||
@@ -51,7 +40,6 @@ }; | ||
this.payloadImage = function() { | ||
return Cordova.exec(successHandler, errorHandler, "MASPluginMQTTMessage", "payloadImage", [this.mid]); | ||
}; | ||
}; | ||
}; | ||
module.exports = MASPluginMQTTMessage; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
1296498
3.19%59
13.46%1773
9.51%