source: titan/plugins/tiwakeup/tiwakeup.h @ 20616

Last change on this file since 20616 was 20616, checked in by nit, 10 years ago

[titan] add tiwakeup plugin

File size: 2.7 KB
Line 
1/*****************************************************/
2/* this file is part of the tiTan / tiTanNIT Project */
3/* and allowed only for use with this.               */
4/*                                                   */
5/* copyright by NIT                                  */
6/*****************************************************/
7
8#ifndef TIWAKEUP_H
9#define TIWAKEUP_H
10
11void screentiwakeup()
12{
13        int rcret = -1, ret = 0;
14        struct skin* tiwakeup = getscreen("tiwakeup");
15        struct skin* listbox = getscreennode(tiwakeup, "listbox");
16        struct skin* tiwakeup1 = getscreennode(tiwakeup, "tiwakeup1");
17        struct skin* tiwakeup2 = getscreennode(tiwakeup, "tiwakeup2");
18        struct skin* tiwakeup3 = getscreennode(tiwakeup, "tiwakeup3");
19        struct skin* tiwakeup4 = getscreennode(tiwakeup, "tiwakeup4");
20        struct skin* tiwakeup5 = getscreennode(tiwakeup, "tiwakeup5");
21        struct skin* tmp = NULL;
22        char* tmpstr = NULL;
23
24        changemask(tiwakeup1, "000.000.000.000");
25        changeinput(tiwakeup1, getconfig("tiwakeup1", NULL));
26        changemask(tiwakeup2, "000.000.000.000");
27        changeinput(tiwakeup2, getconfig("tiwakeup2", NULL));
28        changemask(tiwakeup3, "000.000.000.000");
29        changeinput(tiwakeup3, getconfig("tiwakeup3", NULL));
30        changemask(tiwakeup4, "000.000.000.000");
31        changeinput(tiwakeup4, getconfig("tiwakeup4", NULL));
32        changemask(tiwakeup5, "000.000.000.000");
33        changeinput(tiwakeup5, getconfig("tiwakeup5", NULL));
34
35        drawscreen(tiwakeup, 0, 0);
36        addscreenrc(tiwakeup, listbox);
37
38        tmp = listbox->select;
39        while(1)
40        {
41                addscreenrc(tiwakeup, tmp);
42                rcret = waitrc(tiwakeup, 0, 0);
43                tmp = listbox->select;
44
45                if(rcret == getrcconfigint("rcexit", NULL)) break;
46
47                if(rcret == getrcconfigint("rcok", NULL))
48                {
49                        addconfigscreencheck("tiwakeup1", tiwakeup1, "000.000.000.000");
50                        addconfigscreencheck("tiwakeup2", tiwakeup2, "000.000.000.000");
51                        addconfigscreencheck("tiwakeup3", tiwakeup3, "000.000.000.000");
52                        addconfigscreencheck("tiwakeup4", tiwakeup4, "000.000.000.000");
53                        addconfigscreencheck("tiwakeup5", tiwakeup5, "000.000.000.000");
54       
55                        if(listbox->select != NULL && listbox->select->ret != NULL)
56                        {
57                                tmpstr = fixip(listbox->select->ret, 1);
58                                tmpstr = ostrcat("ether-wake.sh ", tmpstr, 0, 1);
59                                ret = WEXITSTATUS(system(tmpstr));
60                                free(tmpstr); tmpstr = NULL;
61
62                                if(ret == 0)
63                                        textbox(_("Message"), "Send wakeup ok!", _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
64                                else
65                                        textbox(_("Message"), "Send wakeup not ok!", _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
66                        }
67
68                        drawscreen(tiwakeup, 0, 0);
69                        continue;
70                }
71        }
72
73        delownerrc(tiwakeup);
74        clearscreen(tiwakeup);
75}
76
77#endif
Note: See TracBrowser for help on using the repository browser.