1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var RSM = {};
Cu.import("resource://gre/modules/RILSystemMessenger.jsm", RSM);
const RILSYSTEMMESSENGERHELPER_CONTRACTID =
"@mozilla.org/ril/system-messenger-helper;1";
const RILSYSTEMMESSENGERHELPER_CID =
Components.ID("{19d9a4ea-580d-11e4-8f6c-37ababfaaea9}");
XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
"@mozilla.org/system-message-internal;1",
"nsISystemMessagesInternal");
XPCOMUtils.defineLazyServiceGetter(this, "gStkCmdFactory",
"@mozilla.org/icc/stkcmdfactory;1",
"nsIStkCmdFactory");
var DEBUG = false;
function debug(s) {
dump("-@- RILSystemMessenger: " + s + "\n");
};
// Read debug setting from pref.
try {
let debugPref = Services.prefs.getBoolPref("ril.debugging.enabled");
DEBUG = DEBUG || debugPref;
} catch (e) {}
/**
* RILSystemMessengerHelper
*/
function RILSystemMessengerHelper() {
this.messenger = new RSM.RILSystemMessenger();
this.messenger.broadcastMessage = (aType, aMessage) => {
if (DEBUG) {
debug("broadcastMessage: aType: " + aType +
", aMessage: "+ JSON.stringify(aMessage));
}
gSystemMessenger.broadcastMessage(aType, aMessage);
};
this.messenger.createCommandMessage = (aStkProactiveCmd) => {
return gStkCmdFactory.createCommandMessage(aStkProactiveCmd);
};
}
RILSystemMessengerHelper.prototype = {
classID: RILSYSTEMMESSENGERHELPER_CID,
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyMessenger,
Ci.nsISmsMessenger,
Ci.nsICellbroadcastMessenger,
Ci.nsIMobileConnectionMessenger,
Ci.nsIIccMessenger]),
/**
* RILSystemMessenger instance.
*/
messenger: null,
/**
* nsITelephonyMessenger API
*/
notifyNewCall: function() {
this.messenger.notifyNewCall();
},
notifyCallEnded: function(aServiceId, aNumber, aCdmaWaitingNumber, aEmergency,
aDuration, aOutgoing, aHangUpLocal) {
this.messenger.notifyCallEnded(aServiceId, aNumber, aCdmaWaitingNumber, aEmergency,
aDuration, aOutgoing, aHangUpLocal);
},
notifyUssdReceived: function(aServiceId, aMessage, aSessionEnded) {
this.messenger.notifyUssdReceived(aServiceId, aMessage, aSessionEnded);
},
/**
* nsISmsMessenger API
*/
notifySms: function(aNotificationType, aId, aThreadId, aIccId, aDelivery,
aDeliveryStatus, aSender, aReceiver, aBody, aMessageClass,
aTimestamp, aSentTimestamp, aDeliveryTimestamp, aRead) {
this.messenger.notifySms(aNotificationType, aId, aThreadId, aIccId, aDelivery,
aDeliveryStatus, aSender, aReceiver, aBody, aMessageClass,
aTimestamp, aSentTimestamp, aDeliveryTimestamp, aRead);
},
/**
* nsICellbroadcastMessenger API
*/
notifyCbMessageReceived: function(aServiceId, aGsmGeographicalScope, aMessageCode,
aMessageId, aLanguage, aBody, aMessageClass,
aTimestamp, aCdmaServiceCategory, aHasEtwsInfo,
aEtwsWarningType, aEtwsEmergencyUserAlert, aEtwsPopup) {
this.messenger.notifyCbMessageReceived(aServiceId, aGsmGeographicalScope, aMessageCode,
aMessageId, aLanguage, aBody, aMessageClass,
aTimestamp, aCdmaServiceCategory, aHasEtwsInfo,
aEtwsWarningType, aEtwsEmergencyUserAlert, aEtwsPopup);
},
/**
* nsIMobileConnectionMessenger API
*/
notifyCdmaInfoRecDisplay: function(aServiceId, aDisplay) {
this.messenger.notifyCdmaInfoRecDisplay(aServiceId, aDisplay);
},
notifyCdmaInfoRecCalledPartyNumber: function(aServiceId, aType, aPlan,
aNumber, aPi, aSi) {
this.messenger.notifyCdmaInfoRecCalledPartyNumber(aServiceId, aType, aPlan,
aNumber, aPi, aSi);
},
notifyCdmaInfoRecCallingPartyNumber: function(aServiceId, aType, aPlan,
aNumber, aPi, aSi) {
this.messenger.notifyCdmaInfoRecCallingPartyNumber(aServiceId, aType, aPlan,
aNumber, aPi, aSi);
},
notifyCdmaInfoRecConnectedPartyNumber: function(aServiceId, aType, aPlan,
aNumber, aPi, aSi) {
this.messenger.notifyCdmaInfoRecConnectedPartyNumber(aServiceId, aType, aPlan,
aNumber, aPi, aSi);
},
notifyCdmaInfoRecSignal: function(aServiceId, aType, aAlertPitch, aSignal) {
this.messenger.notifyCdmaInfoRecSignal(aServiceId, aType, aAlertPitch, aSignal);
},
notifyCdmaInfoRecRedirectingNumber: function(aServiceId, aType, aPlan,
aNumber, aPi, aSi, aReason) {
this.messenger.notifyCdmaInfoRecRedirectingNumber(aServiceId, aType, aPlan,
aNumber, aPi, aSi, aReason);
},
notifyCdmaInfoRecLineControl: function(aServiceId, aPolarityIncluded,
aToggle, aReverse, aPowerDenial) {
this.messenger.notifyCdmaInfoRecLineControl(aServiceId, aPolarityIncluded,
aToggle, aReverse, aPowerDenial);
},
notifyCdmaInfoRecClir: function(aServiceId, aCause) {
this.messenger.notifyCdmaInfoRecClir(aServiceId, aCause);
},
notifyCdmaInfoRecAudioControl: function(aServiceId, aUpLink, aDownLink) {
this.messenger.notifyCdmaInfoRecAudioControl(aServiceId, aUpLink, aDownLink);
},
/**
* nsIIccMessenger API
*/
notifyStkProactiveCommand: function(aIccId, aCommand) {
this.messenger.notifyStkProactiveCommand(aIccId, aCommand);
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RILSystemMessengerHelper]);
|