Commit e67b6868 authored by Pavel Vainerman's avatar Pavel Vainerman

(MBSlave): исправил ошибку с неправильной работой счётчика запросов

parent 1f09b1e0
......@@ -2,5 +2,5 @@
# This file is part of the UniSet library #
############################################################################
SUBDIRS = UniSetTypes Processes
SUBDIRS = UniSetTypes Processes Services
include $(top_builddir)/conf/common.mk
......@@ -8,6 +8,7 @@ HHDIR=$(top_builddir)/include
# Исходные файлы IDL
IDLFILES=IOController_i.idl
#UniSetObserver_i.idl
include $(top_builddir)/conf/idl.mk
......
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2005/01/28 20:27:06 $
* \version $Id: UniSetObserver_i.idl,v 1.4 2005/01/28 20:27:06 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef UniSetObserver_i_IDL_
#define UniSetObserver_i_IDL_
// --------------------------------------------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
// --------------------------------------------------------------------------------------------------------------
/*!
* \interface UniSetObserver_i
* \brief шаблон "Наблюдатель"
*/
interface UniSetObserver_i
{
// исключения
exception NameNotFound
{
string err;
};
void attach( in UniSetTypes::ObjectId id, in UniSetTypes::ObjectId fromid ) raises(NameNotFound);
void detach( in UniSetTypes::ObjectId id, in UniSetTypes::ObjectId fromid ) raises(NameNotFound);
};
// --------------------------------------------------------------------------------------------------------------
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2005/11/01 21:44:53 $
* \version $Id: DBServer_i.idl,v 1.5 2005/11/01 21:44:53 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef DBServer_i_IDL_
#define DBServer_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface DBServer_i
* \brief Интерфейс сервера базы данных системы
*/
interface DBServer_i: UniSetObject_i
{
// исключения
exception DBError
{
string errmsg;
};
void query(in string query) raises(DBError);
string hostname();
string dbname();
};
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2005/01/28 20:27:06 $
* \version $Id: InfoServer_i.idl,v 1.4 2005/01/28 20:27:06 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef InfoServer_i_IDL_
#define InfoServer_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface InfoServer_i
* \brief Интерфейс к серверу сообщений
*/
interface InfoServer_i: UniSetObject_i
{
// исключения
exception MsgNotFound
{
UniSetTypes::MessageCode bad_code;
};
// исключения
exception MsgBadRange
{
};
/*! Заказ информации о приходе сообщения */
void ackMessage(in UniSetTypes::MessageCode mid, in UniSetTypes::ConsumerInfo ci,
in UniversalIO::UIOCommand cmd, in boolean acknotify ) raises(MsgNotFound);
/*! Заказ информации о приходе сообщений из диапазона */
void ackMessageRange(in UniSetTypes::MessageCode from, in UniSetTypes::MessageCode to,
in UniSetTypes::ConsumerInfo ci,
in UniversalIO::UIOCommand cmd, in boolean acknotify ) raises(MsgNotFound,MsgBadRange);
};
// --------------------------------------------------------------------------
#endif
############################################################################
# This file is part of the UniSet library #
############################################################################
# Каталоги для размещения генерируемых CC- и HH-файлов соответственно
CCDIR=$(top_builddir)/src/Services
HHDIR=$(top_builddir)/include
# Исходные файлы IDL
IDLFILES=TimerService_i.idl InfoServer_i.idl
include $(top_builddir)/conf/idl.mk
idl_include_HEADERS = *.idl
idl_includedir = $(datadir)/idl/@PACKAGE@/Services
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2005/01/28 20:27:06 $
* \version $Id: NetService_i.idl,v 1.4 2005/01/28 20:27:06 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef NetService_i_IDL_
#define BaseProcess_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface NetService_i
*/
interface NetService_i
{
void registration( in BaseObjectName name, in Object ref );
void unregistration( in BaseObjectName name, in Object ref );
Object resolve(in BaseObjectName name);
Object resolveid( in BaseObjectId name);
};
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2005/11/01 21:44:53 $
* \version $Id: RepositoryAgent_i.idl,v 1.5 2005/11/01 21:44:53 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef RepositoryAgent_i_IDL_
#define RepositoryAgent_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------------------------------------------
/*!
* \interface RepositoryAgent_i
* \brief Интерфейс агента репозитория
* Агент репозитрория предназначен для получения доступа к объектам с удаленных узлов.
* Он запускается на каждом узле, и с других узлов через него можно получить доступ
* к процессам, датчикам и т.п на данном узле.
*/
interface RepositoryAgent_i: UniSetObject_i
{
// исключения
exception NameNotFound
{
string errmsg;
};
exception ResolveError
{
string errmsg;
};
// void registration( in BaseObjectName name, in Object ref );
// void unregistration( in BaseObjectName name, in Object ref );
// Object resolve(in BaseObjectName name) raises(NameNotFound, ResolveError);
Object resolveid( in UniSetTypes::ObjectId name) raises(NameNotFound, ResolveError);
};
#endif
\ No newline at end of file
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2005/01/28 21:24:12 $
* \version $Id: TimerService_i.idl,v 1.1 2005/01/28 21:24:12 vitlav Exp $
*/
// --------------------------------------------------------------------------
#ifndef TimerService_i_IDL_
#define TimerService_i_IDL_
// --------------------------------------------------------------------------
#include "../UniSetTypes/UniSetTypes_i.idl"
#include "../UniSetTypes/UniSetObject_i.idl"
// --------------------------------------------------------------------------
/*!
* \interface TimerService_i
*/
interface TimerService_i: UniSetObject_i
{
/*! Превышения максимально возможного
* количества таймеров
*/
exception LimitTimers
{
long maxTimers;
};
/*! Таймер с таким id уже заказан
* (от данного заказчика)
*/
exception TimerAlreadyExist
{
};
/*! Задан интервал меньше
* минимально разрешённого
*/
exception TimeMSLowLimit
{
unsigned long lowLimitMS; // instead timeout_t
};
/*! Информация о таймере */
struct Timer
{
UniSetTypes::TimerId timerid;
unsigned long timeMS;
long ticks; // instead clock_t
short msgPriority;
};
/*! заказ таймера */
void askTimer( in Timer ti, in UniSetTypes::ConsumerInfo ci )
raises(LimitTimers, TimerAlreadyExist, TimeMSLowLimit);
// void setSysTime(...);
// void getSysTime(...);
};
#endif
\ No newline at end of file
......@@ -7,7 +7,7 @@ CCDIR=$(top_builddir)/src/ObjectRepository
HHDIR=$(top_builddir)/include
# Исходные файлы IDL
IDLFILES=UniSetTypes_i.idl UniSetObject_i.idl UniSetManager_i.idl
IDLFILES=UniSetTypes_i.idl UniSetObject_i.idl ObjectsManager_i.idl
include $(top_builddir)/conf/idl.mk
......
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2007/12/18 20:24:11 $
* \version $Id: ObjectsManager_i.idl,v 1.2 2007/12/18 20:24:11 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef ObjectsManager_i_IDL_
#define ObjectsManager_i_IDL_
// ---------------------------------------------------------------------------
#include "UniSetObject_i.idl"
#include "UniSetTypes_i.idl"
// ---------------------------------------------------------------------------
//module UniSet
//{
/*!
* \interface ObjectsManager_i
* \brief Интерфейс менеджера объектов
* \author Pavel Vainerman
* \version
* \date September 2001-
*
* Базовый класс для менеджеров объектов. Позволяет посылать сообщение
* ко всем объектам сразу.
*/
interface ObjectsManager_i : UniSetObject_i
{
/*!< распространить сообщение всем подчиненным объектам */
void broadcast(in UniSetTypes::TransportMessage msg);
/*! получение информации о состоянии подчиненных объектов(менеджеров)
* \param MaxLength - ограничение размера возвращаемой
* последовательности структур SimpleInfo.
* \note Если у менеджера количество подчиненных объектов
* больше MaxLength, то он вернет информацию только
* о первых MaxLength объектах. Если <=, то количество
* равное количеству объектов.
* \note Возвращаемые данные содержат в себе инфо. о всех
* подчиненных объектах данного менеджера, а также объектах
* подчиненных данному менеджеру менеджерах и их объектах
* и т.п. и т.п. рекурсивно... Так что MaxLength должно быть
* достаточным.
* \todo Подумать насчет применения итератора, при слишком
* большом( >1000 ) количестве подчиненных объектов...
*/
UniSetTypes::SimpleInfoSeq getObjectsInfo( in long MaxLength );
};
//}; // end of module UniSet
#endif
// --------------------------------------------------------------------------------------------------------------
......@@ -19,6 +19,8 @@
// --------------------------------------------------------------------------
/*! \file
* \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_
......
......@@ -19,6 +19,8 @@
// --------------------------------------------------------------------------
/*! \file
* \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_
......@@ -30,15 +32,13 @@
{
typedef string<100> BaseObjectName;
typedef long ObjectId; /*!< идентификатор объекта */
typedef long MessageCode; /*!< код сообщения */
typedef long ThresholdId; /*!< идентификатор порога */
typedef long TimerId; /*!< идентификатор таймера */
typedef string<30> ObjectType; /*!< тип объекта */
const unsigned short SizeOfTransportMessage=85;
typedef octet ByteOfMessage; /*!< тип для одного байта сообщения */
typedef ByteOfMessage RawDataOfTransportMessage[SizeOfTransportMessage]; /*!< данные в сообщении */
typedef ByteOfMessage RawDataOfTransportMessage[100]; /*!< данные в сообщении */
/*!
* Структура пакета предназначенного для пересылки по сети
......@@ -59,6 +59,7 @@
{
ObjectId id;
boolean connected;
ObjectId infserver;
ObjectId dbserver;
string host;
string port;
......@@ -94,13 +95,13 @@
/*!
* Типы входов/выходов
*/
enum IOType
enum IOTypes
{
UnknownIOType,
DI, // DigitalInput
DO, // DigitalOutput
AI, // AnalogInput
AO // AnalogOutput
DigitalInput,
DigitalOutput,
AnalogInput,
AnalogOutput
};
/*! Разрешенные команды для всех контроллеров ввода/вывода */
......
......@@ -2,13 +2,16 @@
- Внести в проект реализацию протокола PLCNet // нужно ли
- написать "uniset-check" автоматический тест основных функций (getValue/setValue и т.п.)
- написать "uniset-check" автоматический тест основных функций
(saveState/Value, getState/Value, setState/Value и т.п.)
- сделать, чтобы можно было Debug пускать через syslog (да ещё и на другую машину)
- Подумать и реализовать механизм хранения ссылок (IOR) с использованием разделяемой памяти...
(сейчас есть IORFile и omniNames). // нужно ли
- Сделать ObjectIndex_ArrayXML. т.е. использовать vector, при этом считывая индексы из XML. // нужно ли
- (IONotifyController): Разработать механизм заказа переодических уведомлений (msec), независимо от того, менялись ли датчики..
- (IONotifyController): Разработать механизм заказа группы датчиков сразу (и ответ тоже группой)
......@@ -16,13 +19,24 @@
admin:
- processing "precision"
codegen:
- Сделать работу с TestMode на основе заказа!
- Сделать работу с ResetMsg на основе askTimer! // подумать нужно ли..
iocontrol:
- добавить ещё один вид сигналов (настройку) "работа по переднему фронту".
Т.е. сигнал меняет своё состояние по изменению входного (типа для кнопок без фиксации). "trigger"(обрабатывать после jar_delay)
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
- циклическое хранилище для аварийных следов на основе SQLite
- отказаться от alias-ов.. (не прижилось, а накладные расходы большие)
......@@ -9,4 +9,3 @@ uniset_admin_CPPFLAGS = -I$(top_builddir)/lib
include $(top_builddir)/conf/setting.mk
############################################################################
# This file is part of the UniSet library #
############################################################################
bin_PROGRAMS = uniset-infoserver
uniset_infoserver_SOURCES = main.cc
uniset_infoserver_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_infoserver_CPPFLAGS = -I$(top_builddir)/lib $(SIGC_CFLAGS)
include $(top_builddir)/conf/setting.mk
#include "Configuration.h"
#include "InfoServer.h"
#include "ISRestorer.h"
#include "ObjectsActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
{
cout << "Usage: uniset-infoserver --name ObjectId [--askfile filename]"
<< " [--confile configure.xml]\n";
}
// --------------------------------------------------------------------------
int main(int argc, char** argv)
{
try
{
if( argc>1 && !strcmp(argv[1],"--help") )
{
short_usage();
return 0;
}
uniset_init(argc,argv,"configure.xml");
ObjectId ID = conf->getInfoServer();
// определяем ID объекта
string name = conf->getArgParam("--name");
if( !name.empty() )
{
if( ID != UniSetTypes::DefaultObjectId )
{
unideb[Debug::WARN] << "(InfoServer::main): переопределяем ID заданнй в "
<< conf->getConfFileName() << endl;
}
ID = conf->oind->getIdByName(conf->getServicesSection()+"/"+name);
if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(InfoServer): идентификатор '" << name
<< "' не найден в конф. файле!"
<< " в секции " << conf->getServicesSection() << endl;
return 1;
}
}
else if( ID == UniSetTypes::DefaultObjectId )
{
cerr << "(DBServer::main): Не удалось определить ИДЕНТИФИКАТОР сервера" << endl;
short_usage();
return 1;
}
// определяем ask-файл
string askfile = conf->getArgParam("--askfile",conf->getConfFileName());
if( askfile.empty() )
{
InfoServer is(ID,new ISRestorer_XML(askfile));
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&is));
act.run(false);
}
else
{
InfoServer is(ID);
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&is));
act.run(false);
}
return 0;
}
catch(Exception& ex)
{
cerr << "(InfoServer::main): " << ex << endl;
}
catch(...)
{
cerr << "(InfoServer::main): catch ..." << endl;
}
return 1;
}
......@@ -88,7 +88,7 @@ void MBSlave::execute()
// с проверкой на переполнение
askCount = askCount>=numeric_limits<long>::max() ? 0 : askCount+1;
if( res!=ModbusRTU::erNoError )
++errmap[res];
errmap[res]++;
prev = res;
}
......@@ -116,11 +116,11 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
d.b[6] = 1;
// Фомирование ответа:
unsigned int bcnt = query.count / ModbusRTU::BitsPerByte;
int bcnt = query.count / ModbusRTU::BitsPerByte;
if( (query.count % ModbusRTU::BitsPerByte) > 0 )
bcnt++;
for( unsigned int i=0; i<bcnt; i++ )
for( int i=0; i<bcnt; i++ )
{
if( replyVal!=-1 )
reply.addData(replyVal);
......@@ -149,18 +149,18 @@ ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query,
while( i<query.count )
{
reply.addData(0);
for( unsigned int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
for( int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
reply.setBit(bnum,nbit,d.b[nbit]);
bnum++;
}
}
else
{
unsigned int bcnt = query.count / ModbusRTU::BitsPerByte;
int bcnt = query.count / ModbusRTU::BitsPerByte;
if( (query.count % ModbusRTU::BitsPerByte) > 0 )
bcnt++;
for( unsigned int i=0; i<bcnt; i++ )
for( int i=0; i<bcnt; i++ )
{
if( i == 1 )
reply.addData(replyVal2);
......@@ -381,7 +381,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <= 0 )
{
dwarn << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed;
}
......@@ -393,7 +393,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
int ret = ::read(fd,&buf,sizeof(buf));
if( ret < 0 )
{
dwarn << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
dlog[Debug::WARN] << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -407,7 +407,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
struct stat fs;
if( fstat(fd,&fs) < 0 )
{
dwarn << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
dlog[Debug::WARN] << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -422,7 +422,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) )
{
dwarn << "(fileTransfer): set date failed..." << endl;
dlog[Debug::WARN] << "(fileTransfer): set date failed..." << endl;
return ModbusRTU::erOperationFailed;
}
......@@ -536,3 +536,5 @@ ModbusRTU::mbErrCode MBSlave::read4314( ModbusRTU::MEIMessageRDI& query,
return ModbusRTU::erBadDataAddress;
}
// -------------------------------------------------------------------------
......@@ -85,7 +85,7 @@ void MBTCPServer::execute()
// с проверкой на переполнение
askCount = askCount>=numeric_limits<long>::max() ? 0 : askCount+1;
if( res!=ModbusRTU::erNoError )
++errmap[res];
errmap[res]++;
prev = res;
}
......@@ -161,7 +161,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query
while( i<query.count )
{
reply.addData(0);
for( unsigned int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
for( int nbit=0; nbit<BitsPerByte && i<query.count; nbit++,i++ )
reply.setBit(bnum,nbit,d.b[nbit]);
bnum++;
}
......@@ -172,7 +172,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query
if( (query.count % ModbusRTU::BitsPerByte) > 0 )
bcnt++;
for( unsigned int i=0; i<bcnt; i++ )
for( int i=0; i<bcnt; i++ )
reply.addData(replyVal);
}
......@@ -376,7 +376,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
int fd = open(fname.c_str(), O_RDONLY | O_NONBLOCK );
if( fd <= 0 )
{
dwarn << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
dlog[Debug::WARN] << "(fileTransfer): open '" << fname << "' with error: " << strerror(errno) << endl;
return ModbusRTU::erOperationFailed;
}
......@@ -388,7 +388,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
int ret = ::read(fd,&buf,sizeof(buf));
if( ret < 0 )
{
dwarn << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
dlog[Debug::WARN] << "(fileTransfer): read from '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -402,7 +402,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
struct stat fs;
if( fstat(fd,&fs) < 0 )
{
dwarn << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
dlog[Debug::WARN] << "(fileTransfer): fstat for '" << fname << "' with error: " << strerror(errno) << endl;
close(fd);
return ModbusRTU::erOperationFailed;
}
......@@ -417,7 +417,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
if( !reply.set(query.numfile,numpacks,query.numpacket,buf,ret) )
{
dwarn << "(fileTransfer): set date failed..." << endl;
dlog[Debug::WARN] << "(fileTransfer): set date failed..." << endl;
return ModbusRTU::erOperationFailed;
}
......
......@@ -3,7 +3,10 @@
############################################################################
SUBDIRS = scripts Admin NullController SViewer-text \
SMonit MBTester codegen SImitator
InfoServer SMonit MBTester codegen SImitator
#MapSourceParser ClassGen
include $(top_builddir)/conf/common.mk
include $(top_builddir)/conf/common.mk
......
......@@ -8,4 +8,3 @@ uniset_nullController_LDADD = $(top_builddir)/lib/libUniSet.la
uniset_nullController_CPPFLAGS = -I$(top_builddir)/lib $(SIGC_CFLAGS)
include $(top_builddir)/conf/setting.mk
......@@ -7,11 +7,13 @@ using namespace UniSetTypes;
using namespace std;
// --------------------------------------------------------------------------------
NullController::NullController( ObjectId id, const string& askdump,
const std::string& s_filterField,
const std::string& s_filterValue,
const std::string& c_filterField,
const std::string& c_filterValue,
NullController::NullController( ObjectId id, const string askdump,
const std::string s_filterField,
const std::string s_filterValue,
const std::string c_filterField,
const std::string c_filterValue,
const std::string d_filterField,
const std::string d_filterValue,
bool _dumpingToDB ):
IONotifyController(id),
dumpingToDB(_dumpingToDB)
......@@ -21,6 +23,7 @@ dumpingToDB(_dumpingToDB)
NCRestorer_XML* askd = new NCRestorer_XML(askdump);
askd->setItemFilter(s_filterField, s_filterValue);
askd->setConsumerFilter(c_filterField, c_filterValue);
askd->setDependsFilter(d_filterField, d_filterValue);
restorer = askd;
......
......@@ -10,11 +10,13 @@ class NullController:
public IONotifyController
{
public:
NullController( UniSetTypes::ObjectId id, const std::string& restorfile,
const std::string& s_filterField="",
const std::string& s_filterValue="",
const std::string& c_filterField="",
const std::string& c_filterValue="",
NullController( UniSetTypes::ObjectId id, const std::string restorfile,
const std::string s_filterField="",
const std::string s_filterValue="",
const std::string c_filterField="",
const std::string c_filterValue="",
const std::string d_filterField="",
const std::string d_filterValue="",
bool _dumpingToDB=false );
virtual ~NullController();
......
#include "Configuration.h"
#include "NullController.h"
#include "UniSetActivator.h"
#include "ObjectsActivator.h"
#include "Debug.h"
#include "PassiveTimer.h"
// --------------------------------------------------------------------------
......@@ -16,6 +16,8 @@ static void short_usage()
<< " --s-filter-value value - значение для поля фильтрования списка датчиков \n"
<< " --c-filter-field name - поле для фильтрования списка заказчиков по каждому датчику\n"
<< " --c-filter-value value - значение для поля фильтрования списка заказчиков по каждому датчику\n"
<< " --d-filter-field name - поле для фильтрования списка зависимостей по каждому датчику\n"
<< " --d-filter-value value - значение для поля фильтрования списка зависимостей по каждому датчику\n"
<< " --dbDumping [0,1] - создавать ли dump-файл \n";
}
// --------------------------------------------------------------------------
......@@ -66,12 +68,14 @@ int main(int argc, char** argv)
string s_fvalue = conf->getArgParam("--s-filter-value");
string c_field = conf->getArgParam("--c-filter-field");
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");
NullController nc(ID,askfile,s_field,s_fvalue,c_field,c_fvalue,dbDumping);
UniSetActivator act;
NullController nc(ID,askfile,s_field,s_fvalue,c_field,c_fvalue,d_field,d_fvalue,dbDumping);
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&nc));
act.run(false);
return 0;
......
#include <iostream>
#include "Exceptions.h"
#include "UInterface.h"
#include "UniversalInterface.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
......@@ -20,7 +20,7 @@ void help_print()
struct ExtInfo:
public UniSetTypes::ParamSInfo
{
UniversalIO::IOType iotype;
UniversalIO::IOTypes iotype;
};
// -----------------------------------------------------------------------------
int main( int argc, char **argv )
......@@ -37,7 +37,7 @@ int main( int argc, char **argv )
// -------------------------------------
uniset_init(argc, argv, "configure.xml" );
UInterface ui;
UniversalInterface ui;
string sid(conf->getArgParam("--sid"));
if( sid.empty() )
......@@ -57,8 +57,8 @@ int main( int argc, char **argv )
std::list<ExtInfo> l;
for( std::list<UniSetTypes::ParamSInfo>::iterator it = lst.begin(); it!=lst.end(); ++it )
{
UniversalIO::IOType t = conf->getIOType( it->si.id );
if( t != UniversalIO::AI && t != UniversalIO::AO )
UniversalIO::IOTypes t = conf->getIOType( it->si.id );
if( t != UniversalIO::AnalogInput && t != UniversalIO::AnalogOutput )
{
cerr << endl << "Неверный типа датчика '" << t << "' для id='" << it->fname << "'. Тип должен быть AI или AO." << endl << endl;
return 1;
......@@ -122,6 +122,9 @@ int main( int argc, char **argv )
{
try
{
if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, j, UniversalIO::AnalogInput, DefaultObjectId);
else
ui.setValue(it->si, j, DefaultObjectId);
}
catch( Exception& ex )
......@@ -147,6 +150,9 @@ int main( int argc, char **argv )
{
try
{
if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, i, UniversalIO::AnalogInput, DefaultObjectId);
else
ui.setValue(it->si, i, DefaultObjectId);
}
catch( Exception& ex )
......
#include <iostream>
#include <string>
#include "UniSetActivator.h"
#include "ObjectsActivator.h"
#include "Configuration.h"
#include "SMonitor.h"
// -----------------------------------------------------------------------------
......@@ -33,7 +33,7 @@ int main( int argc, const char **argv )
return 0;
}
UniSetActivator act;
ObjectsActivator act;
SMonitor tp(ID);
act.addObject(&tp);
......
......@@ -8,4 +8,3 @@ uniset_sviewer_text_LDADD = $(top_builddir)/lib/libUniSet.la
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)
uniset_init(argc,argv,"configure.xml");
/*
UInterface ui;
UniversalInterface ui;
IDList lst;
lst.add(1);
lst.add(2);
......
......@@ -42,7 +42,7 @@
#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"/>Trigger.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UInterface.h<xsl:call-template name="postinclude"/>
#include <xsl:call-template name="preinclude"/>UniversalInterface.h<xsl:call-template name="postinclude"/>
// -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK:
<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:
// Текущее значение и предыдущее значение
<xsl:for-each select="//smap/item">
long <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
long prev_<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> </xsl:text><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"/>;
</xsl:for-each>
// --- public variables ---
......
......@@ -31,7 +31,7 @@
// -----------------------------------------------------------------------------
#include &lt;sstream&gt;
#include <xsl:call-template name="preinclude"/>Configuration.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"/>ObjectsActivator.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"
// -----------------------------------------------------------------------------
......@@ -53,6 +53,10 @@ int main( int argc,char* argv[] )
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" );
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 объекта
ObjectId ID(DefaultObjectId);
......@@ -70,11 +74,7 @@ int main( int argc,char* argv[] )
<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() );
UniSetActivator act;
ObjectsActivator act;
act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj));
SystemMessage sm(SystemMessage::StartUp);
......
......@@ -33,7 +33,7 @@
// -----------------------------------------------------------------------------
#include &lt;sstream&gt;
#include <xsl:call-template name="preinclude"/>Configuration.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"/>ObjectsActivator.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"
// -----------------------------------------------------------------------------
......@@ -55,6 +55,10 @@ int main( int argc, const char** argv )
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" );
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:value-of select="$CLASSNAME"/> obj;
......@@ -75,14 +79,9 @@ int main( int argc, const char** argv )
}
}
<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>
UniSetActivator act;
ObjectsActivator act;
act.addObject(static_cast&lt;class UniSetObject*&gt;(&amp;obj));
SystemMessage sm(SystemMessage::StartUp);
......
#include <sstream>
#include <UniSetActivator.h>
#include <ObjectsActivator.h>
#include "Skel.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
......@@ -14,14 +14,14 @@ int main( int argc, const char **argv )
string logfilename = conf->getArgParam("--logfile", "Skel.log");
string logname( conf->getLogDir() + logfilename );
// dlog.logFile( logname.c_str() );
ulog.logFile( logname.c_str() );
unideb.logFile( logname.c_str() );
// conf->initDebug(dlog,"dlog");
UniSetActivator act;
ObjectsActivator act;
xmlNode* cnode = conf->getNode("Skel");
if( cnode == NULL )
{
dlog.crit() << "(Skel): not found <Skel> in conffile" << endl;
dlog[Debug::CRIT] << "(Skel): not found <Skel> in conffile" << endl;
return 1;
}
......@@ -31,10 +31,10 @@ int main( int argc, const char **argv )
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
ulog << "\n\n\n";
ulog << "(Skel::main): -------------- Skel START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(Skel::main): -------------- Skel START -------------------------\n\n";
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(Skel::main): -------------- Skel START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(Skel::main): -------------- Skel START -------------------------\n\n";
act.run(false);
}
catch(SystemError& err)
......
......@@ -23,11 +23,11 @@ void Skel::step()
{
}
// -----------------------------------------------------------------------------
void Skel::sensorInfo( const SensorMessage *sm )
void Skel::sensorInfo( SensorMessage *sm )
{
}
// -----------------------------------------------------------------------------
void Skel::timerInfo( const TimerMessage *tm )
void Skel::timerInfo( TimerMessage *tm )
{
}
// -----------------------------------------------------------------------------
......
noinst_PROGRAMS = test test2
#test2
test_LDADD = $(top_builddir)/lib/libUniSet.la $(COMCPP_LIBS)
test_CXXFLAGS = -I$(top_builddir)/include $(COMCPP_CGLAGS)
test_LDADD = $(top_builddir)/lib/libUniSet.la
test_CXXFLAGS = -I$(top_builddir)/include
test_SOURCES = TestGen_SK.cc TestGen.cc TestGen-main.cc
test2_LDADD = $(top_builddir)/lib/libUniSet.la $(COMCPP_LIBS)
test2_CXXFLAGS = -I$(top_builddir)/include $(COMCPP_CGLAGS)
test2_LDADD = $(top_builddir)/lib/libUniSet.la
test2_CXXFLAGS = -I$(top_builddir)/include
test2_SOURCES = TestGenAlone_SK.cc TestGenAlone.cc TestGenAlone-main.cc
GENERATED=TestGen_SK.h TestGen_SK.cc TestGen-main.cc
GENERATED2=TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc
GENUOBJ=UObject_SK.cc UObject_SK.h
TestGen_SK.cc: ../@PACKAGE@-codegen testgen.src.xml ../*.xsl
$(GENERATED): ../@PACKAGE@-codegen testgen.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include -n TestGen testgen.src.xml
TestGenAlone_SK.cc: ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
$(GENERATED2): ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml
$(GENUOBJ): ../@PACKAGE@-codegen uobject.src.xml ../*.xsl
......
......@@ -39,10 +39,10 @@
</variables>
<smap>
<!-- name - название переменной в конф. файле -->
<item name="input1_s" vartype="in" comment="comment for input1" smTestID="1"/>
<item name="input2_s" vartype="in" comment="comment for input2" />
<item name="output1_c" vartype="out" omment="comment for output1" no_check_id="1"/>
<item name="loglevel_s" vartype="in" comment="log level control" loglevel="1"/>
<item name="input1_s" vartype="in" iotype="DI" comment="comment for input1" smTestID="1"/>
<item name="input2_s" vartype="in" iotype="DI" comment="comment for input2" />
<item name="output1_c" vartype="out" iotype="DO" omment="comment for output1" no_check_id="1"/>
<item name="loglevel_s" vartype="in" iotype="AI" omment="log level control" loglevel="1"/>
</smap>
<msgmap>
......
......@@ -33,4 +33,3 @@ depend:
install:
......@@ -7,8 +7,8 @@
%define oname uniset
Name: libuniset
Version: 2.0
Release: alt0.2
Version: 1.7
Release: alt3
Summary: UniSet - library for building distributed industrial control systems
......@@ -202,6 +202,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%files utils
%_bindir/%oname-admin
%_bindir/%oname-infoserver
%_bindir/%oname-mb*
%_bindir/%oname-nullController
%_bindir/%oname-sviewer-text
......@@ -224,6 +225,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%_includedir/%oname/*.h
%_includedir/%oname/*.hh
%_includedir/%oname/*.tcc
%_includedir/%oname/IOs/
%_includedir/%oname/modbus/
%if_enabled mysql
%_includedir/%oname/mysql/
......@@ -333,33 +335,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc
%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
- add RRDServer
......
......@@ -14,7 +14,7 @@
<AutoStartUpTime name="1"/>
<DumpStateTime name="10"/>
<SleepTickMS name="500"/>
<UniSetDebug levels="crit,warn" name="ulog"/>
<UniSetDebug levels="crit,warn" name="unideb"/>
<ConfDir name="./"/>
<DataDir name="./"/>
<BinDir name="./"/>
......@@ -33,22 +33,6 @@
</UniSet>
<dlog name="dlog"/>
<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"/>
<testnode id="1000" id2="-100" name="testnode"/>
<SharedMemory name="SharedMemory" shmID="SharedMemory">
......@@ -76,6 +60,9 @@
</GateList>
</MBMultiMaster1>
<MBSlave2 addr="0x3">
</MBSlave2>
<MBSlave1 addr="0x31" aftersend-pause="0" dev="/dev/ttyS0" levels="info,warn,crit" name="MBSlave1" poll_time="200" reply_timeout="60" speed="9600">
<filelist>
<!-- Список файлов разрешённых для передачи по modbus
......@@ -137,7 +124,7 @@
<UNetExchange name="UNetExchange"/>
<HeartBeatTime time_msec="5000"/>
<TestGen input1_s="Input1_S" input2_s="DumpSensor1_S" name="TestGen" output1_c="DO_C"/>
<RRDServer1 name="RRDServer1">
<RRDStorage1 name="RRDStorage1">
<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:MAX:0.5:1:4320"/>
......@@ -146,7 +133,7 @@
<item rra="RRA:AVERAGE:0.5:1:4320"/>
<item rra="RRA:MAX:0.5:1:4320"/>
</rrd>
</RRDServer1>
</RRDStorage1>
</settings>
<ObjectsMap idfromfile="1">
<!--
......@@ -171,15 +158,16 @@
</nodes>
<!-- ************************ Датчики ********************** -->
<sensors name="Sensors">
<item dbignore="1" default="1" id="1" iotype="DI" name="Input1_S" priority="Medium" textname="Команда 1"/>
<item db_ignore="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="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="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="11" iotype="AI" name="AI11_AS" priority="Medium" textname="AI 11" depend="Input4_S" depend_off_value="-50"/>
<item id="12" iotype="DI" name="Input12_S" priority="Medium" textname="Команда 12" iofront="01"/>
<item id="60" iotype="DI" name="Input60_S" priority="Medium" textname="Команда 61" iofront="10"/>
<item id="5" iotype="DI" name="Input5_S" priority="Medium" textname="Команда 5" udp="2"/>
<item id="6" iotype="DI" name="Input6_S" priority="Medium" textname="Команда 6" udp="2">
<depends>
<depend name="Input4_S"/>
</depends>
</item>
<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 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"/>
......@@ -222,8 +210,7 @@
<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="57" iotype="AI" name="AI57_S" textname="AI sensor 57" rrd="2" rrd2_ds="DERIVE:20:U:U"/>
<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="58" iotype="AI" name="SVU_AskCount_AS" textname="svu asl count"/>
</sensors>
<thresholds name="thresholds">
<sensor iotype="AI" name="AI_AS">
......@@ -260,57 +247,8 @@
<item id="6008" name="UNetExchange"/>
<item id="6009" name="MBMaster2"/>
<item id="6010" name="MBMultiMaster1"/>
<item id="6011" name="RRDServer1"/>
<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="6011" name="RRDStorage1"/>
<item id="6012" name="MBSlave2"/>
</objects>
</ObjectsMap>
<messages idfromfile="1" name="messages">
......@@ -324,12 +262,6 @@
<!-- <xi:include href="testIDnon-exist.xml"/> -->
<Calibrations name="Calibrations">
<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="-100" y="-60"/>
<point x="-50" y="-20"/>
......@@ -337,14 +269,6 @@
<point x="50" y="20"/>
<point x="100" 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>
</Calibrations>
</UNISETPLC>
......@@ -3,7 +3,7 @@
# See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html
# AC_PREREQ(2.59)
AC_INIT([uniset], [2.0.0], pv@etersoft.ru)
AC_INIT([uniset], [1.7.0], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
# AC_CONFIG_MACRO_DIR([m4])
......@@ -30,7 +30,7 @@ AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
LIBVER=2:0:0
LIBVER=1:7:0
AC_SUBST(LIBVER)
# Checks for libraries.
......@@ -204,8 +204,10 @@ AC_CONFIG_FILES([Makefile
IDL/Makefile
IDL/UniSetTypes/Makefile
IDL/Processes/Makefile
IDL/Services/Makefile
src/Communications/Makefile
src/Communications/Modbus/Makefile
src/IOs/Makefile
src/Interfaces/Makefile
src/ObjectRepository/Makefile
src/Processes/Makefile
......@@ -216,7 +218,9 @@ AC_CONFIG_FILES([Makefile
src/Makefile
include/Makefile
include/modbus/Makefile
include/IOs/Makefile
tests/Makefile
tests/JrnTests/Makefile
tests/UniXmlTest/Makefile
docs/Makefile
docs/UniSetDox.cfg
......@@ -227,6 +231,7 @@ AC_CONFIG_FILES([Makefile
Utilities/NullController/Makefile
Utilities/SViewer-text/Makefile
Utilities/SMonit/Makefile
Utilities/InfoServer/Makefile
Utilities/MBTester/Makefile
Utilities/SImitator/Makefile
Utilities/codegen/Makefile
......
......@@ -76,8 +76,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
...
<ObjectsMap idfromfile="0">
<nodes port="2809">
<item name="LocalhostNode" alias="" textname="Локальный узел" ip="127.0.0.1" dbserver=""/>
<item name="Node2" alias="" textname="Локальный узел" ip="127.0.0.1" dbserver=""/>
<item name="LocalhostNode" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/>
<item name="Node2" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/>
</nodes>
<sensors>
<item name="Input1_S" textname="Команда 1" node="" iotype="DI" priority="Medium" default="1" />
......@@ -91,8 +91,10 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
<!-- ******************* Идентификаторы сервисов ***************** -->
<services name="Services">
<item name="InfoServer"/>
<item name="DBServer"/>
<item name="PrintServer"/>
<item name="TimeService"/>
</services>
<!-- ******************* Идентификаторы объектов ***************** -->
......@@ -132,8 +134,8 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
...
<ObjectsMap idfromfile="1">
<nodes port="2809">
<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" dbserver=""/>
<item id="1000" name="LocalhostNode" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/>
<item id="1001" name="Node2" alias="" textname="Локальный узел" ip="127.0.0.1" infserver="InfoServer" dbserver=""/>
</nodes>
<sensors>
<item id="1" name="Input1_S" textname="Команда 1" node="" iotype="DI" priority="Medium" default="1" />
......@@ -147,8 +149,10 @@ UniSetTypes::Message::TheLastFieldOfTypeOfMessage.
<!-- ******************* Идентификаторы сервисов ***************** -->
<services name="Services">
<item id="500" name="InfoServer"/>
<item id="501" name="DBServer"/>
<item id="502" name="PrintServer"/>
<item id="503" name="TimeService"/>
</services>
<!-- ******************* Идентификаторы объектов ***************** -->
......
......@@ -77,19 +77,28 @@ int main(int argc, char **argv)
</UniSet>
<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">
<Tables></Tables>
</LocalDBServer>
</Services>
<!-- список узлов в сиситеме -->
<ListOfNodes>
<!--
Параметры:
infserver - id инфо-сервера на данном узле(если указать "", значит нет)
dbnode - id db-сервера на данном узле DB(если указать "", значит нет)
-->
<Node name="LocalhostNode" dbserver="DBServer1"/>
<Node name="LocalhostNode" infserver="InfoServer1" dbserver="DBServer1"/>
</ListOfNodes>
</UniSetTestConfiguration>
......
......@@ -3,6 +3,8 @@
\page ServicesPage Сервисы
- \ref secDBServer
- \ref secInfoService
- \ref secTimerService
\section secDBServer Сервер БД
......
<<<<<<< HEAD
/*! OBSOLETE DOC!!
\page CommitPage Общее описание библиотеки UniSet
/* OBSOLETE DOC!!
\page CommonPage Общее описание библиотеки UniSet
- \ref secSection1
- \ref subIO
- Алгоритмы управления
- \ref UniSetGraphics
- \ref subInfoServer
- \ref UniDiag
- \ref subTimer
- \ref secSection2
- \ref subTransfer
......@@ -55,6 +56,15 @@
буферизацию данных на время недоступности других узлов.
\sa \ref secDBServer
\subsection subInfoServer Система оповещения
Некоторым алгоритмам требуются сообщать о том или ином событии оператору. Для этой цели служит InfoServer.
Идея заключается в следующем: Все объекты, которым необходимо послать информацию, работают с локальным зараннее известным
объектом InfoServer. Все сообщения посылаются ему. В его задачи входит переслать это сообщение объекту отображающему
информацию на экране, а также переслать сообщение на другие узлы(в случае необходимости). Помимо этого InfoServer пересылает
сообщения DBServer-у для сохранения их в БД. То что этот объект является локальным, гарантирует, что он будет
доступен...
\sa \ref secInfoServer
\subsection subIO Ввод/вывод
Процессы ввода/вывода строятся на основе классов IOController и IONotifyController.
\par IOController
......@@ -63,6 +73,12 @@
\par IONotifyController
Раширение IOController-а. Предоставляющее интерфейс для заказа уведомлений об изменении состояния датчиков.
\subsection subTimer Таймеры
В библиотеку включен компонент TimerService. Данный сервис реализует функции генератора переодический событий (таймеров).
TimeService предоставляет интерфейс для заказа уведомлений с заданной переодичностью.
\warning TimerService - НЕ является реализацией спецификации CORBA::TimerService.
\sa \ref secTimerService
\subsection UniSetGraphics Графический интерфейс пользователя
...
......@@ -106,10 +122,6 @@
(поток для "распихивания" приходящих сообщений по объектам). Хотя активатор может не порождать отдельного потока, а работать
в основном потоке программы. А также несколько потоков для orb.
\section secResourses Используемые библиотеки
- libmysqlclient, libtcpwrapGK - работа с MySQL
- linomniORB3(4) - реализация CORBA (удаленный доступ к объектам)
......
......@@ -147,10 +147,14 @@ class DBServer_MySQL:
virtual void initDB(DBInterface *db){};
virtual void initDBTableMap(DBTableMap& tblMap){};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm );
virtual void sysCommand( const UniSetTypes::SystemMessage* sm );
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm );
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg );
virtual void processingMessage( UniSetTypes::VoidMessage *msg );
virtual void timerInfo( UniSetTypes::TimerMessage* tm );
virtual void sysCommand( UniSetTypes::SystemMessage* sm );
// Функции обработки пришедших сообщений
virtual void parse( UniSetTypes::SensorMessage* sm );
virtual void parse( UniSetTypes::DBMessage* dbmsg );
virtual void parse( UniSetTypes::ConfirmMessage* cmsg );
bool writeToBase( const string& query );
virtual void init_dbserver();
......@@ -183,7 +187,7 @@ class DBServer_MySQL:
bool lastRemove;
void flushBuffer();
UniSetTypes::uniset_rwmutex mqbuf;
UniSetTypes::uniset_mutex mqbuf;
private:
DBTableMap tblMap;
......
#include "Configuration.h"
#include "DBServer_MySQL.h"
#include "UniSetActivator.h"
#include "ObjectsActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
......@@ -31,7 +31,7 @@ int main(int argc, char** argv)
{
if( ID != UniSetTypes::DefaultObjectId )
{
ulog.warn() << "(DBServer::main): переопределяем ID заданнй в "
unideb[Debug::WARN] << "(DBServer::main): переопределяем ID заданнй в "
<< conf->getConfFileName() << endl;
}
......@@ -52,7 +52,7 @@ int main(int argc, char** argv)
}
DBServer_MySQL dbs(ID);
UniSetActivator act;
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&dbs));
act.run(false);
}
......
......@@ -147,10 +147,14 @@ class DBServer_SQLite:
virtual void initDB( SQLiteInterface *db ){};
virtual void initDBTableMap(DBTableMap& tblMap){};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm );
virtual void sysCommand( const UniSetTypes::SystemMessage* sm );
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm );
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg );
virtual void processingMessage( UniSetTypes::VoidMessage *msg );
virtual void timerInfo( UniSetTypes::TimerMessage* tm );
virtual void sysCommand( UniSetTypes::SystemMessage* sm );
// Функции обработки пришедших сообщений
virtual void parse( UniSetTypes::SensorMessage* sm );
virtual void parse( UniSetTypes::DBMessage* dbmsg );
virtual void parse( UniSetTypes::ConfirmMessage* cmsg );
bool writeToBase( const string& query );
virtual void init_dbserver();
......@@ -183,7 +187,7 @@ class DBServer_SQLite:
bool lastRemove;
void flushBuffer();
UniSetTypes::uniset_rwmutex mqbuf;
UniSetTypes::uniset_mutex mqbuf;
private:
DBTableMap tblMap;
......
......@@ -254,7 +254,7 @@ SQLiteResult::SQLiteResult( sqlite3_stmt* s, bool finalize )
int n = sqlite3_data_count(s);
COL c;
for( unsigned int i=0; i<n; i++ )
for( int i=0; i<n; i++ )
{
char* p = (char*)sqlite3_column_text(s,i);
if( p )
......
......@@ -25,7 +25,7 @@
#define SQLiteInterface_H_
// ---------------------------------------------------------------------------
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <iostream>
#include <sqlite3.h>
......@@ -81,7 +81,7 @@ class SQLiteResult;
// Памятка:
// Включение режима для журнала - "вести в памяти" (чтобы поберечь CompactFlash)
// PRAGMA journal_mode = MEMORY
// При этом конечно есть риск потерять данные при выключении..
//
// ----------------------------------------------------------------------------
class SQLiteInterface
{
......@@ -136,7 +136,7 @@ class SQLiteResult
~SQLiteResult();
typedef std::vector<std::string> COL;
typedef std::deque<COL> ROW;
typedef std::list<COL> ROW;
typedef ROW::iterator iterator;
......
#include "Configuration.h"
#include "DBServer_SQLite.h"
#include "UniSetActivator.h"
#include "ObjectsActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
......@@ -31,7 +31,7 @@ int main(int argc, char** argv)
{
if( ID != UniSetTypes::DefaultObjectId )
{
ulog.warn() << "(DBServer::main): переопределяем ID заданнй в "
unideb[Debug::WARN] << "(DBServer::main): переопределяем ID заданнй в "
<< conf->getConfFileName() << endl;
}
......@@ -52,7 +52,7 @@ int main(int argc, char** argv)
}
DBServer_SQLite dbs(ID);
UniSetActivator act;
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&dbs));
act.run(false);
}
......
......@@ -3,7 +3,7 @@
#define IOControl_H_
// -----------------------------------------------------------------------------
#include <vector>
#include <deque>
#include <list>
#include <string>
#include "UniXML.h"
#include "PassiveTimer.h"
......@@ -84,10 +84,6 @@
<br>\b jardelay - защита от дребезга. Задержка на дребезг, мсек.
<br>\b ondelay - задержка на срабатывание, мсек.
<br>\b offdelay - задержка на отпускание, мсек.
<br>\b iofront - работа по фронту сигнала (для DI).
<br> "01" - срабатывание (и отпускание) по переходу "0 --> 1"
<br> "10" - срабатывание (и отпускание) по переходу "1 --> 0"
<br>\b safety - безопасное значение. Значение которое сохраняется в случае аварийного
завершения процесса.
......@@ -98,6 +94,7 @@
<br>\b rmax - максимальное "сырое" значение
<br>\b cmin - минимальное "калиброванное" значение
<br>\b cmax - максимальное "калиброванное" значение
<br>\b sensibility - чуствительность. (deprecated)
<br>\b precision - Точность. Задаёт количство знаков после запятой.
<br>Т.е. при считывании из канала, значение домножается
<br>на 10^precision и уже таким сохраняется.
......@@ -108,13 +105,12 @@
<br>\b filterT - Постоянная времени фильтра.
<br>\b caldiagram - Имя калибровочной диаграммы из секции <Calibrations>.
<br>\b cal_cachesize - Размер кэша в калибровочной диаграмме (Calibration.h)
<br>\b cal_cacheresort - Количество циклов обращения к кэшу, для вызова принудительной песортировки. (Calibration.h)
<br>\b threshold_aid - идентификатор аналогового датчика по которому формируется порог.
Используется для DI.
<br>\b lowlimit - нижний порого срабатывания.
<br>\b hilimit - верхний порого срабатывания.
<br>\b sensibility - чувствительность (deprecated)
<br>\b card - номер карты
<br>\b subdev - номер подустройства
......@@ -123,7 +119,7 @@
<br>&nbsp;&nbsp; J1 - chanenel 0 - 15
<br>&nbsp;&nbsp; J2
<br>\b lamp - признак, что данный аналоговый датчик является "лампочкой".
<br> Т.е. на самом деле дискретный выход, который может иметь состояния:
<br> Т.е. на самом деле дискретный выход, который может иметь три состояния
<br>UniSetTypes::lmpOFF - выключен
<br>UniSetTypes::lmpON - включен
<br>UniSetTypes::lmpBLINK - мигание с частотой 1
......@@ -197,13 +193,13 @@ class IOControl:
public UniSetObject
{
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();
/*! глобальная функция для инициализации объекта */
static IOControl* init_iocontrol( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, SharedMemory* ic=0,
const std::string& prefix="io" );
const std::string prefix="io" );
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
......@@ -283,10 +279,11 @@ class IOControl:
void blink();
// действия при завершении работы
virtual void sysCommand( const UniSetTypes::SystemMessage* sm );
virtual void processingMessage( UniSetTypes::VoidMessage* msg );
virtual void sysCommand( UniSetTypes::SystemMessage* sm );
virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm );
virtual void timerInfo( const UniSetTypes::TimerMessage* tm );
virtual void sensorInfo( UniSetTypes::SensorMessage* sm );
virtual void timerInfo( UniSetTypes::TimerMessage* tm );
virtual void sigterm( int signo );
virtual bool activateObject();
......@@ -299,12 +296,12 @@ class IOControl:
// чтение файла конфигурации
void readConfiguration();
bool initIOItem( UniXML_iterator& it );
bool readItem( const UniXML& xml, UniXML_iterator& it, xmlNode* sec );
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec );
void buildCardsList();
void waitSM();
bool checkCards( const std::string& func="" );
bool checkCards( const std::string func="" );
// std::string myname;
xmlNode* cnode; /*!< xml-узел в настроечном файле */
......@@ -313,10 +310,11 @@ class IOControl:
CardList cards; /*!< список карт - массив созданных ComediInterface */
bool noCards;
typedef std::vector<IOInfo> IOMap;
IOMap iomap; /*!< список входов/выходов */
typedef std::deque<IOPriority> PIOMap;
typedef std::list<IOPriority> PIOMap;
PIOMap pmap; /*!< список приоритетных входов/выходов */
unsigned int maxItem; /*!< количество элементов (используется на момент инициализации) */
......@@ -328,7 +326,7 @@ class IOControl:
std::string s_fvalue;
SMInterface* shm;
UInterface ui;
UniversalInterface ui;
UniSetTypes::ObjectId myid;
std::string prefix;
......@@ -356,12 +354,12 @@ class IOControl:
UniSetTypes::ObjectId testLamp_S;
Trigger trTestLamp;
bool isTestLamp;
IOController::IOStateList::iterator itTestLamp;
IOController::DIOStateList::iterator ditTestLamp;
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat;
bool force; /*!< флаг, означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out; /*!< флаг, включающий принудительное чтения выходов */
......@@ -370,7 +368,7 @@ class IOControl:
int maxCardNum; /*! максимально разрешённый номер для карты */
UniSetTypes::uniset_mutex iopollMutex;
UniSetTypes::mutex_atomic_t activated;
bool activated;
bool readconf_ok;
int activateTimeout;
UniSetTypes::ObjectId sidTestSMReady;
......@@ -378,7 +376,7 @@ class IOControl:
UniSetTypes::ObjectId testMode_as;
IOController::IOStateList::iterator itTestMode;
IOController::AIOStateList::iterator aitTestMode;
long testmode;
long prev_testmode;
......
#include <string>
#include "Debug.h"
#include "UniSetActivator.h"
#include "ObjectsActivator.h"
#include "Configuration.h"
#include "IOControl.h"
#include "Extensions.h"
......@@ -28,7 +28,7 @@ int main(int argc, const char **argv)
string logfilename = conf->getArgParam("--io-logfile","iocontrol.log");
string logname( conf->getLogDir() + logfilename );
dlog.logFile( logname );
ulog.logFile( logname );
unideb.logFile( logname );
ObjectId shmID = DefaultObjectId;
string sID = conf->getArgParam("--smemory-id");
......@@ -48,20 +48,20 @@ int main(int argc, const char **argv)
IOControl* ic = IOControl::init_iocontrol(argc,argv,shmID);
if( !ic )
{
dcrit << "(iocontrol): init не прошёл..." << endl;
dlog[Debug::CRIT] << "(iocontrol): init не прошёл..." << endl;
return 1;
}
UniSetActivator act;
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(ic));
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
ulog << "\n\n\n";
ulog << "(main): -------------- IOControl START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- IOControl START -------------------------\n\n";
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
act.run(true);
msleep(500);
ic->execute();
......@@ -69,15 +69,15 @@ int main(int argc, const char **argv)
}
catch(SystemError& err)
{
dcrit << "(iocontrol): " << err << endl;
dlog[Debug::CRIT] << "(iocontrol): " << err << endl;
}
catch(Exception& ex)
{
dcrit << "(iocontrol): " << ex << endl;
dlog[Debug::CRIT] << "(iocontrol): " << ex << endl;
}
catch(...)
{
dcrit << "(iocontrol): catch(...)" << endl;
dlog[Debug::CRIT] << "(iocontrol): catch(...)" << endl;
}
return 1;
......
......@@ -215,7 +215,7 @@ int main(int argc, char* argv[])
{
if( autoconf )
{
for( unsigned int k=0; chan[k]!=-1; k++ )
for( int k=0; chan[k]!=-1; k++ )
{
if( comedi_dio_config(card, subdev, chan[k],INSN_CONFIG_DIO_INPUT) < 0)
{
......@@ -225,7 +225,7 @@ int main(int argc, char* argv[])
}
}
for( unsigned int k=0; chan[k]!=-1; k++ )
for( int k=0; chan[k]!=-1; k++ )
{
if( comedi_dio_read(card, subdev, chan[k],&data) < 0)
{
......@@ -242,7 +242,7 @@ int main(int argc, char* argv[])
{
if( autoconf )
{
for( unsigned int k=0; chan[k]!=-1; k++ )
for( int k=0; chan[k]!=-1; k++ )
{
if( comedi_dio_config(card, subdev, chan[k],INSN_CONFIG_DIO_OUTPUT) < 0 )
{
......@@ -254,7 +254,7 @@ int main(int argc, char* argv[])
// реализация мигания
while(1)
{
for( unsigned int k=0; chan[k]!=-1; k++ )
for( int k=0; chan[k]!=-1; k++ )
{
if( verb )
printf( "write: ch=%d val=%d\n",chan[k],val);
......@@ -277,7 +277,7 @@ int main(int argc, char* argv[])
case cmdARead:
{
for( unsigned int k=0; chan[k]!=-1; k++ )
for( int k=0; chan[k]!=-1; k++ )
{
if( autoconf )
insn_config(card, subdev,chan[k],100,range,aref);
......@@ -296,7 +296,7 @@ int main(int argc, char* argv[])
case cmdAWrite:
{
for( unsigned int k=0; chan[k]!=-1; k++ )
for( int k=0; chan[k]!=-1; k++ )
{
if( autoconf )
insn_config(card,subdev,chan[k],101,range,aref);
......@@ -313,7 +313,7 @@ int main(int argc, char* argv[])
case cmdConfig:
{
for( unsigned int k=0; chan[k]!=-1; k++ )
for( int k=0; chan[k]!=-1; k++ )
{
if( val != INSN_CONFIG_DIO_INPUT
&& val != INSN_CONFIG_DIO_OUTPUT
......
......@@ -35,15 +35,15 @@ void LProcessor::execute( const string& lfile )
}
catch( LogicException& ex )
{
dcrit << logname << "(execute): " << ex << endl;
dlog[Debug::CRIT] << logname << "(execute): " << ex << endl;
}
catch( Exception& ex )
{
dcrit << logname << "(execute): " << ex << endl;
dlog[Debug::CRIT] << logname << "(execute): " << ex << endl;
}
catch(...)
{
dcrit << logname << "(execute): catch...\n";
dlog[Debug::CRIT] << logname << "(execute): catch...\n";
}
msleep(sleepTime);
}
......@@ -67,7 +67,7 @@ void LProcessor::build( const string& lfile )
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
dcrit << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: " << it->name << endl;
dlog[Debug::CRIT] << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: " << it->name << endl;
continue;
}
......@@ -78,7 +78,7 @@ void LProcessor::build( const string& lfile )
ei.iotype = conf->getIOType(sid);
if( ei.iotype == UniversalIO::UnknownIOType )
{
dcrit << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
dlog[Debug::CRIT] << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue;
}
extInputs.push_front(ei);
......@@ -89,7 +89,7 @@ void LProcessor::build( const string& lfile )
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
dcrit << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: " << it->name << endl;
dlog[Debug::CRIT] << "НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: " << it->name << endl;
continue;
}
......@@ -99,7 +99,7 @@ void LProcessor::build( const string& lfile )
ei.iotype = conf->getIOType(sid);
if( ei.iotype == UniversalIO::UnknownIOType )
{
dcrit << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
dlog[Debug::CRIT] << "Unkown iotype for sid=" << sid << "(" << it->name << ")" << endl;
continue;
}
......@@ -120,7 +120,7 @@ void LProcessor::getInputs()
{
// try
// {
it->state = (bool)ui.getValue(it->sid);
it->state = ui.getState(it->sid);
// }
}
}
......@@ -143,15 +143,28 @@ void LProcessor::setOuts()
{
try
{
ui.setValue(it->sid,it->lnk->from->getOut(),DefaultObjectId);
switch(it->iotype)
{
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 )
{
dcrit << "(LProcessor::setOuts): " << ex << endl;
dlog[Debug::CRIT] << "(LProcessor::setOuts): " << ex << endl;
}
catch(...)
{
dcrit << "(LProcessor::setOuts): catch...\n";
dlog[Debug::CRIT] << "(LProcessor::setOuts): catch...\n";
}
}
}
......
......@@ -87,7 +87,7 @@
// --------------------------------------------------------------------------
#include <map>
#include "UniSetTypes.h"
#include "UInterface.h"
#include "UniversalInterface.h"
#include "Element.h"
#include "Schema.h"
// --------------------------------------------------------------------------
......@@ -112,7 +112,7 @@ class LProcessor
struct EXTInfo
{
UniSetTypes::ObjectId sid;
UniversalIO::IOType iotype;
UniversalIO::IOTypes iotype;
bool state;
const Schema::EXTLink* lnk;
};
......@@ -120,7 +120,7 @@ class LProcessor
struct EXTOutInfo
{
UniSetTypes::ObjectId sid;
UniversalIO::IOType iotype;
UniversalIO::IOTypes iotype;
const Schema::EXTOut* lnk;
};
......@@ -131,7 +131,7 @@ class LProcessor
OUTList extOuts;
SchemaXML sch;
UInterface ui;
UniversalInterface ui;
int sleepTime;
int smReadyTimeout; /*!< время ожидания готовности SM */
......
......@@ -24,7 +24,7 @@ PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId o
{
ostringstream err;
err << myname << ": ID not found ('HeartBeat') for " << heart;
dcrit << myname << "(init): " << err.str() << endl;
dlog[Debug::CRIT] << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
......@@ -51,19 +51,21 @@ void PassiveLProcessor::step()
}
catch(Exception& ex )
{
dcrit << myname << "(step): (hb) " << ex << std::endl;
dlog[Debug::CRIT] << myname
<< "(step): (hb) " << ex << std::endl;
}
if( sidHeartBeat!=DefaultObjectId && ptHeartBeat.checkTime() )
{
try
{
shm->localSetValue(itHeartBeat,sidHeartBeat,maxHeartBeat,getId());
shm->localSaveValue(aitHeartBeat,sidHeartBeat,maxHeartBeat,getId());
ptHeartBeat.reset();
}
catch(Exception& ex)
{
dcrit << myname << "(step): (hb) " << ex << std::endl;
dlog[Debug::CRIT] << myname
<< "(step): (hb) " << ex << std::endl;
}
}
......@@ -83,27 +85,27 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
}
catch( Exception& ex )
{
dcrit << myname << "(askSensors): " << ex << endl;
dlog[Debug::CRIT] << myname << "(askSensors): " << ex << endl;
throw SystemError(myname +"(askSensors): do not ask sensors" );
}
}
// -------------------------------------------------------------------------
void PassiveLProcessor::sensorInfo( const UniSetTypes::SensorMessage*sm )
void PassiveLProcessor::sensorInfo( UniSetTypes::SensorMessage*sm )
{
for( EXTList::iterator it=extInputs.begin(); it!=extInputs.end(); ++it )
{
if( it->sid == sm->id )
it->state = (bool)sm->value;
it->state = sm->state;
}
}
// -------------------------------------------------------------------------
void PassiveLProcessor::timerInfo( const UniSetTypes::TimerMessage *tm )
void PassiveLProcessor::timerInfo( UniSetTypes::TimerMessage *tm )
{
if( tm->id == tidStep )
step();
}
// -------------------------------------------------------------------------
void PassiveLProcessor::sysCommand( const UniSetTypes::SystemMessage *sm )
void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
{
switch( sm->command )
{
......@@ -111,7 +113,7 @@ void PassiveLProcessor::sysCommand( const UniSetTypes::SystemMessage *sm )
{
if( !shm->waitSMready(smReadyTimeout) )
{
dcrit << myname << "(ERR): SM not ready. Terminated... " << endl;
dlog[Debug::CRIT] << myname << "(ERR): SM not ready. Terminated... " << endl;
raise(SIGTERM);
return;
}
......@@ -144,12 +146,12 @@ void PassiveLProcessor::sysCommand( const UniSetTypes::SystemMessage *sm )
case SystemMessage::LogRotate:
{
// переоткрываем логи
ulog << myname << "(sysCommand): logRotate" << std::endl;
string fname (ulog.getLogFile() );
unideb << myname << "(sysCommand): logRotate" << std::endl;
string fname = unideb.getLogFile();
if( !fname.empty() )
{
ulog.logFile(fname);
ulog << myname << "(sysCommand): ***************** ulog LOG ROTATE *****************" << std::endl;
unideb.logFile(fname);
unideb << myname << "(sysCommand): ***************** UNIDEB LOG ROTATE *****************" << std::endl;
}
dlog << myname << "(sysCommand): logRotate" << std::endl;
......@@ -183,7 +185,7 @@ bool PassiveLProcessor::activateObject()
// ------------------------------------------------------------------------------------------
void PassiveLProcessor::initIterators()
{
shm->initIterator(itHeartBeat);
shm->initAIterator(aitHeartBeat);
}
// -------------------------------------------------------------------------
void PassiveLProcessor::setOuts()
......@@ -193,15 +195,28 @@ void PassiveLProcessor::setOuts()
{
try
{
shm->setValue( it->sid,it->lnk->from->getOut() );
switch(it->iotype)
{
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 )
{
dcrit << myname << "(setOuts): " << ex << endl;
dlog[Debug::CRIT] << myname << "(setOuts): " << ex << endl;
}
catch(...)
{
dcrit << myname << "(setOuts): catch...\n";
dlog[Debug::CRIT] << myname << "(setOuts): catch...\n";
}
}
}
......@@ -212,16 +227,66 @@ void PassiveLProcessor::sigterm( int signo )
{
try
{
shm->setValue(it->sid,0);
switch(it->iotype)
{
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 )
{
dcrit << myname << "(sigterm): " << ex << endl;
dlog[Debug::CRIT] << myname << "(sigterm): " << ex << endl;
}
catch(...)
{
dcrit << myname << "(sigterm): catch...\n";
dlog[Debug::CRIT] << 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 @@
#include "UniSetObject_LT.h"
#include "Extensions.h"
#include "SharedMemory.h"
#include "UInterface.h"
#include "UniversalInterface.h"
#include "SMInterface.h"
#include "LProcessor.h"
// --------------------------------------------------------------------------
......@@ -33,10 +33,11 @@ class PassiveLProcessor:
virtual void getInputs();
virtual void setOuts();
void sysCommand( const UniSetTypes::SystemMessage *msg );
void sensorInfo( const UniSetTypes::SensorMessage*sm );
void timerInfo( const UniSetTypes::TimerMessage *tm );
void askSensors( const UniversalIO::UIOCommand cmd );
virtual void processingMessage( UniSetTypes::VoidMessage *msg );
void sysCommand( UniSetTypes::SystemMessage *msg );
void sensorInfo( UniSetTypes::SensorMessage*sm );
void timerInfo( UniSetTypes::TimerMessage *tm );
void askSensors( UniversalIO::UIOCommand cmd );
// void initOutput();
// действия при завершении работы
......@@ -50,7 +51,7 @@ class PassiveLProcessor:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat;
UniSetTypes::uniset_mutex mutex_start;
};
// ---------------------------------------------------------------------------
......
......@@ -110,7 +110,8 @@ void Schema::extlink( const string& name, Element::ElementID childID, int numIn
// -------------------------------------------------------------------------
Element* Schema::manage( Element* el )
{
dinfo << "Schema: manage new element id=" << el->getId()
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << "Schema: manage new element id=" << el->getId()
<< " type=" << el->getType()
<< " inputs=" << el->inCount() << endl;
......
......@@ -47,7 +47,8 @@ void TAND::setIn( int num, bool state )
if( !brk )
myout = true;
dinfo << this << ": myout " << myout << endl;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( prev != myout )
Element::setChildOut();
......
......@@ -13,7 +13,7 @@ TDelay::TDelay( Element::ElementID id, int delayMS, int inCount):
if( inCount!=0 )
{
// создаём заданное количество входов
for( unsigned int i=1;i<=inCount;i++ )
for( int i=1;i<=inCount;i++ )
ins.push_front(InputInfo(i,false)); // addInput(i,st);
}
}
......@@ -30,7 +30,8 @@ void TDelay::setIn( int num, bool state )
{
pt.setTiming(0); // reset timer
myout = false;
dinfo << this << ": set " << myout << endl;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": set " << myout << endl;
if( prev != myout )
Element::setChildOut();
return;
......@@ -43,7 +44,8 @@ void TDelay::setIn( int num, bool state )
{
pt.setTiming(0); // reset timer
myout = true;
dinfo << this << ": set " << myout << endl;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": set " << myout << endl;
if( prev != myout )
Element::setChildOut();
return;
......@@ -52,7 +54,8 @@ void TDelay::setIn( int num, bool state )
// засекаем, если ещё не установлен таймер
if( !myout && !prev ) // т.е. !myout && prev != myout
{
dinfo << this << ": set timer " << delay << " [msec]" << endl;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": set timer " << delay << " [msec]" << endl;
pt.setTiming(delay);
}
}
......@@ -63,7 +66,8 @@ void TDelay::tick()
{
myout = true;
pt.setTiming(0); // reset timer
dinfo << getType() << "(" << myid << "): TIMER!!!! myout=" << myout << endl;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << getType() << "(" << myid << "): TIMER!!!! myout=" << myout << endl;
Element::setChildOut();
}
}
......
......@@ -22,6 +22,9 @@ void TNOT::setIn( int num, bool state )
bool prev = myout;
myout = !state;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( prev != myout )
Element::setChildOut();
}
......
......@@ -13,7 +13,7 @@ TOR::TOR(ElementID id, int num, bool st):
if( num!=0 )
{
// создаём заданное количество входов
for( unsigned int i=1;i<=num;i++ )
for( int i=1;i<=num;i++ )
{
ins.push_front(InputInfo(i,st)); // addInput(i,st);
if( st == true )
......@@ -60,7 +60,8 @@ void TOR::setIn( int num, bool state )
if( !brk )
myout = false;
dinfo << this << ": myout " << myout << endl;
if( dlog.debugging(Debug::INFO) )
dlog[Debug::INFO] << this << ": myout " << myout << endl;
if( prev != myout )
Element::setChildOut();
}
......
......@@ -23,13 +23,13 @@ int main(int argc, const char **argv)
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
ulog.logFile( logname.str() );
unideb.logFile( logname.str() );
dlog.logFile( logname.str() );
string schema = conf->getArgParam("--schema");
if( schema.empty() )
{
dcrit << "schema-file not defined. Use --schema" << endl;
dlog[Debug::CRIT] << "schema-file not defined. Use --schema" << endl;
return 1;
}
......
#include <iostream>
#include "Configuration.h"
#include "Extensions.h"
#include "UniSetActivator.h"
#include "ObjectsActivator.h"
#include "PassiveLProcessor.h"
// -----------------------------------------------------------------------------
......@@ -25,7 +25,7 @@ int main(int argc, const char **argv)
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
ulog.logFile( logname.str() );
unideb.logFile( logname.str() );
dlog.logFile( logname.str() );
string schema = conf->getArgParam("--schema");
......@@ -70,16 +70,16 @@ int main(int argc, const char **argv)
PassiveLProcessor plc(schema,ID,shmID);
UniSetActivator act;
ObjectsActivator act;
act.addObject(static_cast<class UniSetObject*>(&plc));
SystemMessage sm(SystemMessage::StartUp);
act.broadcast( sm.transport_msg() );
ulog << "\n\n\n";
ulog << "(main): -------------- IOControl START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- IOControl START -------------------------\n\n";
unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- IOControl START -------------------------\n\n";
act.run(false);
return 0;
}
......
......@@ -6,9 +6,9 @@ if HAVE_EXTENTIONS
SUBDIRS = lib include SharedMemory IOControl LogicProcessor \
ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \
RRDServer SharedMemoryPlus tests
#SMDBServer
#SharedMemoryPlus
#UDPExchange
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetExtensions.pc
......@@ -19,5 +19,3 @@ endif
include $(top_builddir)/conf/common.mk
......@@ -28,7 +28,7 @@ class MBExchange:
{
public:
MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string& prefix="mb" );
const std::string prefix="mb" );
virtual ~MBExchange();
/*! глобальная функция для вывода help-а */
......@@ -161,7 +161,7 @@ class MBExchange:
DeviceType dtype; /*!< тип устройства */
UniSetTypes::ObjectId resp_id;
IOController::IOStateList::iterator resp_it;
IOController::DIOStateList::iterator resp_dit;
PassiveTimer resp_ptTimeout;
Trigger resp_trTimeout;
bool resp_state;
......@@ -170,7 +170,7 @@ class MBExchange:
bool resp_init;
bool ask_every_reg;
UniSetTypes::ObjectId mode_id;
IOController::IOStateList::iterator mode_it;
IOController::AIOStateList::iterator mode_ait;
long mode; // режим работы с устройством (см. ExchangeMode)
// return TRUE if state changed
......@@ -200,9 +200,10 @@ class MBExchange:
protected:
virtual void step();
virtual void sysCommand( const UniSetTypes::SystemMessage *msg );
virtual void sensorInfo( const UniSetTypes::SensorMessage*sm );
virtual void timerInfo( const UniSetTypes::TimerMessage *tm );
virtual void processingMessage( UniSetTypes::VoidMessage *msg );
virtual void sysCommand( UniSetTypes::SystemMessage *msg );
virtual void sensorInfo( UniSetTypes::SensorMessage*sm );
virtual void timerInfo( UniSetTypes::TimerMessage *tm );
virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void initOutput();
virtual void sigterm( int signo );
......@@ -254,7 +255,7 @@ class MBExchange:
void waitSMReady();
void readConfiguration();
bool readItem( const UniXML& xml, UniXML_iterator& it, xmlNode* sec );
bool readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec );
bool initItem( UniXML_iterator& it );
void initDeviceList();
void initOffsetList();
......@@ -280,7 +281,7 @@ class MBExchange:
SMInterface* shm;
bool initPause;
UniSetTypes::uniset_rwmutex mutex_start;
UniSetTypes::uniset_mutex mutex_start;
bool force; /*!< флаг означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out; /*!< флаг означающий, принудительного чтения выходов */
......@@ -291,14 +292,15 @@ class MBExchange:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator itHeartBeat;
IOController::AIOStateList::iterator aitHeartBeat;
UniSetTypes::ObjectId test_id;
UniSetTypes::ObjectId sidExchangeMode; /*!< иденидентификатор для датчика режима работы */
IOController::IOStateList::iterator itExchangeMode;
IOController::AIOStateList::iterator aitExchangeMode;
long exchangeMode; /*!< режим работы см. ExchangeMode */
UniSetTypes::mutex_atomic_t activated;
UniSetTypes::uniset_mutex actMutex;
bool activated;
int activateTimeout;
bool noQueryOptimization;
bool no_extimer;
......
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