var dlfcn = require("dlfcna.js");
console.log(dlfcn);

var funcs = [ 
  ["reboot", "ii"] 
];
// "/usr/local/quicknode/enode_modules/rebootdevice.so",
console.log("in rebootdevice.js");
function register() {
  console.log("will register rebootdevice.so");
  var isSuccess = dlfcn.register(
    "@native.rebootdevice",
    "/usr/local/quicknode/enode_modules/rebootdevice.so",
    funcs
  );
  if (isSuccess) {
    console.log("load so successfully");
    var rebootdevice = require("@native.rebootdevice");
    return rebootdevice;
  } else {
    console.log("load so failed");
  }
  return undefined;
}
var rebootdevice = register();
 
function reboot() {
  console.log("__________________________")
  return rebootdevice.reboot(0);
}
 
module.exports = {
  reboot:reboot 
};
