Added PROTOCOL_VERSION define,
Started to change to new client-server protocol 0.2, Added "slash" heartbeat mode...
This commit is contained in:
+43
-13
@@ -90,8 +90,9 @@ int hello_func(client *c, int argc, char **argv)
|
||||
debug("Hello!\n");
|
||||
|
||||
sprintf(str,
|
||||
"connect LCDproc %s lcd wid %i hgt %i cellwid %i cellhgt %i\n",
|
||||
version, lcd.wid, lcd.hgt, lcd.cellwid, lcd.cellhgt);
|
||||
"connect LCDproc %s protocol %s lcd wid %i hgt %i cellwid %i cellhgt %i\n",
|
||||
version, protocol_version,
|
||||
lcd.wid, lcd.hgt, lcd.cellwid, lcd.cellhgt);
|
||||
sock_send_string(c->sock, str);
|
||||
|
||||
if(c->data)
|
||||
@@ -112,7 +113,7 @@ int client_set_func(client *c, int argc, char **argv)
|
||||
for(i=1; i<argc; i++)
|
||||
{
|
||||
// Handle the "name" parameter
|
||||
if(0 == strcmp(argv[i], "name"))
|
||||
if(0 == strcmp(argv[i], "-name"))
|
||||
{
|
||||
if(argc > i+1)
|
||||
{
|
||||
@@ -277,7 +278,7 @@ int screen_set_func(client *c, int argc, char **argv)
|
||||
for(i=2; i<argc; i++)
|
||||
{
|
||||
// Handle the "name" parameter
|
||||
if(0 == strcmp(argv[i], "name"))
|
||||
if(0 == strcmp(argv[i], "-name"))
|
||||
{
|
||||
if(argc > i+1)
|
||||
{
|
||||
@@ -291,11 +292,11 @@ int screen_set_func(client *c, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
sock_send_string(c->sock, "huh? name requires a parameter\n");
|
||||
sock_send_string(c->sock, "huh? -name requires a parameter\n");
|
||||
}
|
||||
}
|
||||
// Handle the "priority" parameter
|
||||
else if(0 == strcmp(argv[i], "priority"))
|
||||
else if(0 == strcmp(argv[i], "-priority"))
|
||||
{
|
||||
if(argc > i+1)
|
||||
{
|
||||
@@ -309,11 +310,11 @@ int screen_set_func(client *c, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
sock_send_string(c->sock, "huh? priority requires a parameter\n");
|
||||
sock_send_string(c->sock, "huh? -priority requires a parameter\n");
|
||||
}
|
||||
}
|
||||
// Handle the "duration" parameter
|
||||
else if(0 == strcmp(argv[i], "duration"))
|
||||
else if(0 == strcmp(argv[i], "-duration"))
|
||||
{
|
||||
if(argc > i+1)
|
||||
{
|
||||
@@ -327,11 +328,40 @@ int screen_set_func(client *c, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
sock_send_string(c->sock, "huh? duration requires a parameter\n");
|
||||
sock_send_string(c->sock, "huh? -duration requires a parameter\n");
|
||||
}
|
||||
}
|
||||
// Handle the "heartbeat" parameter
|
||||
else if(0 == strcmp(argv[i], "-heartbeat"))
|
||||
{
|
||||
if(argc > i+1)
|
||||
{
|
||||
i++;
|
||||
debug("screen_set: heartbeat=\"%s\"\n", argv[i]);
|
||||
|
||||
// set the heartbeat type...
|
||||
if(0 == strcmp(argv[i], "on"))
|
||||
s->heartbeat = 1;
|
||||
if(0 == strcmp(argv[i], "heart"))
|
||||
s->heartbeat = 1;
|
||||
if(0 == strcmp(argv[i], "normal"))
|
||||
s->heartbeat = 1;
|
||||
if(0 == strcmp(argv[i], "default"))
|
||||
s->heartbeat = 1;
|
||||
if(0 == strcmp(argv[i], "off"))
|
||||
s->heartbeat = 0;
|
||||
if(0 == strcmp(argv[i], "none"))
|
||||
s->heartbeat = 0;
|
||||
if(0 == strcmp(argv[i], "slash"))
|
||||
s->heartbeat = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sock_send_string(c->sock, "huh? -heartbeat requires a parameter\n");
|
||||
}
|
||||
}
|
||||
// Handle the "wid" parameter
|
||||
else if(0 == strcmp(argv[i], "wid"))
|
||||
else if(0 == strcmp(argv[i], "-wid"))
|
||||
{
|
||||
if(argc > i+1)
|
||||
{
|
||||
@@ -345,11 +375,11 @@ int screen_set_func(client *c, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
sock_send_string(c->sock, "huh? wid requires a parameter\n");
|
||||
sock_send_string(c->sock, "huh? -wid requires a parameter\n");
|
||||
}
|
||||
}
|
||||
// Handle the "hgt" parameter
|
||||
else if(0 == strcmp(argv[i], "hgt"))
|
||||
else if(0 == strcmp(argv[i], "-hgt"))
|
||||
{
|
||||
if(argc > i+1)
|
||||
{
|
||||
@@ -363,7 +393,7 @@ int screen_set_func(client *c, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
sock_send_string(c->sock, "huh? hgt requires a parameter\n");
|
||||
sock_send_string(c->sock, "huh? -hgt requires a parameter\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -144,7 +144,7 @@ int MtxOrb_init(lcd_logical_driver *driver, char *args)
|
||||
{
|
||||
printf("LCDproc Matrix-Orbital LCD driver\n"
|
||||
"\t-d\t--device\tSelect the output device to use [/dev/lcd]\n"
|
||||
"\t-t\t--type\t\tSelect the LCD type (size) [20x4]\n"
|
||||
// "\t-t\t--type\t\tSelect the LCD type (size) [20x4]\n"
|
||||
"\t-c\t--contrast\tSet the initial contrast [140]\n"
|
||||
"\t-s\t--speed\t\tSet the communication speed [19200]\n"
|
||||
"\t-h\t--help\t\tShow this help information\n");
|
||||
|
||||
+4
-2
@@ -34,6 +34,7 @@
|
||||
|
||||
|
||||
char *version = VERSION;
|
||||
char *protocol_version = PROTOCOL_VERSION;
|
||||
char *build_date = __DATE__;
|
||||
|
||||
|
||||
@@ -74,7 +75,7 @@ int main(int argc, char **argv)
|
||||
//char cfgfile[256] = "/etc/LCDd.cf";
|
||||
int i, err, tmp;
|
||||
int daemon_mode=1;
|
||||
int disable_server_screen=0;
|
||||
int disable_server_screen=1;
|
||||
int child;
|
||||
screen *s = NULL;
|
||||
char *str, *ing; // strings for commandline handling
|
||||
@@ -237,6 +238,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
i++;
|
||||
if(0 == strcmp(argv[i], "off")) disable_server_screen = 1;
|
||||
if(0 == strcmp(argv[i], "on")) disable_server_screen = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -348,7 +350,7 @@ void HelpScreen()
|
||||
printf("LCDproc server daemon, %s\n", version);
|
||||
printf("Copyright (c) 1999 Scott Scriven, William Ferrell, and misc contributors\n");
|
||||
printf("This program is freely redistributable under the terms of the GNU Public License\n\n");
|
||||
printf("Usage: lcdproc [options]\n");
|
||||
printf("Usage: LCDd [options]\n");
|
||||
printf("\tOptions in []'s are optional. Available options are:\n");
|
||||
printf("\t-h\t--help\n\t\t\tDisplay this help screen\n");
|
||||
printf("\t-t\t--type <size>\n\t\t\tSelect an LCD size (20x4, 16x2, etc...)\n");
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
extern char *version;
|
||||
extern char *protocol_version;
|
||||
extern char *build_date;
|
||||
|
||||
void exit_program(int val);
|
||||
|
||||
+6
-1
@@ -114,13 +114,18 @@ int draw_screen(screen *s, int timer)
|
||||
|
||||
if(heartbeat)
|
||||
{
|
||||
if(s->heartbeat || heartbeat == HEART_ON)
|
||||
if((s->heartbeat==1) || heartbeat == HEART_ON)
|
||||
{
|
||||
// Set this to pulsate like a real heart beat...
|
||||
// (binary is fun... :)
|
||||
lcd.icon(!((timer+4)&5), 0);
|
||||
lcd.chr(lcd.wid, 1, 0);
|
||||
}
|
||||
if((s->heartbeat==2) && heartbeat != HEART_OFF)
|
||||
{
|
||||
char *phases = "-\\|/";
|
||||
lcd.chr(lcd.wid, 1, phases[timer&3]);
|
||||
}
|
||||
}
|
||||
|
||||
lcd.flush();
|
||||
|
||||
Reference in New Issue
Block a user