31 int sock = -1; |
31 int sock = -1; |
32 uint16_t keys = 0x0000; |
32 uint16_t keys = 0x0000; |
33 uint16_t leds = 0x0400; /* LED's, buzzer, LCD backlight */ |
33 uint16_t leds = 0x0400; /* LED's, buzzer, LCD backlight */ |
34 uint16_t oleds = 0x0400; |
34 uint16_t oleds = 0x0400; |
35 |
35 |
36 extern int debug; |
|
37 |
36 |
38 |
37 |
39 void putLCDsocket(int fd, uint16_t data) |
38 void putLCDsocket(int fd, uint16_t data) |
40 { |
39 { |
41 socklen_t slen = 0; |
40 socklen_t slen = 0; |
57 syslog(LOG_NOTICE, "Can't shutdown socket: %s", strerror(errno)); |
56 syslog(LOG_NOTICE, "Can't shutdown socket: %s", strerror(errno)); |
58 } |
57 } |
59 sock = -1; |
58 sock = -1; |
60 } else { |
59 } else { |
61 if ((rdat & SLCD_MKEYS) == SLCD_KEYS) { |
60 if ((rdat & SLCD_MKEYS) == SLCD_KEYS) { |
62 if (((rdat & 0x00ff) != keys) && debug) |
|
63 fprintf(stdout, "received keys %04x was %04x\n", rdat & 0x00ff, keys); |
|
64 keys = rdat & 0x00ff; |
61 keys = rdat & 0x00ff; |
65 } else { |
|
66 if (debug) |
|
67 fprintf(stdout, "received %04x\n", rdat); |
|
68 } |
62 } |
69 |
63 |
70 } |
64 } |
71 } |
65 } |
72 } |
66 } |
86 putLCDsocket(fd, leds); |
80 putLCDsocket(fd, leds); |
87 oleds = leds; |
81 oleds = leds; |
88 } |
82 } |
89 |
83 |
90 |
84 |
91 //void slcdHome(int fd) |
|
92 //{ |
|
93 //} |
|
94 |
|
95 |
|
96 |
85 |
97 void slcdClear(int fd) |
86 void slcdClear(int fd) |
98 { |
87 { |
99 putLCDsocket(fd, SLCD_CLEAR); |
88 putLCDsocket(fd, SLCD_CLEAR); |
100 putLCDsocket(fd, SLCD_HOME); |
89 putLCDsocket(fd, SLCD_HOME); |
101 } |
90 } |
102 |
|
103 |
|
104 |
|
105 //void slcdDisplay(int fd, int state) |
|
106 //{ |
|
107 //} |
|
108 |
|
109 |
|
110 |
|
111 //void slcdCursor(int fd, int state) |
|
112 //{ |
|
113 //} |
|
114 |
|
115 |
|
116 |
|
117 //void slcdCursorBlink(int fd, int state) |
|
118 //{ |
|
119 //} |
|
120 |
|
121 |
|
122 |
|
123 //void slcdSendCommand(int fd, unsigned char command) |
|
124 //{ |
|
125 //} |
|
126 |
91 |
127 |
92 |
128 |
93 |
129 void slcdPosition(int fd, int x, int y) |
94 void slcdPosition(int fd, int x, int y) |
130 { |
95 { |
163 slcdPutchar(fd, *string++); |
128 slcdPutchar(fd, *string++); |
164 } |
129 } |
165 |
130 |
166 |
131 |
167 |
132 |
168 //void slcdPrintf(int fd, const char *message, ...) |
|
169 //{ |
|
170 //} |
|
171 |
|
172 |
|
173 |
|
174 /* |
133 /* |
175 * Try to setup a udp connection to 127.0.0.1 so we duplicate the panel |
134 * Try to setup a udp connection to 127.0.0.1 so we duplicate the panel |
176 * display and keys of the real panel. This should fail on a production |
135 * display and keys of the real panel. This should fail on a production |
177 * system because there should no brewpanel program be running. If it |
136 * system because there should no brewpanel program be running. If it |
178 * succeeds, all io will be duplicated over the network. |
137 * succeeds, all io will be duplicated over the network. |