'use strict'
/**
 * 读取身份证 神思
 */
  var ffi = require('ffi');
  var libm  = ffi.Library(__dirname + '/libCommonInterface.so', {
    'OpenDevice': ['int', ['string','string','string']],
    'IdReadCard': ['int', ['int','int','string','long']],
    'CloseDevice': ['int', []]
  });
  var lt  =  new   Buffer ( 102400 );
  var result_list;
  /** 打开 **/
  console.log(libm.OpenDevice("AUTO","",""));
  /** 读卡 **/
  console.log(libm.IdReadCard(0,3,lt,0));
  result_list=lt.toString().split(":");
  console.log(result_list.length);
  for (let i=0;i<result_list.length;i++){
    console.log(result_list[i]);
  }
  /** 关闭 **/
  console.log(libm.CloseDevice());
