Commit b0310ae3 authored by Pavel Vainerman's avatar Pavel Vainerman

(UNet): ненмого подправил изменения от <uzum>.

parent 2b89a801
...@@ -356,8 +356,8 @@ UNetReceiver* UNetExchange::create_receiver( const std::string& h, const ost::tp ...@@ -356,8 +356,8 @@ UNetReceiver* UNetExchange::create_receiver( const std::string& h, const ost::tp
return new UNetReceiver(h,p,shm); return new UNetReceiver(h,p,shm);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UNetSender* UNetExchange::create_sender( const std::string h, const ost::tpport_t p, SMInterface* shm, UNetSender* UNetExchange::create_sender( const std::string& h, const ost::tpport_t p, SMInterface* shm,
const std::string s_field, const std::string s_fvalue, SharedMemory* ic ) const std::string& s_field, const std::string& s_fvalue, SharedMemory* ic )
{ {
return new UNetSender(h,p,shm,s_field,s_fvalue,ic); return new UNetSender(h,p,shm,s_field,s_fvalue,ic);
} }
...@@ -776,12 +776,12 @@ void UNetExchange::receiverEvent( UNetReceiver* r, UNetReceiver::Event ev ) ...@@ -776,12 +776,12 @@ void UNetExchange::receiverEvent( UNetReceiver* r, UNetReceiver::Event ev )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetExchange::ignore_item(UniSetTypes::ObjectId id, bool set) void UNetExchange::setIgnore( UniSetTypes::ObjectId id, bool set )
{ {
std::list<UNetReceiver*> rList = get_receivers(); std::list<UNetReceiver*> rList = get_receivers();
std::list<UNetReceiver*>::iterator rIt = rList.begin(); std::list<UNetReceiver*>::iterator rIt = rList.begin();
for(; rIt != rList.end(); ++ rIt ) for(; rIt != rList.end(); ++ rIt )
(*rIt)->ignore_item(id, set); (*rIt)->setIgnore(id, set);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
std::list<UNetReceiver*> UNetExchange::get_receivers() std::list<UNetReceiver*> UNetExchange::get_receivers()
......
...@@ -86,14 +86,20 @@ class UNetExchange: ...@@ -86,14 +86,20 @@ class UNetExchange:
static UNetExchange* init_unetexchange( int argc, const char* argv[], static UNetExchange* init_unetexchange( int argc, const char* argv[],
UniSetTypes::ObjectId shmID, SharedMemory* ic=0, const std::string& prefix="unet" ); UniSetTypes::ObjectId shmID, SharedMemory* ic=0, const std::string& prefix="unet" );
virtual UNetReceiver* create_receiver( const std::string& h, const ost::tpport_t p, SMInterface* shm );
virtual UNetSender* create_sender( const std::string& h, const ost::tpport_t p, SMInterface* shm,
const std::string& s_field="", const std::string& s_fvalue="", SharedMemory* ic=0 );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* argv[] ); static void help_print( int argc, const char* argv[] );
bool checkExistUNetHost( const std::string& host, ost::tpport_t port ); bool checkExistUNetHost( const std::string& host, ost::tpport_t port );
std::list<UNetReceiver*> get_receivers(); std::list<UNetReceiver*> get_receivers();
/*! игнорировать запись датчика в SM */ /*! игнорировать запись датчика в SM */
void ignore_item(UniSetTypes::ObjectId id = UniSetTypes::DefaultObjectId, bool set = true); void setIgnore(UniSetTypes::ObjectId id = UniSetTypes::DefaultObjectId, bool set = true);
protected: protected:
UNetExchange(); UNetExchange();
...@@ -104,9 +110,7 @@ class UNetExchange: ...@@ -104,9 +110,7 @@ class UNetExchange:
SMInterface* shm; SMInterface* shm;
void step(); void step();
virtual UNetReceiver* create_receiver( const std::string& h, const ost::tpport_t p, SMInterface* shm );
virtual UNetSender* create_sender( const std::string h, const ost::tpport_t p, SMInterface* shm,
const std::string s_field="", const std::string s_fvalue="", SharedMemory* ic=0 );
virtual void processingMessage( UniSetTypes::VoidMessage *msg ); virtual void processingMessage( UniSetTypes::VoidMessage *msg );
void sysCommand( UniSetTypes::SystemMessage *msg ); void sysCommand( UniSetTypes::SystemMessage *msg );
void sensorInfo( UniSetTypes::SensorMessage*sm ); void sensorInfo( UniSetTypes::SensorMessage*sm );
......
...@@ -380,16 +380,16 @@ void UNetReceiver::updateDItem( ItemInfo& ii, const long& id, bool val ) ...@@ -380,16 +380,16 @@ void UNetReceiver::updateDItem( ItemInfo& ii, const long& id, bool val )
else if( ii.iotype == UniversalIO::DigitalOutput ) else if( ii.iotype == UniversalIO::DigitalOutput )
shm->localSetState(ii.dit,id,val,shm->ID()); shm->localSetState(ii.dit,id,val,shm->ID());
else else
dlog[Debug::CRIT] << myname << "(updateAItem): Unknown iotype for sid=" << id << endl; dlog[Debug::CRIT] << myname << "(updateDItem): Unknown iotype for sid=" << id << endl;
} }
catch( UniSetTypes::Exception& ex) catch( UniSetTypes::Exception& ex)
{ {
dlog[Debug::CRIT] << myname << "(updateAItem): " << ex << std::endl; dlog[Debug::CRIT] << myname << "(updateDItem): " << ex << std::endl;
throw ex; throw ex;
} }
catch(...) catch(...)
{ {
dlog[Debug::CRIT] << myname << "(updateAItem): catch ..." << std::endl; dlog[Debug::CRIT] << myname << "(updateDItem): catch ..." << std::endl;
throw; throw;
} }
} }
...@@ -575,7 +575,7 @@ void UNetReceiver::initIterators() ...@@ -575,7 +575,7 @@ void UNetReceiver::initIterators()
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UNetReceiver::ignore_item(UniSetTypes::ObjectId id, bool set) void UNetReceiver::setIgnore( UniSetTypes::ObjectId id, bool set )
{ {
for( ItemVec::iterator it=d_icache.begin(); it!=d_icache.end(); ++it ) for( ItemVec::iterator it=d_icache.begin(); it!=d_icache.end(); ++it )
{ {
......
...@@ -93,8 +93,11 @@ class UNetReceiver ...@@ -93,8 +93,11 @@ class UNetReceiver
typedef sigc::slot<void,UNetReceiver*,Event> EventSlot; typedef sigc::slot<void,UNetReceiver*,Event> EventSlot;
void connectEvent( EventSlot sl ); void connectEvent( EventSlot sl );
/*! игнорировать запись датчика в SM */
void ignore_item(UniSetTypes::ObjectId id = UniSetTypes::DefaultObjectId, bool set = true); /*! игнорировать запись датчика в SM
\param id - идентификатор датчика. DefaultObjectId - выставить флаг для всех датчиков
*/
void setIgnore( UniSetTypes::ObjectId id=UniSetTypes::DefaultObjectId, bool set=true );
protected: protected:
UNetReceiver(); UNetReceiver();
......
...@@ -70,7 +70,6 @@ s_thr(0) ...@@ -70,7 +70,6 @@ s_thr(0)
else else
ic->addReadItem( sigc::mem_fun(this,&UNetSender::readItem) ); ic->addReadItem( sigc::mem_fun(this,&UNetSender::readItem) );
// выставляем поля, которые не меняются // выставляем поля, которые не меняются
mypack.nodeID = conf->getLocalNode(); mypack.nodeID = conf->getLocalNode();
mypack.procID = shm->ID(); mypack.procID = shm->ID();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment