# HG changeset patch # User Michiel Broek # Date 1400441227 -7200 # Node ID 01b96a24ae7cf5e0a5a0c21fee85e6590a11d4fd # Parent f534ace74eea99fba4db16c4e020cc3577275769 Corrected missing and obsolete files diff -r f534ace74eea -r 01b96a24ae7c .hgignore --- a/.hgignore Sun May 18 21:24:55 2014 +0200 +++ b/.hgignore Sun May 18 21:27:07 2014 +0200 @@ -9,7 +9,7 @@ rc433/recv rc433/send rc433/sniffer -coolers/coolers +thermferm/thermferm dht11/dht11 syntax: glob diff -r f534ace74eea -r 01b96a24ae7c thermferm/server.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/thermferm/server.c Sun May 18 21:27:07 2014 +0200 @@ -0,0 +1,93 @@ +/***************************************************************************** + * Copyright (C) 2008-2014 + * + * Michiel Broek + * + * This file is part of the mbsePi-apps + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * mbsePi-apps is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EC-65K; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + + +#include "../lib/mbselib.h" +#include "server.h" + + +extern bool my_shutdown; +extern bool debug; +extern int lcdHandle; +extern unsigned char lcdbuf[MAX_LCDS][20][4]; + + +int sock = -1; + + +char *exe_cmd(char *); + + +char *exe_cmd(char *cmd) +{ + static char obuf[1024]; + int i; + + if (strncmp(cmd, "lcd", 3) == 0) { + for (i = 0; i < 20; i++) { + obuf[i] = lcdbuf[lcdHandle][i][0]; + obuf[i+20] = lcdbuf[lcdHandle][i][1]; + obuf[i+40] = lcdbuf[lcdHandle][i][2]; + obuf[i+60] = lcdbuf[lcdHandle][i][3]; + } + obuf[80] = '\0'; + return obuf; + } + + return (char *)"ERROR"; +} + + + +void do_cmd(char *cmd) +{ + char buf[1024]; + int slen, tries = 0; + + if (debug) + fprintf(stdout, "do_cmd(%s)\n", cmd); + + snprintf(buf, 1024, "%s", exe_cmd(cmd)); + + if (debug) + fprintf(stdout, "do_cmd() reply=\"%s\" len=%d\n", buf, strlen(buf)); + + for (;;) { +// slen = sendto(sock, buf, strlen(buf), 0, (struct sockaddr *)&from, fromlen); + + if (debug) + fprintf(stdout, "do_cmd() slen=%d tries=%d %s\n", slen, tries, strerror(errno)); +// if (slen == -1) +// syslog(LOG_NOTICE, "do_cmd(): sendto error %d %s", tries, from.sun_path); + else if (slen != strlen(buf)) + syslog(LOG_NOTICE, "do_cmd(): send %d of %d bytes, try=%d", slen, strlen(buf), tries); + else + return; + tries++; + if (tries == 3) + return; + else + sleep(1); + } +} + + diff -r f534ace74eea -r 01b96a24ae7c thermferm/server.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/thermferm/server.h Sun May 18 21:27:07 2014 +0200 @@ -0,0 +1,6 @@ +#ifndef MY_SERVER_H +#define MY_SERVER_H + + + +#endif