//============================================================================== //LGMobileOn //============================================================================== //============================================================================== //nexacro.Event.LGMobileOnEventInfo //LGMobileOn에 요청된 작업이 성공했을 때 발생되는 이벤트에서 사용되는 EventInfo Object //============================================================================== if(!nexacro.Event.LGMobileOnEventInfo) { nexacro.Event.LGMobileOnEventInfo = function (strEventId, strSvcId, intReason, strReturnValue) { this.eventid = strEventId; // 이벤트ID this.svcid = strSvcId; // 이벤트 서비스 ID this.reason = intReason; // 이벤트 발생분류 코드 this.returnvalue = strReturnValue; // 이벤트 수행결과 (type:Variant) } _pLGMobileOnEventInfo = nexacro.Event.LGMobileOnEventInfo.prototype = nexacro._createPrototype(nexacro.Event); _pLGMobileOnEventInfo._type = "nexacroLGMobileOnEventInfo"; _pLGMobileOnEventInfo._type_name = "LGMobileOnEventInfo"; _pLGMobileOnEventInfo = null; } //============================================================================== //nexacro.Event.LGMobileOnErrorEventInfo //LGMobileOn에 요청된 작업이 실패했을 때 발생되는 이벤트에서 사용되는 EventInfo Object //============================================================================== if(!nexacro.Event.LGMobileOnErrorEventInfo) { nexacro.Event.LGMobileOnErrorEventInfo = function (strEventId, strSvcId, intReason, intErrorCode, strErrorMsg) { this.eventid = strEventId; // 이벤트ID this.svcid = strSvcId; // 이벤트 서비스 ID this.reason = intReason; this.errorcode = intErrorCode; this.errormsg = strErrorMsg; } _pLGMobileOnErrorEventInfo = nexacro.Event.LGMobileOnErrorEventInfo.prototype = nexacro._createPrototype(nexacro.Event); _pLGMobileOnErrorEventInfo._type = "nexacroLGMobileOnErrorEventInfo"; _pLGMobileOnErrorEventInfo._type_name = "LGMobileOnErrorEventInfo"; _pLGMobileOnErrorEventInfo = null; } //============================================================================== //nexacro.LGMobileOn //LGMobileOn를 연동하기 위해 사용한다. //============================================================================== if (!nexacro.LGMobileOn) { nexacro.LGMobileOn = function(name, obj) { this._id = nexacro.Device.makeID(); nexacro.Device._userCreatedObj[this._id] = this; this.name = name || ""; this.enableevent = true; this.timeout = 10; this._clsnm = ["LGMobileOnPlugin"]; this._reasoncode = { constructor : {ifcls: 0, fn: "constructor"}, destroy : {ifcls: 0, fn: "destroy"}, callMethod : {ifcls: 0, fn: "callMethod"}, }; this._event_list = { "oncallback": 1, }; // native constructor var params = {} ; var fninfo = this._reasoncode.constructor; this._execFn(fninfo, params); }; var _pLGMobileOn = nexacro.LGMobileOn.prototype = nexacro._createPrototype(nexacro.EventSinkObject); _pLGMobileOn._type = "nexacroLGMobileOn"; _pLGMobileOn._type_name = "LGMobileOn"; _pLGMobileOn.destroy = function() { var params = {}; var jsonstr; delete nexacro.Device._userCreatedObj[this._id]; var fninfo = this._reasoncode.destroy; this._execFn(fninfo, params); return true; }; //===================User Method=========================// _pLGMobileOn.callMethod = function(methodid, param) { var fninfo = this._reasoncode.callMethod; var params = {}; params.serviceid = methodid; params.param = param; this._execFn(fninfo, params); }; //===================Native Call=========================// _pLGMobileOn._execFn = function(_obj, _param) { if(nexacro.Device.curDevice == 0) { var jsonstr = this._getJSONStr(_obj, _param); this._log(jsonstr); nexacro.Device.exec(jsonstr); } else { var jsonstr = this._getJSONStr(_obj, _param); this._log(jsonstr); nexacro.Device.exec(jsonstr); } } _pLGMobileOn._getJSONStr = function(_obj, _param) { var _id = this._id; var _clsnm = this._clsnm[_obj.ifcls]; var _fnnm = _obj.fn; var value = {}; value.id = _id; value.div = _clsnm; value.method = _fnnm; value.params = _param; return JSON.stringify(value); } _pLGMobileOn._log = function(arg) { if(trace) { trace(arg); } } //===================EVENT=========================// _pLGMobileOn._oncallback = function(objData) { var e = new nexacro.Event.LGMobileOnEventInfo("oncallback", objData.svcid, objData.reason, objData.returnvalue); this.$fire_oncallback(this, e); }; _pLGMobileOn.$fire_oncallback = function (objLGMobileOn, eLGMobileOnEventInfo) { if (this.oncallback && this.oncallback._has_handlers) { return this.oncallback._fireEvent(this, eLGMobileOnEventInfo); } return true; }; delete _pLGMobileOn; }