Last active
August 29, 2015 14:07
-
-
Save psiddh/102008047095cb4789dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SEConnector() {} | |
// Define the prototypes and utilities for this factory | |
// Our default ConnectorClass is SIMIOConnector | |
SEConnector.prototype.ConnectorClass = SIMIOConnector; | |
// Our Factory method for creating new ConnectorClass instances | |
SEConnector.prototype.createConnector = function ( options ) { | |
switch(options.seType){ | |
case "uicc": | |
this.ConnectorClass = SIMIOConnector; | |
break; | |
case "eSE": | |
this.ConnectorClass = eSEConnector; | |
break; | |
//defaults to SEConnector.prototype.ConnectorClass (SIMIOConnector) | |
} | |
return new this.ConnectorClass( options ); | |
}; | |
function SIMIOConnector() { | |
let rilContent = Cc["@mozilla.org/ril/content-helper;1"]; | |
if (rilContent) { | |
this.iccProvider = rilContent.getService(Ci.nsIIccProvider); | |
let sim_io_cardState = this.iccProvider.getCardState(1); | |
debug('SIMIOConnector : CONSTRUCTOR ' + sim_io_cardState); | |
} | |
} | |
SIMIOConnector.prototype = { | |
__proto__: this.iccProvider.prototype, | |
// for now 'nsIIccProvider'. Should be changed to 'nsIIccChannelCallback' | |
QueryInterface: XPCOMUtils.generateQI([Ci.nsIIccProvider]), | |
classID: SIMIOCONNECTOR_CID, | |
classInfo: XPCOMUtils.generateCI({ | |
classID: SIMIOCONNECTOR_CID, | |
classDescription: "SIMIOConnector", | |
interfaces: [Ci.nsIIccProvider] | |
}), | |
}; | |
. | |
. | |
. | |
let SIMIOConnector = this.seConnectorFactory.createConnector( { seType: "uicc" } ); | |
let sim_io_cardState = SIMIOConnector.getCardState(1); // getCardState() is function declared in 'nsIIccProvider.idl' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment