must go sleep
[CBFWR.git] / bin / cbfwrd.php
index 23897e1..d2a0e83 100644 (file)
@@ -1,7 +1,9 @@
 <?php
 $CMD_ROOT_FS = realpath(dirname(__FILE__));
+$AM_DAEMON = true;
 
 global $CMD_ROOT_FS;
+global $AM_DAEMON;
 
 // add libglcas as if it were a path in ../libglcas
 if(file_exists("../libcbfwr")) {
@@ -16,4 +18,40 @@ require_once("libcbfwr/lib.php");
 glcas_pluginLoader();
 
 error_log("CBFWRD starting");
+
+
+$config = new Config();
+
+if(isset($argv[1])) {
+       if($argv[1] == "boot") {
+               // we get called here on boot.
+               $config->bootHardware();
+               exit(0);
+       }
+}
+
+// now we got into daemon modes
+$cont = true;
+
+// setup our sem/shm stuff
+
+// this stuff needs to go in comms
+while($cont) {
+       $comms = new Comms;
+       
+       $config->loadConfig();
+       $comms->putConfig($config->getConfig());
+       
+       $msg = $comms->waitForMessage();
+       
+       //echo "Got message: $msg\n";
+       if($msg == "quit") $cont = false;
+       else cbfwd_commandProcessor($msg);
+}
+
+
+function cbfwd_commandProcessor($command)
+{
+       
+}
 ?>
\ No newline at end of file