uniset-algorithms  0.2
Открытые члены | Открытые атрибуты
Структура MultiChannelSensors::Channel

Полный список членов класса

Открытые члены

void sensorInfo (UniversalInterface *ui, UniSetTypes::SensorMessage *sm)
void saveTo (UniversalInterface *ui, UniSetTypes::ObjectId id=UniSetTypes::DefaultObjectId)
void askSensors (UniversalInterface *ui, UniversalIO::UIOCommand cmd)
void init (UniXML_iterator &it)
void initValue (UniversalInterface *ui)
bool operator< (const Channel &g) const

Открытые атрибуты

SList slst
UniSetTypes::ObjectId respond_id
bool respond_state
bool respond_invert
bool is_default
int priority
std::string filter_field
std::string filter_value
std::string myname

Методы

void MultiChannelSensors::Channel::saveTo ( UniversalInterface *  ui,
UniSetTypes::ObjectId  id = UniSetTypes::DefaultObjectId 
)

Перекидывание "id" --> "common_id"

{
    // здесь перекидывание из id в common_id
    for( SList::iterator it=slst.begin(); it!=slst.end(); it++ )
    {
        if(id != it->id && id != respond_id)
            continue;
        try
        {
            if( it->iotype == UniversalIO::DigitalInput )
                ui->saveState(it->common_id,it->value,UniversalIO::DigitalInput);
            else if( it->iotype == UniversalIO::AnalogInput )
                ui->saveValue(it->common_id,it->value,UniversalIO::AnalogInput);
        }   
        catch( Exception& ex )
        {
            MultiChannelSensors::dlog[Debug::WARN] << myname << "(saveTo): " << ex << endl;
        }
    }
}
void MultiChannelSensors::Channel::sensorInfo ( UniversalInterface *  ui,
UniSetTypes::SensorMessage *  sm 
)

Перекидывание "common_id" --> "id"

{
    if( sm->id == respond_id )
        respond_state = respond_invert ? !sm->state : sm->state;
    else
    {
        for( SList::iterator it=slst.begin(); it!=slst.end(); it++ )
        {
            if( sm->id == it->id )
                it->value = sm->value;

            if( sm->id == it->common_id )
            {
                // DO/AO перекидываем сразу.. из common_id в id..
                if( it->iotype == UniversalIO::DigitalOutput || it->iotype == UniversalIO::AnalogOutput )
                {
                    try
                    {
                        it->value = sm->value;
                        if( it->iotype == UniversalIO::DigitalOutput )
                            ui->setState(it->id, sm->state);
                        else if( it->iotype == UniversalIO::AnalogOutput )
                            ui->setValue(it->id, sm->value);
                    }   
                    catch( Exception& ex )
                    {
                        MultiChannelSensors::dlog[Debug::WARN] << myname << "(sensorInfo): " << ex << endl;
                    }
                }
                
                return; // т.к. в списке датчики повторяться не могут.. то делаем return..
            }
        }
    }
}

Объявления и описания членов структур находятся в файлах: