2
This file is part of g15daemon.
4
g15daemon is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
g15daemon is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with g15daemon; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
(c) 2006 Mike Lampard, Philip Lawatsch, and others
20
$Revision: 129 $ - $Date: 2006-11-13 03:02:49 +0100 (Mon, 13 Nov 2006) $ $Author: mlampard $
22
simple template plugin, replace the various functions with your own, and change the g15plugin_info struct below to suit,
23
edit Makefile.am and compile. Add salt and pepper to taste. For a more advanced plugin that creates it's own lcd screens on-the-fly,
24
see the tcpserver plugin in this directory.
32
#include <sys/types.h>
38
#include <g15daemon.h>
41
static int *lcdclock(lcd_t *lcd)
49
time_t currtime = time(NULL);
51
memset(lcd->buf,0,1024);
53
strftime(buf,6,"%H:%M",localtime(&currtime));
61
totalwidth=(len*20)+(15);
65
for (col=0;col<len;col++)
67
draw_bignum (lcd, (80-(totalwidth)/2)+col*20, 1,(80-(totalwidth)/2)+(col+1)*20, LCD_HEIGHT, BLACK, buf[col]);
70
lcd->ident = currtime+100;
75
static int myeventhandler(plugin_event_t *myevent) {
76
// lcd_t *lcd = (lcd_t*) myevent->lcd;
78
switch (myevent->event)
80
case G15_EVENT_KEYPRESS:
81
printf("template plugin received keypress event : %i\n",myevent->value);
83
case G15_EVENT_VISIBILITY_CHANGED:
84
printf("template received new visibility status (%i)\n",myevent->value);
92
/* completely uncessary function called when plugin is exiting */
93
static void *callmewhenimdone(lcd_t *lcd){
96
/* completely unnecessary initialisation function which could just as easily have been set to NULL in the g15plugin_info struct */
97
static void *myinithandler(lcd_t *lcd){
100
/* if no exitfunc or eventhandler, member should be NULL */
101
plugin_info_t g15plugin_info[] = {
102
/* TYPE, name, initfunc, updatefreq, exitfunc, eventhandler, initfunc */
103
{G15_PLUGIN_LCD_CLIENT, "template plugin clock", (void*)lcdclock, 500, (void*)callmewhenimdone, (void*)myeventhandler, (void*)myinithandler},
104
{G15_PLUGIN_NONE, "" , NULL, 0, NULL, NULL, NULL}