initscript and correct address
[svn42.git] / go / uc_sensor_node_zmq / main.go
index 52a8aad..bd55297 100644 (file)
@@ -13,21 +13,26 @@ var (
     tty_dev_ string
     pub_addr string
     use_syslog_ bool    
+    enable_debug_ bool    
 )
 
 func init() {
-    flag.StringVar(&pub_addr, "brokeraddr", "tcp://torwaechter.realraum.at:4244", "zmq address to send stuff to")
+    flag.StringVar(&pub_addr, "brokeraddr", "tcp://torwaechter.realraum.at:4243", "zmq address to send stuff to")
     flag.StringVar(&tty_dev_, "ttydev", "/dev/ttyACM0", "path do tty uc device")
     flag.BoolVar(&use_syslog_, "syslog", false, "log to syslog local1 facility")    
+    flag.BoolVar(&enable_debug_, "debug", false, "debugging messages on")    
     flag.Parse()
 }
 
 func main() {
     zmqctx, pub_sock := ZmqsInit(pub_addr)
+    if pub_sock == nil { panic("zmq socket creation failed") }
     defer zmqctx.Close()   
     defer pub_sock.Close()
 
-    if use_syslog_ {
+    if enable_debug_ {
+        LogEnableDebuglog()
+    } else if use_syslog_ {
         LogEnableSyslog()
         Syslog_.Print("started")
     }