cylon/index.js

39 lines
819 B
JavaScript
Raw Normal View History

2015-06-23 09:10:09 +08:00
"use strict";
2015-07-16 00:49:03 +08:00
var MCP = require("./lib/mcp");
2015-06-23 09:10:09 +08:00
2015-07-16 00:49:03 +08:00
module.exports = {
MCP: require("./lib/mcp"),
2015-06-23 09:10:09 +08:00
2015-07-16 00:49:03 +08:00
Robot: require("./lib/robot"),
2015-06-23 09:10:09 +08:00
2015-07-16 00:49:03 +08:00
Driver: require("./lib/driver"),
Adaptor: require("./lib/adaptor"),
2015-06-23 09:10:09 +08:00
2015-07-16 00:49:03 +08:00
Utils: require("./lib/utils"),
Logger: require("./lib/logger"),
2015-06-23 09:10:09 +08:00
2015-07-16 00:49:03 +08:00
IO: {
DigitalPin: require("./lib/io/digital-pin"),
Utils: require("./lib/io/utils")
},
2015-06-23 09:10:09 +08:00
2015-07-16 00:49:03 +08:00
robot: MCP.create,
api: require("./lib/api").create,
config: require("./lib/config").update,
2015-06-23 09:10:09 +08:00
2015-07-16 00:49:03 +08:00
start: MCP.start,
halt: MCP.halt
};
2015-06-23 09:10:09 +08:00
process.on("SIGINT", function() {
2015-07-16 00:49:03 +08:00
MCP.halt(process.kill.bind(process, process.pid));
2015-06-23 09:10:09 +08:00
});
if (process.platform === "win32") {
var io = { input: process.stdin, output: process.stdout },
quit = process.emit.bind(process, "SIGINT");
require("readline").createInterface(io).on("SIGINT", quit);
}