EPadLink ePad Vision Manual de usuario Pagina 16

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 27
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 15
16 www.epadlink.com
Integration Guide (ePad-vision SDK for Chrome & Firefox)
The first step is to import the JS-Ctypes and other required JavaScript modules (jsm) files. Then define
the path of the native library. As the library is installed along with the extension, it can be referenced
(relative to the extension) as shown below.
Load the library.
Components.utils.import("resource://gre/modules/ctypes.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
//Components.classes["@mozilla.org/net/osfileconstantsservice;1"].getService(Components.interfaces.nsIOSFile
ConstantsService).init();
const consoleJSM =Components.utils.import("resource://gre/modules/devtools/Console.jsm",{});
var profileDir =
Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).ge
t("ProfD", Components.interfaces.nsIFile).path ;
var mylibPath_win = profileDir + "/extensions/support@topazsystems.com/FireFoxExtension.dll";
var mylibPath_linux = profileDir + "/extensions/support@topazsystems.com/libFireFoxExtension.so";
var mylib=null;
//compare the OS and then load the respective library
console.log("appversion=" + navigator.appVersion);
if ( navigator.appVersion.indexOf("Win")!=-1) {
mylib=ctypes.open(mylibPath_win);
} else if ( navigator.appVersion.indexOf("X11")!=-1 || navigator.appVersion.indexOf("Linux")!=-1) {
mylib=ctypes.open(mylibPath_linux)
}
Declare the functions of the native library for use within JavaScript
var send=null;
var signatureFunc=null;
var widgetFunc=null;
//Declare the main function for interaction with the device.
send = mylib.declare("JsonDeserialize",ctypes.default_abi,ctypes.char.ptr, ctypes.char.ptr);
//Declare Signature data polling function
signatureFunc = mylib.declare("SignatureData",ctypes.default_abi,ctypes.char.ptr);
widgetFunc = mylib.declare("WidgetData",ctypes.default_abi,ctypes.char.ptr);
Once the functions are declared, you can invoke these functions.
8.4 Invoking the extension from Web page
Normally Firefox extension gets loaded when the Firefox browser gets started.
Extension register for a custom HTML DOM event which the web page raises when signature needs to
be captured. Extension implements the code for ePad-vision device access within this custom event
listener.
document.addEventListener("TopazMozillaSignStartEvent", TopazMozillaSignStart, false, true);
Vista de pagina 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 26 27

Comentarios a estos manuales

Sin comentarios