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

Last change on this file since 43368 was 20620, checked in by nit, 11 years ago

[titan] activate tiwakeup plugin

File size: 2.8 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* load = getscreen("loading");
22        struct skin* tmp = NULL;
23        char* tmpstr = NULL;
24
25        changemask(tiwakeup1, "000.000.000.000");
26        changeinput(tiwakeup1, getconfig("tiwakeup1", NULL));
27        changemask(tiwakeup2, "000.000.000.000");
28        changeinput(tiwakeup2, getconfig("tiwakeup2", NULL));
29        changemask(tiwakeup3, "000.000.000.000");
30        changeinput(tiwakeup3, getconfig("tiwakeup3", NULL));
31        changemask(tiwakeup4, "000.000.000.000");
32        changeinput(tiwakeup4, getconfig("tiwakeup4", NULL));
33        changemask(tiwakeup5, "000.000.000.000");
34        changeinput(tiwakeup5, getconfig("tiwakeup5", NULL));
35
36        drawscreen(tiwakeup, 0, 0);
37        addscreenrc(tiwakeup, listbox);
38
39        tmp = listbox->select;
40        while(1)
41        {
42                addscreenrc(tiwakeup, tmp);
43                rcret = waitrc(tiwakeup, 0, 0);
44                tmp = listbox->select;
45
46                if(rcret == getrcconfigint("rcexit", NULL)) break;
47
48                if(rcret == getrcconfigint("rcok", NULL))
49                {
50                        addconfigscreencheck("tiwakeup1", tiwakeup1, "000.000.000.000");
51                        addconfigscreencheck("tiwakeup2", tiwakeup2, "000.000.000.000");
52                        addconfigscreencheck("tiwakeup3", tiwakeup3, "000.000.000.000");
53                        addconfigscreencheck("tiwakeup4", tiwakeup4, "000.000.000.000");
54                        addconfigscreencheck("tiwakeup5", tiwakeup5, "000.000.000.000");
55       
56                        if(listbox->select != NULL && listbox->select->ret != NULL)
57                        {
58                                drawscreen(load, 0, 0);
59                                tmpstr = fixip(listbox->select->ret, 1);
60                                tmpstr = ostrcat("ether-wake.sh ", tmpstr, 0, 1);
61                                ret = WEXITSTATUS(system(tmpstr));
62                                free(tmpstr); tmpstr = NULL;
63                                clearscreen(load);
64
65                                if(ret == 0)
66                                        textbox(_("Message"), "Send wakeup ok!", _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
67                                else
68                                        textbox(_("Message"), "Send wakeup not ok!", _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
69                        }
70
71                        drawscreen(tiwakeup, 0, 0);
72                        continue;
73                }
74        }
75
76        delownerrc(tiwakeup);
77        clearscreen(tiwakeup);
78}
79
80#endif
Note: See TracBrowser for help on using the repository browser.