Commit 670d17f9 authored by Pavel Vainerman's avatar Pavel Vainerman

(2.0): - Заменил ТАБУЛЯЦИИ НА ПРОБЕЛЫ по всем исходным файлам - Небольшая…

(2.0): - Заменил ТАБУЛЯЦИИ НА ПРОБЕЛЫ по всем исходным файлам - Небольшая оптимизация по преобразованию сообщений из VoidMessage.
parent 110825cb
...@@ -29,3 +29,4 @@ Version 2.0 ...@@ -29,3 +29,4 @@ Version 2.0
- написать документацию по ModbusSlave - написать документацию по ModbusSlave
- рефакторинг класса логов (DebugStream) - рефакторинг класса логов (DebugStream)
- циклическое хранилище для аварийных следов на основе SQLite - циклическое хранилище для аварийных следов на основе SQLite
...@@ -537,3 +537,4 @@ ModbusRTU::mbErrCode MBSlave::read4314( ModbusRTU::MEIMessageRDI& query, ...@@ -537,3 +537,4 @@ ModbusRTU::mbErrCode MBSlave::read4314( ModbusRTU::MEIMessageRDI& query,
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
...@@ -8,3 +8,4 @@ xsl_DATA = *.xsl skel* ...@@ -8,3 +8,4 @@ xsl_DATA = *.xsl skel*
all-local: all-local:
chmod 'a+x' @PACKAGE@-codegen chmod 'a+x' @PACKAGE@-codegen
\ No newline at end of file
...@@ -611,6 +611,7 @@ end_private(false) ...@@ -611,6 +611,7 @@ end_private(false)
<xsl:if test="normalize-space(@no_check_id)!='1'"> <xsl:if test="normalize-space(@no_check_id)!='1'">
if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( <xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
throw Exception( myname + ": Not found ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") ); throw Exception( myname + ": Not found ID for (<xsl:value-of select="@name"/>) " + conf->getProp(cnode,"<xsl:value-of select="@name"/>") );
</xsl:if> </xsl:if>
if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId ) if( node_<xsl:value-of select="normalize-space(@name)"/> == UniSetTypes::DefaultObjectId )
......
...@@ -32,6 +32,8 @@ Valid options are: ...@@ -32,6 +32,8 @@ Valid options are:
--make-skel name - generate process skeleton (name.src.xml, Name.cc, Name.hh, Makefile.am, main.cc) --make-skel name - generate process skeleton (name.src.xml, Name.cc, Name.hh, Makefile.am, main.cc)
Additional arguments: --no-main, --no-makefile Additional arguments: --no-main, --no-makefile
EOF EOF
[ -n "$1" ] && exit "$1" || exit [ -n "$1" ] && exit "$1" || exit
} }
......
...@@ -33,3 +33,4 @@ depend: ...@@ -33,3 +33,4 @@ depend:
install: install:
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
</rrd> </rrd>
</RRDServer1> </RRDServer1>
</settings> </settings>
<ObjectsMap idfromfile="0"> <ObjectsMap idfromfile="1">
<!-- <!--
Краткие пояснения к полям секции 'sensors' Краткие пояснения к полям секции 'sensors'
========================================== ==========================================
...@@ -273,7 +273,6 @@ ...@@ -273,7 +273,6 @@
</messages> </messages>
<!-- <xi:include href="testID.xml"/> --> <!-- <xi:include href="testID.xml"/> -->
<!-- <xi:include href="testIDnon-exist.xml"/> --> <!-- <xi:include href="testIDnon-exist.xml"/> -->
<Calibrations name="Calibrations"> <Calibrations name="Calibrations">
<diagram name="testcal"> <diagram name="testcal">
<point x="-200" y="-60"/> <point x="-200" y="-60"/>
......
...@@ -54,7 +54,6 @@ bool DBInterface::connect( const string& host, const string& user, const string& ...@@ -54,7 +54,6 @@ bool DBInterface::connect( const string& host, const string& user, const string&
connected = false; connected = false;
return false; return false;
} }
connected = true; connected = true;
return true; return true;
} }
......
...@@ -5,3 +5,4 @@ ulimit -Sc 1000000 ...@@ -5,3 +5,4 @@ ulimit -Sc 1000000
uniset-start.sh -f ./uniset-mysql-dbserver --confile test.xml --name DBServer1 \ uniset-start.sh -f ./uniset-mysql-dbserver --confile test.xml --name DBServer1 \
--unideb-add-levels info,crit,warn,level9,system \ --unideb-add-levels info,crit,warn,level9,system \
--dbserver-buffer-size 100 --dbserver-buffer-size 100
...@@ -28,3 +28,4 @@ pkgconfigdir = $(libdir)/pkgconfig ...@@ -28,3 +28,4 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetSQLite.pc pkgconfig_DATA = libUniSetSQLite.pc
endif endif
\ No newline at end of file
...@@ -5,3 +5,4 @@ ulimit -Sc 1000000 ...@@ -5,3 +5,4 @@ ulimit -Sc 1000000
uniset-start.sh -f ./uniset-sqlite-dbserver --confile test.xml --name DBServer1 \ uniset-start.sh -f ./uniset-sqlite-dbserver --confile test.xml --name DBServer1 \
--unideb-add-levels info,crit,warn,level9,system \ --unideb-add-levels info,crit,warn,level9,system \
--dbserver-buffer-size 100 --dbserver-buffer-size 100
...@@ -30,10 +30,8 @@ void TDelay::setIn( int num, bool state ) ...@@ -30,10 +30,8 @@ void TDelay::setIn( int num, bool state )
{ {
pt.setTiming(0); // reset timer pt.setTiming(0); // reset timer
myout = false; myout = false;
if( dlog.is_info() ) if( dlog.is_info() )
dlog.info() << this << ": set " << myout << endl; dlog.info() << this << ": set " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
return; return;
...@@ -46,10 +44,8 @@ void TDelay::setIn( int num, bool state ) ...@@ -46,10 +44,8 @@ void TDelay::setIn( int num, bool state )
{ {
pt.setTiming(0); // reset timer pt.setTiming(0); // reset timer
myout = true; myout = true;
if( dlog.is_info() ) if( dlog.is_info() )
dlog.info() << this << ": set " << myout << endl; dlog.info() << this << ": set " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
return; return;
...@@ -60,7 +56,6 @@ void TDelay::setIn( int num, bool state ) ...@@ -60,7 +56,6 @@ void TDelay::setIn( int num, bool state )
{ {
if( dlog.is_info() ) if( dlog.is_info() )
dlog.info() << this << ": set timer " << delay << " [msec]" << endl; dlog.info() << this << ": set timer " << delay << " [msec]" << endl;
pt.setTiming(delay); pt.setTiming(delay);
} }
} }
......
...@@ -62,7 +62,6 @@ void TOR::setIn( int num, bool state ) ...@@ -62,7 +62,6 @@ void TOR::setIn( int num, bool state )
if( dlog.is_info() ) if( dlog.is_info() )
dlog.info() << this << ": myout " << myout << endl; dlog.info() << this << ": myout " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
} }
......
...@@ -2484,7 +2484,6 @@ bool MBExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniXM ...@@ -2484,7 +2484,6 @@ bool MBExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniXM
if( dlog.is_info() ) if( dlog.is_info() )
dlog.info() << myname << "(initDeviceInfo): add addr=" << ModbusRTU::addr2str(a) << endl; dlog.info() << myname << "(initDeviceInfo): add addr=" << ModbusRTU::addr2str(a) << endl;
int tout = it.getPIntProp("timeout",5000); int tout = it.getPIntProp("timeout",5000);
d->second->resp_ptTimeout.setTiming(tout); d->second->resp_ptTimeout.setTiming(tout);
d->second->resp_invert = it.getIntProp("invert"); d->second->resp_invert = it.getIntProp("invert");
......
...@@ -85,3 +85,4 @@ pkgconfig_DATA = libUniSetMBTCPMaster.pc libUniSetRTU.pc ...@@ -85,3 +85,4 @@ pkgconfig_DATA = libUniSetMBTCPMaster.pc libUniSetRTU.pc
all-local: all-local:
ln -sf ../ModbusMaster/$(devel_include_HEADERS) ../include ln -sf ../ModbusMaster/$(devel_include_HEADERS) ../include
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
--mbtcp-recv-timeout 5000 \ --mbtcp-recv-timeout 5000 \
--mbtcp-force-disconnect 1 \ --mbtcp-force-disconnect 1 \
--mbtcp-polltime 3000 \ --mbtcp-polltime 3000 \
#--mbtcp-set-prop-prefix tcp_
--mbtcp-force-out 1 \ --mbtcp-force-out 1 \
$* $*
......
...@@ -20,3 +20,4 @@ $* ...@@ -20,3 +20,4 @@ $*
#--mbtcp-exchange-mode-id MB1_Mode_AS \ #--mbtcp-exchange-mode-id MB1_Mode_AS \
#--mbtcp-filter-field mbtcp --mbtcp-filter-value 1 #--mbtcp-filter-field mbtcp --mbtcp-filter-value 1
#--mbtcp-set-prop-prefix rs_ \ #--mbtcp-set-prop-prefix rs_ \
...@@ -1490,7 +1490,6 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query, ...@@ -1490,7 +1490,6 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query,
{ {
if( dlog.is_warn() ) if( dlog.is_warn() )
dlog.warn() << myname << "(readInputStatus): " << ex << endl; dlog.warn() << myname << "(readInputStatus): " << ex << endl;
return ModbusRTU::erBadDataAddress; return ModbusRTU::erBadDataAddress;
} }
catch( Exception& ex ) catch( Exception& ex )
......
...@@ -4,3 +4,4 @@ ln -s -f ../../Utilities/scripts/uniset-start.sh ...@@ -4,3 +4,4 @@ ln -s -f ../../Utilities/scripts/uniset-start.sh
ln -s -f ../../Utilities/scripts/uniset-stop.sh stop.sh ln -s -f ../../Utilities/scripts/uniset-stop.sh stop.sh
ln -s -f ../../Utilities/scripts/uniset-functions.sh ln -s -f ../../Utilities/scripts/uniset-functions.sh
ln -s -f ../../conf/test.xml test.xml ln -s -f ../../conf/test.xml test.xml
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
uniset-start.sh -f ./uniset-rrdserver --confile test.xml \ uniset-start.sh -f ./uniset-rrdserver --confile test.xml \
--rrd-name RRDServer1 \ --rrd-name RRDServer1 \
--dlog-add-levels info,crit,warn --dlog-add-levels info,crit,warn
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "NCRestorer.h" #include "NCRestorer.h"
#include "SharedMemory.h" #include "SharedMemory.h"
#include "Extensions.h" #include "Extensions.h"
#include "ORepHelpers.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace UniSetTypes;
...@@ -55,11 +56,9 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname ) ...@@ -55,11 +56,9 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
// ---------------------- // ----------------------
buildHistoryList(cnode); buildHistoryList(cnode);
signal_change_value().connect(sigc::mem_fun(*this, &SharedMemory::updateHistory)); signal_change_value().connect(sigc::mem_fun(*this, &SharedMemory::updateHistory));
for( History::iterator i=hist.begin(); i!=hist.end(); ++i ) for( History::iterator i=hist.begin(); i!=hist.end(); ++i )
histmap[i->fuse_id].push_back(i); histmap[i->fuse_id].push_back(i);
// ---------------------- // ----------------------
restorer = NULL; restorer = NULL;
NCRestorer_XML* rxml = new NCRestorer_XML(datafile); NCRestorer_XML* rxml = new NCRestorer_XML(datafile);
...@@ -814,8 +813,7 @@ void SharedMemory::updateHistory( IOStateList::iterator& s_it, IOController* ) ...@@ -814,8 +813,7 @@ void SharedMemory::updateHistory( IOStateList::iterator& s_it, IOController* )
else if( s_it->second.type == UniversalIO::AI || else if( s_it->second.type == UniversalIO::AI ||
s_it->second.type == UniversalIO::AO ) s_it->second.type == UniversalIO::AO )
{ {
if( sm->sensor_type == UniversalIO::DigitalInput || if( !it->fuse_use_val )
sm->sensor_type == UniversalIO::DigitalOutput )
{ {
bool st = (bool)value; bool st = (bool)value;
...@@ -832,8 +830,7 @@ void SharedMemory::updateHistory( IOStateList::iterator& s_it, IOController* ) ...@@ -832,8 +830,7 @@ void SharedMemory::updateHistory( IOStateList::iterator& s_it, IOController* )
m_historySignal.emit( &(*it) ); m_historySignal.emit( &(*it) );
} }
} }
else if( sm->sensor_type == UniversalIO::AnalogInput || else
sm->sensor_type == UniversalIO::AnalogOutput )
{ {
if( value == it->fuse_val ) if( value == it->fuse_val )
{ {
......
...@@ -301,10 +301,14 @@ class SharedMemory: ...@@ -301,10 +301,14 @@ class SharedMemory:
id(0), id(0),
size(0),filter(""), size(0),filter(""),
fuse_id(UniSetTypes::DefaultObjectId), fuse_id(UniSetTypes::DefaultObjectId),
fuse_invert(false),fuse_use_val(false),fuse_val(0) fuse_invert(false),fuse_use_val(false),fuse_val(0),
fuse_sec(0),fuse_usec(0)
{ {
struct timeval tv;
struct timezone tz; struct timezone tz;
gettimeofday(&fuse_tm,&tz); gettimeofday(&tv,&tz);
fuse_sec = tv.tv_sec;
fuse_usec = tv.tv_usec;
} }
long id; // ID long id; // ID
...@@ -315,13 +319,21 @@ class SharedMemory: ...@@ -315,13 +319,21 @@ class SharedMemory:
bool fuse_invert; bool fuse_invert;
bool fuse_use_val; bool fuse_use_val;
long fuse_val; long fuse_val;
struct timeval fuse_tm; // timestamp // timestamp
long fuse_sec;
long fuse_usec;
}; };
friend std::ostream& operator<<( std::ostream& os, const HistoryInfo& h ); friend std::ostream& operator<<( std::ostream& os, const HistoryInfo& h );
typedef std::list<HistoryInfo> History; typedef std::list<HistoryInfo> History;
// т.к. могуть быть одинаковые "детонаторы" для разных "историй" то,
// вводим не просто map, а "map списка историй".
// точнее итераторов-историй.
typedef std::list<History::iterator> HistoryItList;
typedef std::map<UniSetTypes::ObjectId,HistoryItList> HistoryFuseMap;
typedef sigc::signal<void,HistoryInfo*> HistorySlot; typedef sigc::signal<void,HistoryInfo*> HistorySlot;
HistorySlot signal_history(); /*!< сигнал о срабатывании условий "сборса" дампа истории */ HistorySlot signal_history(); /*!< сигнал о срабатывании условий "сборса" дампа истории */
...@@ -345,7 +357,6 @@ class SharedMemory: ...@@ -345,7 +357,6 @@ class SharedMemory:
// virtual void dumpToDB(){} // virtual void dumpToDB(){}
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ); bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec );
void buildEventList( xmlNode* cnode ); void buildEventList( xmlNode* cnode );
void readEventList( std::string oname ); void readEventList( std::string oname );
...@@ -407,6 +418,7 @@ class SharedMemory: ...@@ -407,6 +418,7 @@ class SharedMemory:
bool dblogging; bool dblogging;
History hist; History hist;
HistoryFuseMap histmap; /*!< map для оптимизации поиска */
virtual void updateHistory( IOStateList::iterator& it, IOController* ); virtual void updateHistory( IOStateList::iterator& it, IOController* );
virtual void saveHistory(); virtual void saveHistory();
......
...@@ -123,7 +123,6 @@ sender2(0) ...@@ -123,7 +123,6 @@ sender2(0)
if( dlog.is_info() ) if( dlog.is_info() )
dlog.info() << myname << "(init): init sender.. my node " << n_it.getProp("name") << endl; dlog.info() << myname << "(init): init sender.. my node " << n_it.getProp("name") << endl;
sender = new UNetSender(h,p,shm,s_field,s_fvalue,ic); sender = new UNetSender(h,p,shm,s_field,s_fvalue,ic);
sender->setSendPause(sendpause); sender->setSendPause(sendpause);
...@@ -254,7 +253,6 @@ sender2(0) ...@@ -254,7 +253,6 @@ sender2(0)
if( dlog.is_info() ) if( dlog.is_info() )
dlog.info() << myname << "(init): (node='" << n << "') add receiver " dlog.info() << myname << "(init): (node='" << n << "') add receiver "
<< h2 << ":" << p2 << endl; << h2 << ":" << p2 << endl;
UNetReceiver* r = new UNetReceiver(h,p,shm); UNetReceiver* r = new UNetReceiver(h,p,shm);
// на всякий принудительно разблокируем, // на всякий принудительно разблокируем,
...@@ -627,7 +625,6 @@ void UNetExchange::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -627,7 +625,6 @@ void UNetExchange::askSensors( UniversalIO::UIOCommand cmd )
if( dlog.is_crit() ) if( dlog.is_crit() )
dlog.crit() << err.str() << endl; dlog.crit() << err.str() << endl;
kill(SIGTERM,getpid()); // прерываем (перезапускаем) процесс... kill(SIGTERM,getpid()); // прерываем (перезапускаем) процесс...
throw SystemError(err.str()); throw SystemError(err.str());
} }
......
...@@ -4,3 +4,4 @@ uniset-start.sh -f ./uniset-unetexchange --unet-name UNetExchange \ ...@@ -4,3 +4,4 @@ uniset-start.sh -f ./uniset-unetexchange --unet-name UNetExchange \
--confile test.xml --smemory-id SharedMemory \ --confile test.xml --smemory-id SharedMemory \
--unet-filter-field rs --unet-filter-value 2 --unet-maxdifferense 40 \ --unet-filter-field rs --unet-filter-value 2 --unet-maxdifferense 40 \
--dlog-add-levels info,crit,warn --dlog-add-levels info,crit,warn
...@@ -35,9 +35,10 @@ class Calibration ...@@ -35,9 +35,10 @@ class Calibration
/*! /*!
Получение калиброванного значения Получение калиброванного значения
\param raw - сырое значение \param raw - сырое значение
\param crop_raw - обрезать переданное значение по крайним точкам
\return Возвращает калиброванное \return Возвращает калиброванное
*/ */
long getValue( long raw ); long getValue( long raw, bool crop_raw=false );
/*! Возвращает минимальное значение 'x' встретившееся в диаграмме */ /*! Возвращает минимальное значение 'x' встретившееся в диаграмме */
inline long getMinVal(){ return minVal; } inline long getMinVal(){ return minVal; }
......
// $Id: DigitalFilter.h,v 1.1 2008/12/14 21:57:50 vpashka Exp $
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Цифровой фильтр с двумя (опционально) уровнями фильтрации сигнала // Цифровой фильтр с двумя (опционально) уровнями фильтрации сигнала
// Первый уровень фильтра усредняет несколько значений, переданных через массив // Первый уровень фильтра усредняет несколько значений, переданных через массив
......
// $Id: Extensions.h,v 1.1 2008/12/14 21:57:50 vpashka Exp $
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
#ifndef Extensions_H_ #ifndef Extensions_H_
#define Extensions_H_ #define Extensions_H_
......
// $Id: IOBase.h,v 1.3 2009/01/23 23:56:54 vpashka Exp $
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef IOBase_H_ #ifndef IOBase_H_
#define IOBase_H_ #define IOBase_H_
......
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! \version $Id: MTR.h,v 1.1 2008/12/14 21:57:50 vpashka Exp $
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef _MTR_H_ #ifndef _MTR_H_
#define _MTR_H_ #define _MTR_H_
......
// $Id: PID.h,v 1.1 2008/12/14 21:57:50 vpashka Exp $
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef PID_H_ #ifndef PID_H_
#define PID_H_ #define PID_H_
......
/* $Id: SMInterface.h,v 1.1 2008/12/14 21:57:50 vpashka Exp $ */
//--------------------------------------------------------------------------
#ifndef SMInterface_H_ #ifndef SMInterface_H_
#define SMInterface_H_ #define SMInterface_H_
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
#include <string> #include <string>
#include "UniSetTypes.h" #include "UniSetTypes.h"
#include "Mutex.h"
#include "IONotifyController.h" #include "IONotifyController.h"
#include "UInterface.h" #include "UInterface.h"
class SMInterface class SMInterface
......
#ifndef SingleProcess_H_
#define SingleProcess_H_
// --------------------------------------------------------------------------
#include <string>
// --------------------------------------------------------------------------
/*! Базовый класс для одиночных процессов.
Обеспечивает корректное завершение процесса,
даже по сигналам...
*/
class SingleProcess
{
public:
SingleProcess();
virtual ~SingleProcess();
protected:
virtual void term( int signo ){}
static void set_signals( bool ask );
private:
static void terminated( int signo );
static void finishterm( int signo );
};
// --------------------------------------------------------------------------
#endif // SingleProcess_H_
// --------------------------------------------------------------------------
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/* /*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE. DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
...@@ -12,19 +13,19 @@ ...@@ -12,19 +13,19 @@
#ifndef UObject_SK_H_ #ifndef UObject_SK_H_
#define UObject_SK_H_ #define UObject_SK_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include <string>
#include "UniSetObject.h" #include "UniSetObject.h"
#include "LT_Object.h" #include "LT_Object.h"
#include "UniXML.h" #include "UniXML.h"
#include "Trigger.h" #include "Trigger.h"
#include "SMInterface.h" #include "DebugStream.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class UObject_SK: class UObject_SK:
public UniSetObject, public UniSetObject,
public LT_Object public LT_Object
{ {
public: public:
UObject_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("UObject"), UObject_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::conf->getNode("UObject"), const std::string& argprefix="" );
UniSetTypes::ObjectId shmID = UniSetTypes::DefaultObjectId );
UObject_SK(); UObject_SK();
virtual ~UObject_SK(); virtual ~UObject_SK();
...@@ -39,27 +40,45 @@ class UObject_SK: ...@@ -39,27 +40,45 @@ class UObject_SK:
DebugStream dlog; DebugStream dlog;
void init_dlog(DebugStream& dlog); void init_dlog(DebugStream& dlog);
void updateValues();
void setInfo( UniSetTypes::ObjectId code, bool state ); // Используемые идентификаторы
// Используемые идентификаторы сообщений
// Текущее значение и предыдущее значение
// --- public variables ---
// --- end of public variables ---
protected: protected:
// --- protected variables ---
// ---- end of protected variables ----
virtual void callback(); virtual void callback();
virtual void processingMessage( UniSetTypes::VoidMessage* msg ); virtual void processingMessage( UniSetTypes::VoidMessage* msg );
virtual void sysCommand( UniSetTypes::SystemMessage* sm ); virtual void sysCommand( UniSetTypes::SystemMessage* sm );
virtual void askSensors( UniversalIO::UIOCommand cmd ); virtual void askSensors( UniversalIO::UIOCommand cmd ){}
virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}; virtual void sensorInfo( UniSetTypes::SensorMessage* sm ){}
virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}; virtual void timerInfo( UniSetTypes::TimerMessage* tm ){}
virtual void sigterm( int signo ); virtual void sigterm( int signo );
virtual bool activateObject(); virtual bool activateObject();
virtual void testMode( bool state ); virtual void testMode( bool state );
void updatePreviousValues(); void updatePreviousValues();
void checkSensors(); void checkSensors();
void updateOutputs( bool force ); void updateOutputs( bool force );
bool checkTestMode();
void preAskSensors( UniversalIO::UIOCommand cmd );
void preSensorInfo( UniSetTypes::SensorMessage* sm ); void preSensorInfo( UniSetTypes::SensorMessage* sm );
void preTimerInfo( UniSetTypes::TimerMessage* tm ); void preTimerInfo( UniSetTypes::TimerMessage* tm );
void waitSM( int wait_msec ); void waitSM( int wait_msec, UniSetTypes::ObjectId testID = UniSetTypes::DefaultObjectId );
void resetMsg(); void resetMsg();
Trigger trResetMsg; Trigger trResetMsg;
...@@ -71,24 +90,37 @@ class UObject_SK: ...@@ -71,24 +90,37 @@ class UObject_SK:
int sleep_msec; /*!< пауза между итерациями */ int sleep_msec; /*!< пауза между итерациями */
bool active; bool active;
bool isTestMode;
Trigger trTestMode; UniSetTypes::ObjectId smTestID; /*!< идентификатор датчика для тестирования готовности SM */
UniSetTypes::ObjectId idTestMode_S; /*!< идентификатор для флага тестовго режима (для всех) */
UniSetTypes::ObjectId idLocalTestMode_S; /*!< идентификатор для флага тестовго режима (для данного узла) */ // управление датчиком "сердцебиения"
bool in_TestMode_S; PassiveTimer ptHeartBeat; /*! < период "сердцебиения" */
bool in_LocalTestMode_S; UniSetTypes::ObjectId idHeartBeat; /*! < идентификатор датчика (AI) "сердцебиения" */
int maxHeartBeat; /*! < сохраняемое значение */
xmlNode* confnode; xmlNode* confnode;
SMInterface shm; /*! получить числовое свойство из конф. файла по привязанной confnode */
int getIntProp(const std::string& name) { return UniSetTypes::conf->getIntProp(confnode, name); }
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline const std::string getProp(const std::string& name) { return UniSetTypes::conf->getProp(confnode, name); }
int smReadyTimeout; /*!< время ожидания готовности SM */ int smReadyTimeout; /*!< время ожидания готовности SM */
bool activated; bool activated;
int activateTimeout; /*!< время ожидания готовности UniSetObject к работе */ int activateTimeout; /*!< время ожидания готовности UniSetObject к работе */
PassiveTimer ptStartUpTimeout; /*!< время на блокировку обработки WatchDog, если недавно был StartUp */ PassiveTimer ptStartUpTimeout; /*!< время на блокировку обработки WatchDog, если недавно был StartUp */
int askPause; /*!< пауза между неудачными попытками заказать датчики */
IOController_i::SensorInfo si;
private: private:
IOController_i::SensorInfo si; // --- private variables ---
// --- end of private variables ---
bool end_private; // вспомогательное поле (для внутреннего использования при генерировании кода)
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! \version $Id: RTUTypes.h,v 1.1 2008/12/14 21:57:50 vpashka Exp $
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef _RTUTypes_H_ #ifndef _RTUTypes_H_
#define _RTUTypes_H_ #define _RTUTypes_H_
......
...@@ -188,9 +188,10 @@ bool UObject_SK::alarm( UniSetTypes::ObjectId _code, bool _state ) ...@@ -188,9 +188,10 @@ bool UObject_SK::alarm( UniSetTypes::ObjectId _code, bool _state )
ulog.level1(false) << endl; ulog.level1(false) << endl;
} }
if( ulog.is_level1() ) if( ulog.is_level1() )
ulog.level1() << " not found MessgeOID?!!" << endl; ulog.level1() << " not found MessgeOID?!!" << endl;
return false; return false;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -5,3 +5,4 @@ noinst_PROGRAMS = calibration ...@@ -5,3 +5,4 @@ noinst_PROGRAMS = calibration
calibration_SOURCES = calibration.cc calibration_SOURCES = calibration.cc
calibration_LDADD = $(top_builddir)/lib/libUniSet.la $(top_builddir)/extensions/lib/libUniSetExtensions.la calibration_LDADD = $(top_builddir)/lib/libUniSet.la $(top_builddir)/extensions/lib/libUniSetExtensions.la
calibration_CPPFLAGS = -I$(top_builddir)/include -I$(top_builddir)/extensions/include calibration_CPPFLAGS = -I$(top_builddir)/include -I$(top_builddir)/extensions/include
../../../Utilities/scripts/uniset-stop.sh
\ No newline at end of file
../../../Utilities/scripts/uniset-functions.sh
\ No newline at end of file
../../../Utilities/scripts/uniset-start.sh
\ No newline at end of file
...@@ -316,3 +316,4 @@ class IONotifyController: ...@@ -316,3 +316,4 @@ class IONotifyController:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#endif #endif
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -81,6 +81,10 @@ namespace UniSetTypes ...@@ -81,6 +81,10 @@ namespace UniSetTypes
class VoidMessage : public Message class VoidMessage : public Message
{ {
public: public:
// для оптимизации, делаем конструктор который не будет инициализировать свойства класса
// это необходимо для VoidMessage, который конструируется при помощи memcpy
VoidMessage( int dummy ):Message(dummy){}
VoidMessage( const TransportMessage& tm ); VoidMessage( const TransportMessage& tm );
VoidMessage(); VoidMessage();
inline bool operator < ( const VoidMessage& msg ) const inline bool operator < ( const VoidMessage& msg ) const
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/*! \file /*! \file
* \brief Интерфейс к объекту сохраняющему список заказчиков для NotifyController-ов * \brief Интерфейс к объекту сохраняющему список заказчиков для NotifyController-ов
* \author Pavel Vainerman * \author Pavel Vainerman
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef NCRestorer_H_ #ifndef NCRestorer_H_
#define NCRestorer_H_ #define NCRestorer_H_
......
...@@ -4775,3 +4775,4 @@ SWIG_init(void) { ...@@ -4775,3 +4775,4 @@ SWIG_init(void) {
return; return;
#endif #endif
} }
...@@ -4327,3 +4327,4 @@ SWIG_init(void) { ...@@ -4327,3 +4327,4 @@ SWIG_init(void) {
return; return;
#endif #endif
} }
...@@ -4988,3 +4988,4 @@ SWIG_init(void) { ...@@ -4988,3 +4988,4 @@ SWIG_init(void) {
return; return;
#endif #endif
} }
...@@ -6400,3 +6400,4 @@ SWIG_init(void) { ...@@ -6400,3 +6400,4 @@ SWIG_init(void) {
return; return;
#endif #endif
} }
...@@ -108,3 +108,5 @@ UConnector_swigregister = _pyUConnector.UConnector_swigregister ...@@ -108,3 +108,5 @@ UConnector_swigregister = _pyUConnector.UConnector_swigregister
UConnector_swigregister(UConnector) UConnector_swigregister(UConnector)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
...@@ -108,3 +108,5 @@ USysError_swigregister = _pyUExceptions.USysError_swigregister ...@@ -108,3 +108,5 @@ USysError_swigregister = _pyUExceptions.USysError_swigregister
USysError_swigregister(USysError) USysError_swigregister(USysError)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
...@@ -164,3 +164,5 @@ USysError_swigregister = _pyUModbus.USysError_swigregister ...@@ -164,3 +164,5 @@ USysError_swigregister = _pyUModbus.USysError_swigregister
USysError_swigregister(USysError) USysError_swigregister(USysError)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
...@@ -172,3 +172,5 @@ USysError_swigregister = _pyUniSet.USysError_swigregister ...@@ -172,3 +172,5 @@ USysError_swigregister = _pyUniSet.USysError_swigregister
USysError_swigregister(USysError) USysError_swigregister(USysError)
# This file is compatible with both classic and new-style classes. # This file is compatible with both classic and new-style classes.
...@@ -43,3 +43,4 @@ if __name__ == "__main__": ...@@ -43,3 +43,4 @@ if __name__ == "__main__":
except UException, e: except UException, e:
print "(testUI): catch exception: " + str(e.getError()) print "(testUI): catch exception: " + str(e.getError())
\ No newline at end of file
...@@ -333,7 +333,6 @@ void IONotifyController::localSetValue( IOController::IOStateList::iterator& li, ...@@ -333,7 +333,6 @@ void IONotifyController::localSetValue( IOController::IOStateList::iterator& li,
if( ulog.is_info() ) if( ulog.is_info() )
ulog.info() << err.str() << endl; ulog.info() << err.str() << endl;
throw IOController_i::NameNotFound(err.str().c_str()); throw IOController_i::NameNotFound(err.str().c_str());
} }
...@@ -382,7 +381,6 @@ void IONotifyController::localSetValue( IOController::IOStateList::iterator& li, ...@@ -382,7 +381,6 @@ void IONotifyController::localSetValue( IOController::IOStateList::iterator& li,
checkThreshold(li,si,true); checkThreshold(li,si,true);
} }
catch(...){} catch(...){}
>>>>>>> (2.0): Поменял механизм "зависимостей". Реализовал на освное сигналов(sigc), сменил формат. Теперь задаётся свойством depend='', depend_value='', depend_off_value=''
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
/*! /*!
......
...@@ -58,7 +58,7 @@ TransportMessage Message::transport(const In &msg) ...@@ -58,7 +58,7 @@ TransportMessage Message::transport(const In &msg)
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
VoidMessage::VoidMessage( const TransportMessage& tm ): VoidMessage::VoidMessage( const TransportMessage& tm ):
Message(1) // вызываем dummy-конструктор Message(1) // вызываем dummy-конструктор, который не инициализирует данные (оптимизация)
{ {
assert(sizeof(VoidMessage)>=sizeof(UniSetTypes::RawDataOfTransportMessage)); assert(sizeof(VoidMessage)>=sizeof(UniSetTypes::RawDataOfTransportMessage));
memcpy(this,&tm.data,sizeof(tm.data)); memcpy(this,&tm.data,sizeof(tm.data));
...@@ -107,7 +107,8 @@ tid(UniSetTypes::DefaultThresholdId) ...@@ -107,7 +107,8 @@ tid(UniSetTypes::DefaultThresholdId)
sm_tv_usec = tm.tv_usec; sm_tv_usec = tm.tv_usec;
} }
SensorMessage::SensorMessage(const VoidMessage *msg) SensorMessage::SensorMessage(const VoidMessage *msg):
Message(1) // вызываем dummy-конструктор, который не инициализирует данные (оптимизация)
{ {
memcpy(this,msg,sizeof(*this)); memcpy(this,msg,sizeof(*this));
assert(this->type == Message::SensorInfo); assert(this->type == Message::SensorInfo);
...@@ -127,14 +128,15 @@ SystemMessage::SystemMessage(Command command, Priority priority, ObjectId consum ...@@ -127,14 +128,15 @@ SystemMessage::SystemMessage(Command command, Priority priority, ObjectId consum
this->consumer = consumer; this->consumer = consumer;
} }
SystemMessage::SystemMessage(const VoidMessage *msg) SystemMessage::SystemMessage(const VoidMessage *msg):
Message(1) // вызываем dummy-конструктор, который не инициализирует данные (оптимизация)
{ {
memcpy(this,msg,sizeof(*this)); memcpy(this,msg,sizeof(*this));
assert(this->type == Message::SysCommand); assert(this->type == Message::SysCommand);
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
TimerMessage::TimerMessage(): TimerMessage::TimerMessage():
id(UniSetTypes::DefaultTimerId) id(UniSetTypes::DefaultTimerId)
{ {
type = Message::Timer; type = Message::Timer;
} }
...@@ -146,13 +148,15 @@ id(id) ...@@ -146,13 +148,15 @@ id(id)
this->consumer = cons; this->consumer = cons;
} }
TimerMessage::TimerMessage(const VoidMessage *msg) TimerMessage::TimerMessage(const VoidMessage *msg):
Message(1) // вызываем dummy-конструктор, который не инициализирует данные (оптимизация)
{ {
memcpy(this,msg,sizeof(*this)); memcpy(this,msg,sizeof(*this));
assert(this->type == Message::Timer); assert(this->type == Message::Timer);
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
ConfirmMessage::ConfirmMessage( const VoidMessage *msg ) ConfirmMessage::ConfirmMessage( const VoidMessage *msg ):
Message(1) // вызываем dummy-конструктор, который не инициализирует данные (оптимизация)
{ {
memcpy(this,msg,sizeof(*this)); memcpy(this,msg,sizeof(*this));
assert(this->type == Message::Confirm); assert(this->type == Message::Confirm);
......
...@@ -51,6 +51,7 @@ int main(int argc, const char **argv) ...@@ -51,6 +51,7 @@ int main(int argc, const char **argv)
UniversalIO::IOType t3=conf->getIOType("Input1_S"); UniversalIO::IOType t3=conf->getIOType("Input1_S");
cout << "**** check getIOType(name): for short name 'Input1_S': (" << t3 << ") " << ( t3 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl; cout << "**** check getIOType(name): for short name 'Input1_S': (" << t3 << ") " << ( t3 == UniversalIO::UnknownIOType ? "FAILED" : "OK" ) << endl;
int i1 = uni_atoi("-100"); int i1 = uni_atoi("-100");
cout << "**** check uni_atoi: '-100' " << ( ( i1 != -100 ) ? "FAILED" : "OK" ) << endl; cout << "**** check uni_atoi: '-100' " << ( ( i1 != -100 ) ? "FAILED" : "OK" ) << endl;
......
...@@ -96,6 +96,7 @@ int main() ...@@ -96,6 +96,7 @@ int main()
} }
cerr << "DelayTimer: TEST10 OK! " << endl; cerr << "DelayTimer: TEST10 OK! " << endl;
DelayTimer dtm3(200,100); DelayTimer dtm3(200,100);
dtm3.check(true); dtm3.check(true);
msleep(190); msleep(190);
......
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