mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 19:41:49 +00:00
Bug 853715 - 0005. Handle incoming Wap Push messages. r=vicamo
--HG-- rename : dom/mobilemessage/src/ril/WapPushManager.js => dom/wappush/src/gonk/WapPushManager.js
This commit is contained in:
parent
480ee33547
commit
8fbe6af03a
@ -54,7 +54,6 @@ EXTRA_JS_MODULES = \
|
||||
ril/mms_consts.js \
|
||||
ril/MmsPduHelper.jsm \
|
||||
ril/wap_consts.js \
|
||||
ril/WapPushManager.js \
|
||||
ril/WspPduHelper.jsm \
|
||||
$(NULL)
|
||||
endif
|
||||
|
@ -867,8 +867,8 @@ this.UintVar = {
|
||||
/**
|
||||
* This encoding is used for token values, which have no well-known binary
|
||||
* encoding, or when the assigned number of the well-known encoding is small
|
||||
* enough to fit into Short-Integer. We change Extension-Media from
|
||||
* NullTerminatedTexts to TextString because of Bug 823816.
|
||||
* enough to fit into Short-Integer. We change Extension-Media from
|
||||
* NullTerminatedTexts to TextString because of Bug 823816.
|
||||
*
|
||||
* Constrained-encoding = Extension-Media | Short-integer
|
||||
* Extension-Media = TextString
|
||||
@ -2797,6 +2797,7 @@ this.OMNA_PUSH_APPLICATION_IDS = (function () {
|
||||
ids[urn] = ids[number] = entry;
|
||||
}
|
||||
|
||||
add("x-wap-application:wml.ua", 0x02);
|
||||
add("x-wap-application:mms.ua", 0x04);
|
||||
|
||||
return ids;
|
||||
|
@ -19,6 +19,7 @@ EXTRA_JS_MODULES = \
|
||||
gonk/WbxmlPduHelper.jsm \
|
||||
gonk/SiPduHelper.jsm \
|
||||
gonk/SlPduHelper.jsm \
|
||||
gonk/WapPushManager.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -13,6 +13,21 @@ Cu.import("resource://gre/modules/WspPduHelper.jsm", this);
|
||||
|
||||
const DEBUG = false; // set to true to see debug messages
|
||||
|
||||
/**
|
||||
* WAP Push decoders
|
||||
*/
|
||||
XPCOMUtils.defineLazyGetter(this, "SI", function () {
|
||||
let SI = {};
|
||||
Cu.import("resource://gre/modules/SiPduHelper.jsm", SI);
|
||||
return SI;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "SL", function () {
|
||||
let SL = {};
|
||||
Cu.import("resource://gre/modules/SlPduHelper.jsm", SL);
|
||||
return SL;
|
||||
});
|
||||
|
||||
/**
|
||||
* Helpers for WAP PDU processing.
|
||||
*/
|
||||
@ -41,14 +56,47 @@ this.WapPushManager = {
|
||||
return;
|
||||
}
|
||||
|
||||
// MMS
|
||||
if (appid == "x-wap-application:mms.ua") {
|
||||
let mmsService = Cc["@mozilla.org/mms/rilmmsservice;1"]
|
||||
.getService(Ci.nsIMmsService);
|
||||
mmsService.QueryInterface(Ci.nsIWapPushApplication)
|
||||
.receiveWapPush(data.array, data.array.length, data.offset, options);
|
||||
} else {
|
||||
debug("No WAP Push application registered for " + appid);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-MMS, handled according to content type
|
||||
*
|
||||
* WAP Type content-type x-wap-application-id
|
||||
* MMS "application/vnd.wap.mms-message" "x-wap-application:mms.ua"
|
||||
* SI "text/vnd.wap.si" "x-wap-application:wml.ua"
|
||||
* SI(WBXML) "application/vnd.wap.sic" "x-wap-application:wml.ua"
|
||||
* SL "text/vnd.wap.sl" "x-wap-application:wml.ua"
|
||||
* SL(WBXML) "application/vnd.wap.slc" "x-wap-application:wml.ua"
|
||||
* Provisioning "text/vnd.wap.connectivity-xml" "x-wap-application:wml.ua"
|
||||
* Provisioning(WBXML) "application/vnd.wap.connectivity-wbxml" "x-wap-application:wml.ua"
|
||||
*
|
||||
* @see http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx
|
||||
*/
|
||||
let contentType = options.headers["content-type"].media;
|
||||
let msg = { contentType: contentType };
|
||||
|
||||
if (contentType === "text/vnd.wap.si" ||
|
||||
contentType === "application/vnd.wap.sic") {
|
||||
SI.PduHelper.parse(data, contentType, msg);
|
||||
} else if (contentType === "text/vnd.wap.sl" ||
|
||||
contentType === "application/vnd.wap.slc") {
|
||||
SL.PduHelper.parse(data, contentType, msg);
|
||||
} else if (contentType === "text/vnd.wap.connectivity-xml" ||
|
||||
contentType === "application/vnd.wap.connectivity-wbxml") {
|
||||
// TODO: Bug 869291 - Support Receiving WAP-Push-CP
|
||||
} else {
|
||||
// Unsupported type, provide raw data.
|
||||
msg.content = data.array;
|
||||
}
|
||||
|
||||
// TODO: Bug 853782 - Notify receiving of WAP Push messages
|
||||
},
|
||||
|
||||
/**
|
Loading…
x
Reference in New Issue
Block a user