Commit 780ac8b6 authored by Pavel Vainerman's avatar Pavel Vainerman

Подправил TODO, а так же мелкие правки форматирования

parent a07949d3
...@@ -2,5 +2,4 @@ ...@@ -2,5 +2,4 @@
# This file is part of the UniSet library # # This file is part of the UniSet library #
############################################################################ ############################################################################
SUBDIRS = UniSetTypes Processes Services SUBDIRS = UniSetTypes Processes
include $(top_builddir)/conf/common.mk
...@@ -8,9 +8,8 @@ HHDIR=$(top_builddir)/include ...@@ -8,9 +8,8 @@ HHDIR=$(top_builddir)/include
# Исходные файлы IDL # Исходные файлы IDL
IDLFILES=IOController_i.idl IDLFILES=IOController_i.idl
#UniSetObserver_i.idl
include $(top_builddir)/conf/idl.mk include $(top_builddir)/IDL/idl.mk
idl_include_HEADERS = *.idl idl_include_HEADERS = *.idl
idl_includedir = $(datadir)/idl/@PACKAGE@/Processes idl_includedir = $(datadir)/idl/@PACKAGE@/Processes
...@@ -7,9 +7,9 @@ CCDIR=$(top_builddir)/src/ObjectRepository ...@@ -7,9 +7,9 @@ CCDIR=$(top_builddir)/src/ObjectRepository
HHDIR=$(top_builddir)/include HHDIR=$(top_builddir)/include
# Исходные файлы IDL # Исходные файлы IDL
IDLFILES=UniSetTypes_i.idl UniSetObject_i.idl ObjectsManager_i.idl IDLFILES=UniSetTypes_i.idl UniSetObject_i.idl UniSetManager_i.idl
include $(top_builddir)/conf/idl.mk include $(top_builddir)/IDL/idl.mk
idl_include_HEADERS = *.idl idl_include_HEADERS = *.idl
idl_includedir = $(datadir)/idl/@PACKAGE@/UniSetTypes idl_includedir = $(datadir)/idl/@PACKAGE@/UniSetTypes
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/*! \file /*! \file
* \author Pavel Vainerman * \author Pavel Vainerman
* \date $Date: 2007/12/17 22:50:59 $
* \version $Id: UniSetObject_i.idl,v 1.4 2007/12/17 22:50:59 vpashka Exp $
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef UniSetObject_i_IDL_ #ifndef UniSetObject_i_IDL_
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/*! \file /*! \file
* \author Pavel Vainerman * \author Pavel Vainerman
* \date $Date: 2009/01/23 23:56:54 $
* \version $Id: UniSetTypes_i.idl,v 1.9 2009/01/23 23:56:54 vpashka Exp $
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#ifndef UniSetTypes_i_IDL_ #ifndef UniSetTypes_i_IDL_
...@@ -32,13 +30,15 @@ ...@@ -32,13 +30,15 @@
{ {
typedef string<100> BaseObjectName; typedef string<100> BaseObjectName;
typedef long ObjectId; /*!< идентификатор объекта */ typedef long ObjectId; /*!< идентификатор объекта */
typedef long MessageCode; /*!< код сообщения */
typedef long ThresholdId; /*!< идентификатор порога */ typedef long ThresholdId; /*!< идентификатор порога */
typedef long TimerId; /*!< идентификатор таймера */ typedef long TimerId; /*!< идентификатор таймера */
typedef string<30> ObjectType; /*!< тип объекта */ typedef string<30> ObjectType; /*!< тип объекта */
const unsigned short SizeOfTransportMessage=85;
typedef octet ByteOfMessage; /*!< тип для одного байта сообщения */ typedef octet ByteOfMessage; /*!< тип для одного байта сообщения */
typedef ByteOfMessage RawDataOfTransportMessage[100]; /*!< данные в сообщении */ typedef ByteOfMessage RawDataOfTransportMessage[SizeOfTransportMessage]; /*!< данные в сообщении */
/*! /*!
* Структура пакета предназначенного для пересылки по сети * Структура пакета предназначенного для пересылки по сети
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
{ {
ObjectId id; ObjectId id;
boolean connected; boolean connected;
ObjectId infserver;
ObjectId dbserver; ObjectId dbserver;
string host; string host;
string port; string port;
...@@ -95,13 +94,13 @@ ...@@ -95,13 +94,13 @@
/*! /*!
* Типы входов/выходов * Типы входов/выходов
*/ */
enum IOTypes enum IOType
{ {
UnknownIOType, UnknownIOType,
DigitalInput, DI, // DigitalInput
DigitalOutput, DO, // DigitalOutput
AnalogInput, AI, // AnalogInput
AnalogOutput AO // AnalogOutput
}; };
/*! Разрешенные команды для всех контроллеров ввода/вывода */ /*! Разрешенные команды для всех контроллеров ввода/вывода */
......
...@@ -33,3 +33,4 @@ depend: ...@@ -33,3 +33,4 @@ depend:
install: install:
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
FIRSTSUBDIRS=IDL FIRSTSUBDIRS=IDL
SUBDIRS=. src lib include Utilities extensions python docs SUBDIRS=. src lib include Utilities extensions python docs
include $(top_builddir)/conf/common.mk
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSet.pc pkgconfig_DATA = libUniSet.pc
......
...@@ -2,16 +2,13 @@ ...@@ -2,16 +2,13 @@
- Внести в проект реализацию протокола PLCNet // нужно ли - Внести в проект реализацию протокола PLCNet // нужно ли
- написать "uniset-check" автоматический тест основных функций - написать "uniset-check" автоматический тест основных функций (getValue/setValue и т.п.)
(saveState/Value, getState/Value, setState/Value и т.п.)
- сделать, чтобы можно было Debug пускать через syslog (да ещё и на другую машину) - сделать, чтобы можно было Debug пускать через syslog (да ещё и на другую машину)
- Подумать и реализовать механизм хранения ссылок (IOR) с использованием разделяемой памяти... - Подумать и реализовать механизм хранения ссылок (IOR) с использованием разделяемой памяти...
(сейчас есть IORFile и omniNames). // нужно ли (сейчас есть IORFile и omniNames). // нужно ли
- Сделать ObjectIndex_ArrayXML. т.е. использовать vector, при этом считывая индексы из XML. // нужно ли
- (IONotifyController): Разработать механизм заказа переодических уведомлений (msec), независимо от того, менялись ли датчики.. - (IONotifyController): Разработать механизм заказа переодических уведомлений (msec), независимо от того, менялись ли датчики..
- (IONotifyController): Разработать механизм заказа группы датчиков сразу (и ответ тоже группой) - (IONotifyController): Разработать механизм заказа группы датчиков сразу (и ответ тоже группой)
...@@ -19,25 +16,15 @@ ...@@ -19,25 +16,15 @@
admin: admin:
- processing "precision" - processing "precision"
codegen: codegen:
- Сделать работу с TestMode на основе заказа! - Сделать работу с TestMode на основе заказа!
- Сделать работу с ResetMsg на основе askTimer! // подумать нужно ли.. - Сделать работу с ResetMsg на основе askTimer! // подумать нужно ли..
iocontrol:
- добавить ещё один вид сигналов (настройку) "работа по переднему фронту".
Т.е. сигнал меняет своё состояние по изменению входного (типа для кнопок без фиксации). "trigger"(обрабатывать после jar_delay)
Version 2.0 Version 2.0
============ ============
- отказаться от функций getState,setState,saveState,saveValue и оставить только getValue/setValue.
- (DBServer): сделать возможность задать для датчика в configure.xml dbignore="1". Видимо надо встроить это поле в SensorMessgage
- удалить AlarmMessage,InfoMessage,InfoServer,TimerServer(подумать),ISRestorer,MessageInteface_xxx,SystemGuard
т.к. активного распространения не получили (пока-что).
- убрать неиспользуемые нынче классы include/IOs/DigitalCard..
- удалить SandClock.h т.к. он deperecated (вместо него HourGlass.h)
- перейти где нужно на rw-mutex-ы..
- написать документацию по ModbusSlave - написать документацию по ModbusSlave
- циклическое хранилище для аварийных следов на основе SQLite
- отказаться от alias-ов.. (не прижилось, а накладные расходы большие)
- сделать MultiChannelSlave (слушает несколько каналов, но в SM сохраняет данные
только от одного, при пропаже связи переключается на другой и т.д. по кругу)
...@@ -7,6 +7,3 @@ uniset_admin_SOURCES = admin.cc ...@@ -7,6 +7,3 @@ uniset_admin_SOURCES = admin.cc
uniset_admin_LDADD = $(top_builddir)/lib/libUniSet.la uniset_admin_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_admin_CPPFLAGS = -I$(top_builddir)/lib uniset_admin_CPPFLAGS = -I$(top_builddir)/lib
include $(top_builddir)/conf/setting.mk
...@@ -88,7 +88,7 @@ void MBSlave::execute() ...@@ -88,7 +88,7 @@ void MBSlave::execute()
// с проверкой на переполнение // с проверкой на переполнение
askCount = askCount>=numeric_limits<long>::max() ? 0 : askCount+1; askCount = askCount>=numeric_limits<long>::max() ? 0 : askCount+1;
if( res!=ModbusRTU::erNoError ) if( res!=ModbusRTU::erNoError )
errmap[res]++; ++errmap[res];
prev = res; prev = res;
} }
...@@ -116,11 +116,11 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query, ...@@ -116,11 +116,11 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
d.b[6] = 1; d.b[6] = 1;
// Фомирование ответа: // Фомирование ответа:
int bcnt = query.count / ModbusRTU::BitsPerByte; unsigned int bcnt = query.count / ModbusRTU::BitsPerByte;
if( (query.count % ModbusRTU::BitsPerByte) > 0 ) if( (query.count % ModbusRTU::BitsPerByte) > 0 )
bcnt++; bcnt++;
for( int i=0; i<bcnt; i++ ) for( unsigned int i=0; i<bcnt; i++ )
{ {
if( replyVal!=-1 ) if( replyVal!=-1 )
reply.addData(replyVal); reply.addData(replyVal);
...@@ -149,18 +149,18 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query, ...@@ -149,18 +149,18 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query,
while( i<query.count ) while( i<query.count )
{ {
reply.addData(0); reply.addData(0);
for( int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ ) for( unsigned int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
reply.setBit(bnum,nbit,d.b[nbit]); reply.setBit(bnum,nbit,d.b[nbit]);
bnum++; bnum++;
} }
} }
else else
{ {
int bcnt = query.count / ModbusRTU::BitsPerByte; unsigned int bcnt = query.count / ModbusRTU::BitsPerByte;
if( (query.count % ModbusRTU::BitsPerByte) > 0 ) if( (query.count % ModbusRTU::BitsPerByte) > 0 )
bcnt++; bcnt++;
for( int i=0; i<bcnt; i++ ) for( unsigned int i=0; i<bcnt; i++ )
{ {
if( i == 1 ) if( i == 1 )
reply.addData(replyVal2); reply.addData(replyVal2);
...@@ -381,7 +381,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer ...@@ -381,7 +381,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK ); int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <= 0 ) if( fd <= 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl; dwarn << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
...@@ -393,7 +393,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer ...@@ -393,7 +393,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
int ret = ::read(fd,&buf,sizeof(buf)); int ret = ::read(fd,&buf,sizeof(buf));
if( ret < 0 ) if( ret < 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl; dwarn << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
close(fd); close(fd);
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
...@@ -407,7 +407,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer ...@@ -407,7 +407,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
struct stat fs; struct stat fs;
if( fstat(fd,&fs) < 0 ) if( fstat(fd,&fs) < 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl; dwarn << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
close(fd); close(fd);
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
...@@ -422,7 +422,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer ...@@ -422,7 +422,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) ) if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) )
{ {
dlog[Debug::WARN] << "(fileTransfer): set date failed..." << endl; dwarn << "(fileTransfer): set date failed..." << endl;
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
......
...@@ -85,7 +85,7 @@ void MBTCPServer::execute() ...@@ -85,7 +85,7 @@ void MBTCPServer::execute()
// с проверкой на переполнение // с проверкой на переполнение
askCount = askCount>=numeric_limits<long>::max() ? 0 : askCount+1; askCount = askCount>=numeric_limits<long>::max() ? 0 : askCount+1;
if( res!=ModbusRTU::erNoError ) if( res!=ModbusRTU::erNoError )
errmap[res]++; ++errmap[res];
prev = res; prev = res;
} }
...@@ -161,7 +161,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query ...@@ -161,7 +161,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query
while( i<query.count ) while( i<query.count )
{ {
reply.addData(0); reply.addData(0);
for( int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ ) for( unsigned int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
reply.setBit(bnum,nbit,d.b[nbit]); reply.setBit(bnum,nbit,d.b[nbit]);
bnum++; bnum++;
} }
...@@ -172,7 +172,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query ...@@ -172,7 +172,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query
if( (query.count % ModbusRTU::BitsPerByte) > 0 ) if( (query.count % ModbusRTU::BitsPerByte) > 0 )
bcnt++; bcnt++;
for( int i=0; i<bcnt; i++ ) for( unsigned int i=0; i<bcnt; i++ )
reply.addData(replyVal); reply.addData(replyVal);
} }
...@@ -376,7 +376,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage& ...@@ -376,7 +376,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK ); int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <= 0 ) if( fd <= 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl; dwarn << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
...@@ -388,7 +388,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage& ...@@ -388,7 +388,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
int ret = ::read(fd,&buf,sizeof(buf)); int ret = ::read(fd,&buf,sizeof(buf));
if( ret < 0 ) if( ret < 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl; dwarn << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
close(fd); close(fd);
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
...@@ -402,7 +402,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage& ...@@ -402,7 +402,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
struct stat fs; struct stat fs;
if( fstat(fd,&fs) < 0 ) if( fstat(fd,&fs) < 0 )
{ {
dlog[Debug::WARN] << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl; dwarn << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
close(fd); close(fd);
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
...@@ -417,7 +417,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage& ...@@ -417,7 +417,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) ) if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) )
{ {
dlog[Debug::WARN] << "(fileTransfer): set date failed..." << endl; dwarn << "(fileTransfer): set date failed..." << endl;
return ModbusRTU::erOperationFailed; return ModbusRTU::erOperationFailed;
} }
......
...@@ -3,10 +3,7 @@ ...@@ -3,10 +3,7 @@
############################################################################ ############################################################################
SUBDIRS = scripts Admin NullController SViewer-text \ SUBDIRS = scripts Admin NullController SViewer-text \
InfoServer SMonit MBTester codegen SImitator SMonit MBTester codegen SImitator
#MapSourceParser ClassGen
include $(top_builddir)/conf/common.mk
...@@ -7,5 +7,3 @@ uniset_nullController_SOURCES = NullController.cc main.cc ...@@ -7,5 +7,3 @@ uniset_nullController_SOURCES = NullController.cc main.cc
uniset_nullController_LDADD = $(top_builddir)/lib/libUniSet.la uniset_nullController_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_nullController_CPPFLAGS = -I$(top_builddir)/lib $(SIGC_CFLAGS) uniset_nullController_CPPFLAGS = -I$(top_builddir)/lib $(SIGC_CFLAGS)
include $(top_builddir)/conf/setting.mk
...@@ -7,13 +7,11 @@ using namespace UniSetTypes; ...@@ -7,13 +7,11 @@ using namespace UniSetTypes;
using namespace std; using namespace std;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
NullController::NullController( ObjectId id, const string askdump, NullController::NullController( ObjectId id, const string& askdump,
const std::string s_filterField, const std::string& s_filterField,
const std::string s_filterValue, const std::string& s_filterValue,
const std::string c_filterField, const std::string& c_filterField,
const std::string c_filterValue, const std::string& c_filterValue,
const std::string d_filterField,
const std::string d_filterValue,
bool _dumpingToDB ): bool _dumpingToDB ):
IONotifyController(id), IONotifyController(id),
dumpingToDB(_dumpingToDB) dumpingToDB(_dumpingToDB)
...@@ -23,7 +21,6 @@ dumpingToDB(_dumpingToDB) ...@@ -23,7 +21,6 @@ dumpingToDB(_dumpingToDB)
NCRestorer_XML* askd = new NCRestorer_XML(askdump); NCRestorer_XML* askd = new NCRestorer_XML(askdump);
askd->setItemFilter(s_filterField, s_filterValue); askd->setItemFilter(s_filterField, s_filterValue);
askd->setConsumerFilter(c_filterField, c_filterValue); askd->setConsumerFilter(c_filterField, c_filterValue);
askd->setDependsFilter(d_filterField, d_filterValue);
restorer = askd; restorer = askd;
......
...@@ -10,13 +10,11 @@ class NullController: ...@@ -10,13 +10,11 @@ class NullController:
public IONotifyController public IONotifyController
{ {
public: public:
NullController( UniSetTypes::ObjectId id, const std::string restorfile, NullController( UniSetTypes::ObjectId id, const std::string& restorfile,
const std::string s_filterField="", const std::string& s_filterField="",
const std::string s_filterValue="", const std::string& s_filterValue="",
const std::string c_filterField="", const std::string& c_filterField="",
const std::string c_filterValue="", const std::string& c_filterValue="",
const std::string d_filterField="",
const std::string d_filterValue="",
bool _dumpingToDB=false ); bool _dumpingToDB=false );
virtual ~NullController(); virtual ~NullController();
......
#include "Configuration.h" #include "Configuration.h"
#include "NullController.h" #include "NullController.h"
#include "ObjectsActivator.h" #include "UniSetActivator.h"
#include "Debug.h" #include "Debug.h"
#include "PassiveTimer.h" #include "PassiveTimer.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -16,8 +16,6 @@ static void short_usage() ...@@ -16,8 +16,6 @@ static void short_usage()
<< " --s-filter-value value - значение для поля фильтрования списка датчиков \n" << " --s-filter-value value - значение для поля фильтрования списка датчиков \n"
<< " --c-filter-field name - поле для фильтрования списка заказчиков по каждому датчику\n" << " --c-filter-field name - поле для фильтрования списка заказчиков по каждому датчику\n"
<< " --c-filter-value value - значение для поля фильтрования списка заказчиков по каждому датчику\n" << " --c-filter-value value - значение для поля фильтрования списка заказчиков по каждому датчику\n"
<< " --d-filter-field name - поле для фильтрования списка зависимостей по каждому датчику\n"
<< " --d-filter-value value - значение для поля фильтрования списка зависимостей по каждому датчику\n"
<< " --dbDumping [0,1] - создавать ли dump-файл \n"; << " --dbDumping [0,1] - создавать ли dump-файл \n";
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -68,14 +66,12 @@ int main(int argc, char** argv) ...@@ -68,14 +66,12 @@ int main(int argc, char** argv)
string s_fvalue = conf->getArgParam("--s-filter-value"); string s_fvalue = conf->getArgParam("--s-filter-value");
string c_field = conf->getArgParam("--c-filter-field"); string c_field = conf->getArgParam("--c-filter-field");
string c_fvalue = conf->getArgParam("--c-filter-value"); string c_fvalue = conf->getArgParam("--c-filter-value");
string d_field = conf->getArgParam("--d-filter-field");
string d_fvalue = conf->getArgParam("--d-filter-value");
// надо ли писать изменения в БД // надо ли писать изменения в БД
bool dbDumping = conf->getArgInt("--dbDumping"); bool dbDumping = conf->getArgInt("--dbDumping");
NullController nc(ID,askfile,s_field,s_fvalue,c_field,c_fvalue,d_field,d_fvalue,dbDumping); NullController nc(ID,askfile,s_field,s_fvalue,c_field,c_fvalue,dbDumping);
ObjectsActivator act; UniSetActivator act;
act.addObject(static_cast<class UniSetObject*>(&nc)); act.addObject(static_cast<class UniSetObject*>(&nc));
act.run(false); act.run(false);
return 0; return 0;
......
#include <iostream> #include <iostream>
#include "Exceptions.h" #include "Exceptions.h"
#include "UniversalInterface.h" #include "UInterface.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace UniSetTypes;
...@@ -20,7 +20,7 @@ void help_print() ...@@ -20,7 +20,7 @@ void help_print()
struct ExtInfo: struct ExtInfo:
public UniSetTypes::ParamSInfo public UniSetTypes::ParamSInfo
{ {
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int main( int argc, char **argv ) int main( int argc, char **argv )
...@@ -37,7 +37,7 @@ int main( int argc, char **argv ) ...@@ -37,7 +37,7 @@ int main( int argc, char **argv )
// ------------------------------------- // -------------------------------------
uniset_init(argc, argv, "configure.xml" ); uniset_init(argc, argv, "configure.xml" );
UniversalInterface ui; UInterface ui;
string sid(conf->getArgParam("--sid")); string sid(conf->getArgParam("--sid"));
if( sid.empty() ) if( sid.empty() )
...@@ -57,8 +57,8 @@ int main( int argc, char **argv ) ...@@ -57,8 +57,8 @@ int main( int argc, char **argv )
std::list<ExtInfo> l; std::list<ExtInfo> l;
for( std::list<UniSetTypes::ParamSInfo>::iterator it = lst.begin(); it!=lst.end(); ++it ) for( std::list<UniSetTypes::ParamSInfo>::iterator it = lst.begin(); it!=lst.end(); ++it )
{ {
UniversalIO::IOTypes t = conf->getIOType( it->si.id ); UniversalIO::IOType t = conf->getIOType( it->si.id );
if( t != UniversalIO::AnalogInput && t != UniversalIO::AnalogOutput ) if( t != UniversalIO::AI && t != UniversalIO::AO )
{ {
cerr << endl << "Неверный типа датчика '" << t << "' для id='" << it->fname << "'. Тип должен быть AI или AO." << endl << endl; cerr << endl << "Неверный типа датчика '" << t << "' для id='" << it->fname << "'. Тип должен быть AI или AO." << endl << endl;
return 1; return 1;
...@@ -122,9 +122,6 @@ int main( int argc, char **argv ) ...@@ -122,9 +122,6 @@ int main( int argc, char **argv )
{ {
try try
{ {
if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, j, UniversalIO::AnalogInput, DefaultObjectId);
else
ui.setValue(it->si, j, DefaultObjectId); ui.setValue(it->si, j, DefaultObjectId);
} }
catch( Exception& ex ) catch( Exception& ex )
...@@ -150,9 +147,6 @@ int main( int argc, char **argv ) ...@@ -150,9 +147,6 @@ int main( int argc, char **argv )
{ {
try try
{ {
if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, i, UniversalIO::AnalogInput, DefaultObjectId);
else
ui.setValue(it->si, i, DefaultObjectId); ui.setValue(it->si, i, DefaultObjectId);
} }
catch( Exception& ex ) catch( Exception& ex )
......
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "ObjectsActivator.h" #include "UniSetActivator.h"
#include "Configuration.h" #include "Configuration.h"
#include "SMonitor.h" #include "SMonitor.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -33,7 +33,7 @@ int main( int argc, const char **argv ) ...@@ -33,7 +33,7 @@ int main( int argc, const char **argv )
return 0; return 0;
} }
ObjectsActivator act; UniSetActivator act;
SMonitor tp(ID); SMonitor tp(ID);
act.addObject(&tp); act.addObject(&tp);
......
...@@ -6,6 +6,3 @@ bin_PROGRAMS = uniset-sviewer-text ...@@ -6,6 +6,3 @@ bin_PROGRAMS = uniset-sviewer-text
uniset_sviewer_text_SOURCES = main.cc uniset_sviewer_text_SOURCES = main.cc
uniset_sviewer_text_LDADD = $(top_builddir)/lib/libUniSet.la uniset_sviewer_text_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_sviewer_text_CPPFLAGS = -I$(top_builddir)/lib uniset_sviewer_text_CPPFLAGS = -I$(top_builddir)/lib
include $(top_builddir)/conf/setting.mk
...@@ -23,7 +23,7 @@ int main(int argc, const char **argv) ...@@ -23,7 +23,7 @@ int main(int argc, const char **argv)
uniset_init(argc,argv,"configure.xml"); uniset_init(argc,argv,"configure.xml");
/* /*
UniversalInterface ui; UInterface ui;
IDList lst; IDList lst;
lst.add(1); lst.add(1);
lst.add(2); lst.add(2);
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include <xsl:call-template name="preinclude"/>LT_Object.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>LT_Object.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UniXML.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>UniXML.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Trigger.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>Trigger.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UniversalInterface.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>UInterface.h<xsl:call-template name="postinclude"/>
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK: class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/>,</xsl:if> <xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/>,</xsl:if>
......
...@@ -81,8 +81,8 @@ class <xsl:value-of select="$CLASSNAME"/>_SK: ...@@ -81,8 +81,8 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
// Текущее значение и предыдущее значение // Текущее значение и предыдущее значение
<xsl:for-each select="//smap/item"> <xsl:for-each select="//smap/item">
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> </xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>; long <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
<xsl:call-template name="settype"><xsl:with-param name="iotype" select="@iotype"/></xsl:call-template><xsl:text> prev_</xsl:text><xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>; long prev_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
</xsl:for-each> </xsl:for-each>
// --- public variables --- // --- public variables ---
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include &lt;sstream&gt; #include &lt;sstream&gt;
#include <xsl:call-template name="preinclude"/>Configuration.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>Configuration.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>ObjectsActivator.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>UniSetActivator.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Debug.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>Debug.h<xsl:call-template name="postinclude"/>
#include "<xsl:value-of select="$CLASSNAME"/>.h" #include "<xsl:value-of select="$CLASSNAME"/>.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -53,10 +53,6 @@ int main( int argc,char* argv[] ) ...@@ -53,10 +53,6 @@ int main( int argc,char* argv[] )
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" ); string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" );
conf = new Configuration(argc, argv,confile); conf = new Configuration(argc, argv,confile);
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname.c_str() );
// определяем ID объекта // определяем ID объекта
ObjectId ID(DefaultObjectId); ObjectId ID(DefaultObjectId);
...@@ -74,7 +70,11 @@ int main( int argc,char* argv[] ) ...@@ -74,7 +70,11 @@ int main( int argc,char* argv[] )
<xsl:value-of select="$CLASSNAME"/> obj(ID); <xsl:value-of select="$CLASSNAME"/> obj(ID);
ObjectsActivator act; string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
obj.mylog.logFile( logname.c_str() );
UniSetActivator act;
act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj)); act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj));
SystemMessage sm(SystemMessage::StartUp); SystemMessage sm(SystemMessage::StartUp);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include &lt;sstream&gt; #include &lt;sstream&gt;
#include <xsl:call-template name="preinclude"/>Configuration.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>Configuration.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>ObjectsActivator.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>UniSetActivator.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>Debug.h<xsl:call-template name="postinclude"/> #include <xsl:call-template name="preinclude"/>Debug.h<xsl:call-template name="postinclude"/>
#include "<xsl:value-of select="$CLASSNAME"/>.h" #include "<xsl:value-of select="$CLASSNAME"/>.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -55,10 +55,6 @@ int main( int argc, const char** argv ) ...@@ -55,10 +55,6 @@ int main( int argc, const char** argv )
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" ); string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" );
conf = new Configuration(argc, argv, confile); conf = new Configuration(argc, argv, confile);
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
unideb.logFile( logname.c_str() );
<xsl:if test="not(normalize-space(//@OID))=''"> <xsl:if test="not(normalize-space(//@OID))=''">
<xsl:value-of select="$CLASSNAME"/> obj; <xsl:value-of select="$CLASSNAME"/> obj;
...@@ -79,9 +75,14 @@ int main( int argc, const char** argv ) ...@@ -79,9 +75,14 @@ int main( int argc, const char** argv )
} }
} }
<xsl:value-of select="$CLASSNAME"/> obj(ID); <xsl:value-of select="$CLASSNAME"/> obj(ID);
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
string logname( conf->getLogDir() + logfilename );
obj.mylog.logFile( logname.c_str() );
</xsl:if> </xsl:if>
ObjectsActivator act; UniSetActivator act;
act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj)); act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj));
SystemMessage sm(SystemMessage::StartUp); SystemMessage sm(SystemMessage::StartUp);
......
#include <sstream> #include <sstream>
#include <ObjectsActivator.h> #include <UniSetActivator.h>
#include "Skel.h" #include "Skel.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace UniSetTypes; using namespace UniSetTypes;
...@@ -14,14 +14,14 @@ int main( int argc, const char **argv ) ...@@ -14,14 +14,14 @@ int main( int argc, const char **argv )
string logfilename = conf->getArgParam("--logfile", "Skel.log"); string logfilename = conf->getArgParam("--logfile", "Skel.log");
string logname( conf->getLogDir() + logfilename ); string logname( conf->getLogDir() + logfilename );
// dlog.logFile( logname.c_str() ); // dlog.logFile( logname.c_str() );
unideb.logFile( logname.c_str() ); ulog.logFile( logname.c_str() );
// conf->initDebug(dlog,"dlog"); // conf->initDebug(dlog,"dlog");
ObjectsActivator act; UniSetActivator act;
xmlNode* cnode = conf->getNode("Skel"); xmlNode* cnode = conf->getNode("Skel");
if( cnode == NULL ) if( cnode == NULL )
{ {
dlog[Debug::CRIT] << "(Skel): not found <Skel> in conffile" << endl; dlog.crit() << "(Skel): not found <Skel> in conffile" << endl;
return 1; return 1;
} }
...@@ -31,10 +31,10 @@ int main( int argc, const char **argv ) ...@@ -31,10 +31,10 @@ int main( int argc, const char **argv )
SystemMessage sm(SystemMessage::StartUp); SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() ); act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n"; ulog << "\n\n\n";
unideb[Debug::ANY] << "(Skel::main): -------------- Skel START -------------------------\n\n"; ulog << "(Skel::main): -------------- Skel START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n"; dlog << "\n\n\n";
dlog[Debug::ANY] << "(Skel::main): -------------- Skel START -------------------------\n\n"; dlog << "(Skel::main): -------------- Skel START -------------------------\n\n";
act.run(false); act.run(false);
} }
catch(SystemError& err) catch(SystemError& err)
......
...@@ -23,11 +23,11 @@ void Skel::step() ...@@ -23,11 +23,11 @@ void Skel::step()
{ {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Skel::sensorInfo( SensorMessage *sm ) void Skel::sensorInfo( const SensorMessage *sm )
{ {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void Skel::timerInfo( TimerMessage *tm ) void Skel::timerInfo( const TimerMessage *tm )
{ {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
noinst_PROGRAMS = test test2 noinst_PROGRAMS = test test2
#test2 #test2
test_LDADD = $(top_builddir)/lib/libUniSet.la test_LDADD = $(top_builddir)/lib/libUniSet.la $(COMCPP_LIBS)
test_CXXFLAGS = -I$(top_builddir)/include test_CXXFLAGS = -I$(top_builddir)/include $(COMCPP_CGLAGS)
test_SOURCES = TestGen_SK.cc TestGen.cc TestGen-main.cc test_SOURCES = TestGen_SK.cc TestGen.cc TestGen-main.cc
test2_LDADD = $(top_builddir)/lib/libUniSet.la test2_LDADD = $(top_builddir)/lib/libUniSet.la $(COMCPP_LIBS)
test2_CXXFLAGS = -I$(top_builddir)/include test2_CXXFLAGS = -I$(top_builddir)/include $(COMCPP_CGLAGS)
test2_SOURCES = TestGenAlone_SK.cc TestGenAlone.cc TestGenAlone-main.cc test2_SOURCES = TestGenAlone_SK.cc TestGenAlone.cc TestGenAlone-main.cc
GENERATED=TestGen_SK.h TestGen_SK.cc TestGen-main.cc GENERATED=TestGen_SK.h TestGen_SK.cc TestGen-main.cc
GENERATED2=TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc GENERATED2=TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc
GENUOBJ=UObject_SK.cc UObject_SK.h GENUOBJ=UObject_SK.cc UObject_SK.h
$(GENERATED): ../@PACKAGE@-codegen testgen.src.xml ../*.xsl TestGen_SK.cc: ../@PACKAGE@-codegen testgen.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include -n TestGen testgen.src.xml ../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include -n TestGen testgen.src.xml
$(GENERATED2): ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl TestGenAlone_SK.cc: ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml ../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml
$(GENUOBJ): ../@PACKAGE@-codegen uobject.src.xml ../*.xsl $(GENUOBJ): ../@PACKAGE@-codegen uobject.src.xml ../*.xsl
......
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
</variables> </variables>
<smap> <smap>
<!-- name - название переменной в конф. файле --> <!-- name - название переменной в конф. файле -->
<item name="input1_s" vartype="in" iotype="DI" comment="comment for input1" smTestID="1"/> <item name="input1_s" vartype="in" comment="comment for input1" smTestID="1"/>
<item name="input2_s" vartype="in" iotype="DI" comment="comment for input2" /> <item name="input2_s" vartype="in" comment="comment for input2" />
<item name="output1_c" vartype="out" iotype="DO" omment="comment for output1" no_check_id="1"/> <item name="output1_c" vartype="out" omment="comment for output1" no_check_id="1"/>
<item name="loglevel_s" vartype="in" iotype="AI" omment="log level control" loglevel="1"/> <item name="loglevel_s" vartype="in" comment="log level control" loglevel="1"/>
</smap> </smap>
<msgmap> <msgmap>
......
...@@ -2,7 +2,5 @@ ...@@ -2,7 +2,5 @@
# This file is part of the UniSet library # # This file is part of the UniSet library #
############################################################################ ############################################################################
include $(top_builddir)/conf/common.mk
bin_SCRIPTS = uniset-start.sh uniset-stop.sh uniset-functions.sh bin_SCRIPTS = uniset-start.sh uniset-stop.sh uniset-functions.sh
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
%define oname uniset %define oname uniset
Name: libuniset Name: libuniset
Version: 1.7 Version: 2.0
Release: alt3 Release: alt0.2
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
...@@ -202,7 +202,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -202,7 +202,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%files utils %files utils
%_bindir/%oname-admin %_bindir/%oname-admin
%_bindir/%oname-infoserver
%_bindir/%oname-mb* %_bindir/%oname-mb*
%_bindir/%oname-nullController %_bindir/%oname-nullController
%_bindir/%oname-sviewer-text %_bindir/%oname-sviewer-text
...@@ -225,7 +224,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -225,7 +224,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%_includedir/%oname/*.h %_includedir/%oname/*.h
%_includedir/%oname/*.hh %_includedir/%oname/*.hh
%_includedir/%oname/*.tcc %_includedir/%oname/*.tcc
%_includedir/%oname/IOs/
%_includedir/%oname/modbus/ %_includedir/%oname/modbus/
%if_enabled mysql %if_enabled mysql
%_includedir/%oname/mysql/ %_includedir/%oname/mysql/
...@@ -335,6 +333,33 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -335,6 +333,33 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc %exclude %_pkgconfigdir/libUniSet.pc
%changelog %changelog
* Fri Jan 24 2014 Pavel Vainerman <pv@altlinux.ru> 2.0-alt0.2
- oprimization processing message (warning: use reinterpret_cast<> )
* Tue Dec 24 2013 Pavel Vainerman <pv@altlinux.ru> 2.0-alt0.1
- rename "IOTypes" --> "IOType"
- rename DigitalInput --> DI
- rename DigitalOutput --> DO
- rename AnalogInput --> AI
- rename AnalogOutput --> AO
- remove deprecated services: InfoServer,TimeService,SystemGuard
- remove deprecated intefaces: MessageInterface
- remove deprecated messages: AlarmMessage, InfoMessage, DBMessage
- remove 'state' from SensorMessage
- remove deprecated function setState,getState,askState
use simple function: setValue,getValue,askSensor
- possible use of the property 'iotype' in uniset-codegen
- refactoring <depends> mechanism
- add iofront=[01,10] to IOBase
- remove deprecated interfaces (Storages,CycleStorage,TableStorage,TextIndex,..)
- rename unideb --> ulog
- DebugStream refactoring (add new function, add syntax sugar for ulog, dlog /dcrit,dwarn,dlog1,ulog1,ucrit,.../)
- UniversalInterface --> UInterface
- ObjectsManager --> UniSetManager
- ObjectsActitvator --> UniSetActivator
- remove deprecated property: "sensebility"
- rename property "inverse" --> "threshold_invert"
* Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3 * Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3
- add RRDServer - add RRDServer
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<AutoStartUpTime name="1"/> <AutoStartUpTime name="1"/>
<DumpStateTime name="10"/> <DumpStateTime name="10"/>
<SleepTickMS name="500"/> <SleepTickMS name="500"/>
<UniSetDebug levels="crit,warn" name="unideb"/> <UniSetDebug levels="crit,warn" name="ulog"/>
<ConfDir name="./"/> <ConfDir name="./"/>
<DataDir name="./"/> <DataDir name="./"/>
<BinDir name="./"/> <BinDir name="./"/>
...@@ -33,6 +33,22 @@ ...@@ -33,6 +33,22 @@
</UniSet> </UniSet>
<dlog name="dlog"/> <dlog name="dlog"/>
<settings> <settings>
<TestProc name="TestProc1"
on_s="Input1_S"
lamp_c="Lamp58_C"
depend_c="Input4_S"
d1_check_s="Input5_S"
set_d1_check_s="Input5_S"
d2_check_s="AI11_AS"
set_d2_check_s="AI11_AS"
undef_c="AI54_S"
check_undef_s="AI54_S"
t_set_c="AI_AS"
t_check_s="Threshold1_S"
log_c="LogLevel_S"
log_s="LogLevel_S"
/>
<IOControl name="IOControl"/> <IOControl name="IOControl"/>
<testnode id="1000" id2="-100" name="testnode"/> <testnode id="1000" id2="-100" name="testnode"/>
<SharedMemory name="SharedMemory" shmID="SharedMemory"> <SharedMemory name="SharedMemory" shmID="SharedMemory">
...@@ -124,7 +140,7 @@ ...@@ -124,7 +140,7 @@
<UNetExchange name="UNetExchange"/> <UNetExchange name="UNetExchange"/>
<HeartBeatTime time_msec="5000"/> <HeartBeatTime time_msec="5000"/>
<TestGen input1_s="Input1_S" input2_s="DumpSensor1_S" name="TestGen" output1_c="DO_C"/> <TestGen input1_s="Input1_S" input2_s="DumpSensor1_S" name="TestGen" output1_c="DO_C"/>
<RRDStorage1 name="RRDStorage1"> <RRDServer1 name="RRDServer1">
<rrd filename="rrdtest.rrd" filter_field="rrd" filter_value="1" step="5" ds_field="rrd1_ds" overwrite="0"> <rrd filename="rrdtest.rrd" filter_field="rrd" filter_value="1" step="5" ds_field="rrd1_ds" overwrite="0">
<item rra="RRA:AVERAGE:0.5:1:4320"/> <item rra="RRA:AVERAGE:0.5:1:4320"/>
<item rra="RRA:MAX:0.5:1:4320"/> <item rra="RRA:MAX:0.5:1:4320"/>
...@@ -133,7 +149,7 @@ ...@@ -133,7 +149,7 @@
<item rra="RRA:AVERAGE:0.5:1:4320"/> <item rra="RRA:AVERAGE:0.5:1:4320"/>
<item rra="RRA:MAX:0.5:1:4320"/> <item rra="RRA:MAX:0.5:1:4320"/>
</rrd> </rrd>
</RRDStorage1> </RRDServer1>
</settings> </settings>
<ObjectsMap idfromfile="1"> <ObjectsMap idfromfile="1">
<!-- <!--
...@@ -158,16 +174,15 @@ ...@@ -158,16 +174,15 @@
</nodes> </nodes>
<!-- ************************ Датчики ********************** --> <!-- ************************ Датчики ********************** -->
<sensors name="Sensors"> <sensors name="Sensors">
<item db_ignore="1" default="1" id="1" iotype="DI" name="Input1_S" priority="Medium" textname="Команда 1"/> <item dbignore="1" default="1" id="1" iotype="DI" name="Input1_S" priority="Medium" textname="Команда 1"/>
<item id="2" iotype="DI" mbaddr="0x01" mbfunc="0x06" mbreg="0x02" nbit="11" mbtype="rtu" name="Input2_S" priority="Medium" rs="4" textname="Команда 2"/> <item id="2" iotype="DI" mbaddr="0x01" mbfunc="0x06" mbreg="0x02" nbit="11" mbtype="rtu" name="Input2_S" priority="Medium" rs="4" textname="Команда 2"/>
<item id="3" iotype="DI" mbtcp="1" mbtcp_mbaddr="0x02" mbtcp_mbfunc="0x03" mbtcp_mbreg="0x02" mbtcp_mbtype="rtu" name="Input3_S" priority="Medium" textname="Команда 3"/> <item id="3" iotype="DI" mbtcp="1" mbtcp_mbaddr="0x02" mbtcp_mbfunc="0x03" mbtcp_mbreg="0x02" mbtcp_mbtype="rtu" name="Input3_S" priority="Medium" textname="Команда 3"/>
<item id="4" iotype="DI" mbaddr="0x02" mbfunc="0x04" mbreg="0x02" mbtype="rtu" name="Input4_S" priority="Medium" rs="2" textname="Команда 4"/> <item id="4" iotype="DI" mbaddr="0x02" mbfunc="0x04" mbreg="0x02" mbtype="rtu" name="Input4_S" priority="Medium" rs="2" textname="Команда 4"/>
<item id="5" iotype="DI" name="Input5_S" priority="Medium" textname="Команда 5" udp="2"/> <item id="5" iotype="DI" name="Input5_S" priority="Medium" textname="Команда 5" udp="2" depend="Input4_S"/>
<item id="6" iotype="DI" name="Input6_S" priority="Medium" textname="Команда 6" udp="2"> <item id="6" iotype="DI" name="Input6_S" priority="Medium" textname="Команда 6" udp="2"/>
<depends> <item id="11" iotype="AI" name="AI11_AS" priority="Medium" textname="AI 11" depend="Input4_S" depend_off_value="-50"/>
<depend name="Input4_S"/> <item id="12" iotype="DI" name="Input12_S" priority="Medium" textname="Команда 12" iofront="01"/>
</depends> <item id="60" iotype="DI" name="Input60_S" priority="Medium" textname="Команда 61" iofront="10"/>
</item>
<item id="7" iotype="DO" name="DO_C" priority="Medium" textname="Digital output"/> <item id="7" iotype="DO" name="DO_C" priority="Medium" textname="Digital output"/>
<item id="8" iotype="DO" name="DO1_C" priority="Medium" textname="Digital output"/> <item id="8" iotype="DO" name="DO1_C" priority="Medium" textname="Digital output"/>
<item default="1000" id="9" iotype="AO" name="AO_AS" precision="2" priority="Medium" rs="2" rs_channel="1" rs_jack="j1" rs_mbaddr="0x01" rs_mbfunc="0x06" rs_mbreg="0x02" rs_mbtype="rtu188" textname="Analog output"/> <item default="1000" id="9" iotype="AO" name="AO_AS" precision="2" priority="Medium" rs="2" rs_channel="1" rs_jack="j1" rs_mbaddr="0x01" rs_mbfunc="0x06" rs_mbreg="0x02" rs_mbtype="rtu188" textname="Analog output"/>
...@@ -210,7 +225,9 @@ ...@@ -210,7 +225,9 @@
<item id="55" iotype="AI" name="AI55_S" textname="AI sensor 55" rrd="1" rrd1_ds="GAUGE:20:U:U"/> <item id="55" iotype="AI" name="AI55_S" textname="AI sensor 55" rrd="1" rrd1_ds="GAUGE:20:U:U"/>
<item id="56" iotype="AI" name="AI56_S" textname="AI sensor 56" rrd="2" rrd2_ds="COUNTER:20:U:U"/> <item id="56" iotype="AI" name="AI56_S" textname="AI sensor 56" rrd="2" rrd2_ds="COUNTER:20:U:U"/>
<item id="57" iotype="AI" name="AI57_S" textname="AI sensor 57" rrd="2" rrd2_ds="DERIVE:20:U:U"/> <item id="57" iotype="AI" name="AI57_S" textname="AI sensor 57" rrd="2" rrd2_ds="DERIVE:20:U:U"/>
<item id="58" iotype="AI" name="SVU_AskCount_AS" textname="svu asl count"/> <item id="58" iotype="AO" name="Lamp58_C" textname="Lamp 58" rrd="1" rrd1_ds="GAUGE:20:U:U"/>
<item id="62" iotype="AI" name="LogLevel_S" textname="LogLevel control"/>
<item id="63" iotype="AI" name="SVU_AskCount_AS" textname="svu asl count"/>
</sensors> </sensors>
<thresholds name="thresholds"> <thresholds name="thresholds">
<sensor iotype="AI" name="AI_AS"> <sensor iotype="AI" name="AI_AS">
...@@ -247,8 +264,58 @@ ...@@ -247,8 +264,58 @@
<item id="6008" name="UNetExchange"/> <item id="6008" name="UNetExchange"/>
<item id="6009" name="MBMaster2"/> <item id="6009" name="MBMaster2"/>
<item id="6010" name="MBMultiMaster1"/> <item id="6010" name="MBMultiMaster1"/>
<item id="6011" name="RRDStorage1"/> <item id="6011" name="RRDServer1"/>
<item id="6012" name="MBSlave2"/> <item id="6012" name="TestProc1"/>
<item id="6013" name="TestProc2"/>
<item id="6014" name="TestProc3"/>
<item id="6015" name="TestProc4"/>
<item id="6016" name="TestProc5"/>
<item id="6017" name="TestProc6"/>
<item id="6018" name="TestProc7"/>
<item id="6019" name="TestProc8"/>
<item id="6020" name="TestProc9"/>
<item id="6021" name="TestProc10"/>
<item id="6022" name="TestProc11"/>
<item id="6023" name="TestProc12"/>
<item id="6024" name="TestProc13"/>
<item id="6025" name="TestProc14"/>
<item id="6026" name="TestProc15"/>
<item id="6027" name="TestProc16"/>
<item id="6028" name="TestProc17"/>
<item id="6029" name="TestProc18"/>
<item id="6030" name="TestProc19"/>
<item id="6031" name="TestProc20"/>
<item id="6032" name="TestProc21"/>
<item id="6033" name="TestProc22"/>
<item id="6034" name="TestProc23"/>
<item id="6035" name="TestProc24"/>
<item id="6036" name="TestProc25"/>
<item id="6037" name="TestProc26"/>
<item id="6038" name="TestProc27"/>
<item id="6039" name="TestProc28"/>
<item id="6040" name="TestProc29"/>
<item id="6041" name="TestProc30"/>
<item id="6042" name="TestProc31"/>
<item id="6043" name="TestProc32"/>
<item id="6044" name="TestProc33"/>
<item id="6045" name="TestProc34"/>
<item id="6046" name="TestProc35"/>
<item id="6047" name="TestProc36"/>
<item id="6048" name="TestProc37"/>
<item id="6049" name="TestProc38"/>
<item id="6050" name="TestProc39"/>
<item id="6051" name="TestProc40"/>
<item id="6052" name="TestProc41"/>
<item id="6053" name="TestProc42"/>
<item id="6054" name="TestProc43"/>
<item id="6055" name="TestProc44"/>
<item id="6056" name="TestProc45"/>
<item id="6057" name="TestProc46"/>
<item id="6058" name="TestProc47"/>
<item id="6059" name="TestProc48"/>
<item id="6060" name="TestProc49"/>
<item id="6061" name="TestProc50"/>
<item id="6062" name="MBSlave2"/>
</objects> </objects>
</ObjectsMap> </ObjectsMap>
<messages idfromfile="1" name="messages"> <messages idfromfile="1" name="messages">
...@@ -262,6 +329,12 @@ ...@@ -262,6 +329,12 @@
<!-- <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="-1000" y="-300"/>
<point x="-900" y="-250"/>
<point x="-800" y="-200"/>
<point x="-700" y="-150"/>
<point x="-600" y="-100"/>
<point x="-500" y="-80"/>
<point x="-200" y="-60"/> <point x="-200" y="-60"/>
<point x="-100" y="-60"/> <point x="-100" y="-60"/>
<point x="-50" y="-20"/> <point x="-50" y="-20"/>
...@@ -269,6 +342,14 @@ ...@@ -269,6 +342,14 @@
<point x="50" y="20"/> <point x="50" y="20"/>
<point x="100" y="60"/> <point x="100" y="60"/>
<point x="200" y="60"/> <point x="200" y="60"/>
<point x="300" y="80"/>
<point x="400" y="100"/>
<point x="500" y="150"/>
<point x="600" y="200"/>
<point x="700" y="250"/>
<point x="800" y="300"/>
<point x="900" y="400"/>
<point x="1000" y="600"/>
</diagram> </diagram>
</Calibrations> </Calibrations>
</UNISETPLC> </UNISETPLC>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html # See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html
# AC_PREREQ(2.59) # AC_PREREQ(2.59)
AC_INIT([uniset], [1.7.0], pv@etersoft.ru) AC_INIT([uniset], [2.0.0], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
# AC_CONFIG_MACRO_DIR([m4]) # AC_CONFIG_MACRO_DIR([m4])
...@@ -30,7 +30,7 @@ AC_ENABLE_SHARED(yes) ...@@ -30,7 +30,7 @@ AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no) AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
LIBVER=1:7:0 LIBVER=2:0:0
AC_SUBST(LIBVER) AC_SUBST(LIBVER)
# Checks for libraries. # Checks for libraries.
...@@ -204,23 +204,18 @@ AC_CONFIG_FILES([Makefile ...@@ -204,23 +204,18 @@ AC_CONFIG_FILES([Makefile
IDL/Makefile IDL/Makefile
IDL/UniSetTypes/Makefile IDL/UniSetTypes/Makefile
IDL/Processes/Makefile IDL/Processes/Makefile
IDL/Services/Makefile
src/Communications/Makefile src/Communications/Makefile
src/Communications/Modbus/Makefile src/Communications/Modbus/Makefile
src/IOs/Makefile
src/Interfaces/Makefile src/Interfaces/Makefile
src/ObjectRepository/Makefile src/ObjectRepository/Makefile
src/Processes/Makefile src/Processes/Makefile
src/Services/Makefile src/Services/Makefile
src/Threads/Makefile
src/Timers/Makefile src/Timers/Makefile
src/Various/Makefile src/Various/Makefile
src/Makefile src/Makefile
include/Makefile include/Makefile
include/modbus/Makefile include/modbus/Makefile
include/IOs/Makefile
tests/Makefile tests/Makefile
tests/JrnTests/Makefile
tests/UniXmlTest/Makefile tests/UniXmlTest/Makefile
docs/Makefile docs/Makefile
docs/UniSetDox.cfg docs/UniSetDox.cfg
...@@ -231,7 +226,6 @@ AC_CONFIG_FILES([Makefile ...@@ -231,7 +226,6 @@ AC_CONFIG_FILES([Makefile
Utilities/NullController/Makefile Utilities/NullController/Makefile
Utilities/SViewer-text/Makefile Utilities/SViewer-text/Makefile
Utilities/SMonit/Makefile Utilities/SMonit/Makefile
Utilities/InfoServer/Makefile
Utilities/MBTester/Makefile Utilities/MBTester/Makefile
Utilities/SImitator/Makefile Utilities/SImitator/Makefile
Utilities/codegen/Makefile Utilities/codegen/Makefile
...@@ -265,6 +259,7 @@ AC_CONFIG_FILES([Makefile ...@@ -265,6 +259,7 @@ AC_CONFIG_FILES([Makefile
extensions/RRDServer/Makefile extensions/RRDServer/Makefile
extensions/RRDServer/libUniSetRRDServer.pc extensions/RRDServer/libUniSetRRDServer.pc
extensions/tests/Makefile extensions/tests/Makefile
extensions/tests/SMemoryTest/Makefile
python/lib/Makefile python/lib/Makefile
python/lib/pyUniSet/Makefile python/lib/pyUniSet/Makefile
python/Makefile]) python/Makefile])
......
...@@ -76,8 +76,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage. ...@@ -76,8 +76,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
... ...
<ObjectsMap idfromfile="0"> <ObjectsMap idfromfile="0">
<nodes port="2809"> <nodes port="2809">
<item name="LocalhostNode" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/> <item name="LocalhostNode" alias="" textname="Локальный узел" ip="127.0.0.1" dbserver=""/>
<item name="Node2" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/> <item name="Node2" alias="" textname="Локальный узел" ip="127.0.0.1" dbserver=""/>
</nodes> </nodes>
<sensors> <sensors>
<item name="Input1_S" textname="Команда 1" node="" iotype="DI" priority="Medium" default="1" /> <item name="Input1_S" textname="Команда 1" node="" iotype="DI" priority="Medium" default="1" />
...@@ -91,10 +91,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage. ...@@ -91,10 +91,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
<!-- ******************* Идентификаторы сервисов ***************** --> <!-- ******************* Идентификаторы сервисов ***************** -->
<services name="Services"> <services name="Services">
<item name="InfoServer"/>
<item name="DBServer"/> <item name="DBServer"/>
<item name="PrintServer"/> <item name="PrintServer"/>
<item name="TimeService"/>
</services> </services>
<!-- ******************* Идентификаторы объектов ***************** --> <!-- ******************* Идентификаторы объектов ***************** -->
...@@ -134,8 +132,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage. ...@@ -134,8 +132,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
... ...
<ObjectsMap idfromfile="1"> <ObjectsMap idfromfile="1">
<nodes port="2809"> <nodes port="2809">
<item id="1000" name="LocalhostNode" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/> <item id="1000" name="LocalhostNode" alias="" textname="Локальный узел" ip="127.0.0.1" dbserver=""/>
<item id="1001" name="Node2" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/> <item id="1001" name="Node2" alias="" textname="Локальный узел" ip="127.0.0.1" dbserver=""/>
</nodes> </nodes>
<sensors> <sensors>
<item id="1" name="Input1_S" textname="Команда 1" node="" iotype="DI" priority="Medium" default="1" /> <item id="1" name="Input1_S" textname="Команда 1" node="" iotype="DI" priority="Medium" default="1" />
...@@ -149,10 +147,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage. ...@@ -149,10 +147,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
<!-- ******************* Идентификаторы сервисов ***************** --> <!-- ******************* Идентификаторы сервисов ***************** -->
<services name="Services"> <services name="Services">
<item id="500" name="InfoServer"/>
<item id="501" name="DBServer"/> <item id="501" name="DBServer"/>
<item id="502" name="PrintServer"/> <item id="502" name="PrintServer"/>
<item id="503" name="TimeService"/>
</services> </services>
<!-- ******************* Идентификаторы объектов ***************** --> <!-- ******************* Идентификаторы объектов ***************** -->
......
...@@ -77,28 +77,19 @@ int main(int argc, char **argv) ...@@ -77,28 +77,19 @@ int main(int argc, char **argv)
</UniSet> </UniSet>
<Services section="Services"> <Services section="Services">
<LocalTimerService name="TimerService1" MaxCountTimers="100" AskLifeTimeSEC="60"/>
<LocalInfoServer name="InfoServer1" dbrepeat="1">
<RouteList>
<!-- <consumer name="" node=""/> -->
</RouteList>
</LocalInfoServer>
<LocalDBServer name="DBServer1" dbnode="" dbname="Theatre" dbuser="dbadmin" dbpass="dbadmin"> <LocalDBServer name="DBServer1" dbnode="" dbname="Theatre" dbuser="dbadmin" dbpass="dbadmin">
<Tables></Tables> <Tables></Tables>
</LocalDBServer> </LocalDBServer>
</Services> </Services>
<!-- список узлов в сиситеме --> <!-- список узлов в сиситеме -->
<ListOfNodes> <ListOfNodes>
<!-- <!--
Параметры: Параметры:
infserver - id инфо-сервера на данном узле(если указать "", значит нет)
dbnode - id db-сервера на данном узле DB(если указать "", значит нет) dbnode - id db-сервера на данном узле DB(если указать "", значит нет)
--> -->
<Node name="LocalhostNode" infserver="InfoServer1" dbserver="DBServer1"/> <Node name="LocalhostNode" dbserver="DBServer1"/>
</ListOfNodes> </ListOfNodes>
</UniSetTestConfiguration> </UniSetTestConfiguration>
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
\page ServicesPage Сервисы \page ServicesPage Сервисы
- \ref secDBServer - \ref secDBServer
- \ref secInfoService
- \ref secTimerService
\section secDBServer Сервер БД \section secDBServer Сервер БД
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
- \ref subIO - \ref subIO
- Алгоритмы управления - Алгоритмы управления
- \ref UniSetGraphics - \ref UniSetGraphics
- \ref subInfoServer
- \ref UniDiag - \ref UniDiag
- \ref subTimer
- \ref secSection2 - \ref secSection2
- \ref subTransfer - \ref subTransfer
...@@ -56,15 +54,6 @@ ...@@ -56,15 +54,6 @@
буферизацию данных на время недоступности других узлов. буферизацию данных на время недоступности других узлов.
\sa \ref secDBServer \sa \ref secDBServer
\subsection subInfoServer Система оповещения
Некоторым алгоритмам требуются сообщать о том или ином событии оператору. Для этой цели служит InfoServer.
Идея заключается в следующем: Все объекты, которым необходимо послать информацию, работают с локальным зараннее известным
объектом InfoServer. Все сообщения посылаются ему. В его задачи входит переслать это сообщение объекту отображающему
информацию на экране, а также переслать сообщение на другие узлы(в случае необходимости). Помимо этого InfoServer пересылает
сообщения DBServer-у для сохранения их в БД. То что этот объект является локальным, гарантирует, что он будет
доступен...
\sa \ref secInfoServer
\subsection subIO Ввод/вывод \subsection subIO Ввод/вывод
Процессы ввода/вывода строятся на основе классов IOController и IONotifyController. Процессы ввода/вывода строятся на основе классов IOController и IONotifyController.
\par IOController \par IOController
...@@ -73,12 +62,6 @@ ...@@ -73,12 +62,6 @@
\par IONotifyController \par IONotifyController
Раширение IOController-а. Предоставляющее интерфейс для заказа уведомлений об изменении состояния датчиков. Раширение IOController-а. Предоставляющее интерфейс для заказа уведомлений об изменении состояния датчиков.
\subsection subTimer Таймеры
В библиотеку включен компонент TimerService. Данный сервис реализует функции генератора переодический событий (таймеров).
TimeService предоставляет интерфейс для заказа уведомлений с заданной переодичностью.
\warning TimerService - НЕ является реализацией спецификации CORBA::TimerService.
\sa \ref secTimerService
\subsection UniSetGraphics Графический интерфейс пользователя \subsection UniSetGraphics Графический интерфейс пользователя
... ...
......
...@@ -147,14 +147,10 @@ class DBServer_MySQL: ...@@ -147,14 +147,10 @@ class DBServer_MySQL:
virtual void initDB(DBInterface *db){}; virtual void initDB(DBInterface *db){};
virtual void initDBTableMap(DBTableMap& tblMap){}; virtual void initDBTableMap(DBTableMap& tblMap){};
virtual void processingMessage( UniSetTypes::VoidMessage *msg ); virtual void timerInfo( const UniSetTypes::TimerMessage* tm );
virtual void timerInfo( UniSetTypes::TimerMessage* tm ); virtual void sysCommand( const UniSetTypes::SystemMessage* sm );
virtual void sysCommand( UniSetTypes::SystemMessage* sm ); virtual void sensorInfo( const UniSetTypes::SensorMessage* sm );
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg );
// Функции обработки пришедших сообщений
virtual void parse( UniSetTypes::SensorMessage* sm );
virtual void parse( UniSetTypes::DBMessage* dbmsg );
virtual void parse( UniSetTypes::ConfirmMessage* cmsg );
bool writeToBase( const string& query ); bool writeToBase( const string& query );
virtual void init_dbserver(); virtual void init_dbserver();
...@@ -187,7 +183,7 @@ class DBServer_MySQL: ...@@ -187,7 +183,7 @@ class DBServer_MySQL:
bool lastRemove; bool lastRemove;
void flushBuffer(); void flushBuffer();
UniSetTypes::uniset_mutex mqbuf; UniSetTypes::uniset_rwmutex mqbuf;
private: private:
DBTableMap tblMap; DBTableMap tblMap;
......
...@@ -13,8 +13,6 @@ bin_PROGRAMS = uniset-mysql-dbserver ...@@ -13,8 +13,6 @@ bin_PROGRAMS = uniset-mysql-dbserver
uniset_mysql_dbserver_LDADD = libUniSet-mysql.la $(top_builddir)/lib/libUniSet.la uniset_mysql_dbserver_LDADD = libUniSet-mysql.la $(top_builddir)/lib/libUniSet.la
uniset_mysql_dbserver_SOURCES = main.cc uniset_mysql_dbserver_SOURCES = main.cc
include $(top_builddir)/conf/setting.mk
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/mysql devel_includedir = $(includedir)/@PACKAGE@/mysql
......
#include "Configuration.h" #include "Configuration.h"
#include "DBServer_MySQL.h" #include "DBServer_MySQL.h"
#include "ObjectsActivator.h" #include "UniSetActivator.h"
#include "Debug.h" #include "Debug.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
using namespace UniSetTypes; using namespace UniSetTypes;
...@@ -31,7 +31,7 @@ int main(int argc, char** argv) ...@@ -31,7 +31,7 @@ int main(int argc, char** argv)
{ {
if( ID != UniSetTypes::DefaultObjectId ) if( ID != UniSetTypes::DefaultObjectId )
{ {
unideb[Debug::WARN] << "(DBServer::main): переопределяем ID заданнй в " ulog.warn() << "(DBServer::main): переопределяем ID заданнй в "
<< conf->getConfFileName() << endl; << conf->getConfFileName() << endl;
} }
...@@ -52,7 +52,7 @@ int main(int argc, char** argv) ...@@ -52,7 +52,7 @@ int main(int argc, char** argv)
} }
DBServer_MySQL dbs(ID); DBServer_MySQL dbs(ID);
ObjectsActivator act; UniSetActivator act;
act.addObject(static_cast<class UniSetObject*>(&dbs)); act.addObject(static_cast<class UniSetObject*>(&dbs));
act.run(false); act.run(false);
} }
......
...@@ -147,14 +147,10 @@ class DBServer_SQLite: ...@@ -147,14 +147,10 @@ class DBServer_SQLite:
virtual void initDB( SQLiteInterface *db ){}; virtual void initDB( SQLiteInterface *db ){};
virtual void initDBTableMap(DBTableMap& tblMap){}; virtual void initDBTableMap(DBTableMap& tblMap){};
virtual void processingMessage( UniSetTypes::VoidMessage *msg ); virtual void timerInfo( const UniSetTypes::TimerMessage* tm );
virtual void timerInfo( UniSetTypes::TimerMessage* tm ); virtual void sysCommand( const UniSetTypes::SystemMessage* sm );
virtual void sysCommand( UniSetTypes::SystemMessage* sm ); virtual void sensorInfo( const UniSetTypes::SensorMessage* sm );
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg );
// Функции обработки пришедших сообщений
virtual void parse( UniSetTypes::SensorMessage* sm );
virtual void parse( UniSetTypes::DBMessage* dbmsg );
virtual void parse( UniSetTypes::ConfirmMessage* cmsg );
bool writeToBase( const string& query ); bool writeToBase( const string& query );
virtual void init_dbserver(); virtual void init_dbserver();
...@@ -187,7 +183,7 @@ class DBServer_SQLite: ...@@ -187,7 +183,7 @@ class DBServer_SQLite:
bool lastRemove; bool lastRemove;
void flushBuffer(); void flushBuffer();
UniSetTypes::uniset_mutex mqbuf; UniSetTypes::uniset_rwmutex mqbuf;
private: private:
DBTableMap tblMap; DBTableMap tblMap;
......
...@@ -18,8 +18,6 @@ noinst_PROGRAMS = sqlite-test ...@@ -18,8 +18,6 @@ noinst_PROGRAMS = sqlite-test
sqlite_test_LDADD = libUniSet-sqlite.la $(top_builddir)/lib/libUniSet.la sqlite_test_LDADD = libUniSet-sqlite.la $(top_builddir)/lib/libUniSet.la
sqlite_test_SOURCES = test.cc sqlite_test_SOURCES = test.cc
include $(top_builddir)/conf/setting.mk
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/sqlite devel_includedir = $(includedir)/@PACKAGE@/sqlite
......
...@@ -254,7 +254,7 @@ SQLiteResult::SQLiteResult( sqlite3_stmt* s, bool finalize ) ...@@ -254,7 +254,7 @@ SQLiteResult::SQLiteResult( sqlite3_stmt* s, bool finalize )
int n = sqlite3_data_count(s); int n = sqlite3_data_count(s);
COL c; COL c;
for( int i=0; i<n; i++ ) for( unsigned int i=0; i<n; i++ )
{ {
char* p = (char*)sqlite3_column_text(s,i); char* p = (char*)sqlite3_column_text(s,i);
if( p ) if( p )
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define SQLiteInterface_H_ #define SQLiteInterface_H_
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#include <string> #include <string>
#include <list> #include <deque>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <sqlite3.h> #include <sqlite3.h>
...@@ -81,7 +81,7 @@ class SQLiteResult; ...@@ -81,7 +81,7 @@ class SQLiteResult;
// Памятка: // Памятка:
// Включение режима для журнала - "вести в памяти" (чтобы поберечь CompactFlash) // Включение режима для журнала - "вести в памяти" (чтобы поберечь CompactFlash)
// PRAGMA journal_mode = MEMORY // PRAGMA journal_mode = MEMORY
// // При этом конечно есть риск потерять данные при выключении..
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class SQLiteInterface class SQLiteInterface
{ {
...@@ -136,7 +136,7 @@ class SQLiteResult ...@@ -136,7 +136,7 @@ class SQLiteResult
~SQLiteResult(); ~SQLiteResult();
typedef std::vector<std::string> COL; typedef std::vector<std::string> COL;
typedef std::list<COL> ROW; typedef std::deque<COL> ROW;
typedef ROW::iterator iterator; typedef ROW::iterator iterator;
......
#include "Configuration.h" #include "Configuration.h"
#include "DBServer_SQLite.h" #include "DBServer_SQLite.h"
#include "ObjectsActivator.h" #include "UniSetActivator.h"
#include "Debug.h" #include "Debug.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
using namespace UniSetTypes; using namespace UniSetTypes;
...@@ -31,7 +31,7 @@ int main(int argc, char** argv) ...@@ -31,7 +31,7 @@ int main(int argc, char** argv)
{ {
if( ID != UniSetTypes::DefaultObjectId ) if( ID != UniSetTypes::DefaultObjectId )
{ {
unideb[Debug::WARN] << "(DBServer::main): переопределяем ID заданнй в " ulog.warn() << "(DBServer::main): переопределяем ID заданнй в "
<< conf->getConfFileName() << endl; << conf->getConfFileName() << endl;
} }
...@@ -52,7 +52,7 @@ int main(int argc, char** argv) ...@@ -52,7 +52,7 @@ int main(int argc, char** argv)
} }
DBServer_SQLite dbs(ID); DBServer_SQLite dbs(ID);
ObjectsActivator act; UniSetActivator act;
act.addObject(static_cast<class UniSetObject*>(&dbs)); act.addObject(static_cast<class UniSetObject*>(&dbs));
act.run(false); act.run(false);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#define IOControl_H_ #define IOControl_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include <vector> #include <vector>
#include <list> #include <deque>
#include <string> #include <string>
#include "UniXML.h" #include "UniXML.h"
#include "PassiveTimer.h" #include "PassiveTimer.h"
...@@ -84,6 +84,10 @@ ...@@ -84,6 +84,10 @@
<br>\b jardelay - защита от дребезга. Задержка на дребезг, мсек. <br>\b jardelay - защита от дребезга. Задержка на дребезг, мсек.
<br>\b ondelay - задержка на срабатывание, мсек. <br>\b ondelay - задержка на срабатывание, мсек.
<br>\b offdelay - задержка на отпускание, мсек. <br>\b offdelay - задержка на отпускание, мсек.
<br>\b iofront - работа по фронту сигнала (для DI).
<br> "01" - срабатывание (и отпускание) по переходу "0 --> 1"
<br> "10" - срабатывание (и отпускание) по переходу "1 --> 0"
<br>\b safety - безопасное значение. Значение которое сохраняется в случае аварийного <br>\b safety - безопасное значение. Значение которое сохраняется в случае аварийного
завершения процесса. завершения процесса.
...@@ -94,7 +98,6 @@ ...@@ -94,7 +98,6 @@
<br>\b rmax - максимальное "сырое" значение <br>\b rmax - максимальное "сырое" значение
<br>\b cmin - минимальное "калиброванное" значение <br>\b cmin - минимальное "калиброванное" значение
<br>\b cmax - максимальное "калиброванное" значение <br>\b cmax - максимальное "калиброванное" значение
<br>\b sensibility - чуствительность. (deprecated)
<br>\b precision - Точность. Задаёт количство знаков после запятой. <br>\b precision - Точность. Задаёт количство знаков после запятой.
<br>Т.е. при считывании из канала, значение домножается <br>Т.е. при считывании из канала, значение домножается
<br>на 10^precision и уже таким сохраняется. <br>на 10^precision и уже таким сохраняется.
...@@ -105,12 +108,13 @@ ...@@ -105,12 +108,13 @@
<br>\b filterT - Постоянная времени фильтра. <br>\b filterT - Постоянная времени фильтра.
<br>\b caldiagram - Имя калибровочной диаграммы из секции <Calibrations>. <br>\b caldiagram - Имя калибровочной диаграммы из секции <Calibrations>.
<br>\b cal_cachesize - Размер кэша в калибровочной диаграмме (Calibration.h)
<br>\b cal_cacheresort - Количество циклов обращения к кэшу, для вызова принудительной песортировки. (Calibration.h)
<br>\b threshold_aid - идентификатор аналогового датчика по которому формируется порог. <br>\b threshold_aid - идентификатор аналогового датчика по которому формируется порог.
Используется для DI. Используется для DI.
<br>\b lowlimit - нижний порого срабатывания. <br>\b lowlimit - нижний порого срабатывания.
<br>\b hilimit - верхний порого срабатывания. <br>\b hilimit - верхний порого срабатывания.
<br>\b sensibility - чувствительность (deprecated)
<br>\b card - номер карты <br>\b card - номер карты
<br>\b subdev - номер подустройства <br>\b subdev - номер подустройства
...@@ -119,7 +123,7 @@ ...@@ -119,7 +123,7 @@
<br>&nbsp;&nbsp; J1 - chanenel 0 - 15 <br>&nbsp;&nbsp; J1 - chanenel 0 - 15
<br>&nbsp;&nbsp; J2 <br>&nbsp;&nbsp; J2
<br>\b lamp - признак, что данный аналоговый датчик является "лампочкой". <br>\b lamp - признак, что данный аналоговый датчик является "лампочкой".
<br> Т.е. на самом деле дискретный выход, который может иметь три состояния <br> Т.е. на самом деле дискретный выход, который может иметь состояния:
<br>UniSetTypes::lmpOFF - выключен <br>UniSetTypes::lmpOFF - выключен
<br>UniSetTypes::lmpON - включен <br>UniSetTypes::lmpON - включен
<br>UniSetTypes::lmpBLINK - мигание с частотой 1 <br>UniSetTypes::lmpBLINK - мигание с частотой 1
...@@ -193,13 +197,13 @@ class IOControl: ...@@ -193,13 +197,13 @@ class IOControl:
public UniSetObject public UniSetObject
{ {
public: public:
IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, SharedMemory* ic=0, int numcards=2, const std::string prefix="io" ); IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, SharedMemory* ic=0, int numcards=2, const std::string& prefix="io" );
virtual ~IOControl(); virtual ~IOControl();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static IOControl* init_iocontrol( int argc, const char* const* argv, static IOControl* init_iocontrol( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, SharedMemory* ic=0, UniSetTypes::ObjectId icID, SharedMemory* ic=0,
const std::string prefix="io" ); const std::string& prefix="io" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
...@@ -279,11 +283,10 @@ class IOControl: ...@@ -279,11 +283,10 @@ class IOControl:
void blink(); void blink();
// действия при завершении работы // действия при завершении работы
virtual void processingMessage( UniSetTypes::VoidMessage* msg ); virtual void sysCommand( const 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( const UniSetTypes::SensorMessage* sm );
virtual void timerInfo( UniSetTypes::TimerMessage* tm ); virtual void timerInfo( const UniSetTypes::TimerMessage* tm );
virtual void sigterm( int signo ); virtual void sigterm( int signo );
virtual bool activateObject(); virtual bool activateObject();
...@@ -296,12 +299,12 @@ class IOControl: ...@@ -296,12 +299,12 @@ class IOControl:
// чтение файла конфигурации // чтение файла конфигурации
void readConfiguration(); void readConfiguration();
bool initIOItem( UniXML_iterator& it ); bool initIOItem( UniXML_iterator& it );
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ); bool readItem( const UniXML& xml, UniXML_iterator& it, xmlNode* sec );
void buildCardsList(); void buildCardsList();
void waitSM(); void waitSM();
bool checkCards( const std::string func="" ); bool checkCards( const std::string& func="" );
// std::string myname; // std::string myname;
xmlNode* cnode; /*!< xml-узел в настроечном файле */ xmlNode* cnode; /*!< xml-узел в настроечном файле */
...@@ -310,11 +313,10 @@ class IOControl: ...@@ -310,11 +313,10 @@ class IOControl:
CardList cards; /*!< список карт - массив созданных ComediInterface */ CardList cards; /*!< список карт - массив созданных ComediInterface */
bool noCards; bool noCards;
typedef std::vector<IOInfo> IOMap; typedef std::vector<IOInfo> IOMap;
IOMap iomap; /*!< список входов/выходов */ IOMap iomap; /*!< список входов/выходов */
typedef std::list<IOPriority> PIOMap; typedef std::deque<IOPriority> PIOMap;
PIOMap pmap; /*!< список приоритетных входов/выходов */ PIOMap pmap; /*!< список приоритетных входов/выходов */
unsigned int maxItem; /*!< количество элементов (используется на момент инициализации) */ unsigned int maxItem; /*!< количество элементов (используется на момент инициализации) */
...@@ -326,7 +328,7 @@ class IOControl: ...@@ -326,7 +328,7 @@ class IOControl:
std::string s_fvalue; std::string s_fvalue;
SMInterface* shm; SMInterface* shm;
UniversalInterface ui; UInterface ui;
UniSetTypes::ObjectId myid; UniSetTypes::ObjectId myid;
std::string prefix; std::string prefix;
...@@ -354,12 +356,12 @@ class IOControl: ...@@ -354,12 +356,12 @@ class IOControl:
UniSetTypes::ObjectId testLamp_S; UniSetTypes::ObjectId testLamp_S;
Trigger trTestLamp; Trigger trTestLamp;
bool isTestLamp; bool isTestLamp;
IOController::DIOStateList::iterator ditTestLamp; IOController::IOStateList::iterator itTestLamp;
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */ bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out; /*!< флаг, включающий принудительное чтения выходов */ bool force_out; /*!< флаг, включающий принудительное чтения выходов */
...@@ -368,7 +370,7 @@ class IOControl: ...@@ -368,7 +370,7 @@ class IOControl:
int maxCardNum; /*! максимально разрешённый номер для карты */ int maxCardNum; /*! максимально разрешённый номер для карты */
UniSetTypes::uniset_mutex iopollMutex; UniSetTypes::uniset_mutex iopollMutex;
bool activated; UniSetTypes::mutex_atomic_t activated;
bool readconf_ok; bool readconf_ok;
int activateTimeout; int activateTimeout;
UniSetTypes::ObjectId sidTestSMReady; UniSetTypes::ObjectId sidTestSMReady;
...@@ -376,7 +378,7 @@ class IOControl: ...@@ -376,7 +378,7 @@ class IOControl:
UniSetTypes::ObjectId testMode_as; UniSetTypes::ObjectId testMode_as;
IOController::AIOStateList::iterator aitTestMode; IOController::IOStateList::iterator itTestMode;
long testmode; long testmode;
long prev_testmode; long prev_testmode;
......
#include <string> #include <string>
#include "Debug.h" #include "Debug.h"
#include "ObjectsActivator.h" #include "UniSetActivator.h"
#include "Configuration.h" #include "Configuration.h"
#include "IOControl.h" #include "IOControl.h"
#include "Extensions.h" #include "Extensions.h"
...@@ -28,7 +28,7 @@ int main(int argc, const char **argv) ...@@ -28,7 +28,7 @@ int main(int argc, const char **argv)
string logfilename = conf->getArgParam("--io-logfile","iocontrol.log"); string logfilename = conf->getArgParam("--io-logfile","iocontrol.log");
string logname( conf->getLogDir() + logfilename ); string logname( conf->getLogDir() + logfilename );
dlog.logFile( logname ); dlog.logFile( logname );
unideb.logFile( logname ); ulog.logFile( logname );
ObjectId shmID = DefaultObjectId; ObjectId shmID = DefaultObjectId;
string sID = conf->getArgParam("--smemory-id"); string sID = conf->getArgParam("--smemory-id");
...@@ -48,20 +48,20 @@ int main(int argc, const char **argv) ...@@ -48,20 +48,20 @@ int main(int argc, const char **argv)
IOControl* ic = IOControl::init_iocontrol(argc,argv,shmID); IOControl* ic = IOControl::init_iocontrol(argc,argv,shmID);
if( !ic ) if( !ic )
{ {
dlog[Debug::CRIT] << "(iocontrol): init не прошёл..." << endl; dcrit << "(iocontrol): init не прошёл..." << endl;
return 1; return 1;
} }
ObjectsActivator act; UniSetActivator act;
act.addObject(static_cast<class UniSetObject*>(ic)); act.addObject(static_cast<class UniSetObject*>(ic));
SystemMessage sm(SystemMessage::StartUp); SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() ); act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n"; ulog << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n"; ulog << "(main): -------------- IOControl START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n"; dlog << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n"; dlog << "(main): -------------- IOControl START -------------------------\n\n";
act.run(true); act.run(true);
msleep(500); msleep(500);
ic->execute(); ic->execute();
...@@ -69,15 +69,15 @@ int main(int argc, const char **argv) ...@@ -69,15 +69,15 @@ int main(int argc, const char **argv)
} }
catch(SystemError& err) catch(SystemError& err)
{ {
dlog[Debug::CRIT] << "(iocontrol): " << err << endl; dcrit << "(iocontrol): " << err << endl;
} }
catch(Exception& ex) catch(Exception& ex)
{ {
dlog[Debug::CRIT] << "(iocontrol): " << ex << endl; dcrit << "(iocontrol): " << ex << endl;
} }
catch(...) catch(...)
{ {
dlog[Debug::CRIT] << "(iocontrol): catch(...)" << endl; dcrit << "(iocontrol): catch(...)" << endl;
} }
return 1; return 1;
......
...@@ -215,7 +215,7 @@ int main(int argc, char* argv[]) ...@@ -215,7 +215,7 @@ int main(int argc, char* argv[])
{ {
if( autoconf ) if( autoconf )
{ {
for( int k=0; chan[k]!=-1; k++ ) for( unsigned int k=0; chan[k]!=-1; k++ )
{ {
if( comedi_dio_config(card, subdev, chan[k],INSN_CONFIG_DIO_INPUT) < 0) if( comedi_dio_config(card, subdev, chan[k],INSN_CONFIG_DIO_INPUT) < 0)
{ {
...@@ -225,7 +225,7 @@ int main(int argc, char* argv[]) ...@@ -225,7 +225,7 @@ int main(int argc, char* argv[])
} }
} }
for( int k=0; chan[k]!=-1; k++ ) for( unsigned int k=0; chan[k]!=-1; k++ )
{ {
if( comedi_dio_read(card, subdev, chan[k],&data) < 0) if( comedi_dio_read(card, subdev, chan[k],&data) < 0)
{ {
...@@ -242,7 +242,7 @@ int main(int argc, char* argv[]) ...@@ -242,7 +242,7 @@ int main(int argc, char* argv[])
{ {
if( autoconf ) if( autoconf )
{ {
for( int k=0; chan[k]!=-1; k++ ) for( unsigned int k=0; chan[k]!=-1; k++ )
{ {
if( comedi_dio_config(card, subdev, chan[k],INSN_CONFIG_DIO_OUTPUT) < 0 ) if( comedi_dio_config(card, subdev, chan[k],INSN_CONFIG_DIO_OUTPUT) < 0 )
{ {
...@@ -254,7 +254,7 @@ int main(int argc, char* argv[]) ...@@ -254,7 +254,7 @@ int main(int argc, char* argv[])
// реализация мигания // реализация мигания
while(1) while(1)
{ {
for( int k=0; chan[k]!=-1; k++ ) for( unsigned int k=0; chan[k]!=-1; k++ )
{ {
if( verb ) if( verb )
printf( "write: ch=%d val=%d\n",chan[k],val); printf( "write: ch=%d val=%d\n",chan[k],val);
...@@ -277,7 +277,7 @@ int main(int argc, char* argv[]) ...@@ -277,7 +277,7 @@ int main(int argc, char* argv[])
case cmdARead: case cmdARead:
{ {
for( int k=0; chan[k]!=-1; k++ ) for( unsigned int k=0; chan[k]!=-1; k++ )
{ {
if( autoconf ) if( autoconf )
insn_config(card, subdev,chan[k],100,range,aref); insn_config(card, subdev,chan[k],100,range,aref);
...@@ -296,7 +296,7 @@ int main(int argc, char* argv[]) ...@@ -296,7 +296,7 @@ int main(int argc, char* argv[])
case cmdAWrite: case cmdAWrite:
{ {
for( int k=0; chan[k]!=-1; k++ ) for( unsigned int k=0; chan[k]!=-1; k++ )
{ {
if( autoconf ) if( autoconf )
insn_config(card,subdev,chan[k],101,range,aref); insn_config(card,subdev,chan[k],101,range,aref);
...@@ -313,7 +313,7 @@ int main(int argc, char* argv[]) ...@@ -313,7 +313,7 @@ int main(int argc, char* argv[])
case cmdConfig: case cmdConfig:
{ {
for( int k=0; chan[k]!=-1; k++ ) for( unsigned int k=0; chan[k]!=-1; k++ )
{ {
if( val != INSN_CONFIG_DIO_INPUT if( val != INSN_CONFIG_DIO_INPUT
&& val != INSN_CONFIG_DIO_OUTPUT && val != INSN_CONFIG_DIO_OUTPUT
......
...@@ -35,15 +35,15 @@ void LProcessor::execute( const string& lfile ) ...@@ -35,15 +35,15 @@ void LProcessor::execute( const string& lfile )
} }
catch( LogicException& ex ) catch( LogicException& ex )
{ {
dlog[Debug::CRIT] << logname << "(execute): " << ex << endl; dcrit << logname << "(execute): " << ex << endl;
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
dlog[Debug::CRIT] << logname << "(execute): " << ex << endl; dcrit << logname << "(execute): " << ex << endl;
} }
catch(...) catch(...)
{ {
dlog[Debug::CRIT] << logname << "(execute): catch...\n"; dcrit << logname << "(execute): catch...\n";
} }
msleep(sleepTime); msleep(sleepTime);
} }
...@@ -67,7 +67,7 @@ void LProcessor::build( const string& lfile ) ...@@ -67,7 +67,7 @@ void LProcessor::build( const string& lfile )
UniSetTypes::ObjectId sid = conf->getSensorID(it->name); UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId ) if( sid == DefaultObjectId )
{ {
dlog[Debug::CRIT] << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: " << it->name << endl; dcrit << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: " << it->name << endl;
continue; continue;
} }
...@@ -78,7 +78,7 @@ void LProcessor::build( const string& lfile ) ...@@ -78,7 +78,7 @@ void LProcessor::build( const string& lfile )
ei.iotype = conf->getIOType(sid); ei.iotype = conf->getIOType(sid);
if( ei.iotype == UniversalIO::UnknownIOType ) if( ei.iotype == UniversalIO::UnknownIOType )
{ {
dlog[Debug::CRIT] << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl; dcrit << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue; continue;
} }
extInputs.push_front(ei); extInputs.push_front(ei);
...@@ -89,7 +89,7 @@ void LProcessor::build( const string& lfile ) ...@@ -89,7 +89,7 @@ void LProcessor::build( const string& lfile )
UniSetTypes::ObjectId sid = conf->getSensorID(it->name); UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId ) if( sid == DefaultObjectId )
{ {
dlog[Debug::CRIT] << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: " << it->name << endl; dcrit << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: " << it->name << endl;
continue; continue;
} }
...@@ -99,7 +99,7 @@ void LProcessor::build( const string& lfile ) ...@@ -99,7 +99,7 @@ void LProcessor::build( const string& lfile )
ei.iotype = conf->getIOType(sid); ei.iotype = conf->getIOType(sid);
if( ei.iotype == UniversalIO::UnknownIOType ) if( ei.iotype == UniversalIO::UnknownIOType )
{ {
dlog[Debug::CRIT] << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl; dcrit << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue; continue;
} }
...@@ -120,7 +120,7 @@ void LProcessor::getInputs() ...@@ -120,7 +120,7 @@ void LProcessor::getInputs()
{ {
// try // try
// { // {
it->state = ui.getState(it->sid); it->state = (bool)ui.getValue(it->sid);
// } // }
} }
} }
...@@ -143,28 +143,15 @@ void LProcessor::setOuts() ...@@ -143,28 +143,15 @@ void LProcessor::setOuts()
{ {
try try
{ {
switch(it->iotype) ui.setValue(it->sid,it->lnk->from->getOut(),DefaultObjectId);
{
case UniversalIO::DigitalInput:
ui.saveState(it->sid,it->lnk->from->getOut(),it->iotype);
break;
case UniversalIO::DigitalOutput:
ui.setState(it->sid,it->lnk->from->getOut());
break;
default:
dlog[Debug::CRIT] << "(LProcessor::setOuts): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
dlog[Debug::CRIT] << "(LProcessor::setOuts): " << ex << endl; dcrit << "(LProcessor::setOuts): " << ex << endl;
} }
catch(...) catch(...)
{ {
dlog[Debug::CRIT] << "(LProcessor::setOuts): catch...\n"; dcrit << "(LProcessor::setOuts): catch...\n";
} }
} }
} }
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
#include <map> #include <map>
#include "UniSetTypes.h" #include "UniSetTypes.h"
#include "UniversalInterface.h" #include "UInterface.h"
#include "Element.h" #include "Element.h"
#include "Schema.h" #include "Schema.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -112,7 +112,7 @@ class LProcessor ...@@ -112,7 +112,7 @@ class LProcessor
struct EXTInfo struct EXTInfo
{ {
UniSetTypes::ObjectId sid; UniSetTypes::ObjectId sid;
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
bool state; bool state;
const Schema::EXTLink* lnk; const Schema::EXTLink* lnk;
}; };
...@@ -120,7 +120,7 @@ class LProcessor ...@@ -120,7 +120,7 @@ class LProcessor
struct EXTOutInfo struct EXTOutInfo
{ {
UniSetTypes::ObjectId sid; UniSetTypes::ObjectId sid;
UniversalIO::IOTypes iotype; UniversalIO::IOType iotype;
const Schema::EXTOut* lnk; const Schema::EXTOut* lnk;
}; };
...@@ -131,7 +131,7 @@ class LProcessor ...@@ -131,7 +131,7 @@ class LProcessor
OUTList extOuts; OUTList extOuts;
SchemaXML sch; SchemaXML sch;
UniversalInterface ui; UInterface ui;
int sleepTime; int sleepTime;
int smReadyTimeout; /*!< время ожидания готовности SM */ int smReadyTimeout; /*!< время ожидания готовности SM */
......
...@@ -24,7 +24,7 @@ PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId o ...@@ -24,7 +24,7 @@ PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId o
{ {
ostringstream err; ostringstream err;
err << myname << ": ID not found ('HeartBeat') for " << heart; err << myname << ": ID not found ('HeartBeat') for " << heart;
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl; dcrit << myname << "(init): " << err.str() << endl;
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -51,21 +51,19 @@ void PassiveLProcessor::step() ...@@ -51,21 +51,19 @@ void PassiveLProcessor::step()
} }
catch(Exception& ex ) catch(Exception& ex )
{ {
dlog[Debug::CRIT] << myname dcrit << myname << "(step): (hb) " << ex << std::endl;
<< "(step): (hb) " << ex << std::endl;
} }
if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() ) if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{ {
try try
{ {
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId()); shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch(Exception& ex) catch(Exception& ex)
{ {
dlog[Debug::CRIT] << myname dcrit << myname << "(step): (hb) " << ex << std::endl;
<< "(step): (hb) " << ex << std::endl;
} }
} }
...@@ -85,27 +83,27 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -85,27 +83,27 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
dlog[Debug::CRIT] << myname << "(askSensors): " << ex << endl; dcrit << myname << "(askSensors): " << ex << endl;
throw SystemError(myname +"(askSensors): do not ask sensors" ); throw SystemError(myname +"(askSensors): do not ask sensors" );
} }
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void PassiveLProcessor::sensorInfo( UniSetTypes::SensorMessage*sm ) void PassiveLProcessor::sensorInfo( const UniSetTypes::SensorMessage*sm )
{ {
for( EXTList::iterator it=extInputs.begin(); it!=extInputs.end(); ++it ) for( EXTList::iterator it=extInputs.begin(); it!=extInputs.end(); ++it )
{ {
if( it->sid == sm->id ) if( it->sid == sm->id )
it->state = sm->state; it->state = (bool)sm->value;
} }
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void PassiveLProcessor::timerInfo( UniSetTypes::TimerMessage *tm ) void PassiveLProcessor::timerInfo( const UniSetTypes::TimerMessage *tm )
{ {
if( tm->id == tidStep ) if( tm->id == tidStep )
step(); step();
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm ) void PassiveLProcessor::sysCommand( const UniSetTypes::SystemMessage *sm )
{ {
switch( sm->command ) switch( sm->command )
{ {
...@@ -113,7 +111,7 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm ) ...@@ -113,7 +111,7 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
{ {
if( !shm->waitSMready(smReadyTimeout) ) if( !shm->waitSMready(smReadyTimeout) )
{ {
dlog[Debug::CRIT] << myname << "(ERR): SM not ready. Terminated... " << endl; dcrit << myname << "(ERR): SM not ready. Terminated... " << endl;
raise(SIGTERM); raise(SIGTERM);
return; return;
} }
...@@ -146,12 +144,12 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm ) ...@@ -146,12 +144,12 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
case SystemMessage::LogRotate: case SystemMessage::LogRotate:
{ {
// переоткрываем логи // переоткрываем логи
unideb << myname << "(sysCommand): logRotate" << std::endl; ulog << myname << "(sysCommand): logRotate" << std::endl;
string fname = unideb.getLogFile(); string fname (ulog.getLogFile() );
if( !fname.empty() ) if( !fname.empty() )
{ {
unideb.logFile(fname); ulog.logFile(fname);
unideb << myname << "(sysCommand): ***************** UNIDEB LOG ROTATE *****************" << std::endl; ulog << myname << "(sysCommand): ***************** ulog LOG ROTATE *****************" << std::endl;
} }
dlog << myname << "(sysCommand): logRotate" << std::endl; dlog << myname << "(sysCommand): logRotate" << std::endl;
...@@ -185,7 +183,7 @@ bool PassiveLProcessor::activateObject() ...@@ -185,7 +183,7 @@ bool PassiveLProcessor::activateObject()
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void PassiveLProcessor::initIterators() void PassiveLProcessor::initIterators()
{ {
shm->initAIterator(aitHeartBeat); shm->initIterator(itHeartBeat);
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void PassiveLProcessor::setOuts() void PassiveLProcessor::setOuts()
...@@ -195,28 +193,15 @@ void PassiveLProcessor::setOuts() ...@@ -195,28 +193,15 @@ void PassiveLProcessor::setOuts()
{ {
try try
{ {
switch(it->iotype) shm->setValue( it->sid,it->lnk->from->getOut() );
{
case UniversalIO::DigitalInput:
shm->saveLocalState(it->sid,it->lnk->from->getOut(),it->iotype);
break;
case UniversalIO::DigitalOutput:
shm->setState(it->sid,it->lnk->from->getOut());
break;
default:
dlog[Debug::CRIT] << myname << "(setOuts): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
dlog[Debug::CRIT] << myname << "(setOuts): " << ex << endl; dcrit << myname << "(setOuts): " << ex << endl;
} }
catch(...) catch(...)
{ {
dlog[Debug::CRIT] << myname << "(setOuts): catch...\n"; dcrit << myname << "(setOuts): catch...\n";
} }
} }
} }
...@@ -227,66 +212,16 @@ void PassiveLProcessor::sigterm( int signo ) ...@@ -227,66 +212,16 @@ void PassiveLProcessor::sigterm( int signo )
{ {
try try
{ {
switch(it->iotype) shm->setValue(it->sid,0);
{
case UniversalIO::DigitalInput:
shm->saveLocalState(it->sid,false,it->iotype);
break;
case UniversalIO::DigitalOutput:
shm->setState(it->sid,false);
break;
default:
dlog[Debug::CRIT] << myname << "(sigterm): неподдерживаемый тип iotype=" << it->iotype << endl;
break;
}
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
dlog[Debug::CRIT] << myname << "(sigterm): " << ex << endl; dcrit << myname << "(sigterm): " << ex << endl;
} }
catch(...) catch(...)
{ {
dlog[Debug::CRIT] << myname << "(sigterm): catch...\n"; dcrit << myname << "(sigterm): catch...\n";
} }
} }
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void PassiveLProcessor::processingMessage( UniSetTypes::VoidMessage* msg )
{
try
{
switch( msg->type )
{
case Message::SensorInfo:
{
SensorMessage sm( msg );
sensorInfo( &sm );
break;
}
case Message::Timer:
{
TimerMessage tm(msg);
timerInfo(&tm);
break;
}
case Message::SysCommand:
{
SystemMessage sm( msg );
sysCommand( &sm );
break;
}
default:
break;
}
}
catch(Exception& ex)
{
dlog[Debug::CRIT] << myname << "(processingMessage): " << ex << endl;
}
}
// -----------------------------------------------------------------------------
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "UniSetObject_LT.h" #include "UniSetObject_LT.h"
#include "Extensions.h" #include "Extensions.h"
#include "SharedMemory.h" #include "SharedMemory.h"
#include "UniversalInterface.h" #include "UInterface.h"
#include "SMInterface.h" #include "SMInterface.h"
#include "LProcessor.h" #include "LProcessor.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -33,11 +33,10 @@ class PassiveLProcessor: ...@@ -33,11 +33,10 @@ class PassiveLProcessor:
virtual void getInputs(); virtual void getInputs();
virtual void setOuts(); virtual void setOuts();
virtual void processingMessage( UniSetTypes::VoidMessage *msg ); void sysCommand( const UniSetTypes::SystemMessage *msg );
void sysCommand( UniSetTypes::SystemMessage *msg ); void sensorInfo( const UniSetTypes::SensorMessage*sm );
void sensorInfo( UniSetTypes::SensorMessage*sm ); void timerInfo( const UniSetTypes::TimerMessage *tm );
void timerInfo( UniSetTypes::TimerMessage *tm ); void askSensors( const UniversalIO::UIOCommand cmd );
void askSensors( UniversalIO::UIOCommand cmd );
// void initOutput(); // void initOutput();
// действия при завершении работы // действия при завершении работы
...@@ -51,7 +50,7 @@ class PassiveLProcessor: ...@@ -51,7 +50,7 @@ class PassiveLProcessor:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::uniset_mutex mutex_start; UniSetTypes::uniset_mutex mutex_start;
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
......
...@@ -110,8 +110,7 @@ void Schema::extlink( const string& name, Element::ElementID childID, int numIn ...@@ -110,8 +110,7 @@ void Schema::extlink( const string& name, Element::ElementID childID, int numIn
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
Element* Schema::manage( Element* el ) Element* Schema::manage( Element* el )
{ {
if( dlog.debugging(Debug::INFO) ) dinfo << "Schema: manage new element id=" << el->getId()
dlog[Debug::INFO] << "Schema: manage new element id=" << el->getId()
<< " type=" << el->getType() << " type=" << el->getType()
<< " inputs=" << el->inCount() << endl; << " inputs=" << el->inCount() << endl;
......
...@@ -47,8 +47,7 @@ void TAND::setIn( int num, bool state ) ...@@ -47,8 +47,7 @@ void TAND::setIn( int num, bool state )
if( !brk ) if( !brk )
myout = true; myout = true;
if( dlog.debugging(Debug::INFO) ) dinfo << this << ": myout " << myout << endl;
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
......
...@@ -13,7 +13,7 @@ TDelay::TDelay( Element::ElementID id, int delayMS, int inCount): ...@@ -13,7 +13,7 @@ TDelay::TDelay( Element::ElementID id, int delayMS, int inCount):
if( inCount!=0 ) if( inCount!=0 )
{ {
// создаём заданное количество входов // создаём заданное количество входов
for( int i=1;i<=inCount;i++ ) for( unsigned int i=1;i<=inCount;i++ )
ins.push_front(InputInfo(i,false)); // addInput(i,st); ins.push_front(InputInfo(i,false)); // addInput(i,st);
} }
} }
...@@ -30,8 +30,7 @@ void TDelay::setIn( int num, bool state ) ...@@ -30,8 +30,7 @@ void TDelay::setIn( int num, bool state )
{ {
pt.setTiming(0); // reset timer pt.setTiming(0); // reset timer
myout = false; myout = false;
if( dlog.debugging(Debug::INFO) ) dinfo << this << ": set " << myout << endl;
dlog[Debug::INFO] << this << ": set " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
return; return;
...@@ -44,8 +43,7 @@ void TDelay::setIn( int num, bool state ) ...@@ -44,8 +43,7 @@ void TDelay::setIn( int num, bool state )
{ {
pt.setTiming(0); // reset timer pt.setTiming(0); // reset timer
myout = true; myout = true;
if( dlog.debugging(Debug::INFO) ) dinfo << this << ": set " << myout << endl;
dlog[Debug::INFO] << this << ": set " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
return; return;
...@@ -54,8 +52,7 @@ void TDelay::setIn( int num, bool state ) ...@@ -54,8 +52,7 @@ void TDelay::setIn( int num, bool state )
// засекаем, если ещё не установлен таймер // засекаем, если ещё не установлен таймер
if( !myout && !prev ) // т.е. !myout && prev != myout if( !myout && !prev ) // т.е. !myout && prev != myout
{ {
if( dlog.debugging(Debug::INFO) ) dinfo << this << ": set timer " << delay << " [msec]" << endl;
dlog[Debug::INFO] << this << ": set timer " << delay << " [msec]" << endl;
pt.setTiming(delay); pt.setTiming(delay);
} }
} }
...@@ -66,8 +63,7 @@ void TDelay::tick() ...@@ -66,8 +63,7 @@ void TDelay::tick()
{ {
myout = true; myout = true;
pt.setTiming(0); // reset timer pt.setTiming(0); // reset timer
if( dlog.debugging(Debug::INFO) ) dinfo << getType() << "(" << myid << "): TIMER!!!! myout=" << myout << endl;
dlog[Debug::INFO] << getType() << "(" << myid << "): TIMER!!!! myout=" << myout << endl;
Element::setChildOut(); Element::setChildOut();
} }
} }
......
...@@ -22,9 +22,6 @@ void TNOT::setIn( int num, bool state ) ...@@ -22,9 +22,6 @@ void TNOT::setIn( int num, bool state )
bool prev = myout; bool prev = myout;
myout = !state; myout = !state;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
} }
......
...@@ -13,7 +13,7 @@ TOR::TOR(ElementID id, int num, bool st): ...@@ -13,7 +13,7 @@ TOR::TOR(ElementID id, int num, bool st):
if( num!=0 ) if( num!=0 )
{ {
// создаём заданное количество входов // создаём заданное количество входов
for( int i=1;i<=num;i++ ) for( unsigned int i=1;i<=num;i++ )
{ {
ins.push_front(InputInfo(i,st)); // addInput(i,st); ins.push_front(InputInfo(i,st)); // addInput(i,st);
if( st == true ) if( st == true )
...@@ -60,8 +60,7 @@ void TOR::setIn( int num, bool state ) ...@@ -60,8 +60,7 @@ void TOR::setIn( int num, bool state )
if( !brk ) if( !brk )
myout = false; myout = false;
if( dlog.debugging(Debug::INFO) ) dinfo << this << ": myout " << myout << endl;
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( prev != myout ) if( prev != myout )
Element::setChildOut(); Element::setChildOut();
} }
......
...@@ -23,13 +23,13 @@ int main(int argc, const char **argv) ...@@ -23,13 +23,13 @@ int main(int argc, const char **argv)
std::ostringstream logname; std::ostringstream logname;
string dir(conf->getLogDir()); string dir(conf->getLogDir());
logname << dir << logfilename; logname << dir << logfilename;
unideb.logFile( logname.str() ); ulog.logFile( logname.str() );
dlog.logFile( logname.str() ); dlog.logFile( logname.str() );
string schema = conf->getArgParam("--schema"); string schema = conf->getArgParam("--schema");
if( schema.empty() ) if( schema.empty() )
{ {
dlog[Debug::CRIT] << "schema-file not defined. Use --schema" << endl; dcrit << "schema-file not defined. Use --schema" << endl;
return 1; return 1;
} }
......
#include <iostream> #include <iostream>
#include "Configuration.h" #include "Configuration.h"
#include "Extensions.h" #include "Extensions.h"
#include "ObjectsActivator.h" #include "UniSetActivator.h"
#include "PassiveLProcessor.h" #include "PassiveLProcessor.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -25,7 +25,7 @@ int main(int argc, const char **argv) ...@@ -25,7 +25,7 @@ int main(int argc, const char **argv)
std::ostringstream logname; std::ostringstream logname;
string dir(conf->getLogDir()); string dir(conf->getLogDir());
logname << dir << logfilename; logname << dir << logfilename;
unideb.logFile( logname.str() ); ulog.logFile( logname.str() );
dlog.logFile( logname.str() ); dlog.logFile( logname.str() );
string schema = conf->getArgParam("--schema"); string schema = conf->getArgParam("--schema");
...@@ -70,16 +70,16 @@ int main(int argc, const char **argv) ...@@ -70,16 +70,16 @@ int main(int argc, const char **argv)
PassiveLProcessor plc(schema,ID,shmID); PassiveLProcessor plc(schema,ID,shmID);
ObjectsActivator act; UniSetActivator act;
act.addObject(static_cast<class UniSetObject*>(&plc)); act.addObject(static_cast<class UniSetObject*>(&plc));
SystemMessage sm(SystemMessage::StartUp); SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() ); act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n"; ulog << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n"; ulog << "(main): -------------- IOControl START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n"; dlog << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n"; dlog << "(main): -------------- IOControl START -------------------------\n\n";
act.run(false); act.run(false);
return 0; return 0;
} }
......
...@@ -6,9 +6,9 @@ if HAVE_EXTENTIONS ...@@ -6,9 +6,9 @@ if HAVE_EXTENTIONS
SUBDIRS = lib include SharedMemory IOControl LogicProcessor \ SUBDIRS = lib include SharedMemory IOControl LogicProcessor \
ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \ ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \
RRDServer SharedMemoryPlus tests RRDServer SharedMemoryPlus tests
#SMDBServer #SMDBServer
#SharedMemoryPlus #SharedMemoryPlus
#UDPExchange
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetExtensions.pc pkgconfig_DATA = libUniSetExtensions.pc
...@@ -17,7 +17,4 @@ else ...@@ -17,7 +17,4 @@ else
SUBDIRS = SUBDIRS =
endif endif
include $(top_builddir)/conf/common.mk
...@@ -28,7 +28,7 @@ class MBExchange: ...@@ -28,7 +28,7 @@ class MBExchange:
{ {
public: public:
MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, SharedMemory* ic=0, MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="mb" ); const std::string& prefix="mb" );
virtual ~MBExchange(); virtual ~MBExchange();
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
...@@ -161,7 +161,7 @@ class MBExchange: ...@@ -161,7 +161,7 @@ class MBExchange:
DeviceType dtype; /*!< тип устройства */ DeviceType dtype; /*!< тип устройства */
UniSetTypes::ObjectId resp_id; UniSetTypes::ObjectId resp_id;
IOController::DIOStateList::iterator resp_dit; IOController::IOStateList::iterator resp_it;
PassiveTimer resp_ptTimeout; PassiveTimer resp_ptTimeout;
Trigger resp_trTimeout; Trigger resp_trTimeout;
bool resp_state; bool resp_state;
...@@ -170,7 +170,7 @@ class MBExchange: ...@@ -170,7 +170,7 @@ class MBExchange:
bool resp_init; bool resp_init;
bool ask_every_reg; bool ask_every_reg;
UniSetTypes::ObjectId mode_id; UniSetTypes::ObjectId mode_id;
IOController::AIOStateList::iterator mode_ait; IOController::IOStateList::iterator mode_it;
long mode; // режим работы с устройством (см. ExchangeMode) long mode; // режим работы с устройством (см. ExchangeMode)
// return TRUE if state changed // return TRUE if state changed
...@@ -200,10 +200,9 @@ class MBExchange: ...@@ -200,10 +200,9 @@ class MBExchange:
protected: protected:
virtual void step(); virtual void step();
virtual void processingMessage( UniSetTypes::VoidMessage *msg ); virtual void sysCommand( const UniSetTypes::SystemMessage *msg );
virtual void sysCommand( UniSetTypes::SystemMessage *msg ); virtual void sensorInfo( const UniSetTypes::SensorMessage*sm );
virtual void sensorInfo( UniSetTypes::SensorMessage*sm ); virtual void timerInfo( const UniSetTypes::TimerMessage *tm );
virtual void timerInfo( UniSetTypes::TimerMessage *tm );
virtual void askSensors( UniversalIO::UIOCommand cmd ); virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void initOutput(); virtual void initOutput();
virtual void sigterm( int signo ); virtual void sigterm( int signo );
...@@ -255,7 +254,7 @@ class MBExchange: ...@@ -255,7 +254,7 @@ class MBExchange:
void waitSMReady(); void waitSMReady();
void readConfiguration(); void readConfiguration();
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec ); bool readItem( const UniXML& xml, UniXML_iterator& it, xmlNode* sec );
bool initItem( UniXML_iterator& it ); bool initItem( UniXML_iterator& it );
void initDeviceList(); void initDeviceList();
void initOffsetList(); void initOffsetList();
...@@ -281,7 +280,7 @@ class MBExchange: ...@@ -281,7 +280,7 @@ class MBExchange:
SMInterface* shm; SMInterface* shm;
bool initPause; bool initPause;
UniSetTypes::uniset_mutex mutex_start; UniSetTypes::uniset_rwmutex mutex_start;
bool force; /*!< флаг означающий, что надо сохранять в SM, даже если значение не менялось */ bool force; /*!< флаг означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out; /*!< флаг означающий, принудительного чтения выходов */ bool force_out; /*!< флаг означающий, принудительного чтения выходов */
...@@ -292,15 +291,14 @@ class MBExchange: ...@@ -292,15 +291,14 @@ class MBExchange:
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat; UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat; int maxHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat; IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id; UniSetTypes::ObjectId test_id;
UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */ UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */
IOController::AIOStateList::iterator aitExchangeMode; IOController::IOStateList::iterator itExchangeMode;
long exchangeMode; /*!< режим работы см. ExchangeMode */ long exchangeMode; /*!< режим работы см. ExchangeMode */
UniSetTypes::uniset_mutex actMutex; UniSetTypes::mutex_atomic_t activated;
bool activated;
int activateTimeout; int activateTimeout;
bool noQueryOptimization; bool noQueryOptimization;
bool no_extimer; bool no_extimer;
......
...@@ -11,7 +11,7 @@ using namespace UniSetTypes; ...@@ -11,7 +11,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions; using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MBTCPMaster::MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, MBTCPMaster::MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
SharedMemory* ic, const std::string prefix ): SharedMemory* ic, const std::string& prefix ):
MBExchange(objId,shmId,ic,prefix), MBExchange(objId,shmId,ic,prefix),
force_disconnect(true), force_disconnect(true),
mbtcp(0), mbtcp(0),
...@@ -38,7 +38,7 @@ pollThread(0) ...@@ -38,7 +38,7 @@ pollThread(0)
prop_prefix = ""; prop_prefix = "";
} }
dlog[Debug::INFO] << myname << "(init): prop_prefix=" << prop_prefix << endl; dinfo << myname << "(init): prop_prefix=" << prop_prefix << endl;
UniXML_iterator it(cnode); UniXML_iterator it(cnode);
...@@ -53,9 +53,10 @@ pollThread(0) ...@@ -53,9 +53,10 @@ pollThread(0)
if( port <= 0 ) if( port <= 0 )
throw UniSetTypes::SystemError(myname+"(MBMaster): Unknown inet port...(Use: " + tmp +")" ); throw UniSetTypes::SystemError(myname+"(MBMaster): Unknown inet port...(Use: " + tmp +")" );
dinfo << myname << "(init): gateway " << iaddr << ":" << port << endl;
force_disconnect = conf->getArgInt("--" + prefix + "-persistent-connection",it.getProp("persistent_connection")) ? false : true; force_disconnect = conf->getArgInt("--" + prefix + "-persistent-connection",it.getProp("persistent_connection")) ? false : true;
dlog[Debug::INFO] << myname << "(init): persisten-connection=" << (!force_disconnect) << endl; dinfo << myname << "(init): persisten-connection=" << (!force_disconnect) << endl;
if( shm->isLocalwork() ) if( shm->isLocalwork() )
{ {
...@@ -68,7 +69,7 @@ pollThread(0) ...@@ -68,7 +69,7 @@ pollThread(0)
pollThread = new ThreadCreator<MBTCPMaster>(this, &MBTCPMaster::poll_thread); pollThread = new ThreadCreator<MBTCPMaster>(this, &MBTCPMaster::poll_thread);
if( dlog.debugging(Debug::INFO) ) if( dlog.is_info() )
printMap(rmap); printMap(rmap);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -106,14 +107,14 @@ ModbusClient* MBTCPMaster::initMB( bool reopen ) ...@@ -106,14 +107,14 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
mbtcp->setAfterSendPause(aftersend_pause); mbtcp->setAfterSendPause(aftersend_pause);
dlog[Debug::INFO] << myname << "(init): ipaddr=" << iaddr << " port=" << port << endl; dinfo << myname << "(init): ipaddr=" << iaddr << " port=" << port << endl;
if( dlog.debugging(Debug::LEVEL9) ) if( dlog.is_level9() )
mbtcp->setLog(dlog); mbtcp->setLog(dlog);
} }
catch( ModbusRTU::mbException& ex ) catch( ModbusRTU::mbException& ex )
{ {
dlog[Debug::WARN] << "(init): " << ex << endl; dwarn << "(init): " << ex << endl;
} }
catch(...) catch(...)
{ {
...@@ -127,7 +128,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen ) ...@@ -127,7 +128,7 @@ ModbusClient* MBTCPMaster::initMB( bool reopen )
return mbtcp; return mbtcp;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MBTCPMaster::sysCommand( UniSetTypes::SystemMessage *sm ) void MBTCPMaster::sysCommand( const UniSetTypes::SystemMessage *sm )
{ {
MBExchange::sysCommand(sm); MBExchange::sysCommand(sm);
if( sm->command == SystemMessage::StartUp ) if( sm->command == SystemMessage::StartUp )
...@@ -146,7 +147,7 @@ void MBTCPMaster::poll_thread() ...@@ -146,7 +147,7 @@ void MBTCPMaster::poll_thread()
try try
{ {
if( sidExchangeMode != DefaultObjectId && force ) if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode); exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
} }
catch(...){} catch(...){}
try try
...@@ -175,25 +176,25 @@ void MBTCPMaster::help_print( int argc, const char* const* argv ) ...@@ -175,25 +176,25 @@ void MBTCPMaster::help_print( int argc, const char* const* argv )
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv, MBTCPMaster* MBTCPMaster::init_mbmaster( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, SharedMemory* ic, UniSetTypes::ObjectId icID, SharedMemory* ic,
const std::string prefix ) const std::string& prefix )
{ {
string name = conf->getArgParam("--" + prefix + "-name","MBTCPMaster1"); string name = conf->getArgParam("--" + prefix + "-name","MBTCPMaster1");
if( name.empty() ) if( name.empty() )
{ {
dlog[Debug::CRIT] << "(MBTCPMaster): Не задан name'" << endl; dcrit << "(MBTCPMaster): Не задан name'" << endl;
return 0; return 0;
} }
ObjectId ID = conf->getObjectID(name); ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId ) if( ID == UniSetTypes::DefaultObjectId )
{ {
dlog[Debug::CRIT] << "(MBTCPMaster): идентификатор '" << name dcrit << "(MBTCPMaster): идентификатор '" << name
<< "' не найден в конф. файле!" << "' не найден в конф. файле!"
<< " в секции " << conf->getObjectsSection() << endl; << " в секции " << conf->getObjectsSection() << endl;
return 0; return 0;
} }
dlog[Debug::INFO] << "(MBTCPMaster): name = " << name << "(" << ID << ")" << endl; dinfo << "(MBTCPMaster): name = " << name << "(" << ID << ")" << endl;
return new MBTCPMaster(ID,icID,ic,prefix); return new MBTCPMaster(ID,icID,ic,prefix);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -193,25 +193,25 @@ class MBTCPMaster: ...@@ -193,25 +193,25 @@ class MBTCPMaster:
{ {
public: public:
MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, SharedMemory* ic=0, MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="mbtcp" ); const std::string& prefix="mbtcp" );
virtual ~MBTCPMaster(); virtual ~MBTCPMaster();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static MBTCPMaster* init_mbmaster( int argc, const char* const* argv, static MBTCPMaster* init_mbmaster( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, SharedMemory* ic=0, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="mbtcp" ); const std::string& prefix="mbtcp" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
protected: protected:
virtual void sysCommand( UniSetTypes::SystemMessage *sm ); virtual void sysCommand( const UniSetTypes::SystemMessage *sm );
UniSetTypes::uniset_mutex mbMutex; UniSetTypes::uniset_rwmutex mbMutex;
std::string iaddr; std::string iaddr;
// ost::InetAddress* ia; // ost::InetAddress* ia;
int port; int port;
int recv_timeout; // int recv_timeout;
// virtual void step(); // virtual void step();
virtual ModbusClient* initMB( bool reopen=false ); virtual ModbusClient* initMB( bool reopen=false );
...@@ -227,7 +227,7 @@ class MBTCPMaster: ...@@ -227,7 +227,7 @@ class MBTCPMaster:
// т.к. TCP может "зависнуть" на подключении к недоступному узлу // т.к. TCP может "зависнуть" на подключении к недоступному узлу
// делаем опрос в отдельном потоке // делаем опрос в отдельном потоке
ThreadCreator<MBTCPMaster>* pollThread; /*!< поток опроса */ ThreadCreator<MBTCPMaster>* pollThread; /*!< поток опроса */
UniSetTypes::uniset_mutex tcpMutex; UniSetTypes::uniset_rwmutex tcpMutex;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _MBTCPMaster_H_ #endif // _MBTCPMaster_H_
......
...@@ -215,26 +215,25 @@ class MBTCPMultiMaster: ...@@ -215,26 +215,25 @@ class MBTCPMultiMaster:
{ {
public: public:
MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, SharedMemory* ic=0, MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="mbtcp" ); const std::string& prefix="mbtcp" );
virtual ~MBTCPMultiMaster(); virtual ~MBTCPMultiMaster();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static MBTCPMultiMaster* init_mbmaster( int argc, const char* const* argv, static MBTCPMultiMaster* init_mbmaster( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, SharedMemory* ic=0, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="mbtcp" ); const std::string& prefix="mbtcp" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
protected: protected:
virtual void sysCommand( UniSetTypes::SystemMessage *sm ); virtual void sysCommand( const UniSetTypes::SystemMessage *sm );
virtual void initIterators(); virtual void initIterators();
virtual ModbusClient* initMB( bool reopen=false ); virtual ModbusClient* initMB( bool reopen=false );
void poll_thread(); void poll_thread();
void check_thread(); void check_thread();
UniSetTypes::uniset_mutex mbMutex; UniSetTypes::uniset_rwmutex mbMutex;
int recv_timeout;
bool force_disconnect; bool force_disconnect;
int checktime; int checktime;
...@@ -256,7 +255,7 @@ class MBTCPMultiMaster: ...@@ -256,7 +255,7 @@ class MBTCPMultiMaster:
bool respond; bool respond;
UniSetTypes::ObjectId respond_id; UniSetTypes::ObjectId respond_id;
IOController::DIOStateList::iterator respond_dit; IOController::IOStateList::iterator respond_it;
bool respond_invert; bool respond_invert;
inline bool operator < ( const MBSlaveInfo& mbs ) const inline bool operator < ( const MBSlaveInfo& mbs ) const
...@@ -285,7 +284,7 @@ class MBTCPMultiMaster: ...@@ -285,7 +284,7 @@ class MBTCPMultiMaster:
// т.к. TCP может "зависнуть" на подключении к недоступному узлу // т.к. TCP может "зависнуть" на подключении к недоступному узлу
// делаем опрос в отдельном потоке // делаем опрос в отдельном потоке
ThreadCreator<MBTCPMultiMaster>* pollThread; /*!< поток опроса */ ThreadCreator<MBTCPMultiMaster>* pollThread; /*!< поток опроса */
UniSetTypes::uniset_mutex tcpMutex; UniSetTypes::uniset_rwmutex tcpMutex;
ThreadCreator<MBTCPMultiMaster>* checkThread; /*!< поток проверки связи по другим каналам */ ThreadCreator<MBTCPMultiMaster>* checkThread; /*!< поток проверки связи по другим каналам */
}; };
......
...@@ -9,7 +9,7 @@ using namespace UniSetTypes; ...@@ -9,7 +9,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions; using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
RTUExchange::RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, SharedMemory* ic, RTUExchange::RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, SharedMemory* ic,
const std::string prefix_ ): const std::string& prefix_ ):
MBExchange(objId,shmId,ic,prefix_), MBExchange(objId,shmId,ic,prefix_),
mbrtu(0), mbrtu(0),
defSpeed(ComPort::ComSpeed38400), defSpeed(ComPort::ComSpeed38400),
...@@ -38,7 +38,7 @@ rs_pre_clean(false) ...@@ -38,7 +38,7 @@ rs_pre_clean(false)
prop_prefix = ""; prop_prefix = "";
} }
dlog[Debug::INFO] << myname << "(init): prop_prefix=" << prop_prefix << endl; dinfo << myname << "(init): prop_prefix=" << prop_prefix << endl;
UniXML_iterator it(cnode); UniXML_iterator it(cnode);
...@@ -69,7 +69,7 @@ rs_pre_clean(false) ...@@ -69,7 +69,7 @@ rs_pre_clean(false)
initMB(false); initMB(false);
if( dlog.debugging(Debug::INFO) ) if( dlog.is_info() )
printMap(rmap); printMap(rmap);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -130,7 +130,7 @@ ModbusClient* RTUExchange::initMB( bool reopen ) ...@@ -130,7 +130,7 @@ ModbusClient* RTUExchange::initMB( bool reopen )
mbrtu->setSleepPause(sleepPause_usec); mbrtu->setSleepPause(sleepPause_usec);
mbrtu->setAfterSendPause(aftersend_pause); mbrtu->setAfterSendPause(aftersend_pause);
dlog[Debug::INFO] << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl; dinfo << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl;
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
...@@ -138,7 +138,7 @@ ModbusClient* RTUExchange::initMB( bool reopen ) ...@@ -138,7 +138,7 @@ ModbusClient* RTUExchange::initMB( bool reopen )
delete mbrtu; delete mbrtu;
mbrtu = 0; mbrtu = 0;
dlog[Debug::WARN] << myname << "(init): " << ex << endl; dwarn << myname << "(init): " << ex << endl;
} }
catch(...) catch(...)
{ {
...@@ -146,7 +146,7 @@ ModbusClient* RTUExchange::initMB( bool reopen ) ...@@ -146,7 +146,7 @@ ModbusClient* RTUExchange::initMB( bool reopen )
delete mbrtu; delete mbrtu;
mbrtu = 0; mbrtu = 0;
dlog[Debug::INFO] << myname << "(init): catch...." << endl; dinfo << myname << "(init): catch...." << endl;
} }
mb = mbrtu; mb = mbrtu;
...@@ -158,7 +158,7 @@ void RTUExchange::step() ...@@ -158,7 +158,7 @@ void RTUExchange::step()
try try
{ {
if( sidExchangeMode != DefaultObjectId && force ) if( sidExchangeMode != DefaultObjectId && force )
exchangeMode = shm->localGetValue(aitExchangeMode,sidExchangeMode); exchangeMode = shm->localGetValue(itExchangeMode,sidExchangeMode);
} }
catch(...){} catch(...){}
...@@ -223,12 +223,9 @@ void RTUExchange::poll() ...@@ -223,12 +223,9 @@ void RTUExchange::poll()
if( !d->rtu ) if( !d->rtu )
continue; continue;
if( dlog.debugging(Debug::LEVEL3) ) dlog3 << myname << "(pollRTU188): poll RTU188 "
{
dlog[Debug::LEVEL3] << myname << "(pollRTU188): poll RTU188 "
<< " mbaddr=" << ModbusRTU::addr2str(d->mbaddr) << " mbaddr=" << ModbusRTU::addr2str(d->mbaddr)
<< endl; << endl;
}
try try
{ {
...@@ -242,19 +239,15 @@ void RTUExchange::poll() ...@@ -242,19 +239,15 @@ void RTUExchange::poll()
{ {
if( d->resp_real ) if( d->resp_real )
{ {
if( dlog.debugging(Debug::LEVEL3) ) dlog3 << myname << "(poll): FAILED ask addr=" << ModbusRTU::addr2str(d->mbaddr)
{
dlog[Debug::CRIT] << myname << "(poll): FAILED ask addr=" << ModbusRTU::addr2str(d->mbaddr)
<< " -> " << ex << endl; << " -> " << ex << endl;
}
d->resp_real = false; d->resp_real = false;
} }
} }
} }
else else
{ {
if( dlog.debugging(Debug::LEVEL3) ) dlog3 << myname << "(poll): ask addr=" << ModbusRTU::addr2str(d->mbaddr)
dlog[Debug::LEVEL3] << myname << "(poll): ask addr=" << ModbusRTU::addr2str(d->mbaddr)
<< " regs=" << d->regmap.size() << endl; << " regs=" << d->regmap.size() << endl;
d->resp_real = false; d->resp_real = false;
...@@ -274,13 +267,11 @@ void RTUExchange::poll() ...@@ -274,13 +267,11 @@ void RTUExchange::poll()
{ {
// if( d->resp_real ) // if( d->resp_real )
// { // {
if( dlog.debugging(Debug::LEVEL3) ) dlog3 << myname << "(poll): FAILED ask addr=" << ModbusRTU::addr2str(d->mbaddr)
{
dlog[Debug::LEVEL3] << myname << "(poll): FAILED ask addr=" << ModbusRTU::addr2str(d->mbaddr)
<< " reg=" << ModbusRTU::dat2str(it->second->mbreg) << " reg=" << ModbusRTU::dat2str(it->second->mbreg)
<< " for sensors: "; print_plist(dlog(Debug::LEVEL3), it->second->slst); << " for sensors: "; print_plist(dlog(Debug::LEVEL3), it->second->slst);
dlog(Debug::LEVEL3) << " err: " << ex << endl; dlog(Debug::LEVEL3) << " err: " << ex << endl;
}
// d->resp_real = false; // d->resp_real = false;
// } // }
} }
...@@ -318,8 +309,7 @@ void RTUExchange::poll() ...@@ -318,8 +309,7 @@ void RTUExchange::poll()
if( allNotRespond && ptReopen.checkTime() ) if( allNotRespond && ptReopen.checkTime() )
{ {
uniset_mutex_lock l(pollMutex, 300); uniset_mutex_lock l(pollMutex, 300);
if( dlog.debugging(Debug::WARN) ) dwarn << myname << ": REOPEN timeout..(" << ptReopen.getInterval() << ")" << endl;
dlog[Debug::WARN] << myname << ": REOPEN timeout..(" << ptReopen.getInterval() << ")" << endl;
mb = initMB(true); mb = initMB(true);
ptReopen.reset(); ptReopen.reset();
...@@ -329,7 +319,7 @@ void RTUExchange::poll() ...@@ -329,7 +319,7 @@ void RTUExchange::poll()
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
RTUExchange* RTUExchange::init_rtuexchange( int argc, const char* const* argv, UniSetTypes::ObjectId icID, RTUExchange* RTUExchange::init_rtuexchange( int argc, const char* const* argv, UniSetTypes::ObjectId icID,
SharedMemory* ic, const std::string prefix ) SharedMemory* ic, const std::string& prefix )
{ {
string name = conf->getArgParam("--" + prefix + "-name","RTUExchange1"); string name = conf->getArgParam("--" + prefix + "-name","RTUExchange1");
if( name.empty() ) if( name.empty() )
...@@ -347,7 +337,7 @@ RTUExchange* RTUExchange::init_rtuexchange( int argc, const char* const* argv, U ...@@ -347,7 +337,7 @@ RTUExchange* RTUExchange::init_rtuexchange( int argc, const char* const* argv, U
return 0; return 0;
} }
dlog[Debug::INFO] << "(rtuexchange): name = " << name << "(" << ID << ")" << endl; dinfo << "(rtuexchange): name = " << name << "(" << ID << ")" << endl;
return new RTUExchange(ID,icID,ic,prefix); return new RTUExchange(ID,icID,ic,prefix);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -359,7 +349,7 @@ bool RTUExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniX ...@@ -359,7 +349,7 @@ bool RTUExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniX
RTUDeviceMap::iterator d = m.find(a); RTUDeviceMap::iterator d = m.find(a);
if( d == m.end() ) if( d == m.end() )
{ {
dlog[Debug::WARN] << myname << "(initDeviceInfo): not found device for addr=" << ModbusRTU::addr2str(a) << endl; dwarn << myname << "(initDeviceInfo): not found device for addr=" << ModbusRTU::addr2str(a) << endl;
return false; return false;
} }
...@@ -370,7 +360,7 @@ bool RTUExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniX ...@@ -370,7 +360,7 @@ bool RTUExchange::initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a, UniX
if( d->second->speed == ComPort::ComSpeed0 ) if( d->second->speed == ComPort::ComSpeed0 )
{ {
d->second->speed = defSpeed; d->second->speed = defSpeed;
dlog[Debug::CRIT] << myname << "(initDeviceInfo): Unknown speed=" << s << dcrit << myname << "(initDeviceInfo): Unknown speed=" << s <<
" for addr=" << ModbusRTU::addr2str(a) << endl; " for addr=" << ModbusRTU::addr2str(a) << endl;
return false; return false;
} }
......
...@@ -14,13 +14,13 @@ class RTUExchange: ...@@ -14,13 +14,13 @@ class RTUExchange:
{ {
public: public:
RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID,
SharedMemory* ic=0, const std::string prefix="rs" ); SharedMemory* ic=0, const std::string& prefix="rs" );
virtual ~RTUExchange(); virtual ~RTUExchange();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static RTUExchange* init_rtuexchange( int argc, const char* const* argv, static RTUExchange* init_rtuexchange( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, SharedMemory* ic=0, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="rs" ); const std::string& prefix="rs" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
...@@ -42,7 +42,6 @@ class RTUExchange: ...@@ -42,7 +42,6 @@ class RTUExchange:
private: private:
RTUExchange(); RTUExchange();
UniSetTypes::uniset_mutex pollMutex;
bool rs_pre_clean; bool rs_pre_clean;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
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