some structure to how configs are loaded, how the daemon works, etc
[CBFWR.git] / bin / cbfwrd.php
index 3b29870..4bf1513 100644 (file)
@@ -19,8 +19,17 @@ 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;
 
@@ -30,12 +39,12 @@ $cont = true;
 while($cont) {
        $comms = new Comms;
        
+       $config->loadConfig();
        $comms->putConfig($config->getConfig());
        
        $msg = $comms->waitForMessage();
        
        //echo "Got message: $msg\n";
-       
-       $cont = false;
+       if($msg == "quit") $cont = false;
 }
 ?>
\ No newline at end of file