Added PROTOCOL_VERSION define,

Started to change to new client-server protocol 0.2,
Added "slash" heartbeat mode...
This commit is contained in:
toykeeper
2000-01-05 00:03:25 +00:00
parent 14df3acb82
commit e2401e4a72
17 changed files with 101 additions and 43 deletions
+6
View File
@@ -12,6 +12,12 @@ Coming soon: (?) (my list of stuff to do soon...)
* Dynamically-loaded driver system
v0.4-pre10:
+ "rotating slash" heartbeat mode (looks weird on CFontz displays)
Use "screen_set s -heartbeat slash" to use this.
* Switched to client-server protocol V0.2, so arguments can come in
any order, and require a "-" on the front. Instead of
"widget_set s w 1 2 foo", use "widget_set s w -x 1 -y 2 -text foo".
* Server info screen no longer enabled by default.
* Merged Andrew McMeikan's HD44780 driver changes
- Removed WHATSNEW
+ Added ChangeLog (okay, fine, I renamed WHATSNEW and typed a few
+3
View File
@@ -40,6 +40,9 @@
/* Define the package name */
#undef PACKAGE
/* Define the protocol version */
#undef PROTOCOL_VERSION
#undef SLI_DRV
#undef STAT_NFS
+1 -1
View File
@@ -83,7 +83,7 @@ int battery_screen(int rep, int display)
{
first = 0;
sprintf(buffer, "screen_set B name {APM stats: %s}\n", host);
sprintf(buffer, "screen_set B -name {APM stats: %s}\n", host);
sock_send_string(sock, buffer);
sock_send_string(sock, "widget_add B title title\n");
sprintf(tmp, "widget_set B title {LCDPROC %s}\n", version);
+4 -4
View File
@@ -162,7 +162,7 @@ int time_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add T\n");
sprintf(buffer, "screen_set T name {Time Screen: %s}\n", host);
sprintf(buffer, "screen_set T -name {Time Screen: %s}\n", host);
sock_send_string(sock, buffer);
sock_send_string(sock, "widget_add T title title\n");
sock_send_string(sock, "widget_set T title {Time Screen}\n");
@@ -324,7 +324,7 @@ int clock_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add O\n");
sprintf(buffer, "screen_set O name {Clock Screen: %s}\n", host);
sprintf(buffer, "screen_set O -name {Clock Screen: %s}\n", host);
sock_send_string(sock, buffer);
sock_send_string(sock, "widget_add O title title\n");
sock_send_string(sock, "widget_add O one string\n");
@@ -435,7 +435,7 @@ int uptime_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add U\n");
sprintf(buffer, "screen_set U name {Uptime Screen: %s}\n", host);
sprintf(buffer, "screen_set U -name {Uptime Screen: %s}\n", host);
sock_send_string(sock, buffer);
sock_send_string(sock, "widget_add U title title\n");
if(lcd_hgt >= 4)
@@ -519,7 +519,7 @@ int big_clock_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add K\n");
sock_send_string(sock, "screen_set K name {Big Clock Screen}\n");
sock_send_string(sock, "screen_set K -name {Big Clock Screen}\n");
sock_send_string(sock, "widget_del K heartbeat\n");
sock_send_string(sock, "widget_add K d0 num\n");
sock_send_string(sock, "widget_add K d1 num\n");
+2 -2
View File
@@ -85,7 +85,7 @@ int cpu_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add C\n");
sprintf(buffer, "screen_set C name {CPU Use: %s}\n", host);
sprintf(buffer, "screen_set C -name {CPU Use: %s}\n", host);
sock_send_string(sock, buffer);
if(lcd_hgt >= 4)
{
@@ -272,7 +272,7 @@ int cpu_graph_screen(int rep, int display)
{
first = 0;
sock_send_string(sock, "screen_add G\n");
sprintf(buffer, "screen_set G name {CPU Graph: %s}\n", host);
sprintf(buffer, "screen_set G -name {CPU Graph: %s}\n", host);
sock_send_string(sock, buffer);
if(lcd_hgt >= 4)
{
+2 -1
View File
@@ -27,6 +27,7 @@
#include <sys/statfs.h>
#endif
#include "../../shared/sockets.h"
#include "main.h"
@@ -150,7 +151,7 @@ int disk_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add D\n");
sprintf(buffer, "screen_set D name {Disk Use: %s}\n", host);
sprintf(buffer, "screen_set D -name {Disk Use: %s}\n", host);
sock_send_string(sock, buffer);
sock_send_string(sock, "widget_add D title title\n");
sprintf(buffer, "widget_set D title {DISKS: %s}\n", host);
+1 -1
View File
@@ -62,7 +62,7 @@ int xload_screen(int rep, int display)
memset(loads, 0, sizeof(float)*LCD_MAX_WIDTH);
sock_send_string(sock, "screen_add X\n");
sprintf(buffer, "screen_set X name {X-Load: %s}\n", host);
sprintf(buffer, "screen_set X -name {X-Load: %s}\n", host);
sock_send_string(sock, buffer);
// Add the vbars...
for(i=1; i<lcd_wid; i++)
+1
View File
@@ -309,6 +309,7 @@ void main_loop(mode *sequence)
else if(0 == strcmp(argv[a], "cellhgt"))
lcd_cellhgt = atoi(argv[++a]);
}
sock_send_string(sock, "client_set -name LCDproc\n");
}
else if(0 == strcmp(argv[0], "bye"))
{
+2 -2
View File
@@ -73,7 +73,7 @@ int mem_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add M\n");
sprintf(buffer, "screen_set M name {Memory & Swap: %s}\n", host);
sprintf(buffer, "screen_set M -name {Memory & Swap: %s}\n", host);
sock_send_string(sock, buffer);
if(lcd_hgt >= 4)
@@ -289,7 +289,7 @@ int mem_top_screen(int rep, int display)
first = 0;
sock_send_string(sock, "screen_add S\n");
sprintf(buffer, "screen_set S name {Top Memory Use: %s}\n", host);
sprintf(buffer, "screen_set S -name {Top Memory Use: %s}\n", host);
sock_send_string(sock, buffer);
sock_send_string(sock, "widget_add S title title\n");
sprintf(buffer, "widget_set S title {TOP MEM: %s}\n", host);
+1 -1
View File
@@ -249,7 +249,7 @@ int credit_screen(int rep, int display)
sock_send_string(sock, "screen_add A\n");
sock_send_string(sock,
"screen_set A name {Credits for LCDproc}\n");
"screen_set A -name {Credits for LCDproc}\n");
sock_send_string(sock, "widget_add A title title\n");
sprintf(tmp, "widget_set A title {LCDPROC %s}\n", version);
sock_send_string(sock, tmp);
+3
View File
@@ -80,6 +80,9 @@ AC_ARG_WITH(lcdport,
)
AC_DEFINE_UNQUOTED(LCDPORT, $LCDPORT)
AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "0.2")
AC_ARG_WITH(loadmax,
[ --with-loadmax=<load> Max Load Avg at which the backlight will]
[ start blinking [1.3]],
+20 -14
View File
@@ -1,4 +1,4 @@
LCDproc client/server protocol
LCDproc client/server protocol, V0.2
---------------------------------------------
@@ -98,19 +98,9 @@ hello
in return... (a "connect" string)
client_set [name #id]
client_set [-name #id]
Set client's name and other info
client_add_key #id
Tells the server the client can handle keypresses of type #id.
#id is probably just "A", "B", and so on...
All keypresses are disabled by default, so you'll have to tell
the server which ones you want to accept...
client_del_key #id
Tells the server to never send that keypress.
All keypresses are disabled by default.
screen_add #id
Add a new screen
@@ -118,9 +108,14 @@ screen_add #id
screen_del #id
Remove a screen
screen_set #id [priority integer] [name "my_name"] [duration integer]
[wid width] [hgt height]
screen_set #id [-priority integer] [-name "my_name"] [-duration integer]
[-wid width] [-hgt height] [-heartbeat type]
Initialize a screen, or reset its data.
Heartbeat types can be:
on, heart "Heart" icon
normal, default User's choice
off, none None
slash Rotating slash
Priority values are as follows:
0 You feel like getting kicked off the server, don't you?
1 The world is about to explode
@@ -238,6 +233,17 @@ The functions below are planned but not completed.
client->server functions
-------------------------
client_add_key #id
Tells the server the client can handle keypresses of type #id.
#id is probably just "A", "B", and so on...
All keypresses are disabled by default, so you'll have to tell
the server which ones you want to accept...
client_del_key #id
Tells the server to never send that keypress.
All keypresses are disabled by default.
menu_add #id
Add a new menu.
+43 -13
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -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");
+1
View File
@@ -11,6 +11,7 @@
*/
extern char *version;
extern char *protocol_version;
extern char *build_date;
void exit_program(int val);
+6 -1
View File
@@ -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();