//============================================================================== //ZXing //============================================================================== //============================================================================== //nexacro.Event.ZXingEventInfo //ZXing에 요청된 작업이 성공했을 때 발생되는 이벤트에서 사용되는 EventInfo Object //============================================================================== if(!nexacro.Event.ZXingEventInfo) { nexacro.Event.ZXingEventInfo = function (strEventId, strSvcId, intReason, strReturnValue) { this.eventid = strEventId; // 이벤트ID this.svcid = strSvcId; // 이벤트 서비스 ID this.reason = intReason; // 이벤트 발생분류 코드 this.returnvalue = strReturnValue; // 이벤트 수행결과 (type:Variant) } _pZXingEventInfo = nexacro.Event.ZXingEventInfo.prototype = nexacro._createPrototype(nexacro.Event); _pZXingEventInfo._type = "nexacroZXingEventInfo"; _pZXingEventInfo._type_name = "ZXingEventInfo"; _pZXingEventInfo = null; } //============================================================================== //nexacro.Event.ZXingErrorEventInfo //ZXing에 요청된 작업이 실패했을 때 발생되는 이벤트에서 사용되는 EventInfo Object //============================================================================== if(!nexacro.Event.ZXingErrorEventInfo) { nexacro.Event.ZXingErrorEventInfo = function (strEventId, strSvcId, intReason, intErrorCode, strErrorMsg) { this.eventid = strEventId; // 이벤트ID this.svcid = strSvcId; // 이벤트 서비스 ID this.reason = intReason; this.errorcode = intErrorCode; this.errormsg = strErrorMsg; } _pZXingErrorEventInfo = nexacro.Event.ZXingErrorEventInfo.prototype = nexacro._createPrototype(nexacro.Event); _pZXingErrorEventInfo._type = "nexacroZXingErrorEventInfo"; _pZXingErrorEventInfo._type_name = "ZXingErrorEventInfo"; _pZXingErrorEventInfo = null; } //============================================================================== //nexacro.ZXing //ZXing를 연동하기 위해 사용한다. //============================================================================== if (!nexacro.ZXing) { nexacro.ZXing = 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 = ["ZXingPlugin"]; 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 _pZXing = nexacro.ZXing.prototype = nexacro._createPrototype(nexacro.EventSinkObject); _pZXing._type = "nexacroZXing"; _pZXing._type_name = "ZXing"; _pZXing.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=========================// _pZXing.callMethod = function(methodid, param) { var fninfo = this._reasoncode.callMethod; var params = {}; params.serviceid = methodid; params.param = param; this._execFn(fninfo, params); }; //===================Native Call=========================// _pZXing._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); } } _pZXing._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); } _pZXing._log = function(arg) { if(trace) { trace(arg); } } //===================EVENT=========================// _pZXing._oncallback = function(objData) { var e = new nexacro.Event.ZXingEventInfo("oncallback", objData.svcid, objData.reason, objData.returnvalue); this.$fire_oncallback(this, e); }; _pZXing.$fire_oncallback = function (objZXing, eZXingEventInfo) { if (this.oncallback && this.oncallback._has_handlers) { return this.oncallback._fireEvent(this, eZXingEventInfo); } return true; }; delete _pZXing; }