Ignore:
Timestamp:
Feb 24, 2012, 12:37:36 PM (13 years ago)
Author:
frichard
Message:

-Alignement des antennes
-Version 0.0.9 de libindi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BAORadio/libindi/libindi/libs/indibase/basedriver.cpp

    r504 r642  
     1/*******************************************************************************
     2  Copyright(c) 2011 Jasem Mutlaq. All rights reserved.
     3
     4 This library is free software; you can redistribute it and/or
     5 modify it under the terms of the GNU Library General Public
     6 License version 2 as published by the Free Software Foundation.
     7
     8 This library is distributed in the hope that it will be useful,
     9 but WITHOUT ANY WARRANTY; without even the implied warranty of
     10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11 Library General Public License for more details.
     12
     13 You should have received a copy of the GNU Library General Public License
     14 along with this library; see the file COPYING.LIB.  If not, write to
     15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     16 Boston, MA 02110-1301, USA.
     17*******************************************************************************/
     18
    119#include <stdlib.h>
    220#include <string.h>
     
    927#include "base64.h"
    1028
     29PropertyContainer::PropertyContainer()
     30{
     31    pPtr = NULL;
     32    pRegistered = false;
     33    pDynamic = false;
     34    pType = INDI_UNKNOWN;
     35}
     36
     37PropertyContainer::~PropertyContainer()
     38{
     39    // Only delete properties if they were created dynamically via the buildSkeleton
     40    // function. Other drivers are responsible for their own memory allocation.
     41    if (pDynamic)
     42    {
     43        switch (pType)
     44        {
     45        case INDI_NUMBER:
     46         delete ((INumberVectorProperty *) pPtr);
     47         break;
     48
     49        case INDI_TEXT:
     50        delete ((ITextVectorProperty *) pPtr);
     51        break;
     52
     53        case INDI_SWITCH:
     54        delete ((ISwitchVectorProperty *) pPtr);
     55        break;
     56
     57        case INDI_LIGHT:
     58        delete ((ILightVectorProperty *) pPtr);
     59        break;
     60
     61        case INDI_BLOB:
     62        delete ((IBLOBVectorProperty *) pPtr);
     63        break;
     64
     65    }
     66  }
     67}
     68
     69void PropertyContainer::setProperty(void *p)
     70{
     71    pRegistered = true;
     72    pPtr = p;
     73
     74}
     75
     76void PropertyContainer::setType(INDI_TYPE t)
     77{
     78    pType = t;
     79}
     80
     81void PropertyContainer::setRegistered(bool r)
     82{
     83   pRegistered = r;
     84}
     85
     86void PropertyContainer::setDynamic(bool d)
     87{
     88   pDynamic = d;
     89}
     90
    1191INDI::BaseDriver::BaseDriver()
    1292{
    1393    mediator = NULL;
    1494    lp = newLilXML();
     95    char indidev[MAXINDIDEVICE];
     96    strncpy(indidev, "INDIDEV=", MAXINDIDEVICE);
    1597
    1698    if (getenv("INDIDEV") != NULL)
    1799    {
    18         strncpy(deviceID, getenv("INDIDEV"), MAXINDINAME);
    19         putenv("INDIDEV=");
     100        strncpy(deviceID, getenv("INDIDEV"), MAXINDIDEVICE);
     101        putenv(indidev);
    20102    }
    21103}
     
    25107{
    26108    delLilXML (lp);
     109    while(!pAll.empty())
     110    {
     111      delete pAll.back();
     112      pAll.pop_back();
     113    }
    27114}
    28115
     
    31118    INumberVectorProperty * nvp = NULL;
    32119
    33     nvp = static_cast<INumberVectorProperty *> (getProperty(name, INDI_NUMBER));
     120    nvp = static_cast<INumberVectorProperty *> (getProperty(name, PropertyContainer::INDI_NUMBER));
    34121
    35122    return nvp;
     
    40127    ITextVectorProperty * tvp = NULL;
    41128
    42     tvp = static_cast<ITextVectorProperty *> (getProperty(name, INDI_TEXT));
     129    tvp = static_cast<ITextVectorProperty *> (getProperty(name, PropertyContainer::INDI_TEXT));
    43130
    44131    return tvp;
     
    49136    ISwitchVectorProperty * svp = NULL;
    50137
    51     svp = static_cast<ISwitchVectorProperty *> (getProperty(name, INDI_SWITCH));
     138    svp = static_cast<ISwitchVectorProperty *> (getProperty(name, PropertyContainer::INDI_SWITCH));
    52139
    53140    return svp;
     
    58145    ILightVectorProperty * lvp = NULL;
    59146
    60     lvp = static_cast<ILightVectorProperty *> (getProperty(name, INDI_LIGHT));
     147    lvp = static_cast<ILightVectorProperty *> (getProperty(name, PropertyContainer::INDI_LIGHT));
    61148
    62149    return lvp;
     
    67154  IBLOBVectorProperty * bvp = NULL;
    68155
    69   bvp = static_cast<IBLOBVectorProperty *> (getProperty(name, INDI_BLOB));
     156  bvp = static_cast<IBLOBVectorProperty *> (getProperty(name, PropertyContainer::INDI_BLOB));
    70157
    71158  return bvp;
    72159}
    73160
    74 void * INDI::BaseDriver::getProperty(const char *name, INDI_TYPE type)
    75 {
    76     std::map< boost::shared_ptr<void>, INDI_TYPE>::iterator orderi;
     161void * INDI::BaseDriver::getProperty(const char *name, PropertyContainer::INDI_TYPE type)
     162{
     163    PropertyContainer::INDI_TYPE pType;
     164    void *pPtr;
     165    bool pRegistered = false;
     166
     167    std::vector<PropertyContainer *>::iterator orderi;
    77168
    78169    INumberVectorProperty *nvp;
     
    84175    for (orderi = pAll.begin(); orderi != pAll.end(); orderi++)
    85176    {
    86         if (type != INDI_UNKNOWN &&  orderi->second != type)
     177        pType       = (*orderi)->getType();
     178        pPtr        = (*orderi)->getProperty();
     179        pRegistered = (*orderi)->getRegistered();
     180
     181        if (type != PropertyContainer::INDI_UNKNOWN && pType != type)
    87182            continue;
    88183
    89         switch (orderi->second)
    90         {
    91         case INDI_NUMBER:
    92             nvp = static_cast<INumberVectorProperty *>((orderi->first).get());
    93             if (!strcmp(name, nvp->name))
    94                 return (orderi->first).get();
    95              break;
    96         case INDI_TEXT:
    97              tvp = static_cast<ITextVectorProperty *>((orderi->first).get());
    98              if (!strcmp(name, tvp->name))
    99                 return (orderi->first).get();
    100              break;
    101         case INDI_SWITCH:
    102              svp = static_cast<ISwitchVectorProperty *>((orderi->first).get());
    103              if (!strcmp(name, svp->name))
    104                  return (orderi->first).get();
    105              break;
    106         case INDI_LIGHT:
    107              lvp = static_cast<ILightVectorProperty *>((orderi->first).get());
    108              if (!strcmp(name, lvp->name))
    109                  return (orderi->first).get();
    110              break;
    111         case INDI_BLOB:
    112              bvp = static_cast<IBLOBVectorProperty *>((orderi->first).get());
    113              if (!strcmp(name, bvp->name))
    114                  return (orderi->first).get();
     184        switch (pType)
     185        {
     186        case PropertyContainer::INDI_NUMBER:
     187            nvp = static_cast<INumberVectorProperty *>(pPtr);
     188            if (nvp == NULL)
     189                continue;
     190
     191            if (!strcmp(name, nvp->name) && pRegistered)
     192                return pPtr;
     193             break;
     194        case PropertyContainer::INDI_TEXT:
     195             tvp = static_cast<ITextVectorProperty *>(pPtr);
     196             if (tvp == NULL)
     197                 continue;
     198
     199             if (!strcmp(name, tvp->name)  && pRegistered)
     200                return pPtr;
     201             break;
     202        case PropertyContainer::INDI_SWITCH:
     203             svp = static_cast<ISwitchVectorProperty *>(pPtr);
     204             if (svp == NULL)
     205                 continue;
     206
     207             //IDLog("Switch %s and aux value is now %d\n", svp->name, regStatus );
     208             if (!strcmp(name, svp->name) && pRegistered)
     209                 return pPtr;
     210             break;
     211        case PropertyContainer::INDI_LIGHT:
     212             lvp = static_cast<ILightVectorProperty *>(pPtr);
     213             if (lvp == NULL)
     214                 continue;
     215
     216             if (!strcmp(name, lvp->name)  && pRegistered)
     217                 return pPtr;
     218             break;
     219        case PropertyContainer::INDI_BLOB:
     220             bvp = static_cast<IBLOBVectorProperty *>(pPtr);
     221             if (bvp == NULL)
     222                 continue;
     223
     224             if (!strcmp(name, bvp->name) && pRegistered)
     225                 return pPtr;
    115226             break;
    116227        }
     
    121232}
    122233
    123 int INDI::BaseDriver::removeProperty(const char *name)
    124 {
    125     std::map< boost::shared_ptr<void>, INDI_TYPE>::iterator orderi;
     234PropertyContainer * INDI::BaseDriver::getContainer(const char *name, PropertyContainer::INDI_TYPE type)
     235{
     236    PropertyContainer::INDI_TYPE pType;
     237    void *pPtr;
     238    bool pRegistered = false;
     239
     240    std::vector<PropertyContainer *>::iterator orderi;
    126241
    127242    INumberVectorProperty *nvp;
     
    133248    for (orderi = pAll.begin(); orderi != pAll.end(); orderi++)
    134249    {
    135         switch (orderi->second)
    136         {
    137         case INDI_NUMBER:
    138             nvp = static_cast<INumberVectorProperty *>((orderi->first).get());
     250        pType       = (*orderi)->getType();
     251        pPtr        = (*orderi)->getProperty();
     252        pRegistered = (*orderi)->getRegistered();
     253
     254        if (type != PropertyContainer::INDI_UNKNOWN && pType != type)
     255            continue;
     256
     257        switch (pType)
     258        {
     259        case PropertyContainer::INDI_NUMBER:
     260            nvp = static_cast<INumberVectorProperty *>(pPtr);
     261            if (nvp == NULL)
     262                continue;
     263
     264            if (!strcmp(name, nvp->name) && pRegistered)
     265                return *orderi;
     266             break;
     267        case PropertyContainer::INDI_TEXT:
     268             tvp = static_cast<ITextVectorProperty *>(pPtr);
     269             if (tvp == NULL)
     270                 continue;
     271
     272             if (!strcmp(name, tvp->name)  && pRegistered)
     273                return *orderi;
     274             break;
     275        case PropertyContainer::INDI_SWITCH:
     276             svp = static_cast<ISwitchVectorProperty *>(pPtr);
     277             if (svp == NULL)
     278                 continue;
     279
     280             //IDLog("Switch %s and aux value is now %d\n", svp->name, regStatus );
     281             if (!strcmp(name, svp->name) && pRegistered)
     282                 return *orderi;
     283             break;
     284        case PropertyContainer::INDI_LIGHT:
     285             lvp = static_cast<ILightVectorProperty *>(pPtr);
     286             if (lvp == NULL)
     287                 continue;
     288
     289             if (!strcmp(name, lvp->name)  && pRegistered)
     290                 return *orderi;
     291             break;
     292        case PropertyContainer::INDI_BLOB:
     293             bvp = static_cast<IBLOBVectorProperty *>(pPtr);
     294             if (bvp == NULL)
     295                 continue;
     296
     297             if (!strcmp(name, bvp->name) && pRegistered)
     298                 return *orderi;
     299             break;
     300        }
     301
     302    }
     303
     304    return NULL;
     305}
     306
     307int INDI::BaseDriver::removeProperty(const char *name)
     308{   
     309    std::vector<PropertyContainer *>::iterator orderi;
     310
     311    PropertyContainer::INDI_TYPE pType;
     312    void *pPtr;
     313
     314    INumberVectorProperty *nvp;
     315    ITextVectorProperty *tvp;
     316    ISwitchVectorProperty *svp;
     317    ILightVectorProperty *lvp;
     318    IBLOBVectorProperty *bvp;
     319
     320    for (orderi = pAll.begin(); orderi != pAll.end(); orderi++)
     321    {
     322        pType       = (*orderi)->getType();
     323        pPtr        = (*orderi)->getProperty();
     324
     325        switch (pType)
     326        {
     327        case PropertyContainer::INDI_NUMBER:
     328            nvp = static_cast<INumberVectorProperty *>(pPtr);
    139329            if (!strcmp(name, nvp->name))
    140330            {
    141                  pAll.erase(orderi);
     331                (*orderi)->setRegistered(false);
    142332                 return 0;
    143333             }
    144334             break;
    145         case INDI_TEXT:
    146              tvp = static_cast<ITextVectorProperty *>((orderi->first).get());
     335        case PropertyContainer::INDI_TEXT:
     336             tvp = static_cast<ITextVectorProperty *>(pPtr);
    147337             if (!strcmp(name, tvp->name))
    148338             {
    149                   pAll.erase(orderi);
     339                  (*orderi)->setRegistered(false);
    150340                  return 0;
    151341              }
    152342             break;
    153         case INDI_SWITCH:
    154              svp = static_cast<ISwitchVectorProperty *>((orderi->first).get());
     343        case PropertyContainer::INDI_SWITCH:
     344             svp = static_cast<ISwitchVectorProperty *>(pPtr);
    155345             if (!strcmp(name, svp->name))
    156346             {
    157                   pAll.erase(orderi);
     347                 (*orderi)->setRegistered(false);
    158348                  return 0;
    159349              }
    160350             break;
    161         case INDI_LIGHT:
    162              lvp = static_cast<ILightVectorProperty *>((orderi->first).get());
     351        case PropertyContainer::INDI_LIGHT:
     352             lvp = static_cast<ILightVectorProperty *>(pPtr);
    163353             if (!strcmp(name, lvp->name))
    164354             {
    165                   pAll.erase(orderi);
     355                 (*orderi)->setRegistered(false);
    166356                  return 0;
    167357              }
    168358             break;
    169         case INDI_BLOB:
    170              bvp = static_cast<IBLOBVectorProperty *>((orderi->first).get());
     359        case PropertyContainer::INDI_BLOB:
     360             bvp = static_cast<IBLOBVectorProperty *>(pPtr);
    171361             if (!strcmp(name, bvp->name))
    172362             {
    173                   pAll.erase(orderi);
     363                 (*orderi)->setRegistered(false);
    174364                  return 0;
    175365              }
     
    215405    IPerm perm;
    216406    IPState state;
    217     ISRule rule;
    218407    XMLEle *ep = NULL;
    219408    char *rtag, *rname, *rdev;
    220     //INDI_TYPE type;
    221409    double timeout=0;
    222410
     
    258446    if (!strcmp (rtag, "defNumberVector"))
    259447    {
    260 
    261         numberPtr nvp(new INumberVectorProperty);
    262         //INumberVectorProperty *nvp = new INumberVectorProperty;
    263         //INumberVectorProperty *nvp = (INumberVectorProperty *) malloc(sizeof(INumberVectorProperty));
     448        PropertyContainer *indiProp = new PropertyContainer();
     449        INumberVectorProperty *nvp = new INumberVectorProperty;
     450
    264451        INumber *np = NULL;
    265452        int n=0;
     
    281468            np = (INumber *) realloc(np, (n+1) * sizeof(INumber));
    282469
    283             np[n].nvp = nvp.get();
     470            np[n].nvp = nvp;
    284471
    285472            XMLAtt *na = findXMLAtt (ep, "name");
     
    320507        nvp->nnp = n;
    321508        nvp->np  = np;
    322         //orderPtr o(new pOrder);
    323         //o->p = &nvp;
    324         //o->type = INDI_NUMBER;
    325         //pAll.push_back(o);
    326         pAll[nvp] = INDI_NUMBER;
     509
     510        indiProp->setProperty(nvp);
     511        indiProp->setDynamic(true);
     512        indiProp->setType(PropertyContainer::INDI_NUMBER);
     513
     514        pAll.push_back(indiProp);
     515
    327516        //IDLog("Adding number property %s to list.\n", nvp->name);
    328517        if (mediator)
     
    334523  else if (!strcmp (rtag, "defSwitchVector"))
    335524        {
    336             switchPtr svp(new ISwitchVectorProperty);
    337             //ISwitchVectorProperty *svp = new ISwitchVectorProperty;
    338             //ISwitchVectorProperty *svp = (ISwitchVectorProperty *) malloc(sizeof(ISwitchVectorProperty));
     525            PropertyContainer *indiProp = new PropertyContainer();
     526            ISwitchVectorProperty *svp = new ISwitchVectorProperty;
     527
    339528            ISwitch *sp = NULL;
    340529            int n=0;
     
    360549                sp = (ISwitch *) realloc(sp, (n+1) * sizeof(ISwitch));
    361550
    362                 sp[n].svp = svp.get();
     551                sp[n].svp = svp;
    363552
    364553                XMLAtt *na = findXMLAtt (ep, "name");
     
    380569            svp->nsp = n;
    381570            svp->sp  = sp;
    382             //orderPtr o(new pOrder);
    383             //o->p = &svp;
    384             //o->type = INDI_SWITCH;
    385             //pAll.push_back(o);
    386             pAll[svp] = INDI_SWITCH;
     571
     572            indiProp->setProperty(svp);
     573            indiProp->setDynamic(true);
     574            indiProp->setType(PropertyContainer::INDI_SWITCH);
     575
     576            pAll.push_back(indiProp);
    387577            //IDLog("Adding Switch property %s to list.\n", svp->name);
    388578            if (mediator)
     
    396586    {
    397587
    398         //ITextVectorProperty *tvp = new ITextVectorProperty;
    399         //ITextVectorProperty *tvp = (ITextVectorProperty *) malloc(sizeof(ITextVectorProperty));
    400         textPtr tvp(new ITextVectorProperty);
     588        PropertyContainer *indiProp = new PropertyContainer();
     589        ITextVectorProperty *tvp = new ITextVectorProperty;
    401590        IText *tp = NULL;
    402591        int n=0;
     
    418607            tp = (IText *) realloc(tp, (n+1) * sizeof(IText));
    419608
    420             tp[n].tvp = tvp.get();
     609            tp[n].tvp = tvp;
    421610
    422611            XMLAtt *na = findXMLAtt (ep, "name");
     
    439628        tvp->ntp = n;
    440629        tvp->tp  = tp;
    441         //orderPtr o(new pOrder);
    442         //o->p = &tvp;
    443         //o->type = INDI_TEXT;
    444         //pAll.push_back(o);
    445         pAll[tvp] = INDI_TEXT;
     630
     631        indiProp->setProperty(tvp);
     632        indiProp->setDynamic(true);
     633        indiProp->setType(PropertyContainer::INDI_TEXT);
     634
     635        pAll.push_back(indiProp);
    446636        //IDLog("Adding Text property %s to list.\n", tvp->name);
    447637        if (mediator)
     
    454644    {
    455645
    456         //ILightVectorProperty *lvp = new ILightVectorProperty;
    457         //ILightVectorProperty *lvp = (ILightVectorProperty *) malloc(sizeof(ILightVectorProperty));
    458         lightPtr lvp(new ILightVectorProperty);
     646        PropertyContainer *indiProp = new PropertyContainer();
     647        ILightVectorProperty *lvp = new ILightVectorProperty;
    459648        ILight *lp = NULL;
    460649        int n=0;
     
    474663            lp = (ILight *) realloc(lp, (n+1) * sizeof(ILight));
    475664
    476             lp[n].lvp = lvp.get();
     665            lp[n].lvp = lvp;
    477666
    478667            XMLAtt *na = findXMLAtt (ep, "name");
     
    495684        lvp->nlp = n;
    496685        lvp->lp  = lp;
    497         //orderPtr o(new pOrder);
    498         //o->p = &lvp;
    499         //o->type = INDI_LIGHT;
    500         //pAll.push_back(o);
    501         pAll[lvp] = INDI_LIGHT;
     686
     687        indiProp->setProperty(lvp);
     688        indiProp->setDynamic(true);
     689        indiProp->setType(PropertyContainer::INDI_LIGHT);
     690
     691        pAll.push_back(indiProp);
     692
    502693        //IDLog("Adding Light property %s to list.\n", lvp->name);
    503694        if (mediator)
     
    509700else if (!strcmp (rtag, "defBLOBVector"))
    510701    {
    511 
    512         //IBLOBVectorProperty *bvp = new IBLOBVectorProperty;
    513         //IBLOBVectorProperty *bvp = (IBLOBVectorProperty *) malloc(sizeof(IBLOBVectorProperty));
    514         blobPtr bvp(new IBLOBVectorProperty);
     702        PropertyContainer *indiProp = new PropertyContainer();
     703        IBLOBVectorProperty *bvp = new IBLOBVectorProperty;
    515704        IBLOB *bp = NULL;
    516705        int n=0;
     
    530719            bp = (IBLOB *) realloc(bp, (n+1) * sizeof(IBLOB));
    531720
    532             bp[n].bvp = bvp.get();
     721            bp[n].bvp = bvp;
    533722
    534723            XMLAtt *na = findXMLAtt (ep, "name");
     
    560749        bvp->nbp = n;
    561750        bvp->bp  = bp;
    562         //orderPtr o(new pOrder);
    563         //o->p = &bvp;
    564         //o->type = INDI_BLOB;
    565         //pAll.push_back(o);
    566         pAll[bvp] = INDI_BLOB;
     751
     752        indiProp->setProperty(bvp);
     753        indiProp->setDynamic(true);
     754        indiProp->setType(PropertyContainer::INDI_BLOB);
     755
     756        pAll.push_back(indiProp);
    567757        //IDLog("Adding BLOB property %s to list.\n", bvp->name);
    568758        if (mediator)
     
    9131103}
    9141104
    915 void INDI::BaseDriver::registerProperty(void *p, INDI_TYPE type)
    916 {
    917 
    918 
    919     if (type == INDI_NUMBER)
     1105void INDI::BaseDriver::registerProperty(void *p, PropertyContainer::INDI_TYPE type)
     1106{
     1107    PropertyContainer *pContainer;
     1108
     1109    if (type == PropertyContainer::INDI_NUMBER)
    9201110    {
    9211111        INumberVectorProperty *nvp = static_cast<INumberVectorProperty *> (p);
    922         if (getProperty(nvp->name, INDI_NUMBER) != NULL)
     1112        if ( (pContainer = getContainer(nvp->name, PropertyContainer::INDI_NUMBER)) != NULL)
     1113        {
     1114            pContainer->setRegistered(true);
    9231115            return;
    924 
    925         numberPtr ovp(nvp);
    926 
    927         pAll[ovp] = INDI_NUMBER;
    928     }
    929     else if (type == INDI_TEXT)
     1116        }
     1117
     1118        pContainer = new PropertyContainer();
     1119        pContainer->setProperty(p);
     1120        pContainer->setType(type);
     1121
     1122        pAll.push_back(pContainer);
     1123
     1124    }
     1125    else if (type == PropertyContainer::INDI_TEXT)
    9301126    {
    9311127       ITextVectorProperty *tvp = static_cast<ITextVectorProperty *> (p);
    932        if (getProperty(tvp->name, INDI_TEXT) != NULL)
     1128
     1129       if ( (pContainer = getContainer(tvp->name, PropertyContainer::INDI_TEXT)) != NULL)
     1130       {
     1131           pContainer->setRegistered(true);
    9331132           return;
    934 
    935        textPtr ovp(tvp);
    936        //o->p = &ovp;
    937 
    938        pAll[ovp] = INDI_TEXT;
     1133       }
     1134
     1135       pContainer = new PropertyContainer();
     1136       pContainer->setProperty(p);
     1137       pContainer->setType(type);
     1138
     1139       pAll.push_back(pContainer);
     1140
     1141
    9391142   }
    940     else if (type == INDI_SWITCH)
     1143    else if (type == PropertyContainer::INDI_SWITCH)
    9411144    {
    9421145       ISwitchVectorProperty *svp = static_cast<ISwitchVectorProperty *> (p);
    943        if (getProperty(svp->name, INDI_SWITCH) != NULL)
     1146
     1147       if ( (pContainer = getContainer(svp->name, PropertyContainer::INDI_SWITCH)) != NULL)
     1148       {
     1149           pContainer->setRegistered(true);
    9441150           return;
    945 
    946        switchPtr ovp(svp);
    947        //o->p = &ovp;
    948 
    949        IDLog("Registering switch %s\n", svp->name);
    950 
    951        pAll[ovp] = INDI_SWITCH;
    952     }
    953     else if (type == INDI_LIGHT)
     1151       }
     1152
     1153       pContainer = new PropertyContainer();
     1154       pContainer->setProperty(p);
     1155       pContainer->setType(type);
     1156
     1157       pAll.push_back(pContainer);
     1158
     1159    }
     1160    else if (type == PropertyContainer::INDI_LIGHT)
    9541161    {
    9551162       ILightVectorProperty *lvp = static_cast<ILightVectorProperty *> (p);
    956        if (getProperty(lvp->name, INDI_LIGHT) != NULL)
     1163
     1164       if ( (pContainer = getContainer(lvp->name, PropertyContainer::INDI_LIGHT)) != NULL)
     1165       {
     1166           pContainer->setRegistered(true);
    9571167           return;
    958 
    959        lightPtr ovp(lvp);
    960        //o->p = &ovp;
    961        pAll[ovp] = INDI_LIGHT;
     1168       }
     1169
     1170       pContainer = new PropertyContainer();
     1171       pContainer->setProperty(p);
     1172       pContainer->setType(type);
     1173
     1174       pAll.push_back(pContainer);
    9621175   }
    963     else if (type == INDI_BLOB)
     1176    else if (type == PropertyContainer::INDI_BLOB)
    9641177    {
    9651178       IBLOBVectorProperty *bvp = static_cast<IBLOBVectorProperty *> (p);
    966        if (getProperty(bvp->name, INDI_BLOB) != NULL)
     1179
     1180       if ( (pContainer = getContainer(bvp->name, PropertyContainer::INDI_BLOB)) != NULL)
     1181       {
     1182           pContainer->setRegistered(true);
    9671183           return;
    968 
    969        blobPtr ovp(bvp);
    970        //o->p = &ovp;
    971 
    972        pAll[ovp] = INDI_BLOB;
    973     }
    974 
    975 }
    976 
     1184       }
     1185
     1186       pContainer = new PropertyContainer();
     1187       pContainer->setProperty(p);
     1188       pContainer->setType(type);
     1189
     1190       pAll.push_back(pContainer);
     1191
     1192    }
     1193
     1194}
     1195
Note: See TracChangeset for help on using the changeset viewer.