Changeset 40942


Ignore:
Timestamp:
09/10/17 20:09:39 (7 years ago)
Author:
gost
Message:

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

Location:
titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/instar/instar.h

    r40938 r40942  
    66char* cam11 = NULL;
    77char* cam21 = NULL;
     8
     9char* cam3 = NULL;
     10char* cam4 = NULL;
     11char* cam31 = NULL;
     12char* cam41 = NULL;
     13
    814struct skin* instar_screen = NULL;
    915struct skin* instar_pic1 = NULL;
     
    8288                                free(tmpstr); tmpstr = NULL;
    8389                        }
     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                        }
    84136                               
    85137                drawscreen(instar_screen, 0, 0);
     
    184236                        }
    185237                        if(rcret == getrcconfigint("rcred", NULL)) {
    186                                 if(actcam == 1 && cam2 != 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                                {
    187248                                        actcam = 2;
    188249                                        changepic(instar_pic1, "/tmp/instar2.jpg");
     
    190251                                        tempcam = cam2;
    191252                                        addlist(myconfig, "InstarActCam", "2");
    192                                 }
    193                                 else if(actcam == 2 && cam1 != NULL) {
    194                                         actcam = 1;
    195                                         changepic(instar_pic1, "/tmp/instar1.jpg");
    196                                         changetext(instar_actcam1, "CAM1");
    197                                         tempcam = cam1;
    198                                         addlist(myconfig, "InstarActCam", "1");
     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");
    199269                                }
    200270                        }
     
    229299        struct skin* userCam2 = getscreennode(instar_einstellungen, "userCam2");
    230300        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");
    231313       
    232314        struct skin* tmp = NULL;
     
    278360  changeinput(passCam2, getlist(myconfig, "InstarCam2Pass", NULL));
    279361 
     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 
    280400        drawscreen(instar_einstellungen, 0, 0);
    281401        addscreenrc(instar_einstellungen, listbox);
     
    302422                        addlist(myconfig, "InstarCam2User", userCam2->ret);
    303423                        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);
    304429                        writelist(myconfig, instarconf);
    305430                        addconfig("instar_1", typCam1->ret);
    306431                        addconfig("instar_2", typCam2->ret);
     432                        addconfig("instar_3", typCam3->ret);
     433                        addconfig("instar_4", typCam4->ret);
    307434                        addconfig("instar_alterwebif", alterwebif->ret);
    308435                        if(rcret == getrcconfigint("rcblue", NULL))
     
    436563                                }                               
    437564                        }
     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                        }                                               
    438637                                       
    439638                        instar_screen = getscreen("instar_full");
     
    441640                        instar_actcam1 = getscreennode(instar_screen, "actcam1");
    442641       
    443                         if(ostrcmp(getlist(myconfig, "InstarActCam", NULL), "2") == 0 && ext != 1)
     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)
    444650                        {
    445651                                actcam = 2;
    446652                                changepic(instar_pic1, "/tmp/instar2.jpg");
    447653                                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");
    448666                        }
    449667                        else
     
    460678                        free(cam11), cam11 = NULL;
    461679                        free(cam21), cam21 = NULL;
     680                        free(cam3), cam3 = NULL;
     681                        free(cam4), cam4 = NULL;
     682                        free(cam31), cam31 = NULL;
     683                        free(cam41), cam41 = NULL;
    462684                       
    463685                        if(rcode == 0)
  • titan/skins/instar/skin.xml

    r35883 r40942  
    2121<node name="userCam2" type="inputbox" parent="listbox" valign="middle" posx="0" text="Benutzer-Kamera 2" bordercol="bordercol" bordersize="2" width="100%" height="25">
    2222<node name="passCam2" type="inputbox" parent="listbox" valign="middle" posx="0" text="Passwort-Kamera 2" bordercol="bordercol" bordersize="2" width="100%" height="25">
     23<node name="s2" type="inputbox" parent="listbox" valign="middle" posx="0" text=" " bordercol="bordercol" bordersize="2" width="100%" height="15">
     24<node name="onCam3" type="choicebox" parent="listbox" valign="middle" posx="0" text="Kamera 3 (Umschalten mit Rot)" bordercol="bordercol" bordersize="2" width="100%" height="25">
     25<node name="typCam3" type="choicebox" parent="listbox" valign="middle" posx="0" text="Typ" bordercol="bordercol" bordersize="2" width="100%" height="25">
     26<node name="ipCam3" type="inputbox" parent="listbox" valign="middle" posx="0" text="IP-Kamera 3" bordercol="bordercol" bordersize="2" width="100%" height="25">
     27<node name="portCam3" type="inputboxnum" parent="listbox" valign="middle" posx="0" text="Port-Kamera 3" bordercol="bordercol" bordersize="2" width="100%" height="25">
     28<node name="userCam3" type="inputbox" parent="listbox" valign="middle" posx="0" text="Benutzer-Kamera 3" bordercol="bordercol" bordersize="2" width="100%" height="25">
     29<node name="passCam3" type="inputbox" parent="listbox" valign="middle" posx="0" text="Passwort-Kamera 3" bordercol="bordercol" bordersize="2" width="100%" height="25">
     30<node name="s3" type="inputbox" parent="listbox" valign="middle" posx="0" text=" " bordercol="bordercol" bordersize="2" width="100%" height="15">
     31<node name="onCam4" type="choicebox" parent="listbox" valign="middle" posx="0" text="Kamera 4 (Umschalten mit Rot)" bordercol="bordercol" bordersize="2" width="100%" height="25">
     32<node name="typCam4" type="choicebox" parent="listbox" valign="middle" posx="0" text="Typ" bordercol="bordercol" bordersize="2" width="100%" height="25">
     33<node name="ipCam4" type="inputbox" parent="listbox" valign="middle" posx="0" text="IP-Kamera 4" bordercol="bordercol" bordersize="2" width="100%" height="25">
     34<node name="portCam4" type="inputboxnum" parent="listbox" valign="middle" posx="0" text="Port-Kamera 4" bordercol="bordercol" bordersize="2" width="100%" height="25">
     35<node name="userCam4" type="inputbox" parent="listbox" valign="middle" posx="0" text="Benutzer-Kamera 4" bordercol="bordercol" bordersize="2" width="100%" height="25">
     36<node name="passCam4" type="inputbox" parent="listbox" valign="middle" posx="0" text="Passwort-Kamera 4" bordercol="bordercol" bordersize="2" width="100%" height="25">
    2337<node name="b1" text="SAVE" halign="center" valign="middle" bordercol="green" bordersize="2" bordertype="2" posx="0" posy="0" width="150" height="30"/>
    2438<node name="b2" text="EXIT" halign="center" valign="middle" bordercol="exitcol" bordersize="2" bordertype="2" posx="160" posy="0" width="150" height="30"/>
Note: See TracChangeset for help on using the changeset viewer.