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

Last change on this file since 40942 was 40942, checked in by gost, 6 years ago

[plugins] ip-kamera... extension up to 4 cameras

  • Property svn:executable set to *
File size: 24.0 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                        position = ostrcat("/decoder_control.cgi?command=", "31", 0 , 0);
152                        ohnestop = 1;
153                }
154                if(rcret == getrcconfigint("rc2", NULL)) {
155                        position = ostrcat("/decoder_control.cgi?command=", "33", 0 , 0);
156                        ohnestop = 1;
157                }
158                if(rcret == getrcconfigint("rc3", NULL)) {
159                        position = ostrcat("/decoder_control.cgi?command=", "35", 0 , 0);
160                        ohnestop = 1;
161                }
162                if(rcret == getrcconfigint("rc4", NULL)) {
163                        position = ostrcat("/decoder_control.cgi?command=", "37", 0 , 0);
164                        ohnestop = 1;
165                }
166                if(rcret == getrcconfigint("rc5", NULL)) {
167                        position = ostrcat("/decoder_control.cgi?command=", "39", 0 , 0);
168                        ohnestop = 1;
169                }
170                if(rcret == getrcconfigint("rc6", NULL)) {
171                        position = ostrcat("/decoder_control.cgi?command=", "41", 0 , 0);
172                        ohnestop = 1;
173                }
174                if(rcret == getrcconfigint("rc7", NULL)) {
175                        position = ostrcat("/decoder_control.cgi?command=", "43", 0 , 0);
176                        ohnestop = 1;
177                }
178                if(rcret == getrcconfigint("rc8", NULL)) {
179                        position = ostrcat("/decoder_control.cgi?command=", "45", 0 , 0);
180                        ohnestop = 1;
181                }
182                if(rcret == getrcconfigint("rc9", NULL)) {
183                        position = ostrcat("/decoder_control.cgi?command=", "47", 0 , 0);
184                        ohnestop = 1;
185                }
186                if(positionstop == NULL)
187                {
188                        if(rcret == getrcconfigint("rcup", NULL)) {
189                                position = ostrcat("/decoder_control.cgi?command=", "0", 0 , 0);
190                                positionstop = ostrcat("/decoder_control.cgi?command=", "1", 0 , 0);
191                        }
192                        if(rcret == getrcconfigint("rcdown", NULL)) {
193                                position = ostrcat("/decoder_control.cgi?command=", "2", 0 , 0);
194                                positionstop = ostrcat("/decoder_control.cgi?command=", "3", 0 , 0);
195                        }
196                        if(rcret == getrcconfigint("rcleft", NULL)) {
197                                position = ostrcat("/decoder_control.cgi?command=", "4", 0 , 0);
198                                positionstop = ostrcat("/decoder_control.cgi?command=", "5", 0 , 0);
199                        }
200                        if(rcret == getrcconfigint("rcright", NULL)) {
201                                position = ostrcat("/decoder_control.cgi?command=", "6", 0 , 0);
202                                positionstop = ostrcat("/decoder_control.cgi?command=", "7", 0 , 0);
203                        }
204                        if(rcret == getrcconfigint("rcchup", NULL)) {
205                                position = ostrcat("/decoder_control.cgi?command=", "16", 0 , 0);
206                                positionstop = ostrcat("/decoder_control.cgi?command=", "17", 0 , 0);
207                        }
208                        if(rcret == getrcconfigint("rcchdown", NULL)) {
209                                position = ostrcat("/decoder_control.cgi?command=", "18", 0 , 0);
210                                positionstop = ostrcat("/decoder_control.cgi?command=", "19", 0 , 0);
211                        }
212                }
213               
214                if(tempcam != NULL && rcret != RCTIMEOUT)
215                {
216                        if(positionstop != NULL && ohnestop == 1)
217                        {
218                                tmpstr = ostrcat(tempcam, positionstop, 0, 0);
219                                system(tmpstr);
220                                free(tmpstr); tmpstr = NULL;   
221                                free(positionstop); positionstop = NULL;
222                        }
223                        if(position != NULL)
224                        {
225                                tmpstr = ostrcat(tempcam, position, 0, 0);
226                                system(tmpstr);
227                                free(tmpstr); tmpstr = NULL;   
228                                free(position); position = NULL;
229                        }
230                        else if(positionstop != NULL)
231                        {
232                                tmpstr = ostrcat(tempcam, positionstop, 0, 0);
233                                system(tmpstr);
234                                free(tmpstr); tmpstr = NULL;   
235                                free(positionstop); positionstop = NULL;
236                        }
237                        if(rcret == getrcconfigint("rcred", NULL)) {
238                                if(actcam == 4 && cam1 != NULL)
239                                {
240                                        actcam = 1;
241                                        changepic(instar_pic1, "/tmp/instar1.jpg");
242                                        changetext(instar_actcam1, "CAM1");
243                                        tempcam = cam1;
244                                        addlist(myconfig, "InstarActCam", "1");
245                                }
246                                else if(actcam == 1 && cam2 != NULL)
247                                {
248                                        actcam = 2;
249                                        changepic(instar_pic1, "/tmp/instar2.jpg");
250                                        changetext(instar_actcam1, "CAM2");
251                                        tempcam = cam2;
252                                        addlist(myconfig, "InstarActCam", "2");
253                                }                               
254                                else if(actcam == 2 && cam3 != NULL)
255                                {
256                                        actcam = 3;
257                                        changepic(instar_pic1, "/tmp/instar3.jpg");
258                                        changetext(instar_actcam1, "CAM3");
259                                        tempcam = cam3;
260                                        addlist(myconfig, "InstarActCam", "3");
261                                }
262                                else if(actcam == 3 && cam4 != NULL)
263                                {
264                                        actcam = 4;
265                                        changepic(instar_pic1, "/tmp/instar4.jpg");
266                                        changetext(instar_actcam1, "CAM4");
267                                        tempcam = cam4;
268                                        addlist(myconfig, "InstarActCam", "4");
269                                }
270                        }
271                }
272        }
273
274        clearscreen(instar_screen);
275        setosdtransparent(getskinconfigint("osdtransparent", NULL));
276        return rcode;
277}
278
279int instar_settings()
280{
281       
282        int rcret = 0;
283        int rcode = 0;
284       
285        struct skin* instar_einstellungen = getscreen("instar_einstellungen");
286        struct skin* listbox = getscreennode(instar_einstellungen, "listbox");
287        struct skin* alterwebif = getscreennode(instar_einstellungen, "alterwebif");
288        struct skin* autoCam = getscreennode(instar_einstellungen, "autoCam");
289        struct skin* onCam1 = getscreennode(instar_einstellungen, "onCam1");
290        struct skin* typCam1 = getscreennode(instar_einstellungen, "typCam1");
291        struct skin* ipCam1 = getscreennode(instar_einstellungen, "ipCam1");
292        struct skin* portCam1 = getscreennode(instar_einstellungen, "portCam1");
293        struct skin* userCam1 = getscreennode(instar_einstellungen, "userCam1");
294        struct skin* passCam1 = getscreennode(instar_einstellungen, "passCam1");
295        struct skin* onCam2 = getscreennode(instar_einstellungen, "onCam2");
296        struct skin* typCam2 = getscreennode(instar_einstellungen, "typCam2");
297        struct skin* ipCam2 = getscreennode(instar_einstellungen, "ipCam2");
298        struct skin* portCam2 = getscreennode(instar_einstellungen, "portCam2");
299        struct skin* userCam2 = getscreennode(instar_einstellungen, "userCam2");
300        struct skin* passCam2 = getscreennode(instar_einstellungen, "passCam2");
301        struct skin* onCam3 = getscreennode(instar_einstellungen, "onCam3");
302        struct skin* typCam3 = getscreennode(instar_einstellungen, "typCam3");
303        struct skin* ipCam3 = getscreennode(instar_einstellungen, "ipCam3");
304        struct skin* portCam3 = getscreennode(instar_einstellungen, "portCam3");
305        struct skin* userCam3 = getscreennode(instar_einstellungen, "userCam3");
306        struct skin* passCam3 = getscreennode(instar_einstellungen, "passCam3");
307        struct skin* onCam4 = getscreennode(instar_einstellungen, "onCam4");
308        struct skin* typCam4 = getscreennode(instar_einstellungen, "typCam4");
309        struct skin* ipCam4 = getscreennode(instar_einstellungen, "ipCam4");
310        struct skin* portCam4 = getscreennode(instar_einstellungen, "portCam4");
311        struct skin* userCam4 = getscreennode(instar_einstellungen, "userCam4");
312        struct skin* passCam4 = getscreennode(instar_einstellungen, "passCam4");
313       
314        struct skin* tmp = NULL;
315
316  addchoicebox(autoCam, "nein", _("nein"));
317        addchoicebox(autoCam, "ja", _("ja"));
318        setchoiceboxselection(autoCam, getlist(myconfig, "InstarCamAutostart", NULL));
319       
320        addchoicebox(alterwebif, "0", "off");
321        addchoicebox(alterwebif, "1", "on");
322        setchoiceboxselection(alterwebif, getconfig("instar_alterwebif", NULL));
323 
324  addchoicebox(onCam1, "aus", _("aus"));
325        addchoicebox(onCam1, "ein", _("ein"));
326        setchoiceboxselection(onCam1, getlist(myconfig, "InstarCam1", NULL));   
327        addchoicebox(typCam1, "0", "0");
328        addchoicebox(typCam1, "1", "1");
329        addchoicebox(typCam1, "2", "2");
330        addchoicebox(typCam1, "3", "3");
331        addchoicebox(typCam1, "4", "4");
332        addchoicebox(typCam1, "5", "5");
333        setchoiceboxselection(typCam1, getconfig("instar_1", NULL));
334        changemask(ipCam1, "abcdefghijklmnopqrstuvwxyz");
335  changeinput(ipCam1, getlist(myconfig, "InstarCam1IP", NULL));
336  changemask(portCam1, "0000");
337  changeinput(portCam1, getlist(myconfig, "InstarCam1Port", NULL));
338  changemask(userCam1, "abcdefghijklmnopqrstuvwxyz");
339  changeinput(userCam1, getlist(myconfig, "InstarCam1User", NULL));
340  changemask(passCam1, "abcdefghijklmnopqrstuvwxyz");
341  changeinput(passCam1, getlist(myconfig, "InstarCam1Pass", NULL));
342 
343  addchoicebox(onCam2, "aus", _("aus"));
344        addchoicebox(onCam2, "ein", _("ein"));
345        setchoiceboxselection(onCam2, getlist(myconfig, "InstarCam2", NULL));   
346        addchoicebox(typCam2, "0", "0");
347        addchoicebox(typCam2, "1", "1");
348        addchoicebox(typCam2, "2", "2");
349        addchoicebox(typCam2, "3", "3");
350        addchoicebox(typCam2, "4", "4");
351        addchoicebox(typCam2, "5", "5");
352        setchoiceboxselection(typCam2, getconfig("instar_2", NULL));
353        changemask(ipCam2, "abcdefghijklmnopqrstuvwxyz");
354  changeinput(ipCam2, getlist(myconfig, "InstarCam2IP", NULL));
355  changemask(portCam2, "0000");
356  changeinput(portCam2, getlist(myconfig, "InstarCam2Port", NULL));
357  changemask(userCam2, "abcdefghijklmnopqrstuvwxyz");
358  changeinput(userCam2, getlist(myconfig, "InstarCam2User", NULL));
359  changemask(passCam2, "abcdefghijklmnopqrstuvwxyz");
360  changeinput(passCam2, getlist(myconfig, "InstarCam2Pass", NULL));
361 
362  addchoicebox(onCam3, "aus", _("aus"));
363        addchoicebox(onCam3, "ein", _("ein"));
364        setchoiceboxselection(onCam3, getlist(myconfig, "InstarCam3", NULL));   
365        addchoicebox(typCam3, "0", "0");
366        addchoicebox(typCam3, "1", "1");
367        addchoicebox(typCam3, "2", "2");
368        addchoicebox(typCam3, "3", "3");
369        addchoicebox(typCam3, "4", "4");
370        addchoicebox(typCam3, "5", "5");
371        setchoiceboxselection(typCam3, getconfig("instar_3", NULL));
372        changemask(ipCam3, "abcdefghijklmnopqrstuvwxyz");
373  changeinput(ipCam3, getlist(myconfig, "InstarCam3IP", NULL));
374  changemask(portCam3, "0000");
375  changeinput(portCam3, getlist(myconfig, "InstarCam3Port", NULL));
376  changemask(userCam3, "abcdefghijklmnopqrstuvwxyz");
377  changeinput(userCam3, getlist(myconfig, "InstarCam3User", NULL));
378  changemask(passCam3, "abcdefghijklmnopqrstuvwxyz");
379  changeinput(passCam3, getlist(myconfig, "InstarCam3Pass", NULL));
380 
381  addchoicebox(onCam4, "aus", _("aus"));
382        addchoicebox(onCam4, "ein", _("ein"));
383        setchoiceboxselection(onCam4, getlist(myconfig, "InstarCam4", NULL));   
384        addchoicebox(typCam4, "0", "0");
385        addchoicebox(typCam4, "1", "1");
386        addchoicebox(typCam4, "2", "2");
387        addchoicebox(typCam4, "3", "3");
388        addchoicebox(typCam4, "4", "4");
389        addchoicebox(typCam4, "5", "5");
390        setchoiceboxselection(typCam4, getconfig("instar_4", NULL));
391        changemask(ipCam4, "abcdefghijklmnopqrstuvwxyz");
392  changeinput(ipCam4, getlist(myconfig, "InstarCam4IP", NULL));
393  changemask(portCam4, "0000");
394  changeinput(portCam4, getlist(myconfig, "InstarCam4Port", NULL));
395  changemask(userCam4, "abcdefghijklmnopqrstuvwxyz");
396  changeinput(userCam4, getlist(myconfig, "InstarCam4User", NULL));
397  changemask(passCam4, "abcdefghijklmnopqrstuvwxyz");
398  changeinput(passCam4, getlist(myconfig, "InstarCam4Pass", NULL));
399 
400        drawscreen(instar_einstellungen, 0, 0);
401        addscreenrc(instar_einstellungen, listbox);
402        tmp = listbox->select;
403       
404        while(1)
405        {
406                addscreenrc(instar_einstellungen, tmp);
407                rcret = waitrc(instar_einstellungen, 1000, 0);
408                tmp = listbox->select;
409               
410                if(rcret == getrcconfigint("rcexit", NULL)) break;
411                if(rcret == getrcconfigint("rcgreen", NULL) || rcret == getrcconfigint("rcblue", NULL))
412                {
413                        addlist(myconfig, "InstarCamAutostart", autoCam->ret);
414                        addlist(myconfig, "InstarCam1", onCam1->ret);
415                        addlist(myconfig, "InstarCam1IP", ipCam1->ret);
416                        addlist(myconfig, "InstarCam1Port", portCam1->ret);
417                        addlist(myconfig, "InstarCam1User", userCam1->ret);
418                        addlist(myconfig, "InstarCam1Pass", passCam1->ret);
419                        addlist(myconfig, "InstarCam2", onCam2->ret);
420                        addlist(myconfig, "InstarCam2IP", ipCam2->ret);
421                        addlist(myconfig, "InstarCam2Port", portCam2->ret);
422                        addlist(myconfig, "InstarCam2User", userCam2->ret);
423                        addlist(myconfig, "InstarCam2Pass", passCam2->ret);
424                        addlist(myconfig, "InstarCam3", onCam3->ret);
425                        addlist(myconfig, "InstarCam3IP", ipCam3->ret);
426                        addlist(myconfig, "InstarCam3Port", portCam3->ret);
427                        addlist(myconfig, "InstarCam3User", userCam3->ret);
428                        addlist(myconfig, "InstarCam3Pass", passCam3->ret);
429                        writelist(myconfig, instarconf);
430                        addconfig("instar_1", typCam1->ret);
431                        addconfig("instar_2", typCam2->ret);
432                        addconfig("instar_3", typCam3->ret);
433                        addconfig("instar_4", typCam4->ret);
434                        addconfig("instar_alterwebif", alterwebif->ret);
435                        if(rcret == getrcconfigint("rcblue", NULL))
436                        {
437                                rcode = 1;
438                                break;
439                        }
440                }
441        }
442        delownerrc(instar_einstellungen);
443        clearscreen(instar_einstellungen);
444        return rcode;   
445}
446
447
448
449void instar_main()
450{
451        int rcode = 0;
452        int ext = 0;
453       
454        instarconf = createpluginpath("/instar/instar.conf", 0);
455        readconfig(instarconf, myconfig);
456
457        char* CURL = NULL;
458        CURL = createpluginpath("/instar/curl", 0);
459        if(!file_exist(CURL))
460        {
461                free(CURL); CURL = NULL;
462                CURL = ostrcat("curl", NULL, 0, 0);
463        }
464
465        if(file_exist("/tmp/callcam1"))
466        {
467                ext = 1;
468                system("rm /callcam*");
469        }
470  else if(file_exist("/tmp/callcam2"))
471        {
472                ext = 2;
473                system("rm /callcam*");
474        }
475  else
476        ext = 0;
477 
478  if(ext > 0)
479        rcode = 1;
480  else if(ostrcmp(getlist(myconfig, "InstarCamAutostart", NULL), "ja") == 0)
481                rcode = 1;
482        else
483                rcode = instar_settings();
484       
485        if(rcode == 1)
486        {
487                if(checkbox("ATEMIO5200") == 1)
488                        addconfig("pic_scale", "1");
489                while(1)
490                {
491                        if(ostrcmp(getlist(myconfig, "InstarCam1", NULL), "ein") == 0 || ext == 1)
492                        {
493                                if(getconfigint("instar_1", NULL) != 5)
494                                {
495                                        if(getconfigint("instar_alterwebif", NULL) == 0)
496                                                cam1 = ostrcat("wget --output-document=/tmp/instar1.jpg http://", getlist(myconfig, "InstarCam1User", NULL), 0, 0);
497                                        else
498                                        {
499                                                cam1 = ostrcat(CURL, " http://", 0, 0);
500                                                cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1User", NULL), 1, 0);
501                                        }
502                                        cam1 = ostrcat(cam1, ":",1, 0);
503                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1Pass", NULL), 1, 0);
504                                        cam1 = ostrcat(cam1, "@",1, 0);
505                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1IP", NULL), 1, 0);
506                                        cam1 = ostrcat(cam1, ":",1, 0);
507                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1Port", NULL), 1, 0);
508                                }
509                                else
510                                {
511                                        if(getconfigint("instar_alterwebif", NULL) == 0)
512                                                cam1 = ostrcat("wget --output-document=/tmp/instar1.jpg http://", NULL, 0, 0);
513                                        else
514                                        {
515                                                cam1 = ostrcat(CURL, " http://", 0, 0);
516                                        }
517                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1IP", NULL), 1, 0);
518                                        cam1 = ostrcat(cam1, ":",1, 0);
519                                        cam1 = ostrcat(cam1, getlist(myconfig, "InstarCam1Port", NULL), 1, 0);
520                                        cam11 = ostrcat("%26usr%3D", getlist(myconfig, "InstarCam1User", NULL), 0, 0);
521                                        cam11 = ostrcat(cam11, "%26pwd%3D", 1, 0);
522                                        cam11 = ostrcat(cam11, getlist(myconfig, "InstarCam1Pass", NULL), 1, 0);
523                                        //cam11 = ostrcat(cam11, "&", 1, 0);
524                                       
525                                }
526                        }
527                       
528               
529                       
530                        if(ostrcmp(getlist(myconfig, "InstarCam2", NULL), "ein") == 0 || ext == 2)
531                        {
532                                if(getconfigint("instar_2", NULL) != 5)
533                                {                               
534                                        if(getconfigint("instar_alterwebif", NULL) == 0)
535                                                cam2 = ostrcat("wget --output-document=/tmp/instar2.jpg http://", getlist(myconfig, "InstarCam2User", NULL), 0, 0);
536                                        else
537                                        {
538                                                cam2 = ostrcat(CURL, " http://", 0, 0);
539                                                cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2User", NULL), 1, 0);
540                                        }
541                                        cam2 = ostrcat(cam2, ":",1, 0);
542                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2Pass", NULL), 1, 0);
543                                        cam2 = ostrcat(cam2, "@",1, 0);
544                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2IP", NULL), 1, 0);
545                                        cam2 = ostrcat(cam2, ":",1, 0);
546                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2Port", NULL), 1, 0);
547                                }
548                                else
549                                {
550                                        if(getconfigint("instar_alterwebif", NULL) == 0)
551                                                cam2 = ostrcat("wget --output-document=/tmp/instar2.jpg http://", NULL, 0, 0);
552                                        else
553                                        {
554                                                cam2 = ostrcat(CURL, " http://", 0, 0);
555                                        }
556                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2IP", NULL), 1, 0);
557                                        cam2 = ostrcat(cam2, ":",1, 0);
558                                        cam2 = ostrcat(cam2, getlist(myconfig, "InstarCam2Port", NULL), 1, 0);
559                                        cam21 = ostrcat("%26usr%3D", getlist(myconfig, "InstarCam2User", NULL), 0, 0);
560                                        cam21 = ostrcat(cam21, "%26pwd%3D", 1, 0);
561                                        cam21 = ostrcat(cam21, getlist(myconfig, "InstarCam2Pass", NULL), 1, 0);
562                                        //cam21 = ostrcat(cam21, "&", 1, 0);
563                                }                               
564                        }
565                       
566                        if(ostrcmp(getlist(myconfig, "Instarcam3", NULL), "ein") == 0)
567                        {
568                                if(getconfigint("instar_3", NULL) != 5)
569                                {                               
570                                        if(getconfigint("instar_alterwebif", NULL) == 0)
571                                                cam3 = ostrcat("wget --output-document=/tmp/instar3.jpg http://", getlist(myconfig, "Instarcam3User", NULL), 0, 0);
572                                        else
573                                        {
574                                                cam3 = ostrcat(CURL, " http://", 0, 0);
575                                                cam3 = ostrcat(cam3, getlist(myconfig, "Instarcam3User", NULL), 1, 0);
576                                        }
577                                        cam3 = ostrcat(cam3, ":",1, 0);
578                                        cam3 = ostrcat(cam3, getlist(myconfig, "Instarcam3Pass", NULL), 1, 0);
579                                        cam3 = ostrcat(cam3, "@",1, 0);
580                                        cam3 = ostrcat(cam3, getlist(myconfig, "Instarcam3IP", NULL), 1, 0);
581                                        cam3 = ostrcat(cam3, ":",1, 0);
582                                        cam3 = ostrcat(cam3, getlist(myconfig, "Instarcam3Port", NULL), 1, 0);
583                                }
584                                else
585                                {
586                                        if(getconfigint("instar_alterwebif", NULL) == 0)
587                                                cam3 = ostrcat("wget --output-document=/tmp/instar3.jpg http://", NULL, 0, 0);
588                                        else
589                                        {
590                                                cam3 = ostrcat(CURL, " http://", 0, 0);
591                                        }
592                                        cam3 = ostrcat(cam3, getlist(myconfig, "Instarcam3IP", NULL), 1, 0);
593                                        cam3 = ostrcat(cam3, ":",1, 0);
594                                        cam3 = ostrcat(cam3, getlist(myconfig, "Instarcam3Port", NULL), 1, 0);
595                                        cam31 = ostrcat("%26usr%3D", getlist(myconfig, "Instarcam3User", NULL), 0, 0);
596                                        cam31 = ostrcat(cam31, "%26pwd%3D", 1, 0);
597                                        cam31 = ostrcat(cam31, getlist(myconfig, "Instarcam3Pass", NULL), 1, 0);
598                                        //cam31 = ostrcat(cam31, "&", 1, 0);
599                                }                               
600                        }
601                       
602                        if(ostrcmp(getlist(myconfig, "Instarcam4", NULL), "ein") == 0)
603                        {
604                                if(getconfigint("instar_4", NULL) != 5)
605                                {                               
606                                        if(getconfigint("instar_alterwebif", NULL) == 0)
607                                                cam4 = ostrcat("wget --output-document=/tmp/instar4.jpg http://", getlist(myconfig, "Instarcam4User", NULL), 0, 0);
608                                        else
609                                        {
610                                                cam4 = ostrcat(CURL, " http://", 0, 0);
611                                                cam4 = ostrcat(cam4, getlist(myconfig, "Instarcam4User", NULL), 1, 0);
612                                        }
613                                        cam4 = ostrcat(cam4, ":",1, 0);
614                                        cam4 = ostrcat(cam4, getlist(myconfig, "Instarcam4Pass", NULL), 1, 0);
615                                        cam4 = ostrcat(cam4, "@",1, 0);
616                                        cam4 = ostrcat(cam4, getlist(myconfig, "Instarcam4IP", NULL), 1, 0);
617                                        cam4 = ostrcat(cam4, ":",1, 0);
618                                        cam4 = ostrcat(cam4, getlist(myconfig, "Instarcam4Port", NULL), 1, 0);
619                                }
620                                else
621                                {
622                                        if(getconfigint("instar_alterwebif", NULL) == 0)
623                                                cam4 = ostrcat("wget --output-document=/tmp/instar4.jpg http://", NULL, 0, 0);
624                                        else
625                                        {
626                                                cam4 = ostrcat(CURL, " http://", 0, 0);
627                                        }
628                                        cam4 = ostrcat(cam4, getlist(myconfig, "Instarcam4IP", NULL), 1, 0);
629                                        cam4 = ostrcat(cam4, ":",1, 0);
630                                        cam4 = ostrcat(cam4, getlist(myconfig, "Instarcam4Port", NULL), 1, 0);
631                                        cam41 = ostrcat("%26usr%3D", getlist(myconfig, "Instarcam4User", NULL), 0, 0);
632                                        cam41 = ostrcat(cam41, "%26pwd%3D", 1, 0);
633                                        cam41 = ostrcat(cam41, getlist(myconfig, "Instarcam4Pass", NULL), 1, 0);
634                                        //cam41 = ostrcat(cam41, "&", 1, 0);
635                                }                               
636                        }                                               
637                                       
638                        instar_screen = getscreen("instar_full");
639                        instar_pic1 = getscreennode(instar_screen, "pic1");
640                        instar_actcam1 = getscreennode(instar_screen, "actcam1");
641       
642                       
643                        if(ext == 1 || ostrcmp(getlist(myconfig, "InstarActCam", NULL), "1") == 0)
644                        {
645                                actcam = 1;
646                                changepic(instar_pic1, "/tmp/instar1.jpg");
647                                changetext(instar_actcam1, "CAM1");
648                        }               
649                        else if(ext == 2 || ostrcmp(getlist(myconfig, "InstarActCam", NULL), "2") == 0)
650                        {
651                                actcam = 2;
652                                changepic(instar_pic1, "/tmp/instar2.jpg");
653                                changetext(instar_actcam1, "CAM2");
654                        }
655                        else if(ostrcmp(getlist(myconfig, "InstarActCam", NULL), "3") == 0)
656                        {
657                                actcam = 3;
658                                changepic(instar_pic1, "/tmp/instar3.jpg");
659                                changetext(instar_actcam1, "CAM3");
660                        }
661                        else if(ostrcmp(getlist(myconfig, "InstarActCam", NULL), "4") == 0)
662                        {
663                                actcam = 4;
664                                changepic(instar_pic1, "/tmp/instar4.jpg");
665                                changetext(instar_actcam1, "CAM4");
666                        }
667                        else
668                        {
669                                actcam = 1;
670                                changepic(instar_pic1, "/tmp/instar1.jpg");
671                                changetext(instar_actcam1, "CAM1");
672                        }
673                       
674                        rcode = show_control();
675       
676                        free(cam1), cam1 = NULL;
677                        free(cam2), cam2 = NULL;
678                        free(cam11), cam11 = NULL;
679                        free(cam21), cam21 = NULL;
680                        free(cam3), cam3 = NULL;
681                        free(cam4), cam4 = NULL;
682                        free(cam31), cam31 = NULL;
683                        free(cam41), cam41 = NULL;
684                       
685                        if(rcode == 0)
686                                break;
687                        rcode = 0;
688                       
689                        rcode = instar_settings();
690                        if(rcode == 0)
691                                break;
692                }
693                if(checkbox("ATEMIO5200") == 1)
694                        addconfig("pic_scale", "0");
695        }
696        writelist(myconfig, instarconf);
697        freelist(myconfig);
698        free(instarconf); instarconf = NULL;
699        free(CURL); CURL = NULL;
700}
Note: See TracBrowser for help on using the repository browser.