source: titan/plugins/instar/instar.h @ 41002

Last change on this file since 41002 was 41002, checked in by gost, 7 years ago

[pligins] ip-kamera... add moving camera-head for typ 2

  • Property svn:executable set to *
File size: 29.5 KB
Line 
1//#ifndef INSTAR_H
2//#define INSTAR_H
3
4char* cam1 = NULL;
5char* cam2 = NULL;
6char* cam11 = NULL;
7char* cam21 = NULL;
8
9char* cam3 = NULL;
10char* cam4 = NULL;
11char* cam31 = NULL;
12char* cam41 = NULL;
13
14struct skin* instar_screen = NULL;
15struct skin* instar_pic1 = NULL;
16struct skin* instar_actcam1 = NULL;
17int actcam = 1;
18
19struct clist *myconfig[LISTHASHSIZE] = {NULL};
20char* instarconf = NULL;
21
22int show_control()
23{
24        char* tmpstr = NULL;
25        char* tempcam = NULL;
26        char* position = NULL;
27        char* positionstop = NULL;
28        int rcret = 0;
29        int rcode = 0;
30        int ohnestop = 0;
31       
32        if(actcam == 1)
33                tempcam = cam1;
34        if(actcam == 2)
35                tempcam = cam2;
36       
37        setfbtransparent(255);
38       
39        printf("[ip-cam] Aufruf1: %s\n", cam1);
40        printf("[ip-cam] Aufruf2: %s\n", cam2);
41       
42        while(1)
43        {
44                        if(cam1 != NULL)
45                        {
46                                if(getconfigint("instar_1", NULL) == 1)
47                                        tmpstr = ostrcat(cam1, "/image/jpeg.cgi", 0, 0);
48                                else if(getconfigint("instar_1", NULL) == 2)
49                                        tmpstr = ostrcat(cam1, "/tmpfs/auto.jpg", 0, 0);
50                                else if(getconfigint("instar_1", NULL) == 3)
51                                        tmpstr = ostrcat(cam1, "/onvif/GetSnapshotUri", 0, 0);
52                                else if(getconfigint("instar_1", NULL) == 4)
53                                        tmpstr = ostrcat(cam1, "/image", 0, 0);
54                                else if(getconfigint("instar_1", NULL) == 5)
55                                {
56                                        tmpstr = ostrcat(cam1, "/cgi-bin/CGIProxy.fcgi?cmd%3DsnapPicture2", 0, 0);
57                                        tmpstr = ostrcat(tmpstr, cam11, 1, 0);
58                                }
59                                else
60                                        tmpstr = ostrcat(cam1, "/snapshot.cgi", 0, 0);
61                                if(getconfigint("instar_alterwebif", NULL) == 1)
62                                        tmpstr = ostrcat(tmpstr, " > /tmp/instar1.jpg", 1, 0);
63                                system(tmpstr);
64                                printf("-> %s\n", tmpstr);
65                                free(tmpstr); tmpstr = NULL;
66                        }
67                        if(cam2 != NULL)
68                        {
69                                if(getconfigint("instar_2", NULL) == 1)
70                                        tmpstr = ostrcat(cam2, "/image/jpeg.cgi", 0, 0);
71                                else if(getconfigint("instar_2", NULL) == 2)
72                                        tmpstr = ostrcat(cam2, "/tmpfs/auto.jpg", 0, 0);
73                                else if(getconfigint("instar_2", NULL) == 3)
74                                        tmpstr = ostrcat(cam2, "/onvif/GetSnapshotUri", 0, 0);
75                                else if(getconfigint("instar_2", NULL) == 4)
76                                        tmpstr = ostrcat(cam2, "/image", 0, 0);
77                                else if(getconfigint("instar_2", NULL) == 5)
78                                {
79                                        tmpstr = ostrcat(cam2, "/cgi-bin/CGIProxy.fcgi?cmd%3DsnapPicture2", 0, 0);
80                                        tmpstr = ostrcat(tmpstr, cam21, 1, 0);
81                                }
82                                else
83                                        tmpstr = ostrcat(cam2, "/snapshot.cgi", 0, 0);
84                                if(getconfigint("instar_alterwebif", NULL) == 1)
85                                        tmpstr = ostrcat(tmpstr, " > /tmp/instar2.jpg", 1, 0);
86                                system(tmpstr);
87                                printf("-> %s\n", tmpstr);
88                                free(tmpstr); tmpstr = NULL;
89                        }
90                        if(cam3 != NULL)
91                        {
92                                if(getconfigint("instar_3", NULL) == 1)
93                                        tmpstr = ostrcat(cam3, "/image/jpeg.cgi", 0, 0);
94                                else if(getconfigint("instar_3", NULL) == 2)
95                                        tmpstr = ostrcat(cam3, "/tmpfs/auto.jpg", 0, 0);
96                                else if(getconfigint("instar_3", NULL) == 3)
97                                        tmpstr = ostrcat(cam3, "/onvif/GetSnapshotUri", 0, 0);
98                                else if(getconfigint("instar_3", NULL) == 4)
99                                        tmpstr = ostrcat(cam3, "/image", 0, 0);
100                                else if(getconfigint("instar_3", NULL) == 5)
101                                {
102                                        tmpstr = ostrcat(cam3, "/cgi-bin/CGIProxy.fcgi?cmd%3DsnapPicture2", 0, 0);
103                                        tmpstr = ostrcat(tmpstr, cam31, 1, 0);
104                                }
105                                else
106                                        tmpstr = ostrcat(cam3, "/snapshot.cgi", 0, 0);
107                                if(getconfigint("instar_alterwebif", NULL) == 1)
108                                        tmpstr = ostrcat(tmpstr, " > /tmp/instar3.jpg", 1, 0);
109                                system(tmpstr);
110                                printf("-> %s\n", tmpstr);
111                                free(tmpstr); tmpstr = NULL;
112                        }
113                        if(cam4 != NULL)
114                        {
115                                if(getconfigint("instar_4", NULL) == 1)
116                                        tmpstr = ostrcat(cam4, "/image/jpeg.cgi", 0, 0);
117                                else if(getconfigint("instar_4", NULL) == 2)
118                                        tmpstr = ostrcat(cam4, "/tmpfs/auto.jpg", 0, 0);
119                                else if(getconfigint("instar_4", NULL) == 3)
120                                        tmpstr = ostrcat(cam4, "/onvif/GetSnapshotUri", 0, 0);
121                                else if(getconfigint("instar_4", NULL) == 4)
122                                        tmpstr = ostrcat(cam4, "/image", 0, 0);
123                                else if(getconfigint("instar_4", NULL) == 5)
124                                {
125                                        tmpstr = ostrcat(cam4, "/cgi-bin/CGIProxy.fcgi?cmd%3DsnapPicture2", 0, 0);
126                                        tmpstr = ostrcat(tmpstr, cam41, 1, 0);
127                                }
128                                else
129                                        tmpstr = ostrcat(cam4, "/snapshot.cgi", 0, 0);
130                                if(getconfigint("instar_alterwebif", NULL) == 1)
131                                        tmpstr = ostrcat(tmpstr, " > /tmp/instar4.jpg", 1, 0);
132                                system(tmpstr);
133                                printf("-> %s\n", tmpstr);
134                                free(tmpstr); tmpstr = NULL;
135                        }
136                               
137                drawscreen(instar_screen, 0, 0);
138                rcret = waitrc(instar_screen, 100, 0);
139                ohnestop = 0;
140
141                if(rcret == getrcconfigint("rcexit", NULL)) break;
142               
143                if(rcret == getrcconfigint("rcinfo", NULL))
144                {
145                        //addlist(myconfig, "InstarCamAutostart", "nein");
146                        rcode = 1;
147                        break;
148                }       
149                       
150                if(rcret == getrcconfigint("rc1", NULL)) {
151                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
152                        {
153                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "0", 0 , 0);
154                                ohnestop = 1;                   
155                        }
156                        else
157                        {
158                                position = ostrcat("/decoder_control.cgi?command=", "31", 0 , 0);
159                                ohnestop = 1;
160                        }
161                }
162                if(rcret == getrcconfigint("rc2", NULL)) {
163                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
164                        {
165                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "1", 0 , 0);
166                                ohnestop = 1;                   
167                        }
168                        else
169                        {
170                                position = ostrcat("/decoder_control.cgi?command=", "33", 0 , 0);
171                                ohnestop = 1;
172                        }
173                }
174                if(rcret == getrcconfigint("rc3", NULL)) {
175                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
176                        {
177                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "2", 0 , 0);
178                                ohnestop = 1;                   
179                        }
180                        else
181                        {
182                                position = ostrcat("/decoder_control.cgi?command=", "35", 0 , 0);
183                                ohnestop = 1;
184                        }
185                }
186                if(rcret == getrcconfigint("rc4", NULL)) {
187                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
188                        {
189                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "3", 0 , 0);
190                                ohnestop = 1;                   
191                        }
192                        else
193                        {
194                                position = ostrcat("/decoder_control.cgi?command=", "37", 0 , 0);
195                                ohnestop = 1;
196                        }
197                }
198                if(rcret == getrcconfigint("rc5", NULL)) {
199                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
200                        {
201                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "4", 0 , 0);
202                                ohnestop = 1;                   
203                        }
204                        else
205                        {
206                                position = ostrcat("/decoder_control.cgi?command=", "39", 0 , 0);
207                                ohnestop = 1;
208                        }
209                }
210                if(rcret == getrcconfigint("rc6", NULL)) {
211                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
212                        {
213                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "5", 0 , 0);
214                                ohnestop = 1;                   
215                        }
216                        else
217                        {
218                                position = ostrcat("/decoder_control.cgi?command=", "41", 0 , 0);
219                                ohnestop = 1;
220                        }
221                }
222                if(rcret == getrcconfigint("rc7", NULL)) {
223                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
224                        {
225                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "6", 0 , 0);
226                                ohnestop = 1;                   
227                        }
228                        else
229                        {
230                                position = ostrcat("/decoder_control.cgi?command=", "43", 0 , 0);
231                                ohnestop = 1;
232                        }
233                }
234                if(rcret == getrcconfigint("rc8", NULL)) {
235                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
236                        {
237                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "7", 0 , 0);
238                                ohnestop = 1;                   
239                        }
240                        else
241                        {
242                                position = ostrcat("/decoder_control.cgi?command=", "45", 0 , 0);
243                                ohnestop = 1;
244                        }
245                }
246                if(rcret == getrcconfigint("rc9", NULL)) {
247                        if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
248                        {
249                                position = ostrcat("/cgi-bin/hi3510/preset.cgi?-act=goto&-status=1&-number=", "8", 0 , 0);
250                                ohnestop = 1;                   
251                        }
252                        else
253                        {
254                                position = ostrcat("/decoder_control.cgi?command=", "47", 0 , 0);
255                                ohnestop = 1;
256                        }
257                }
258                if(positionstop == NULL)
259                {
260                        if(rcret == getrcconfigint("rcup", NULL)) {
261                                if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
262                                {
263                                        position = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "up", 0 , 0);
264                                        positionstop = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "stop", 0 , 0);
265                                }
266                                else
267                                {
268                                        position = ostrcat("/decoder_control.cgi?command=", "0", 0 , 0);
269                                        positionstop = ostrcat("/decoder_control.cgi?command=", "1", 0 , 0);
270                                }
271                        }
272                        if(rcret == getrcconfigint("rcdown", NULL)) {
273                                if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
274                                {
275                                        position = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "down", 0 , 0);
276                                        positionstop = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "stop", 0 , 0);
277                                }
278                                else
279                                {
280                                        position = ostrcat("/decoder_control.cgi?command=", "2", 0 , 0);
281                                        positionstop = ostrcat("/decoder_control.cgi?command=", "3", 0 , 0);
282                                }
283                        }
284                        if(rcret == getrcconfigint("rcleft", NULL)) {
285                                if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
286                                {
287                                        position = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "left", 0 , 0);
288                                        positionstop = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "stop", 0 , 0);
289                                }
290                                else
291                                {
292                                        position = ostrcat("/decoder_control.cgi?command=", "4", 0 , 0);
293                                        positionstop = ostrcat("/decoder_control.cgi?command=", "5", 0 , 0);
294                                }
295                        }
296                        if(rcret == getrcconfigint("rcright", NULL)) {
297                                if((actcam == 1 && getconfigint("instar_1", NULL) == 2) || (actcam == 2 && getconfigint("instar_2", NULL) == 2) || (actcam == 3 && getconfigint("instar_3", NULL) == 2)  || (actcam == 4 && getconfigint("instar_4", NULL) == 2))
298                                {
299                                        position = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "right", 0 , 0);
300                                        positionstop = ostrcat("/cgi-bin/hi3510/ptzctrl.cgi?-step=0&-act=", "stop", 0 , 0);
301                                }
302                                else
303                                {
304                                        position = ostrcat("/decoder_control.cgi?command=", "6", 0 , 0);
305                                        positionstop = ostrcat("/decoder_control.cgi?command=", "7", 0 , 0);
306                                }
307                        }
308                        if(rcret == getrcconfigint("rcchup", NULL)) {
309                                position = ostrcat("/decoder_control.cgi?command=", "16", 0 , 0);
310                                positionstop = ostrcat("/decoder_control.cgi?command=", "17", 0 , 0);
311                        }
312                        if(rcret == getrcconfigint("rcchdown", NULL)) {
313                                position = ostrcat("/decoder_control.cgi?command=", "18", 0 , 0);
314                                positionstop = ostrcat("/decoder_control.cgi?command=", "19", 0 , 0);
315                        }
316                }
317               
318                if(tempcam != NULL && rcret != RCTIMEOUT)
319                {
320                        if(positionstop != NULL && ohnestop == 1)
321                        {
322                                tmpstr = ostrcat(tempcam, positionstop, 0, 0);
323                                system(tmpstr);
324                                free(tmpstr); tmpstr = NULL;   
325                                free(positionstop); positionstop = NULL;
326                        }
327                        if(position != NULL)
328                        {
329                                tmpstr = ostrcat(tempcam, position, 0, 0);
330                                system(tmpstr);
331                                free(tmpstr); tmpstr = NULL;   
332                                free(position); position = NULL;
333                        }
334                        else if(positionstop != NULL)
335                        {
336                                tmpstr = ostrcat(tempcam, positionstop, 0, 0);
337                                system(tmpstr);
338                                free(tmpstr); tmpstr = NULL;   
339                                free(positionstop); positionstop = NULL;
340                        }
341                        if(rcret == getrcconfigint("rcred", NULL)) {
342                                if(actcam == 4 && cam1 != NULL)
343                                {
344                                        actcam = 1;
345                                        changepic(instar_pic1, "/tmp/instar1.jpg");
346                                        changetext(instar_actcam1, "CAM1");
347                                        tempcam = cam1;
348                                        addlist(myconfig, "InstarActCam", "1");
349                                }
350                                else if(actcam == 1 && cam2 != NULL)
351                                {
352                                        actcam = 2;
353                                        changepic(instar_pic1, "/tmp/instar2.jpg");
354                                        changetext(instar_actcam1, "CAM2");
355                                        tempcam = cam2;
356                                        addlist(myconfig, "InstarActCam", "2");
357                                }                               
358                                else if(actcam == 2 && cam3 != NULL)
359                                {
360                                        actcam = 3;
361                                        changepic(instar_pic1, "/tmp/instar3.jpg");
362                                        changetext(instar_actcam1, "CAM3");
363                                        tempcam = cam3;
364                                        addlist(myconfig, "InstarActCam", "3");
365                                }
366                                else if(actcam == 3 && cam4 != NULL)
367                                {
368                                        actcam = 4;
369                                        changepic(instar_pic1, "/tmp/instar4.jpg");
370                                        changetext(instar_actcam1, "CAM4");
371                                        tempcam = cam4;
372                                        addlist(myconfig, "InstarActCam", "4");
373                                }
374                                else
375                                {
376                                        actcam = 1;
377                                        changepic(instar_pic1, "/tmp/instar1.jpg");
378                                        changetext(instar_actcam1, "CAM1");
379                                        tempcam = cam1;
380                                        addlist(myconfig, "InstarActCam", "1");
381                                }
382                        }
383                }
384        }
385
386        clearscreen(instar_screen);
387        setosdtransparent(getskinconfigint("osdtransparent", NULL));
388        return rcode;
389}
390
391int instar_settings()
392{
393       
394        int rcret = 0;
395        int rcode = 0;
396       
397        struct skin* instar_einstellungen = getscreen("instar_einstellungen");
398        struct skin* listbox = getscreennode(instar_einstellungen, "listbox");
399        struct skin* alterwebif = getscreennode(instar_einstellungen, "alterwebif");
400        struct skin* autoCam = getscreennode(instar_einstellungen, "autoCam");
401        struct skin* onCam1 = getscreennode(instar_einstellungen, "onCam1");
402        struct skin* typCam1 = getscreennode(instar_einstellungen, "typCam1");
403        struct skin* ipCam1 = getscreennode(instar_einstellungen, "ipCam1");
404        struct skin* portCam1 = getscreennode(instar_einstellungen, "portCam1");
405        struct skin* userCam1 = getscreennode(instar_einstellungen, "userCam1");
406        struct skin* passCam1 = getscreennode(instar_einstellungen, "passCam1");
407        struct skin* onCam2 = getscreennode(instar_einstellungen, "onCam2");
408        struct skin* typCam2 = getscreennode(instar_einstellungen, "typCam2");
409        struct skin* ipCam2 = getscreennode(instar_einstellungen, "ipCam2");
410        struct skin* portCam2 = getscreennode(instar_einstellungen, "portCam2");
411        struct skin* userCam2 = getscreennode(instar_einstellungen, "userCam2");
412        struct skin* passCam2 = getscreennode(instar_einstellungen, "passCam2");
413        struct skin* onCam3 = getscreennode(instar_einstellungen, "onCam3");
414        struct skin* typCam3 = getscreennode(instar_einstellungen, "typCam3");
415        struct skin* ipCam3 = getscreennode(instar_einstellungen, "ipCam3");
416        struct skin* portCam3 = getscreennode(instar_einstellungen, "portCam3");
417        struct skin* userCam3 = getscreennode(instar_einstellungen, "userCam3");
418        struct skin* passCam3 = getscreennode(instar_einstellungen, "passCam3");
419        struct skin* onCam4 = getscreennode(instar_einstellungen, "onCam4");
420        struct skin* typCam4 = getscreennode(instar_einstellungen, "typCam4");
421        struct skin* ipCam4 = getscreennode(instar_einstellungen, "ipCam4");
422        struct skin* portCam4 = getscreennode(instar_einstellungen, "portCam4");
423        struct skin* userCam4 = getscreennode(instar_einstellungen, "userCam4");
424        struct skin* passCam4 = getscreennode(instar_einstellungen, "passCam4");
425       
426        struct skin* tmp = NULL;
427
428  addchoicebox(autoCam, "nein", _("nein"));
429        addchoicebox(autoCam, "ja", _("ja"));
430        setchoiceboxselection(autoCam, getlist(myconfig, "InstarCamAutostart", NULL));
431       
432        addchoicebox(alterwebif, "0", "off");
433        addchoicebox(alterwebif, "1", "on");
434        setchoiceboxselection(alterwebif, getconfig("instar_alterwebif", NULL));
435 
436  addchoicebox(onCam1, "aus", _("aus"));
437        addchoicebox(onCam1, "ein", _("ein"));
438        setchoiceboxselection(onCam1, getlist(myconfig, "InstarCam1", NULL));   
439        addchoicebox(typCam1, "0", "0");
440        addchoicebox(typCam1, "1", "1");
441        addchoicebox(typCam1, "2", "2");
442        addchoicebox(typCam1, "3", "3");
443        addchoicebox(typCam1, "4", "4");
444        addchoicebox(typCam1, "5", "5");
445        setchoiceboxselection(typCam1, getconfig("instar_1", NULL));
446        changemask(ipCam1, "abcdefghijklmnopqrstuvwxyz");
447  changeinput(ipCam1, getlist(myconfig, "InstarCam1IP", NULL));
448  changemask(portCam1, "0000");
449  changeinput(portCam1, getlist(myconfig, "InstarCam1Port", NULL));
450  changemask(userCam1, "abcdefghijklmnopqrstuvwxyz");
451  changeinput(userCam1, getlist(myconfig, "InstarCam1User", NULL));
452  changemask(passCam1, "abcdefghijklmnopqrstuvwxyz");
453  changeinput(passCam1, getlist(myconfig, "InstarCam1Pass", NULL));
454 
455  addchoicebox(onCam2, "aus", _("aus"));
456        addchoicebox(onCam2, "ein", _("ein"));
457        setchoiceboxselection(onCam2, getlist(myconfig, "InstarCam2", NULL));   
458        addchoicebox(typCam2, "0", "0");
459        addchoicebox(typCam2, "1", "1");
460        addchoicebox(typCam2, "2", "2");
461        addchoicebox(typCam2, "3", "3");
462        addchoicebox(typCam2, "4", "4");
463        addchoicebox(typCam2, "5", "5");
464        setchoiceboxselection(typCam2, getconfig("instar_2", NULL));
465        changemask(ipCam2, "abcdefghijklmnopqrstuvwxyz");
466  changeinput(ipCam2, getlist(myconfig, "InstarCam2IP", NULL));
467  changemask(portCam2, "0000");
468  changeinput(portCam2, getlist(myconfig, "InstarCam2Port", NULL));
469  changemask(userCam2, "abcdefghijklmnopqrstuvwxyz");
470  changeinput(userCam2, getlist(myconfig, "InstarCam2User", NULL));
471  changemask(passCam2, "abcdefghijklmnopqrstuvwxyz");
472  changeinput(passCam2, getlist(myconfig, "InstarCam2Pass", NULL));
473 
474  addchoicebox(onCam3, "aus", _("aus"));
475        addchoicebox(onCam3, "ein", _("ein"));
476        setchoiceboxselection(onCam3, getlist(myconfig, "InstarCam3", NULL));   
477        addchoicebox(typCam3, "0", "0");
478        addchoicebox(typCam3, "1", "1");
479        addchoicebox(typCam3, "2", "2");
480        addchoicebox(typCam3, "3", "3");
481        addchoicebox(typCam3, "4", "4");
482        addchoicebox(typCam3, "5", "5");
483        setchoiceboxselection(typCam3, getconfig("instar_3", NULL));
484        changemask(ipCam3, "abcdefghijklmnopqrstuvwxyz");
485  changeinput(ipCam3, getlist(myconfig, "InstarCam3IP", NULL));
486  changemask(portCam3, "0000");
487  changeinput(portCam3, getlist(myconfig, "InstarCam3Port", NULL));
488  changemask(userCam3, "abcdefghijklmnopqrstuvwxyz");
489  changeinput(userCam3, getlist(myconfig, "InstarCam3User", NULL));
490  changemask(passCam3, "abcdefghijklmnopqrstuvwxyz");
491  changeinput(passCam3, getlist(myconfig, "InstarCam3Pass", NULL));
492 
493  addchoicebox(onCam4, "aus", _("aus"));
494        addchoicebox(onCam4, "ein", _("ein"));
495        setchoiceboxselection(onCam4, getlist(myconfig, "InstarCam4", NULL));   
496        addchoicebox(typCam4, "0", "0");
497        addchoicebox(typCam4, "1", "1");
498        addchoicebox(typCam4, "2", "2");
499        addchoicebox(typCam4, "3", "3");
500        addchoicebox(typCam4, "4", "4");
501        addchoicebox(typCam4, "5", "5");
502        setchoiceboxselection(typCam4, getconfig("instar_4", NULL));
503        changemask(ipCam4, "abcdefghijklmnopqrstuvwxyz");
504  changeinput(ipCam4, getlist(myconfig, "InstarCam4IP", NULL));
505  changemask(portCam4, "0000");
506  changeinput(portCam4, getlist(myconfig, "InstarCam4Port", NULL));
507  changemask(userCam4, "abcdefghijklmnopqrstuvwxyz");
508  changeinput(userCam4, getlist(myconfig, "InstarCam4User", NULL));
509  changemask(passCam4, "abcdefghijklmnopqrstuvwxyz");
510  changeinput(passCam4, getlist(myconfig, "InstarCam4Pass", NULL));
511 
512        drawscreen(instar_einstellungen, 0, 0);
513        addscreenrc(instar_einstellungen, listbox);
514        tmp = listbox->select;
515       
516        while(1)
517        {
518                addscreenrc(instar_einstellungen, tmp);
519                rcret = waitrc(instar_einstellungen, 1000, 0);
520                tmp = listbox->select;
521               
522                if(rcret == getrcconfigint("rcexit", NULL)) break;
523                if(rcret == getrcconfigint("rcgreen", NULL) || rcret == getrcconfigint("rcblue", NULL))
524                {
525                        addlist(myconfig, "InstarCamAutostart", autoCam->ret);
526                        addlist(myconfig, "InstarCam1", onCam1->ret);
527                        addlist(myconfig, "InstarCam1IP", ipCam1->ret);
528                        addlist(myconfig, "InstarCam1Port", portCam1->ret);
529                        addlist(myconfig, "InstarCam1User", userCam1->ret);
530                        addlist(myconfig, "InstarCam1Pass", passCam1->ret);
531                        addlist(myconfig, "InstarCam2", onCam2->ret);
532                        addlist(myconfig, "InstarCam2IP", ipCam2->ret);
533                        addlist(myconfig, "InstarCam2Port", portCam2->ret);
534                        addlist(myconfig, "InstarCam2User", userCam2->ret);
535                        addlist(myconfig, "InstarCam2Pass", passCam2->ret);
536                        addlist(myconfig, "InstarCam3", onCam3->ret);
537                        addlist(myconfig, "InstarCam3IP", ipCam3->ret);
538                        addlist(myconfig, "InstarCam3Port", portCam3->ret);
539                        addlist(myconfig, "InstarCam3User", userCam3->ret);
540                        addlist(myconfig, "InstarCam3Pass", passCam3->ret);
541                        addlist(myconfig, "InstarCam4", onCam4->ret);
542                        addlist(myconfig, "InstarCam4IP", ipCam4->ret);
543                        addlist(myconfig, "InstarCam4Port", portCam4->ret);
544                        addlist(myconfig, "InstarCam4User", userCam4->ret);
545                        addlist(myconfig, "InstarCam4Pass", passCam4->ret);
546                        writelist(myconfig, instarconf);
547                        addconfig("instar_1", typCam1->ret);
548                        addconfig("instar_2", typCam2->ret);
549                        addconfig("instar_3", typCam3->ret);
550                        addconfig("instar_4", typCam4->ret);
551                        addconfig("instar_alterwebif", alterwebif->ret);
552                        if(rcret == getrcconfigint("rcblue", NULL))
553                        {
554                                rcode = 1;
555                                break;
556                        }
557                }
558        }
559        delownerrc(instar_einstellungen);
560        clearscreen(instar_einstellungen);
561        return rcode;   
562}
563
564
565
566void instar_main()
567{
568        int rcode = 0;
569        int ext = 0;
570       
571        instarconf = createpluginpath("/instar/instar.conf", 0);
572        readconfig(instarconf, myconfig);
573
574        char* CURL = NULL;
575        CURL = createpluginpath("/instar/curl", 0);
576        if(!file_exist(CURL))
577        {
578                free(CURL); CURL = NULL;
579                CURL = ostrcat("curl", NULL, 0, 0);
580        }
581
582        if(file_exist("/tmp/callcam1"))
583        {
584                ext = 1;
585                system("rm /callcam*");
586        }
587  else if(file_exist("/tmp/callcam2"))
588        {
589                ext = 2;
590                system("rm /callcam*");
591        }
592  else
593        ext = 0;
594 
595  if(ext > 0)
596        rcode = 1;
597  else if(ostrcmp(getlist(myconfig, "InstarCamAutostart", NULL), "ja") == 0)
598                rcode = 1;
599        else
600                rcode = instar_settings();
601       
602        if(rcode == 1)
603        {
604                if(checkbox("ATEMIO5200") == 1)
605                        addconfig("pic_scale", "1");
606                while(1)
607                {
608                        if(ostrcmp(getlist(myconfig, "InstarCam1", NULL), "ein") == 0 || ext == 1)
609                        {
610                                if(getconfigint("instar_1", NULL) != 5)
611                                {
612                                        if(getconfigint("instar_alterwebif", NULL) == 0)
613                                                cam1 = ostrcat("wget --output-document=/tmp/instar1.jpg http://", getlist(myconfig, "InstarCam1User", NULL), 0, 0);
614                                        else
615                                        {
616                                                cam1 = ostrcat(CURL, " http://", 0, 0);
617                                                cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1User", NULL), 1, 0);
618                                        }
619                                        cam1 = ostrcat(cam1, ":",1, 0);
620                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1Pass", NULL), 1, 0);
621                                        cam1 = ostrcat(cam1, "@",1, 0);
622                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1IP", NULL), 1, 0);
623                                        cam1 = ostrcat(cam1, ":",1, 0);
624                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1Port", NULL), 1, 0);
625                                }
626                                else
627                                {
628                                        if(getconfigint("instar_alterwebif", NULL) == 0)
629                                                cam1 = ostrcat("wget --output-document=/tmp/instar1.jpg http://", NULL, 0, 0);
630                                        else
631                                        {
632                                                cam1 = ostrcat(CURL, " http://", 0, 0);
633                                        }
634                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1IP", NULL), 1, 0);
635                                        cam1 = ostrcat(cam1, ":",1, 0);
636                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1Port", NULL), 1, 0);
637                                        cam11 = ostrcat("%26usr%3D", getlist(myconfig, "InstarCam1User", NULL), 0, 0);
638                                        cam11 = ostrcat(cam11, "%26pwd%3D", 1, 0);
639                                        cam11 = ostrcat(cam11, getlist(myconfig, "InstarCam1Pass", NULL), 1, 0);
640                                        //cam11 = ostrcat(cam11, "&", 1, 0);
641                                       
642                                }
643                        }
644                       
645               
646                       
647                        if(ostrcmp(getlist(myconfig, "InstarCam2", NULL), "ein") == 0 || ext == 2)
648                        {
649                                if(getconfigint("instar_2", NULL) != 5)
650                                {                               
651                                        if(getconfigint("instar_alterwebif", NULL) == 0)
652                                                cam2 = ostrcat("wget --output-document=/tmp/instar2.jpg http://", getlist(myconfig, "InstarCam2User", NULL), 0, 0);
653                                        else
654                                        {
655                                                cam2 = ostrcat(CURL, " http://", 0, 0);
656                                                cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2User", NULL), 1, 0);
657                                        }
658                                        cam2 = ostrcat(cam2, ":",1, 0);
659                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2Pass", NULL), 1, 0);
660                                        cam2 = ostrcat(cam2, "@",1, 0);
661                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2IP", NULL), 1, 0);
662                                        cam2 = ostrcat(cam2, ":",1, 0);
663                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2Port", NULL), 1, 0);
664                                }
665                                else
666                                {
667                                        if(getconfigint("instar_alterwebif", NULL) == 0)
668                                                cam2 = ostrcat("wget --output-document=/tmp/instar2.jpg http://", NULL, 0, 0);
669                                        else
670                                        {
671                                                cam2 = ostrcat(CURL, " http://", 0, 0);
672                                        }
673                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2IP", NULL), 1, 0);
674                                        cam2 = ostrcat(cam2, ":",1, 0);
675                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2Port", NULL), 1, 0);
676                                        cam21 = ostrcat("%26usr%3D", getlist(myconfig, "InstarCam2User", NULL), 0, 0);
677                                        cam21 = ostrcat(cam21, "%26pwd%3D", 1, 0);
678                                        cam21 = ostrcat(cam21, getlist(myconfig, "InstarCam2Pass", NULL), 1, 0);
679                                        //cam21 = ostrcat(cam21, "&", 1, 0);
680                                }                               
681                        }
682                       
683                        if(ostrcmp(getlist(myconfig, "InstarCam3", NULL), "ein") == 0)
684                        {
685                                if(getconfigint("instar_3", NULL) != 5)
686                                {                               
687                                        if(getconfigint("instar_alterwebif", NULL) == 0)
688                                                cam3 = ostrcat("wget --output-document=/tmp/instar3.jpg http://", getlist(myconfig, "Instarcam3User", NULL), 0, 0);
689                                        else
690                                        {
691                                                cam3 = ostrcat(CURL, " http://", 0, 0);
692                                                cam3 = ostrcat(cam3, getlist(myconfig, "InstarCam3User", NULL), 1, 0);
693                                        }
694                                        cam3 = ostrcat(cam3, ":",1, 0);
695                                        cam3 = ostrcat(cam3, getlist(myconfig, "InstarCam3Pass", NULL), 1, 0);
696                                        cam3 = ostrcat(cam3, "@",1, 0);
697                                        cam3 = ostrcat(cam3, getlist(myconfig, "InstarCam3IP", NULL), 1, 0);
698                                        cam3 = ostrcat(cam3, ":",1, 0);
699                                        cam3 = ostrcat(cam3, getlist(myconfig, "InstarCam3Port", NULL), 1, 0);
700                                }
701                                else
702                                {
703                                        if(getconfigint("instar_alterwebif", NULL) == 0)
704                                                cam3 = ostrcat("wget --output-document=/tmp/instar3.jpg http://", NULL, 0, 0);
705                                        else
706                                        {
707                                                cam3 = ostrcat(CURL, " http://", 0, 0);
708                                        }
709                                        cam3 = ostrcat(cam3, getlist(myconfig, "InstarCam3IP", NULL), 1, 0);
710                                        cam3 = ostrcat(cam3, ":",1, 0);
711                                        cam3 = ostrcat(cam3, getlist(myconfig, "InstarCam3Port", NULL), 1, 0);
712                                        cam31 = ostrcat("%26usr%3D", getlist(myconfig, "InstarCam3User", NULL), 0, 0);
713                                        cam31 = ostrcat(cam31, "%26pwd%3D", 1, 0);
714                                        cam31 = ostrcat(cam31, getlist(myconfig, "InstarCam3Pass", NULL), 1, 0);
715                                        //cam31 = ostrcat(cam31, "&", 1, 0);
716                                }                               
717                        }
718                       
719                        if(ostrcmp(getlist(myconfig, "InstarCam4", NULL), "ein") == 0)
720                        {
721                                if(getconfigint("instar_4", NULL) != 5)
722                                {                               
723                                        if(getconfigint("instar_alterwebif", NULL) == 0)
724                                                cam4 = ostrcat("wget --output-document=/tmp/instar4.jpg http://", getlist(myconfig, "InstarCam3User", NULL), 0, 0);
725                                        else
726                                        {
727                                                cam4 = ostrcat(CURL, " http://", 0, 0);
728                                                cam4 = ostrcat(cam4, getlist(myconfig, "InstarCam4User", NULL), 1, 0);
729                                        }
730                                        cam4 = ostrcat(cam4, ":",1, 0);
731                                        cam4 = ostrcat(cam4, getlist(myconfig, "InstarCam4Pass", NULL), 1, 0);
732                                        cam4 = ostrcat(cam4, "@",1, 0);
733                                        cam4 = ostrcat(cam4, getlist(myconfig, "InstarCam4IP", NULL), 1, 0);
734                                        cam4 = ostrcat(cam4, ":",1, 0);
735                                        cam4 = ostrcat(cam4, getlist(myconfig, "InstarCam4Port", NULL), 1, 0);
736                                }
737                                else
738                                {
739                                        if(getconfigint("instar_alterwebif", NULL) == 0)
740                                                cam4 = ostrcat("wget --output-document=/tmp/instar4.jpg http://", NULL, 0, 0);
741                                        else
742                                        {
743                                                cam4 = ostrcat(CURL, " http://", 0, 0);
744                                        }
745                                        cam4 = ostrcat(cam4, getlist(myconfig, "InstarCam4IP", NULL), 1, 0);
746                                        cam4 = ostrcat(cam4, ":",1, 0);
747                                        cam4 = ostrcat(cam4, getlist(myconfig, "InstarCam4Port", NULL), 1, 0);
748                                        cam41 = ostrcat("%26usr%3D", getlist(myconfig, "InstarCam4User", NULL), 0, 0);
749                                        cam41 = ostrcat(cam41, "%26pwd%3D", 1, 0);
750                                        cam41 = ostrcat(cam41, getlist(myconfig, "InstarCam4Pass", NULL), 1, 0);
751                                        //cam41 = ostrcat(cam41, "&", 1, 0);
752                                }                               
753                        }                                               
754                                       
755                        instar_screen = getscreen("instar_full");
756                        instar_pic1 = getscreennode(instar_screen, "pic1");
757                        instar_actcam1 = getscreennode(instar_screen, "actcam1");
758       
759                       
760                        if(ext == 1 || ostrcmp(getlist(myconfig, "InstarActCam", NULL), "1") == 0)
761                        {
762                                actcam = 1;
763                                changepic(instar_pic1, "/tmp/instar1.jpg");
764                                changetext(instar_actcam1, "CAM1");
765                        }               
766                        else if(ext == 2 || ostrcmp(getlist(myconfig, "InstarActCam", NULL), "2") == 0)
767                        {
768                                actcam = 2;
769                                changepic(instar_pic1, "/tmp/instar2.jpg");
770                                changetext(instar_actcam1, "CAM2");
771                        }
772                        else if(ostrcmp(getlist(myconfig, "InstarActCam", NULL), "3") == 0)
773                        {
774                                actcam = 3;
775                                changepic(instar_pic1, "/tmp/instar3.jpg");
776                                changetext(instar_actcam1, "CAM3");
777                        }
778                        else if(ostrcmp(getlist(myconfig, "InstarActCam", NULL), "4") == 0)
779                        {
780                                actcam = 4;
781                                changepic(instar_pic1, "/tmp/instar4.jpg");
782                                changetext(instar_actcam1, "CAM4");
783                        }
784                        else
785                        {
786                                actcam = 1;
787                                changepic(instar_pic1, "/tmp/instar1.jpg");
788                                changetext(instar_actcam1, "CAM1");
789                        }
790                       
791                        rcode = show_control();
792       
793                        free(cam1), cam1 = NULL;
794                        free(cam2), cam2 = NULL;
795                        free(cam11), cam11 = NULL;
796                        free(cam21), cam21 = NULL;
797                        free(cam3), cam3 = NULL;
798                        free(cam4), cam4 = NULL;
799                        free(cam31), cam31 = NULL;
800                        free(cam41), cam41 = NULL;
801                       
802                        if(rcode == 0)
803                                break;
804                        rcode = 0;
805                       
806                        rcode = instar_settings();
807                        if(rcode == 0)
808                                break;
809                }
810                if(checkbox("ATEMIO5200") == 1)
811                        addconfig("pic_scale", "0");
812        }
813        writelist(myconfig, instarconf);
814        freelist(myconfig);
815        free(instarconf); instarconf = NULL;
816        free(CURL); CURL = NULL;
817}
Note: See TracBrowser for help on using the repository browser.