1 // (c) Bernhard Tittelbach, 2013
12 //~ func StringArrayToByteArray(ss []string) [][]byte {
13 //~ bb := make([][]byte, len(ss))
14 //~ for index, s := range(ss) {
15 //~ bb[index] = []byte(s)
20 // ---------- Main Code -------------
23 fmt.Fprintf(os.Stderr, "Usage: door_daemon_0mq <door tty device>\n")
33 fmt.Fprintf(os.Stderr, "Input file is missing!\n");
38 cmd_chans, pub_chans := ZmqsInit("tcp://localhost:5555", "gmp://*:6666")
40 serial_wr, serial_rd, err := OpenAndHandleSerial(args[0], pub_chans.Out())
47 firmware_version := <- serial_rd
48 log.Print("Firmware version:", firmware_version)
50 for incoming_request := range cmd_chans.In() {
51 reply, err := HandleCommand(incoming_request, pub_chans.Out(), serial_wr, serial_rd)
53 cmd_chans.Out() <- [][]byte{[]byte("ERROR"), []byte(err.Error())}
56 cmd_chans.Out() <- reply