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

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

[plugins] ip-kamera test typ2

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