Commit 14146423 authored by Pavel Vainerman's avatar Pavel Vainerman

backported to p8 as 2.6-alt3.M80P.4 (with rpmbph script)

parents 12cca635 4ac2dbf8
......@@ -98,6 +98,7 @@ Utilities/Admin/test.xml
Utilities/Admin/uniset2-admin
Utilities/Admin/uniset-functions.sh
Utilities/Admin/uniset-start.sh
*/cov-html/*
Utilities/DBServer-MySQL/uniset-mysql-dbserver
Utilities/InfoServer/uniset-infoserver
......@@ -188,3 +189,4 @@ tests/tests
tests/tests_with_conf
testsuite/atconfig
*
\ No newline at end of file
......@@ -33,7 +33,7 @@ before_script:
# due broken comedi
- export CXXFLAGS="$CXXFLAGS -Wl,--unresolved-symbols=ignore-in-shared-libs"
- autoreconf -fiv
- ./configure --enable-tests --enable-mysql --enable-sqlite --enable-rrd --enable-io --enable-logicproc --disable-python --disable-mqtt --disable-pgsql --disable-pkgchecklibev
- ./configure --enable-tests --enable-mysql --enable-sqlite --enable-rrd --enable-io --enable-logicproc --disable-python --disable-mqtt --disable-pgsql --disable-api --disable-pkgchecklibev
script:
- if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then make ; fi
......
see git changelog
----
json.hpp - Niels Lohmann https://github.com/nlohmann/json
......@@ -55,28 +55,25 @@ interface IOController_i : UniSetManager_i
/*! Информация о датчике */
struct SensorInfo
{
UniSetTypes::ObjectId id; /*!< идентификатор датчика */
UniSetTypes::ObjectId node; /*!< узел на котором он находится */
uniset::ObjectId id; /*!< идентификатор датчика */
uniset::ObjectId node; /*!< узел на котором он находится */
};
long getValue(in UniSetTypes::ObjectId sid) raises(NameNotFound,Undefined);
void setValue(in UniSetTypes::ObjectId sid, in long value,
in UniSetTypes::ObjectId sup_id) raises(NameNotFound,Undefined);
long getValue(in uniset::ObjectId sid) raises(NameNotFound,Undefined);
void setValue(in uniset::ObjectId sid, in long value,
in uniset::ObjectId sup_id) raises(NameNotFound,Undefined);
// установка неопределённого состояния
// (пока работает только для аналоговых датчиков)
void setUndefinedState(in UniSetTypes::ObjectId sid, in boolean undefined, in UniSetTypes::ObjectId sup_id )
void setUndefinedState(in uniset::ObjectId sid, in boolean undefined, in uniset::ObjectId sup_id )
raises(NameNotFound);
// fast version (не вырабатывает исключения)
oneway void fastSetValue(in UniSetTypes::ObjectId sid, in long value, in UniSetTypes::ObjectId sup_id);
UniversalIO::IOType getIOType(in UniSetTypes::ObjectId sid) raises(NameNotFound);
UniversalIO::IOType getIOType(in uniset::ObjectId sid) raises(NameNotFound);
// --- Интерфейс для конфигурирования ---
/*! Получение неколиброванного значения */
long getRawValue( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
long getRawValue( in uniset::ObjectId sid ) raises(NameNotFound);
struct CalibrateInfo
{
......@@ -87,8 +84,8 @@ interface IOController_i : UniSetManager_i
short precision; /*!< точность */
};
void calibrate( in UniSetTypes::ObjectId sid, in CalibrateInfo ci, in UniSetTypes::ObjectId adminId ) raises(NameNotFound);
CalibrateInfo getCalibrateInfo( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
void calibrate( in uniset::ObjectId sid, in CalibrateInfo ci, in uniset::ObjectId adminId ) raises(NameNotFound);
CalibrateInfo getCalibrateInfo( in uniset::ObjectId sid ) raises(NameNotFound);
// --- Интерфес получения информации о всех датчиках ---
/*! Информация датчике */
......@@ -105,19 +102,19 @@ interface IOController_i : UniSetManager_i
CalibrateInfo ci; /*!< калибровочные параметры */
unsigned long tv_sec; /*!< время последнего изменения датчика, секунды (clock_gettime(CLOCK_REALTIME) */
unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */
UniSetTypes::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */
uniset::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */
boolean dbignore; /*!< не сохранять изменения в БД */
};
typedef sequence<SensorIOInfo> SensorInfoSeq;
SensorInfoSeq getSensorsMap();
SensorIOInfo getSensorIOInfo( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
SensorIOInfo getSensorIOInfo( in uniset::ObjectId sid ) raises(NameNotFound);
// -- Функции работы со списком датчиков --
/*! Получение состояния датчиков. */
SensorInfoSeq getSensorSeq( in UniSetTypes::IDSeq lst );
SensorInfoSeq getSensorSeq( in uniset::IDSeq lst );
/*! Информация о "выходе" */
struct OutInfo
......@@ -133,7 +130,7 @@ interface IOController_i : UniSetManager_i
\return Возвращает список входов/выходов изменить состояние которых не удалось.
Будет пустым если всё хорошо.
*/
UniSetTypes::IDSeq setOutputSeq( in OutSeq lst, in UniSetTypes::ObjectId sup_id );
uniset::IDSeq setOutputSeq( in OutSeq lst, in uniset::ObjectId sup_id );
/*! Информация о датчике */
......@@ -144,10 +141,10 @@ interface IOController_i : UniSetManager_i
// могут быть проблеммы в 64bit-ных
unsigned long tv_sec; /*!< время последнего изменения датчика, секунды (clock_gettime(CLOCK_REALTIME) */
unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */
UniSetTypes::ObjectId supplier; /*!< идентификатор того, кто менял датчик (последний раз) */
uniset::ObjectId supplier; /*!< идентификатор того, кто менял датчик (последний раз) */
};
ShortIOInfo getChangedTime( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
ShortIOInfo getTimeChange( in uniset::ObjectId sid ) raises(NameNotFound);
/*! Информация о дискретном датчике */
......@@ -183,15 +180,15 @@ interface IONotifyController_i : IOController_i
/*! Универсальная функция заказа уведомления об изменнии датчика.
* \sa UniversalIO::UniversalIOController::askSensor()
*/
void askSensor(in UniSetTypes::ObjectId sid, in UniSetTypes::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
void askSensor(in uniset::ObjectId sid, in uniset::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
/*!
Заказ сразу списка объектов.
\return Возвращает список объектов заказ по котором не прошёл.
Будет пустым если всё хорошо.
*/
UniSetTypes::IDSeq askSensorsSeq( in UniSetTypes::IDSeq lst,
in UniSetTypes::ConsumerInfo ci,
uniset::IDSeq askSensorsSeq( in uniset::IDSeq lst,
in uniset::ConsumerInfo ci,
in UniversalIO::UIOCommand cmd );
......@@ -205,7 +202,7 @@ interface IONotifyController_i : IOController_i
struct ThresholdInfo
{
UniSetTypes::ThresholdId id;
uniset::ThresholdId id;
long hilimit; /*!< верхняя граница срабатывания */
long lowlimit; /*!< нижняя гранийа срабатывания */
ThresholdState state;
......@@ -225,7 +222,7 @@ interface IONotifyController_i : IOController_i
* Если invert=false, порог срабатывает при условии >= hilimit и отпускается при <= lowlimit
* Если invert=true, порог срабатывает при условии <= lowlimit и отпускается при <= hilimit
*/
void askThreshold(in UniSetTypes::ObjectId sid, in UniSetTypes::ConsumerInfo ci, in UniSetTypes::ThresholdId tid,
void askThreshold(in uniset::ObjectId sid, in uniset::ConsumerInfo ci, in uniset::ThresholdId tid,
in long lowLimit, in long hiLimit, in boolean invert,
in UniversalIO::UIOCommand cmd ) raises(NameNotFound, IOBadParam, BadRange);
......@@ -233,7 +230,7 @@ interface IONotifyController_i : IOController_i
/*! Получение информации о пороге
* Т.к. пороги могут иметь одинаковый tid для разных аналоговых датчиков, то передаётся и SensorInfo
*/
ThresholdInfo getThresholdInfo( in UniSetTypes::ObjectId sid, in UniSetTypes::ThresholdId tid ) raises(NameNotFound);
ThresholdInfo getThresholdInfo( in uniset::ObjectId sid, in uniset::ThresholdId tid ) raises(NameNotFound);
struct ThresholdList
{
......@@ -246,7 +243,7 @@ interface IONotifyController_i : IOController_i
typedef sequence<ThresholdList> ThresholdsListSeq;
/*! получить список порогов для датчка "si" */
ThresholdList getThresholds( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
ThresholdList getThresholds( in uniset::ObjectId sid ) raises(NameNotFound);
/*! получить список ВСЕХ датчиков по которым созданы пороги */
ThresholdsListSeq getThresholdsList();
......
......@@ -21,13 +21,10 @@
#ifndef UniSetBaseConstants_IDL_
#define UniSetBaseConstants_IDL_
// --------------------------------------------------------------------------
//module UniSet
//{
module UniSetTypes
module uniset
{
const unsigned short SizeOfTransportMessage=@SIZE_OF_TRANSPORT_MESSAGE@;
const unsigned short SizeOfObjectType=30;
};
//}; // end of module UniSet
// --------------------------------------------------------------------------------------------------------------
#endif // of UniSetBaseConstants_IDL
......@@ -40,7 +40,7 @@
interface UniSetManager_i : UniSetObject_i
{
/*!< распространить сообщение всем подчиненным объектам */
void broadcast(in UniSetTypes::TransportMessage msg);
void broadcast(in uniset::TransportMessage msg);
/*! получение информации о состоянии подчиненных объектов(менеджеров)
* \param userparam - Необязательный пользовательский параметр (см. UniSetObject_i::getInfo()).
......@@ -58,7 +58,7 @@
* \todo Подумать насчет применения итератора, при слишком
* большом( >1000 ) количестве подчиненных объектов...
*/
UniSetTypes::SimpleInfoSeq getObjectsInfo( in long MaxLength, in long userparam );
uniset::SimpleInfoSeq getObjectsInfo( in long MaxLength, in string userparam );
};
//}; // end of module UniSet
......
......@@ -36,18 +36,22 @@
*/
interface UniSetObject_i
{
UniSetTypes::ObjectId getId(); /*!< получение идентификатора объекта */
UniSetTypes::ObjectType getType(); /*!< получение типа объекта */
uniset::ObjectId getId(); /*!< получение идентификатора объекта */
uniset::ObjectType getType(); /*!< получение типа объекта */
/*! получение информации о внутреннем состоянии объекта
/*! получение информации от объекта
\param userparam - Необязательный пользовательский параметр
\deprecated { Эта функция может быть удалена, желательно использовать более универсальную apiRequest }
*/
UniSetTypes::SimpleInfo getInfo( in long userparam );
uniset::SimpleInfo getInfo( in string userparam );
/*! REST API. Формат запроса: /api/version/query_for_object[?param1&param2...] */
uniset::SimpleInfo apiRequest( in string query );
boolean exist(); /*!< проверка существования объекта */
/*! Функция посылки сообщения объекту */
void push(in UniSetTypes::TransportMessage msg);
void push( in uniset::TransportMessage msg );
};
//}; // end of module UniSet
......
......@@ -25,7 +25,7 @@
// --------------------------------------------------------------------------
//module UniSet
//{
module UniSetTypes
module uniset
{
typedef long ObjectId; /*!< идентификатор объекта */
typedef long ThresholdId; /*!< идентификатор порога */
......@@ -82,7 +82,7 @@
typedef sequence<ObjectId> IDSeq;
};// end of module UniSetTypes
};// end of module uniset
module UniversalIO
......
......@@ -9,6 +9,8 @@ There are set of base components to construct this kind of systems:
* logging system based on MySQL, SQLite, PostgreeSQL databases.
* Web interface to display logging and statistic information.
* utilities for system's configuration based on XML.
* python interface
* REST API
UniSet have been written in C++ and IDL languages but you can use another languages in your
add-on components. The main principle of the UniSet library's design is a maximum integration
......
......@@ -39,6 +39,8 @@ Version 2.3
uniset-codegen: добавить ключ --gen-sensor-name для генерирования name_Item.. (чтобы можно было в логах использовать текстовые названия)
uniset-codegen: перенести инициализацию полей в header (c++11) и "разгрузить конструкторы"
- Сделать диапазонные пороги в IOBase и SM (т.е. "1" когда min >= val <= max ).
SQL:
====
- добавить работу с History (при передаче указателя на SM в конструкторе).
......@@ -46,6 +48,22 @@ SQL:
Debug:
- дописать в codegen документацию по запуску и управлению логами через LogServer
LogServer:
- подумать насчёт буфера для хранения последних n-сообщений (с возможностью вытащить через REST API)
HTTP API:
- запрос списка заказчиков по конкретным датчикам
- запрос о том, кто последний сохранил указанный датчик
- список объектов возвращать с их типом (чтобы можно было SM вычислять)
= Сделать возможность настраивать параметры httpserver-а из командной строки (количество потоков и т.п.)
- ТЕСТЫ (как вариант поизучать про тестовые фреймворки на питоне (pytest?)
- /sensors/XXX?config=name,textname,... - запрос полей (из configure.xml)
- /conf/objects?prop1,prop2,prop3,.. - props from condigure.xml
- /conf/nodes?prop1,prop2,prop3,.. - props from condigure.xml
- /conf/controlers?..
- /conf/services?...
- /conf/...
Version 2.5
============
- smonit запись значений в файл (csv?,sqlite?,gnuplot)
......@@ -85,6 +103,12 @@ DB: Сделать регулируемый буфер на INSERT-ы БД, чт
Уйти от использования libxml2,DebugLog ==> и применять одну библиотеку libpoco (http://pocoproject.org/documentation/index.html)
или всё-таки на boost?
ИДЕИ
-----
- ведение статистики по типам сообщений в каждом объекте (и в SM). Чтобы увидеть где происходит потеря пакетов (если происходит).
(т.е. идея в том, что сколько "успешно" послала SM столько должно придти и быть обработано (разные счётчики) в объекте)
==================
Но тогда стоит вводить и namespace uniset
......
......@@ -11,11 +11,13 @@ ln -s -f admin.sh omap
ln -s -f admin.sh msgmap
ln -s -f admin.sh setValue
ln -s -f admin.sh getValue
ln -s -f admin.sh csv
ln -s -f admin.sh getRawValue
ln -s -f admin.sh getChangedTime
ln -s -f admin.sh getCalibrate
ln -s -f admin.sh help
ln -s -f admin.sh oinfo
ln -s -f admin.sh apiRequest
ln -s -f ../../Utilities/scripts/uniset2-start.sh
ln -s -f ../../Utilities/scripts/uniset2-stop.sh stop.sh
......
......@@ -12,7 +12,7 @@
#endif
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
using namespace ModbusRTU;
// -------------------------------------------------------------------------
MBSlave::MBSlave(const std::unordered_set<ModbusAddr>& _vaddr, const std::string& dev, const std::string& speed, bool use485 ):
......@@ -107,7 +107,7 @@ void MBSlave::sigterm( int signo )
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
ReadCoilRetMessage& reply )
ReadCoilRetMessage& reply )
{
if( verbose )
cout << "(readCoilStatus): " << query << endl;
......@@ -136,7 +136,7 @@ ModbusRTU::mbErrCode MBSlave::readCoilStatus( ReadCoilMessage& query,
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::readInputStatus( ReadInputStatusMessage& query,
ReadInputStatusRetMessage& reply )
ReadInputStatusRetMessage& reply )
{
if( verbose )
cout << "(readInputStatus): " << query << endl;
......@@ -276,7 +276,7 @@ ModbusRTU::mbErrCode MBSlave::readOutputRegisters(
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply )
ModbusRTU::ForceCoilsRetMessage& reply )
{
if( verbose )
cout << "(forceMultipleCoils): " << query << endl;
......@@ -310,7 +310,7 @@ ModbusRTU::mbErrCode MBSlave::writeOutputSingleRegister( ModbusRTU::WriteSingleO
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply )
ModbusRTU::ForceSingleCoilRetMessage& reply )
{
if( verbose )
cout << "(forceSingleCoil): " << query << endl;
......@@ -322,7 +322,7 @@ ModbusRTU::mbErrCode MBSlave::forceSingleCoil( ModbusRTU::ForceSingleCoilMessage
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply )
ModbusRTU::JournalCommandRetMessage& reply )
{
if( verbose )
cout << "(journalCommand): " << query << endl;
......@@ -359,7 +359,7 @@ ModbusRTU::mbErrCode MBSlave::journalCommand( ModbusRTU::JournalCommandMessage&
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply )
ModbusRTU::SetDateTimeRetMessage& reply )
{
if( verbose )
cout << "(setDateTime): " << query << endl;
......@@ -371,14 +371,14 @@ ModbusRTU::mbErrCode MBSlave::setDateTime( ModbusRTU::SetDateTimeMessage& query,
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply )
ModbusRTU::RemoteServiceRetMessage& reply )
{
cerr << "(remoteService): " << query << endl;
return ModbusRTU::erOperationFailed;
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply )
ModbusRTU::FileTransferRetMessage& reply )
{
if( verbose )
cout << "(fileTransfer): " << query << endl;
......@@ -459,7 +459,7 @@ ModbusRTU::mbErrCode MBSlave::fileTransfer( ModbusRTU::FileTransferMessage& quer
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBSlave::diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply )
ModbusRTU::DiagnosticRetMessage& reply )
{
if( verbose )
cout << "(diagnostics): " << query << endl;
......
......@@ -12,7 +12,7 @@
class MBSlave
{
public:
MBSlave( const std::unordered_set<ModbusRTU::ModbusAddr>& vaddr, const std::string& dev, const std::string& speed, bool use485 = false );
MBSlave( const std::unordered_set<uniset::ModbusRTU::ModbusAddr>& vaddr, const std::string& dev, const std::string& speed, bool use485 = false );
~MBSlave();
inline void setVerbose( bool state )
......@@ -42,67 +42,67 @@ class MBSlave
void sigterm( int signo );
/*! обработка 0x01 */
ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode readCoilStatus( uniset::ModbusRTU::ReadCoilMessage& query,
uniset::ModbusRTU::ReadCoilRetMessage& reply );
/*! обработка 0x02 */
ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputStatus( uniset::ModbusRTU::ReadInputStatusMessage& query,
uniset::ModbusRTU::ReadInputStatusRetMessage& reply );
/*! обработка 0x03 */
ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readOutputRegisters( uniset::ModbusRTU::ReadOutputMessage& query,
uniset::ModbusRTU::ReadOutputRetMessage& reply );
/*! обработка 0x04 */
ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputRegisters( uniset::ModbusRTU::ReadInputMessage& query,
uniset::ModbusRTU::ReadInputRetMessage& reply );
/*! обработка 0x05 */
ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceSingleCoil( uniset::ModbusRTU::ForceSingleCoilMessage& query,
uniset::ModbusRTU::ForceSingleCoilRetMessage& reply );
/*! обработка 0x0F */
ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceMultipleCoils( uniset::ModbusRTU::ForceCoilsMessage& query,
uniset::ModbusRTU::ForceCoilsRetMessage& reply );
/*! обработка 0x10 */
ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputRegisters( uniset::ModbusRTU::WriteOutputMessage& query,
uniset::ModbusRTU::WriteOutputRetMessage& reply );
/*! обработка 0x06 */
ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputSingleRegister( uniset::ModbusRTU::WriteSingleOutputMessage& query,
uniset::ModbusRTU::WriteSingleOutputRetMessage& reply );
/*! обработка запросов на чтение ошибок */
ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
uniset::ModbusRTU::mbErrCode journalCommand( uniset::ModbusRTU::JournalCommandMessage& query,
uniset::ModbusRTU::JournalCommandRetMessage& reply );
/*! обработка запроса на установку времени */
ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
uniset::ModbusRTU::mbErrCode setDateTime( uniset::ModbusRTU::SetDateTimeMessage& query,
uniset::ModbusRTU::SetDateTimeRetMessage& reply );
/*! обработка запроса удалённого сервиса */
ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
uniset::ModbusRTU::mbErrCode remoteService( uniset::ModbusRTU::RemoteServiceMessage& query,
uniset::ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
uniset::ModbusRTU::mbErrCode fileTransfer( uniset::ModbusRTU::FileTransferMessage& query,
uniset::ModbusRTU::FileTransferRetMessage& reply );
ModbusRTU::mbErrCode diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply );
uniset::ModbusRTU::mbErrCode diagnostics( uniset::ModbusRTU::DiagnosticMessage& query,
uniset::ModbusRTU::DiagnosticRetMessage& reply );
ModbusRTU::mbErrCode read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply );
uniset::ModbusRTU::mbErrCode read4314( uniset::ModbusRTU::MEIMessageRDI& query,
uniset::ModbusRTU::MEIMessageRetRDI& reply );
/*! интерфейс ModbusRTUSlave для обмена по RS */
ModbusRTUSlaveSlot* rscomm;
std::unordered_set<ModbusRTU::ModbusAddr> vaddr; /*!< адреса на которые отвечаем */
uniset::ModbusRTUSlaveSlot* rscomm;
std::unordered_set<uniset::ModbusRTU::ModbusAddr> vaddr; /*!< адреса на которые отвечаем */
bool verbose;
#if 0
typedef std::unordered_map<ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
typedef std::unordered_map<uniset::ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
ExchangeErrorMap errmap; /*!< статистика обмена */
ModbusRTU::mbErrCode prev;
uniset::ModbusRTU::mbErrCode prev;
// можно было бы сделать unsigned, но аналоговые датчики у нас имеют
......
......@@ -12,7 +12,7 @@
#endif
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
using namespace ModbusRTU;
// -------------------------------------------------------------------------
MBTCPServer::MBTCPServer(const std::unordered_set<ModbusAddr>& myaddr, const string& inetaddr, int port, bool verb ):
......@@ -83,7 +83,7 @@ void MBTCPServer::sigterm( int signo )
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBTCPServer::readCoilStatus( ReadCoilMessage& query,
ReadCoilRetMessage& reply )
ReadCoilRetMessage& reply )
{
if( verbose )
cout << "(readCoilStatus): " << query << endl;
......@@ -168,7 +168,7 @@ ModbusRTU::mbErrCode MBTCPServer::readInputStatus( ReadInputStatusMessage& query
}
// -------------------------------------------------------------------------
mbErrCode MBTCPServer::readInputRegisters( ReadInputMessage& query,
ReadInputRetMessage& reply )
ReadInputRetMessage& reply )
{
if( verbose )
cout << "(readInputRegisters): " << query << endl;
......@@ -296,7 +296,7 @@ ModbusRTU::mbErrCode MBTCPServer::forceSingleCoil( ModbusRTU::ForceSingleCoilMes
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBTCPServer::journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply )
ModbusRTU::JournalCommandRetMessage& reply )
{
if( verbose )
cout << "(journalCommand): " << query << endl;
......@@ -333,7 +333,7 @@ ModbusRTU::mbErrCode MBTCPServer::journalCommand( ModbusRTU::JournalCommandMessa
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBTCPServer::setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply )
ModbusRTU::SetDateTimeRetMessage& reply )
{
if( verbose )
cout << "(setDateTime): " << query << endl;
......@@ -345,14 +345,14 @@ ModbusRTU::mbErrCode MBTCPServer::setDateTime( ModbusRTU::SetDateTimeMessage& qu
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBTCPServer::remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply )
ModbusRTU::RemoteServiceRetMessage& reply )
{
cerr << "(remoteService): " << query << endl;
return ModbusRTU::erOperationFailed;
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply )
ModbusRTU::FileTransferRetMessage& reply )
{
if( verbose )
cout << "(fileTransfer): " << query << endl;
......@@ -433,7 +433,7 @@ ModbusRTU::mbErrCode MBTCPServer::fileTransfer( ModbusRTU::FileTransferMessage&
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBTCPServer::diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply )
ModbusRTU::DiagnosticRetMessage& reply )
{
if( query.subf == ModbusRTU::subEcho )
{
......@@ -472,7 +472,7 @@ ModbusRTU::mbErrCode MBTCPServer::diagnostics( ModbusRTU::DiagnosticMessage& que
}
// -------------------------------------------------------------------------
ModbusRTU::mbErrCode MBTCPServer::read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply )
ModbusRTU::MEIMessageRetRDI& reply )
{
if( verbose )
cout << "(read4314): " << query << endl;
......
......@@ -10,7 +10,7 @@
class MBTCPServer
{
public:
MBTCPServer( const std::unordered_set<ModbusRTU::ModbusAddr>& myaddr, const std::string& inetaddr, int port = 502, bool verbose = false );
MBTCPServer( const std::unordered_set<uniset::ModbusRTU::ModbusAddr>& myaddr, const std::string& inetaddr, int port = 502, bool verbose = false );
~MBTCPServer();
inline void setVerbose( bool state )
......@@ -23,7 +23,7 @@ class MBTCPServer
replyVal = val;
}
inline timeout_t setAfterSendPause( timeout_t msec )
inline uniset::timeout_t setAfterSendPause( uniset::timeout_t msec )
{
return sslot->setAfterSendPause(msec);
}
......@@ -38,70 +38,70 @@ class MBTCPServer
void sigterm( int signo );
/*! обработка 0x01 */
ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode readCoilStatus( uniset::ModbusRTU::ReadCoilMessage& query,
uniset::ModbusRTU::ReadCoilRetMessage& reply );
/*! обработка 0x02 */
ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputStatus( uniset::ModbusRTU::ReadInputStatusMessage& query,
uniset::ModbusRTU::ReadInputStatusRetMessage& reply );
/*! обработка 0x03 */
ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readOutputRegisters( uniset::ModbusRTU::ReadOutputMessage& query,
uniset::ModbusRTU::ReadOutputRetMessage& reply );
/*! обработка 0x04 */
ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputRegisters( uniset::ModbusRTU::ReadInputMessage& query,
uniset::ModbusRTU::ReadInputRetMessage& reply );
/*! обработка 0x05 */
ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceSingleCoil( uniset::ModbusRTU::ForceSingleCoilMessage& query,
uniset::ModbusRTU::ForceSingleCoilRetMessage& reply );
/*! обработка 0x0F */
ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceMultipleCoils( uniset::ModbusRTU::ForceCoilsMessage& query,
uniset::ModbusRTU::ForceCoilsRetMessage& reply );
/*! обработка 0x10 */
ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputRegisters( uniset::ModbusRTU::WriteOutputMessage& query,
uniset::ModbusRTU::WriteOutputRetMessage& reply );
/*! обработка 0x06 */
ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputSingleRegister( uniset::ModbusRTU::WriteSingleOutputMessage& query,
uniset::ModbusRTU::WriteSingleOutputRetMessage& reply );
ModbusRTU::mbErrCode diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply );
uniset::ModbusRTU::mbErrCode diagnostics( uniset::ModbusRTU::DiagnosticMessage& query,
uniset::ModbusRTU::DiagnosticRetMessage& reply );
ModbusRTU::mbErrCode read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply );
uniset::ModbusRTU::mbErrCode read4314( uniset::ModbusRTU::MEIMessageRDI& query,
uniset::ModbusRTU::MEIMessageRetRDI& reply );
/*! обработка запросов на чтение ошибок */
ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
uniset::ModbusRTU::mbErrCode journalCommand( uniset::ModbusRTU::JournalCommandMessage& query,
uniset::ModbusRTU::JournalCommandRetMessage& reply );
/*! обработка запроса на установку времени */
ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
uniset::ModbusRTU::mbErrCode setDateTime( uniset::ModbusRTU::SetDateTimeMessage& query,
uniset::ModbusRTU::SetDateTimeRetMessage& reply );
/*! обработка запроса удалённого сервиса */
ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
uniset::ModbusRTU::mbErrCode remoteService( uniset::ModbusRTU::RemoteServiceMessage& query,
uniset::ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
uniset::ModbusRTU::mbErrCode fileTransfer( uniset::ModbusRTU::FileTransferMessage& query,
uniset::ModbusRTU::FileTransferRetMessage& reply );
/*! интерфейс ModbusSlave для обмена по RS */
ModbusTCPServerSlot* sslot;
std::unordered_set<ModbusRTU::ModbusAddr> vaddr; /*!< адреса данного узла */
uniset::ModbusTCPServerSlot* sslot;
std::unordered_set<uniset::ModbusRTU::ModbusAddr> vaddr; /*!< адреса данного узла */
bool verbose = { false };
long replyVal = { -1 };
#if 0
typedef std::unordered_map<ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
typedef std::unordered_map<uniset::ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
ExchangeErrorMap errmap; /*!< статистика обмена */
ModbusRTU::mbErrCode prev;
uniset::ModbusRTU::mbErrCode prev;
// можно было бы сделать unsigned, но аналоговые датчики у нас имеют
......
......@@ -5,7 +5,7 @@
#include "Debug.h"
#include "MBSlave.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......
......@@ -6,7 +6,7 @@
#include "modbus/ModbusRTUMaster.h"
#include "modbus/ModbusHelpers.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -346,7 +346,7 @@ int main( int argc, char** argv )
if( !checkArg(optind + 3, argc, argv) )
break;
fn = (ModbusRTU::SlaveFunctionCode)UniSetTypes::uni_atoi(argv[optind + 3]);
fn = (ModbusRTU::SlaveFunctionCode)uniset::uni_atoi(argv[optind + 3]);
}
break;
......@@ -365,7 +365,7 @@ int main( int argc, char** argv )
if( !checkArg(optind + 1, argc, argv) )
break;
fn = (ModbusRTU::SlaveFunctionCode)UniSetTypes::uni_atoi(argv[optind + 1]);
fn = (ModbusRTU::SlaveFunctionCode)uniset::uni_atoi(argv[optind + 1]);
}
break;
......@@ -664,7 +664,7 @@ int main( int argc, char** argv )
ModbusRTU::ModbusAddr a = ModbusHelpers::autodetectSlave(&mb, beg, end, reg, fn);
cout << "autodetect modbus slave: " << ModbusRTU::addr2str(a) << endl;
}
catch( UniSetTypes::TimeOut )
catch( uniset::TimeOut )
{
cout << "slave not autodetect..." << endl;
}
......@@ -688,7 +688,7 @@ int main( int argc, char** argv )
cout << "autodetect: slaveaddr=" << ModbusRTU::addr2str(slaveaddr)
<< " speed=" << ComPort::getSpeed(s) << endl;
}
catch( UniSetTypes::TimeOut )
catch( uniset::TimeOut )
{
cout << "speed not autodetect for slaveaddr="
<< ModbusRTU::addr2str(slaveaddr) << endl;
......
......@@ -5,7 +5,7 @@
#include "MBSlave.h"
#include "ComPort485F.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -92,7 +92,7 @@ int main( int argc, char** argv )
}
}
auto avec = UniSetTypes::explode_str(myaddr, ',');
auto avec = uniset::explode_str(myaddr, ',');
std::unordered_set<ModbusRTU::ModbusAddr> vaddr;
for( const auto& a : avec )
......
......@@ -4,7 +4,7 @@
#include "Debug.h"
#include "modbus/ModbusTCPMaster.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -215,7 +215,7 @@ int main( int argc, char** argv )
{
cerr << "(mbtester): " << err << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(mbtester): " << ex << endl;
}
......
......@@ -4,7 +4,7 @@
#include "Debug.h"
#include "MBTCPServer.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -98,7 +98,7 @@ int main( int argc, char** argv )
}
}
auto avec = UniSetTypes::explode_str(myaddr, ',');
auto avec = uniset::explode_str(myaddr, ',');
std::unordered_set<ModbusRTU::ModbusAddr> vaddr;
for( const auto& a : avec )
......
......@@ -6,7 +6,7 @@
#include "Debug.h"
#include "modbus/ModbusTCPMaster.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -713,7 +713,7 @@ int main( int argc, char** argv )
{
cerr << "(mbtester): " << err << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(mbtester): " << ex << endl;
}
......
......@@ -3,7 +3,7 @@
#include "NullController.h"
#include "PassiveTimer.h"
// --------------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------------
......
......@@ -7,10 +7,10 @@
#include "NCRestorer.h"
// --------------------------------------------------------------------------
class NullController:
public IONotifyController
public uniset::IONotifyController
{
public:
NullController( UniSetTypes::ObjectId id, const std::string& restorfile,
NullController( uniset::ObjectId id, const std::string& restorfile,
const std::string& s_filterField = "",
const std::string& s_filterValue = "",
const std::string& c_filterField = "",
......
......@@ -4,7 +4,7 @@
#include "Debug.h"
#include "PassiveTimer.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
......@@ -52,7 +52,7 @@ int main(int argc, char** argv)
ObjectId ID = conf->oind->getIdByName(conf->getControllersSection() + "/" + name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(nullController): идентификатор '" << name
<< "' не найден в конф. файле!"
......
......@@ -2,7 +2,7 @@
ulimit -Sc 1000000
./uniset2-start.sh -f ./uniset2-nullController --name SharedMemory1 --confile test.xml --ulog-add-levels any $*
./uniset2-start.sh -f ./uniset2-nullController --name SharedMemory1 --confile test.xml --ulog-add-levels level1,warn,crit $*
#info,warn,crit,system,level9 > 1.log
#--c-filter-field cfilter --c-filter-value test1 --s-filter-field io --s-filter-value 1
......@@ -3,7 +3,7 @@
#include "UInterface.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
void help_print()
{
......@@ -18,7 +18,7 @@ void help_print()
}
// -----------------------------------------------------------------------------
struct ExtInfo:
public UniSetTypes::ParamSInfo
public uniset::ParamSInfo
{
UniversalIO::IOType iotype;
};
......@@ -50,7 +50,7 @@ int main( int argc, char** argv )
return 1;
}
auto lst = UniSetTypes::getSInfoList(sid, conf);
auto lst = uniset::getSInfoList(sid, conf);
if( lst.empty() )
{
......@@ -135,7 +135,7 @@ int main( int argc, char** argv )
{
ui.setValue(it.si, j, DefaultObjectId);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << endl << "save id=" << it.fname << " " << ex << endl;
}
......@@ -162,7 +162,7 @@ int main( int argc, char** argv )
{
ui.setValue(it->si, i, DefaultObjectId);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << endl << "save id=" << it->fname << " " << ex << endl;
}
......@@ -172,7 +172,7 @@ int main( int argc, char** argv )
msleep(amsec);
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << endl << "(simitator): " << ex << endl;
return 1;
......
......@@ -4,7 +4,7 @@
#include "Configuration.h"
#include "SMonitor.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
......@@ -30,7 +30,7 @@ int main( int argc, const char** argv )
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(main): идентификатор '" << name
<< "' не найден в конф. файле!"
......@@ -47,7 +47,7 @@ int main( int argc, const char** argv )
act->run(false);
return 0;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cout << "(main):" << ex << endl;
}
......
......@@ -3,7 +3,7 @@
#include "SViewer.h"
#include "Configuration.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
......
......@@ -6,7 +6,7 @@
#include "LogServer.h"
#include "Exceptions.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -------------------------------------------------------------------------
static struct option longopts[] =
......@@ -94,7 +94,7 @@ int main( int argc, char* argv[], char* envp[] )
cerr << "(log-stdin): " << err << endl;
return 1;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(log-stdin): " << ex << endl;
return 1;
......
......@@ -11,7 +11,7 @@
#include <unistd.h>
#include <cstring>
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -------------------------------------------------------------------------
static void print_help()
......@@ -105,7 +105,7 @@ int main( int argc, char* argv[], char* envp[] )
cerr << "(logserver-wrap): " << err << endl;
return 1;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(logserver-wrap): " << ex << endl;
return 1;
......
......@@ -9,7 +9,7 @@
#include "LogReader.h"
#include "LogServerTypes.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -317,7 +317,7 @@ int main( int argc, char** argv )
{
cerr << "(log): " << err << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(log): " << ex << endl;
}
......
......@@ -2,7 +2,7 @@
#include "Debug.h"
#include "Configuration.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main( int argc, char** argv )
......
......@@ -8,7 +8,7 @@
#include "LogServer.h"
#include "LogAgregator.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -209,7 +209,7 @@ int main( int argc, char** argv )
{
cerr << "(logserver): " << err << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(logserver): " << ex << endl;
}
......
......@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
updateOutputs(forceOut);
updatePreviousValues();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -115,7 +115,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
msleep( sleep_msec );
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* _sm )
{
<xsl:for-each select="//sensors/item/consumers/consumer">
<xsl:if test="normalize-space(../../@msg)!='1'">
......@@ -146,7 +146,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
<xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="../../@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="../../@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -163,7 +163,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
</xsl:for-each>
}
// -----------------------------------------------------------------------------
UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
uniset::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
if( smTestID != DefaultObjectId )
return smTestID;
......@@ -206,7 +206,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each>
return;
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -218,9 +218,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId _sid, long _val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
// ui->setState(sid,state);
......@@ -243,13 +243,13 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
ui->setValue(_sid,_val);
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId _sid, UniversalIO::UIOCommand _cmd, uniset::ObjectId _node )
{
ui->askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
try
{
......@@ -267,7 +267,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid);
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -321,7 +321,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
</xsl:if>
</xsl:if>
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -356,7 +356,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -371,7 +371,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -100,7 +100,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
// обновление списка предыдущих состояний
updatePreviousValues();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -109,7 +109,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
mycrit &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl;
}
catch( const std::exception&amp;ex )
catch( const std::exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): catch " &lt;&lt; ex.what() &lt;&lt; endl;
}
......@@ -133,7 +133,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* _sm )
{
sensorInfo(_sm);
}
......@@ -144,7 +144,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
<xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="../../@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="../../@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -161,7 +161,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId _sid, UniversalIO::UIOCommand _cmd, uniset::ObjectId _node )
{
if( _cmd == UniversalIO::UIONotify )
{
......@@ -176,9 +176,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _s
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId _sid, long _val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
// ui->setState(sid,state);
......@@ -201,7 +201,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
<xsl:for-each select="//sensors/item/consumers/consumer">
<xsl:if test="normalize-space(../../@msg)!='1'">
......@@ -233,7 +233,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
-->
}
// -----------------------------------------------------------------------------
UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
uniset::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
if( smTestID != DefaultObjectId )
return smTestID;
......@@ -261,7 +261,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
</xsl:if>
</xsl:if>
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -296,7 +296,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -311,7 +311,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
updateOutputs(forceOut);
updatePreviousValues();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -104,7 +104,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
mycrit &lt;&lt; myname &lt;&lt; "(execute): СORBA::SystemException: "
&lt;&lt; ex.NP_minorString() &lt;&lt; endl;
}
catch( const std::exception&amp;ex )
catch( const std::exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): catch " &lt;&lt; ex.what() &lt;&lt; endl;
}
......@@ -115,9 +115,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
msleep( sleep_msec );
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId _sid, long _val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
<xsl:for-each select="//smap/item">
......@@ -162,7 +162,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
-->
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* _sm )
{
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@vartype)='in'">
......@@ -187,7 +187,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -202,12 +202,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId _sid, UniversalIO::UIOCommand _cmd, uniset::ObjectId _node )
{
ui->askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
try
{
......@@ -221,7 +221,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid);
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each>
return;
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -280,7 +280,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
{
priv_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui->getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
}
catch( UniSetTypes::Exception&amp; ex )
catch( uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -297,7 +297,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
si.node = node_<xsl:value-of select="@name"/>;
ui->setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() );
}
catch( UniSetTypes::Exception&amp; ex )
catch( uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -315,7 +315,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
si.node = node_<xsl:value-of select="@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
catch( UniSetTypes::Exception&amp; ex )
catch( uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -98,7 +98,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
updateOutputs(forceOut);
updatePreviousValues();
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -118,9 +118,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
msleep( sleep_msec );
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId sid, long val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId sid, long val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
<xsl:for-each select="//smap/item">
......@@ -163,7 +163,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId sid, UniversalIO::UIOCommand cmd, uniset::ObjectId node )
{
if( cmd == UniversalIO::UIONotify )
{
......@@ -178,7 +178,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId si
}
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
<xsl:for-each select="//smap/item">
if( _sid == <xsl:value-of select="@name"/> )
......@@ -188,7 +188,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid);
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* sm )
{
sensorInfo(sm);
}
......@@ -197,7 +197,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -221,7 +221,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
if( <xsl:value-of select="@name"/> != DefaultObjectId )
priv_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui->getValue(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -238,7 +238,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() );
}
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -273,7 +273,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si,(long)m_<xsl:value-of select="@name"/>, getId() );
}
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setmsg): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -52,15 +52,19 @@
#include <xsl:call-template name="preinclude"/>VMonitor.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>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject</xsl:if>
<xsl:choose>
<xsl:when test="normalize-space($BASECLASS)='UniSetObject'"> public uniset::UniSetObject</xsl:when>
<xsl:when test="normalize-space($BASECLASS)='UniSetManager'"> public uniset::UniSetManager</xsl:when>
<xsl:when test="normalize-space($BASECLASS)!=''"> public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:when>
<xsl:when test="normalize-space($BASECLASS)=''"> public uniset::UniSetObject</xsl:when>
</xsl:choose>
{
public:
<xsl:if test="not(normalize-space($OID))=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id = UniSetTypes::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>"), const string&amp; argprefix="" );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id = uniset::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>"), const string&amp; argprefix="" );
</xsl:if>
<xsl:if test="normalize-space($OID)=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>") );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id, xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>") );
</xsl:if>
<xsl:value-of select="$CLASSNAME"/>_SK();
......
......@@ -51,15 +51,19 @@
#include <xsl:call-template name="preinclude"/>VMonitor.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>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject</xsl:if>
<xsl:choose>
<xsl:when test="normalize-space($BASECLASS)='UniSetObject'"> public uniset::UniSetObject</xsl:when>
<xsl:when test="normalize-space($BASECLASS)='UniSetManager'"> public uniset::UniSetManager</xsl:when>
<xsl:when test="normalize-space($BASECLASS)!=''"> public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:when>
<xsl:when test="normalize-space($BASECLASS)=''"> public uniset::UniSetObject</xsl:when>
</xsl:choose>
{
public:
<xsl:if test="not(normalize-space($OID))=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id = UniSetTypes::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id = uniset::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
</xsl:if>
<xsl:if test="normalize-space($OID)=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id, xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
</xsl:if>
<xsl:value-of select="$CLASSNAME"/>_SK();
virtual ~<xsl:value-of select="$CLASSNAME"/>_SK();
......@@ -68,16 +72,16 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
// Используемые идентификаторы
<xsl:for-each select="//smap/item">
const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const UniSetTypes::ObjectId node_<xsl:value-of select="@name"/>;
const uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const uniset::ObjectId node_<xsl:value-of select="@name"/>;
<xsl:if test="normalize-space(@vartype)='io'">#error (uniset-codegen): vartype='io' NO LONGER SUPPORTED! (ignore variable: '<xsl:value-of select="@name"/>')
</xsl:if>
</xsl:for-each>
// Используемые идентификаторы сообщений
<xsl:for-each select="//msgmap/item">
const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const UniSetTypes::ObjectId node_<xsl:value-of select="@name"/>;
const uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const uniset::ObjectId node_<xsl:value-of select="@name"/>;
bool m_<xsl:value-of select="@name"/>; /*!&lt; текущее состояние /> */
</xsl:for-each>
......@@ -106,9 +110,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:if>
<xsl:if test="normalize-space(@type)='str'">std::string <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='sensor'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='sensor'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='object'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='object'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
</xsl:if>
</xsl:for-each>
......@@ -134,9 +138,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:if>
<xsl:if test="normalize-space(@type)='str'">std::string <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='sensor'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='sensor'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='object'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='object'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
</xsl:if>
</xsl:if>
......@@ -163,7 +167,7 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:if>
<xsl:if test="normalize-space(@type)='str'">std::string <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='sensor'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='sensor'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
</xsl:if>
</xsl:for-each>// --- end of private variables ---
......
......@@ -36,7 +36,7 @@
#include "<xsl:value-of select="$CLASSNAME"/>.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
int main( int argc,char* argv[] )
{
......@@ -57,7 +57,7 @@ int main( int argc,char* argv[] )
if( !name.empty() )
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr &lt;&lt; "(main): идентификатор '" &lt;&lt; name
&lt;&lt; "' не найден в конф. файле!"
......@@ -75,7 +75,7 @@ int main( int argc,char* argv[] )
act-&gt;run(false);
return 0;
}
catch( const Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
}
......
......@@ -38,7 +38,7 @@
#include "<xsl:value-of select="$CLASSNAME"/>.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
{
......@@ -62,7 +62,7 @@ int main( int argc, const char** argv )
if( !name.empty() )
{
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr &lt;&lt; "(main): идентификатор '" &lt;&lt; name
&lt;&lt; "' не найден в конф. файле!"
......@@ -82,7 +82,7 @@ int main( int argc, const char** argv )
act-&gt;run(false);
return 0;
}
catch( const Exception&amp; ex)
catch( const uniset::Exception&amp; ex)
{
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
}
......
......@@ -3,7 +3,7 @@
#include <UniSetActivator.h>
#include "Skel.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
......
......@@ -2,9 +2,9 @@
#include "Skel.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
Skel::Skel( UniSetTypes::ObjectId id, xmlNode* confnode ):
Skel::Skel( uniset::ObjectId id, xmlNode* confnode ):
Skel_SK( id, confnode )
{
}
......
......@@ -8,15 +8,15 @@ class Skel:
public Skel_SK
{
public:
Skel( UniSetTypes::ObjectId id, xmlNode* confnode = UniSetTypes::uniset_conf()->getNode("Skel") );
Skel( uniset::ObjectId id, xmlNode* confnode = uniset::uniset_conf()->getNode("Skel") );
virtual ~Skel();
protected:
Skel();
virtual void step() override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void askSensors( UniversalIO::UIOCommand cmd ) override;
private:
......
......@@ -16,13 +16,13 @@ GENUOBJ=UObject_SK.cc UObject_SK.h
BUILT_SOURCES=$(GENERATED) $(GENERATED2) $(GENOBJ)
TestGen-main.cc TestGen_SK.cc TestGen_SK.h: ../@PACKAGE@-codegen testgen.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --gen-varmap --local-include -n TestGen testgen.src.xml
$(SHELL) ../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --gen-varmap --local-include -n TestGen testgen.src.xml
TestGenAlone-main.cc TestGenAlone_SK.cc TestGenAlone_SK.h: ../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml
$(SHELL) ../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen --local-include --alone -n TestGenAlone testgen-alone.src.xml
$(GENUOBJ): ../@PACKAGE@-codegen uobject.src.xml ../*.xsl
../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen -n UObject --no-main uobject.src.xml
$(SHELL) ../@PACKAGE@-codegen -l $(top_builddir)/Utilities/codegen -n UObject --no-main uobject.src.xml
clean-local:
rm -rf $(GENERATED) $(GENERATED2) $(GENUOBJ)
......
......@@ -2,9 +2,9 @@
#include "TestGen.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
TestGen::TestGen( UniSetTypes::ObjectId id, xmlNode* confnode ):
TestGen::TestGen( uniset::ObjectId id, xmlNode* confnode ):
TestGen_SK( id, confnode )
{
vmonit(int_var);
......@@ -26,7 +26,7 @@ TestGen::TestGen( UniSetTypes::ObjectId id, xmlNode* confnode ):
cerr << "input2_s NOT FOUND!!!" << endl;
else
cerr << "input2_s=" << (*i) << " d=" << d << " d2=" << d2 << " d3=" << d3 << " input2_s=" << input2_s << endl;
vmonit(t_val);
}
// -----------------------------------------------------------------------------
......@@ -83,7 +83,17 @@ void TestGen::sigterm( int signo )
TestGen_SK::sigterm(signo);
}
// -----------------------------------------------------------------------------
void TestGen::sysCommand( const UniSetTypes::SystemMessage* sm )
#ifndef DISABLE_REST_API
void TestGen::httpGetUserData( Poco::JSON::Object::Ptr& jdata )
{
jdata->set("myMode", "RUNNING");
jdata->set("myVar", 42);
jdata->set("myFloatVar", 42.42);
jdata->set("myMessage", "This is text fot test httpGetUserData");
}
#endif
// -----------------------------------------------------------------------------
void TestGen::sysCommand( const uniset::SystemMessage* sm )
{
if( sm->command == SystemMessage::StartUp )
askTimer(1, 2000);
......
......@@ -8,22 +8,24 @@ class TestGen:
public TestGen_SK
{
public:
TestGen( UniSetTypes::ObjectId id, xmlNode* confnode = UniSetTypes::uniset_conf()->getNode("TestGen") );
TestGen( uniset::ObjectId id, xmlNode* confnode = uniset::uniset_conf()->getNode("TestGen") );
virtual ~TestGen();
protected:
TestGen();
virtual void step() override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sigterm( int signo ) override;
#ifndef DISABLE_REST_API
virtual void httpGetUserData( Poco::JSON::Object::Ptr& jdata ) override;
#endif
private:
bool bool_var = { false };
int int_var = {0};
timeout_t t_val = { 0 };
uniset::timeout_t t_val = { 0 };
};
// -----------------------------------------------------------------------------
#endif // TestGen_H_
......
......@@ -2,9 +2,9 @@
#include "TestGenAlone.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
TestGenAlone::TestGenAlone( UniSetTypes::ObjectId id, xmlNode* confnode ):
TestGenAlone::TestGenAlone( uniset::ObjectId id, xmlNode* confnode ):
TestGenAlone_SK( id, confnode )
{
}
......
......@@ -8,14 +8,14 @@ class TestGenAlone:
public TestGenAlone_SK
{
public:
TestGenAlone( UniSetTypes::ObjectId id, xmlNode* confnode = UniSetTypes::uniset_conf()->getNode("TestGenAlone") );
TestGenAlone( uniset::ObjectId id, xmlNode* confnode = uniset::uniset_conf()->getNode("TestGenAlone") );
virtual ~TestGenAlone();
protected:
virtual void step() override;
void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
void sensorInfo( const uniset::SensorMessage* sm ) override;
void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sigterm( int signo ) override;
private:
......
......@@ -3,7 +3,7 @@
ulimit -Sc 1000000
uniset2-start.sh -f ./test --name TestProc --confile test.xml --ulog-add-levels system,warn,crit \
--test-sm-ready-timeout 15000 --test-run-logserver --test-logserver-host 192.192.192.192
--test-sm-ready-timeout 15000 --test-run-logserver $*
#--test-log-add-levels any $*
#info,warn,crit,system,level9 > 1.log
......
......@@ -13,6 +13,7 @@
<Test>
<settings>
<set name="class-name" val="TestGen"/>
<set name="base-class" val="UniSetManager"/>
<set name="msg-count" val="20"/>
<set name="sleep-msec" val="150"/>
<set name="arg-prefix" val="test-"/>
......
......@@ -11,6 +11,8 @@ top_builddir=@top_builddir@
xsltdir=@datadir@/@PACKAGE@/xslt
[ -z "@DISABLE_REST_API@" ] && DISABLE_REST_API=0 || DISABLE_REST_API=1
PROG="${0##*/}"
print_usage()
......@@ -28,6 +30,7 @@ Valid options are:
-n, --name - filename for *_SK files (base class implementation). Default: xmlfilename_SK
--ask - Use 'ask' templates. See the documentation.
--gen-varmap - generate variable map. For function: long* valptr(ObjectId)
--no-gen-statistics - disable generate code for the account of statistics
--alone - Use 'alone' templates. See the documentation.
--no-main - Don't generate main.cc
......@@ -40,7 +43,7 @@ EOF
}
#parse command line options
TEMP=`getopt -n $PROG -o h,n:,m:,a,l:,z -l help,name:,main:,no-main,topdir:,path:,alone,ask,no-ask,local:,local-include,add-cc-include,add-hh-include,make-skel:,no-makefile,gen-varmap -- "$@"` || exit 1
TEMP=`getopt -n $PROG -o h,n:,m:,a,l:,z -l help,name:,main:,no-main,topdir:,path:,alone,ask,no-ask,local:,local-include,add-cc-include,add-hh-include,make-skel:,no-makefile,gen-varmap,no-gen-statistics -- "$@"` || exit 1
eval set -- "$TEMP"
name=
......@@ -70,6 +73,7 @@ skel_xml="skel.src.xml"
skel_make="skel-Makefile.am"
varmap=0
genstat=1
while :; do
case "$1" in
......@@ -120,6 +124,10 @@ while :; do
varmap=1
;;
--no-gen-statistics)
genstat=1
;;
-l|--local)
shift
xsltdir=$1
......@@ -199,6 +207,8 @@ PARAMS=$( echo \
--stringparam CNAME "${name}" \
--stringparam LOCALINC "${localinc}" \
--stringparam VARMAP "${varmap}" \
--stringparam STAT "${genstat}" \
--stringparam DISABLE_REST_API "${DISABLE_REST_API}" \
$xsltpath \
)
# --stringparam ADD_CC_INC "${add_cc_inc}" \
......
......@@ -11,12 +11,14 @@
#%def_enable modbus
%def_disable tests
%def_disable mqtt
%def_disable netdata
%def_enable api
%define oname uniset2
Name: libuniset2
Version: 2.5
Release: alt18.M80P.19
Version: 2.6
Release: alt3.M80P.4
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
......@@ -64,6 +66,10 @@ BuildRequires: librrd-devel
BuildRequires: libmosquitto-devel
%endif
%if_enabled netdata
BuildRequires: netdata
%endif
%if_enabled python
BuildRequires: python-devel python-module-distribute
BuildRequires(pre): rpm-build-python
......@@ -120,6 +126,16 @@ Requires: %name = %version-%release
Python interface for %name
%endif
%if_enabled netdata
%package netdata-plugin
Group: Development/Tools
Summary: python plugin for netdata
Requires: python-module-%oname
%description netdata-plugin
python plugin for netdata
%endif
%package utils
Summary: UniSet utilities
Group: Development/Tools
......@@ -301,7 +317,7 @@ SharedMemoryPlus extension ('all in one') for libuniset
%build
%autoreconf
%configure %{subst_enable docs} %{subst_enable mysql} %{subst_enable sqlite} %{subst_enable pgsql} %{subst_enable python} %{subst_enable rrd} %{subst_enable io} %{subst_enable logicproc} %{subst_enable tests} %{subst_enable mqtt}
%configure %{subst_enable docs} %{subst_enable mysql} %{subst_enable sqlite} %{subst_enable pgsql} %{subst_enable python} %{subst_enable rrd} %{subst_enable io} %{subst_enable logicproc} %{subst_enable tests} %{subst_enable mqtt} %{subst_enable api}
%make
%install
......@@ -387,6 +403,12 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%python_sitelibdir/%oname/
%endif
%if_enabled netdata
%files netdata-plugin
%_libdir/netdata/python.d/*.*
%config(noreplace) %_sysconfdir/netdata/python.d/*.conf
%endif
%if_enabled docs
%files docs
%_docdir/%oname/
......@@ -485,12 +507,67 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet2.pc
# history of current unpublished changes
# ..
%changelog
* Tue Oct 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.5-alt18.M80P.19
* Wed Dec 07 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3.M80P.4
- backport to ALTLinux p8 (by rpmbph script)
* Wed Dec 07 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt4
- new version
- getChangedTime --> getTimeChange
- getInfo( long param ) --> getInfo( string param )
- IDL Interface: added new function: string apiRequest( string query )
- getInfo() deprecated..
* Sun Dec 04 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3.3
- IOC rest api: reformat json reply
* Sat Dec 03 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3.2
- getChangedTime --> getTimeChange
- getInfo( long param ) --> getInfo( string param )
- IDL Interface: added new function: string apiRequest( string query )
/ ..getInfo() deprecated now.. /
* Tue Nov 22 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3.1
- CommonEventLoop: refactoring prepare process (part. 2)
* Tue Nov 22 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3
- CommonEventLoop: refactoring prepare process
* Mon Nov 21 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt2
- UNet: fixed bug in change receive channel
* Sat Nov 19 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1.5
- LogServer: attempt to fixed bug in run fuction (infinity lock)
* Sat Nov 19 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1.4
- LogServer: attempt to fixed bug in run fuction (infinity lock)
* Sat Nov 19 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1.3
- (codegen): add process state info for getInfo()
* Fri Nov 18 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1.2
- set default activate-timeout 30 sec
- show pid() in getInfo()
- minor fixes
* Fri Nov 18 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1.1
- add try/catch for run log server
* Fri Nov 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1
- build new version
- remove 'fastSaveValue'
- add suppor HTTP REST API
- (SM): add new statistics for consumers
* Mon Oct 24 2016 Pavel Vainerman <pv@altlinux.ru> 2.5-alt20
- correction after verification static analyzer (part 2)
- LogServer: fixed bug "connection refuse" (again)
- DebugStream: refactoring, add showMicroseconds(),showMilliseconds
* Sat Oct 22 2016 Alexei Takaseev <taf@altlinux.org> 2.5-alt19.1
- Rebuild with poco 1.7.6
* Tue Oct 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.5-alt19
- Calibration: fixed bug in getValue(), refactoring
- correction after verification static analyzer
......
......@@ -64,7 +64,7 @@ function cp2ftp()
add_changelog_helper "- new build" $SPECNAME
rpmbb $SPECNAME || fatal "Can't build"
rpmbb ${UNISET_BUILD_ADDON_OPTIONS} $SPECNAME || fatal "Can't build"
cp2ftp
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,10 +3,10 @@
# See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html
# AC_PREREQ(2.59)
AC_INIT([uniset2], [2.5.1], pv@etersoft.ru)
AC_INIT([uniset2], [2.6.0], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
LIBVER=2:5:0
LIBVER=2:6:0
AC_SUBST(LIBVER)
# AC_CONFIG_MACRO_DIR([m4])
......@@ -32,7 +32,7 @@ AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
ASTYLE_OPT="-A1 -T -C -S -N -L -w -Y -M -f -p --mode=c --lineend=linux --align-reference=type --align-pointer=type --suffix=none --style=ansi"
ASTYLE_OPT="-A1 -T -C -S -L -w -Y -M -f -p --mode=c --lineend=linux --align-reference=type --align-pointer=type --suffix=none --style=ansi --max-instatement-indent=50"
AC_SUBST(ASTYLE_OPT)
# Checks for libraries.
......@@ -55,11 +55,40 @@ else
AC_SUBST(EV_CFLAGS)
fi
#check rest api support
AC_MSG_CHECKING([REST API support])
buildapi=true
AC_ARG_ENABLE(api, AC_HELP_STRING([--disable-api], [disable REST API support]),
[ if test $enableval = yes; then buildapi=true; else buildapi=false; fi],[ buildapi=true; ])
REST_API_CFLAGS=
REST_API_CLIBS=
DISABLE_REST_API=
if test ${buildapi} = true; then
AC_MSG_RESULT([enabled])
REST_API_CLIBS="-lPocoJSON"
else
AC_MSG_RESULT([disabled])
REST_API_CFLAGS="-DDISABLE_REST_API"
DISABLE_REST_API=1
fi
AM_CONDITIONAL(DISABLE_REST_API, test ${buildapi} = false)
AC_SUBST(DISABLE_REST_API)
AC_SUBST(REST_API_CFLAGS)
AC_SUBST(REST_API_CLIBS)
#check libpoco support
AC_MSG_CHECKING([libpoco support])
#AC_SEARCH_LIBS(ServerSocket,PocoNet,,exit)
AC_CHECK_HEADER(Poco/Net/Socket.h,,exit)
POCO_LIBS="-lPocoFoundation -lPocoNet"
if test ${buildapi} = true; then
POCO_LIBS="$POCO_LIBS -lPocoJSON"
fi
POCO_CFLAGS="-IPoco"
AC_SUBST(POCO_LIBS)
AC_SUBST(POCO_CFLAGS)
......@@ -69,6 +98,13 @@ if test -n "$poco_old"; then
POCO_CFLAGS="${POCO_CFLAGS} -DPOCO_OLD_VERSION"
fi
#AC_MSG_CHECKING([check json])
#if test -a "/usr/include/json.hpp"; then
# AC_MSG_RESULT([ok])
#else
# AC_MSG_ERROR([json.hpp not found])
#fi
#check sqlite support
AC_MSG_CHECKING([sqlite support])
buildsqlite=true
......@@ -101,11 +137,11 @@ AC_ARG_ENABLE(mysql, AC_HELP_STRING([--disable-mysql], [disable MySQL support]),
[ if test $enableval = yes; then buildmysql=true; else buildmysql=false; fi],[ buildmysql=true; ])
if test ${buildmysql} = true; then
AC_MSG_RESULT([enabled])
AC_CHECK_HEADERS([mysql/mysql.h])
AC_SEARCH_LIBS([mysql_init],mysqlclient,[],[],exit)
AC_MSG_RESULT([enabled])
AC_CHECK_HEADERS([mysql/mysql.h])
AC_CHECK_LIB([mysqlclient],mysql_init,,exit)
else
AC_MSG_RESULT([disabled])
AC_MSG_RESULT([disabled])
fi
AM_CONDITIONAL(DISABLE_MYSQL, test ${buildmysql} = false)
......@@ -330,7 +366,7 @@ CXX_EXTRA_FLAGS="-Wnon-virtual-dtor -Woverloaded-virtual -Woverflow -D_GLIBCXX_U
# export
LDFLAGS="$LDFLAGS ${OMNI_LIBS} ${XML_LIBS} ${SIGC_LIBS} ${COV_LIBS} ${POCO_LIBS} ${EV_LIBS}"
# all developer liked options add to autogen.sh, please
CXXFLAGS="-I\$(top_builddir)/include $CXXFLAGS -funsigned-char -std=c++11 -g -D_GNU_SOURCE ${OMNI_CFLAGS} ${XML_CFLAGS} ${SIGC_CFLAGS} ${COV_CFLAGS} ${POCO_CFLAGS} ${EV_CFLAGS} $CXX_EXTRA_FLAGS"
CXXFLAGS="-I\$(top_builddir)/include $CXXFLAGS -funsigned-char -std=c++11 -g -D_GNU_SOURCE ${REST_API_CFLAGS} ${OMNI_CFLAGS} ${XML_CFLAGS} ${SIGC_CFLAGS} ${COV_CFLAGS} ${POCO_CFLAGS} ${EV_CFLAGS} $CXX_EXTRA_FLAGS"
AC_SUBST(LDFLAGS)
AC_SUBST(CXXFLAGS)
......@@ -366,7 +402,7 @@ AC_C_VOLATILE
#AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([atexit getcwd gettimeofday atomic_set])
AC_CHECK_FUNCS([atexit getcwd])
AC_CONFIG_FILES([Makefile
libUniSet2.pc
......@@ -378,6 +414,7 @@ AC_CONFIG_FILES([Makefile
src/Communications/Makefile
src/Communications/Modbus/Makefile
src/Communications/TCP/Makefile
src/Communications/Http/Makefile
src/Interfaces/Makefile
src/ObjectRepository/Makefile
src/Processes/Makefile
......@@ -392,6 +429,7 @@ AC_CONFIG_FILES([Makefile
tests/UniXmlTest/Makefile
tests/MQPerfTest/Makefile
tests/PocoTest/Makefile
tests/UHttpTest/Makefile
docs/Makefile
docs/UniSetDox.cfg
docs/UniSetDoxDevel.cfg
......@@ -451,6 +489,7 @@ AC_CONFIG_FILES([Makefile
testsuite/Makefile
python/lib/Makefile
python/lib/pyUniSet/Makefile
python/netdata-plugin/Makefile
python/Makefile])
......
/*! \page page_REST_API REST API
В библиотеке предусмотрен REST API. Есть два "уровня" доступа к REST API.
Первый - это встроенный в UniSetActivator http-сервер.
\ref sec_SM_REST_API
Второй уровень. Это функция apiRequest(query) которую можно вызывать у каждого
объекта посредством RPC. Её вызов не требует наличия запущенного http-сервера.
\warning С точки зрения надёжности функционирования системы наличие запущенного
http-сервера, а так же наличие функций \b getInfo(userparam) и \b apiRequest(query)
которые возвращают string является \b ОПАСНЫМ. Т.к. размер запросов и ответов в текущей
реализации не контролируется. И при помощи больших запросов можно вызвать переполнение памяти
или крах процессов. На текущий момент контроль оставлен на разработчика конкретной реализации
getInfo() или apiRequest().
*/
\ No newline at end of file
......@@ -31,7 +31,7 @@
#include "UniXML.h"
#include "DBLogSugar.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
DBServer_MySQL::DBServer_MySQL(ObjectId id, const std::string& prefix ):
......@@ -66,7 +66,7 @@ DBServer_MySQL::~DBServer_MySQL()
db->close();
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::sysCommand( const UniSetTypes::SystemMessage* sm )
void DBServer_MySQL::sysCommand( const uniset::SystemMessage* sm )
{
DBServer::sysCommand(sm);
......@@ -95,7 +95,7 @@ void DBServer_MySQL::sysCommand( const UniSetTypes::SystemMessage* sm )
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
void DBServer_MySQL::confirmInfo( const uniset::ConfirmMessage* cem )
{
try
{
......@@ -115,7 +115,7 @@ void DBServer_MySQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(update_confirm): " << ex << endl;
}
......@@ -194,7 +194,7 @@ void DBServer_MySQL::flushBuffer()
}
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::sensorInfo( const UniSetTypes::SensorMessage* si )
void DBServer_MySQL::sensorInfo( const uniset::SensorMessage* si )
{
try
{
......@@ -230,7 +230,7 @@ void DBServer_MySQL::sensorInfo( const UniSetTypes::SensorMessage* si )
dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl;
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(insert_main_history): " << ex << endl;
}
......@@ -254,7 +254,7 @@ void DBServer_MySQL::initDBServer()
auto conf = uniset_conf();
if( conf->getDBServer() == UniSetTypes::DefaultObjectId )
if( conf->getDBServer() == uniset::DefaultObjectId )
{
ostringstream msg;
msg << myname << "(init): DBServer OFF for this node.."
......@@ -276,8 +276,8 @@ void DBServer_MySQL::initDBServer()
string user(conf->getProp(node, "dbuser"));
string password(conf->getProp(node, "dbpass"));
tblMap[UniSetTypes::Message::SensorInfo] = "main_history";
tblMap[UniSetTypes::Message::Confirm] = "main_history";
tblMap[uniset::Message::SensorInfo] = "main_history";
tblMap[uniset::Message::Confirm] = "main_history";
PingTime = conf->getIntProp(node, "pingTime");
ReconnectTime = conf->getIntProp(node, "reconnectTime");
......@@ -349,7 +349,7 @@ void DBServer_MySQL::createTables( MySQLInterface* db )
}
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::timerInfo( const UniSetTypes::TimerMessage* tm )
void DBServer_MySQL::timerInfo( const uniset::TimerMessage* tm )
{
DBServer::timerInfo(tm);
......@@ -413,7 +413,7 @@ std::shared_ptr<DBServer_MySQL> DBServer_MySQL::init_dbserver( int argc, const c
{
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(DBServer_MySQL): Unknown ObjectID for '" << name << endl;
return 0;
......
......@@ -26,6 +26,9 @@
#include "UniSetTypes.h"
#include "MySQLInterface.h"
#include "DBServer.h"
// -------------------------------------------------------------------------
namespace uniset
{
//------------------------------------------------------------------------------------------
/*!
\page page_DBServer_MySQL (DBServer_MySQL) Реализация сервиса ведения БД на основе MySQL
......@@ -135,7 +138,7 @@ class DBServer_MySQL:
public DBServer
{
public:
DBServer_MySQL( UniSetTypes::ObjectId id, const std::string& prefix );
DBServer_MySQL( uniset::ObjectId id, const std::string& prefix );
explicit DBServer_MySQL( const std::string& prefix );
virtual ~DBServer_MySQL();
......@@ -161,10 +164,10 @@ class DBServer_MySQL:
virtual void initDB( std::shared_ptr<MySQLInterface>& db ) {};
virtual void initDBTableMap(DBTableMap& tblMap) {};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void confirmInfo( const uniset::ConfirmMessage* cmsg ) override;
bool writeToBase( const string& query );
void createTables( MySQLInterface* db );
......@@ -196,11 +199,13 @@ class DBServer_MySQL:
bool lastRemove;
void flushBuffer();
UniSetTypes::uniset_rwmutex mqbuf;
uniset::uniset_rwmutex mqbuf;
private:
DBTableMap tblMap;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
//------------------------------------------------------------------------------------------
#endif
......@@ -22,7 +22,7 @@
#include "UniSetTypes.h"
#include "MySQLInterface.h"
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------------------
MySQLInterface::MySQLInterface():
......
......@@ -29,6 +29,9 @@
//#define USE_OLD_FUNCTIONS
#include <mysql/mysql.h>
#include <DBInterface.h>
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------
class MySQLInterface:
public DBNetInterface
......@@ -79,4 +82,6 @@ class MySQLInterface:
bool connected;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------------
#endif
......@@ -3,7 +3,7 @@
#include "UniSetActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......
......@@ -3,7 +3,7 @@
#include "Exceptions.h"
#include "MySQLInterface.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......@@ -48,7 +48,7 @@ int main(int argc, char** argv)
db.close();
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(test): " << ex << endl;
}
......
......@@ -26,7 +26,7 @@
#include "UniXML.h"
#include "DBLogSugar.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
DBServer_PostgreSQL::DBServer_PostgreSQL(ObjectId id, const std::string& prefix ):
......@@ -74,7 +74,7 @@ DBServer_PostgreSQL::~DBServer_PostgreSQL()
db->close();
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::sysCommand( const UniSetTypes::SystemMessage* sm )
void DBServer_PostgreSQL::sysCommand( const uniset::SystemMessage* sm )
{
DBServer::sysCommand(sm);
......@@ -104,7 +104,7 @@ void DBServer_PostgreSQL::sysCommand( const UniSetTypes::SystemMessage* sm )
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
void DBServer_PostgreSQL::confirmInfo( const uniset::ConfirmMessage* cem )
{
DBServer::confirmInfo(cem);
......@@ -129,7 +129,7 @@ void DBServer_PostgreSQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(update_confirm): " << ex << endl;
}
......@@ -222,7 +222,7 @@ void DBServer_PostgreSQL::flushInsertBuffer()
ibuf.erase(beg, end);
// ibufSize - беззнаковое, так что надо аккуратно
ibufSize = (delnum < ibufSize) ? (ibufSize-delnum) : 0;
ibufSize = (delnum < ibufSize) ? (ibufSize - delnum) : 0;
dbwarn << myname << "(flushInsertBuffer): overflow: clear data " << delnum << " records." << endl;
return;
......@@ -244,7 +244,7 @@ void DBServer_PostgreSQL::flushInsertBuffer()
}
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::sensorInfo( const UniSetTypes::SensorMessage* si )
void DBServer_PostgreSQL::sensorInfo( const uniset::SensorMessage* si )
{
try
{
......@@ -275,7 +275,7 @@ void DBServer_PostgreSQL::sensorInfo( const UniSetTypes::SensorMessage* si )
if( ibufSize >= ibufMaxSize )
flushInsertBuffer();
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(insert_main_history): " << ex << endl;
}
......@@ -299,7 +299,7 @@ void DBServer_PostgreSQL::initDBServer()
auto conf = uniset_conf();
if( conf->getDBServer() == UniSetTypes::DefaultObjectId )
if( conf->getDBServer() == uniset::DefaultObjectId )
{
ostringstream msg;
msg << myname << "(init): DBServer OFF for this node.."
......@@ -330,8 +330,8 @@ void DBServer_PostgreSQL::initDBServer()
std::string sfactor = conf->getArg2Param("--" + prefix + "-ibuf-overflow-cleanfactor", it.getProp("ibufOverflowCleanFactor"), "0.5");
ibufOverflowCleanFactor = atof(sfactor.c_str());
tblMap[UniSetTypes::Message::SensorInfo] = "main_history";
tblMap[UniSetTypes::Message::Confirm] = "main_history";
tblMap[uniset::Message::SensorInfo] = "main_history";
tblMap[uniset::Message::Confirm] = "main_history";
PingTime = conf->getArgPInt("--" + prefix + "-pingTime", it.getProp("pingTime"), 15000);
ReconnectTime = conf->getArgPInt("--" + prefix + "-reconnectTime", it.getProp("reconnectTime"), 30000);
......@@ -402,7 +402,7 @@ void DBServer_PostgreSQL::createTables( std::shared_ptr<PostgreSQLInterface>& db
}
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::timerInfo( const UniSetTypes::TimerMessage* tm )
void DBServer_PostgreSQL::timerInfo( const uniset::TimerMessage* tm )
{
DBServer::timerInfo(tm);
......@@ -488,7 +488,7 @@ std::shared_ptr<DBServer_PostgreSQL> DBServer_PostgreSQL::init_dbserver( int arg
{
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(DBServer_PostgreSQL): Unknown ObjectID for '" << name << endl;
return 0;
......
......@@ -22,6 +22,9 @@
#include "UniSetTypes.h"
#include "PostgreSQLInterface.h"
#include "DBServer.h"
// -------------------------------------------------------------------------
namespace uniset
{
//------------------------------------------------------------------------------------------
/*!
* \brief The DBServer_PostgreSQL class
......@@ -52,7 +55,7 @@ class DBServer_PostgreSQL:
public DBServer
{
public:
DBServer_PostgreSQL( UniSetTypes::ObjectId id, const std::string& prefix );
DBServer_PostgreSQL( uniset::ObjectId id, const std::string& prefix );
DBServer_PostgreSQL();
virtual ~DBServer_PostgreSQL();
......@@ -78,10 +81,10 @@ class DBServer_PostgreSQL:
virtual void initDB( std::shared_ptr<PostgreSQLInterface>& db ) {};
virtual void initDBTableMap(DBTableMap& tblMap) {};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void confirmInfo( const uniset::ConfirmMessage* cmsg ) override;
virtual void sigterm( int signo ) override;
bool writeToBase( const string& query );
......@@ -131,5 +134,7 @@ class DBServer_PostgreSQL:
DBTableMap tblMap;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
//------------------------------------------------------------------------------------------
#endif
......@@ -20,7 +20,7 @@
#include "PostgreSQLInterface.h"
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
using namespace pqxx;
// --------------------------------------------------------------------------
......
......@@ -25,6 +25,9 @@
#include <pqxx/pqxx>
#include <PassiveTimer.h>
#include <DBInterface.h>
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------
class PostgreSQLInterface:
public DBNetInterface
......@@ -67,6 +70,8 @@ class PostgreSQLInterface:
std::string lastE;
double last_inserted_id;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------
#endif
// ----------------------------------------------------------------------------------
......@@ -3,7 +3,7 @@
#include "UniSetActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......@@ -26,7 +26,7 @@ int main(int argc, char** argv)
act->add(dbs);
act->run(false);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(DBServer_PosgreSQL::main): " << ex << endl;
}
......
......@@ -3,7 +3,7 @@
#include "Exceptions.h"
#include "PostgreSQLInterface.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......@@ -101,7 +101,7 @@ int main(int argc, char** argv)
db.close();
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(test): " << ex << endl;
}
......
......@@ -31,7 +31,7 @@
#include "UniXML.h"
#include "DBLogSugar.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
DBServer_SQLite::DBServer_SQLite( ObjectId id, const std::string& prefix ):
......@@ -64,7 +64,7 @@ DBServer_SQLite::~DBServer_SQLite()
db->close();
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::sysCommand( const UniSetTypes::SystemMessage* sm )
void DBServer_SQLite::sysCommand( const uniset::SystemMessage* sm )
{
DBServer::sysCommand(sm);
......@@ -92,7 +92,7 @@ void DBServer_SQLite::sysCommand( const UniSetTypes::SystemMessage* sm )
}
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
void DBServer_SQLite::confirmInfo( const uniset::ConfirmMessage* cem )
{
try
{
......@@ -112,7 +112,7 @@ void DBServer_SQLite::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(update_confirm): " << ex << endl;
}
......@@ -177,7 +177,7 @@ void DBServer_SQLite::flushBuffer()
}
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::sensorInfo( const UniSetTypes::SensorMessage* si )
void DBServer_SQLite::sensorInfo( const uniset::SensorMessage* si )
{
try
{
......@@ -213,7 +213,7 @@ void DBServer_SQLite::sensorInfo( const UniSetTypes::SensorMessage* si )
dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl;
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(insert_main_history): " << ex << endl;
}
......@@ -237,7 +237,7 @@ void DBServer_SQLite::initDBServer()
auto conf = uniset_conf();
if( conf->getDBServer() == UniSetTypes::DefaultObjectId )
if( conf->getDBServer() == uniset::DefaultObjectId )
{
ostringstream msg;
msg << myname << "(init): DBServer OFF for this node.."
......@@ -256,8 +256,8 @@ void DBServer_SQLite::initDBServer()
dbinfo << myname << "(init): init connection.." << endl;
string dbfile(conf->getProp(node, "dbfile"));
tblMap[UniSetTypes::Message::SensorInfo] = "main_history";
tblMap[UniSetTypes::Message::Confirm] = "main_history";
tblMap[uniset::Message::SensorInfo] = "main_history";
tblMap[uniset::Message::Confirm] = "main_history";
PingTime = conf->getIntProp(node, "pingTime");
ReconnectTime = conf->getIntProp(node, "reconnectTime");
......@@ -324,7 +324,7 @@ void DBServer_SQLite::createTables( SQLiteInterface* db )
}
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::timerInfo( const UniSetTypes::TimerMessage* tm )
void DBServer_SQLite::timerInfo( const uniset::TimerMessage* tm )
{
DBServer::timerInfo(tm);
......@@ -388,7 +388,7 @@ std::shared_ptr<DBServer_SQLite> DBServer_SQLite::init_dbserver( int argc, const
{
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(DBServer_SQLite): Unknown ObjectID for '" << name << endl;
return 0;
......
......@@ -26,6 +26,9 @@
#include "UniSetTypes.h"
#include "SQLiteInterface.h"
#include "DBServer.h"
// -------------------------------------------------------------------------
namespace uniset
{
//------------------------------------------------------------------------------------------
/*!
\page page_DBServer_SQLite (DBServer_SQLite) Реализация сервиса ведения БД на основе SQLite
......@@ -135,7 +138,7 @@ class DBServer_SQLite:
public DBServer
{
public:
DBServer_SQLite( UniSetTypes::ObjectId id, const std::string& prefix );
DBServer_SQLite( uniset::ObjectId id, const std::string& prefix );
explicit DBServer_SQLite( const std::string& prefix );
virtual ~DBServer_SQLite();
......@@ -161,10 +164,10 @@ class DBServer_SQLite:
virtual void initDB( std::shared_ptr<SQLiteInterface>& db ) {};
virtual void initDBTableMap(DBTableMap& tblMap) {};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void confirmInfo( const uniset::ConfirmMessage* cmsg ) override;
bool writeToBase( const string& query );
void createTables( SQLiteInterface* db );
......@@ -196,11 +199,13 @@ class DBServer_SQLite:
bool lastRemove;
void flushBuffer();
UniSetTypes::uniset_rwmutex mqbuf;
uniset::uniset_rwmutex mqbuf;
private:
DBTableMap tblMap;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
//------------------------------------------------------------------------------------------
#endif
......@@ -24,7 +24,7 @@
#include "SQLiteInterface.h"
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// --------------------------------------------------------------------------
SQLiteInterface::SQLiteInterface():
......@@ -76,7 +76,7 @@ bool SQLiteInterface::connect( const std::string& param )
bool SQLiteInterface::connect( const string& dbfile, bool create )
{
// т.к. sqlite3 по умолчанию, создаёт файл при открытии, то проверим "сами"
// if( !create && !UniSetTypes::file_exist(dbfile) )
// if( !create && !uniset::file_exist(dbfile) )
// return false;
int flags = create ? 0 : SQLITE_OPEN_READWRITE;
......
......@@ -28,6 +28,9 @@
#include <sqlite3.h>
#include "PassiveTimer.h"
#include <DBInterface.h>
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------
/*! \page SQLiteIntarface Интерфейс к SQLite
......@@ -135,7 +138,8 @@ class SQLiteInterface:
timeout_t opTimeout;
timeout_t opCheckPause;
};
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------
#endif
// ----------------------------------------------------------------------------------
......@@ -3,7 +3,7 @@
#include "UniSetActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......
......@@ -3,7 +3,7 @@
#include "Exceptions.h"
#include "SQLiteInterface.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......
......@@ -19,7 +19,7 @@
#include <cstring>
#include "ComediInterface.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -----------------------------------------------------------------------------
ComediInterface::ComediInterface( const std::string& dev ):
......@@ -42,7 +42,7 @@ ComediInterface::~ComediInterface()
}
// -----------------------------------------------------------------------------
int ComediInterface::getAnalogChannel( int subdev, int channel, int range, int aref )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
lsampl_t data = 0;
int ret = comedi_data_read(card, subdev, channel, range, aref, &data);
......@@ -61,7 +61,7 @@ throw(UniSetTypes::Exception)
}
// -----------------------------------------------------------------------------
void ComediInterface::setAnalogChannel( int subdev, int channel, int data, int range, int aref )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
if( comedi_data_write(card, subdev, channel, range, aref, data) < 0 )
{
......@@ -74,7 +74,7 @@ throw(UniSetTypes::Exception)
}
}
// -----------------------------------------------------------------------------
bool ComediInterface::getDigitalChannel( int subdev, int channel ) throw(UniSetTypes::Exception)
bool ComediInterface::getDigitalChannel( int subdev, int channel ) throw(uniset::Exception)
{
lsampl_t data = 0;
......@@ -90,7 +90,7 @@ bool ComediInterface::getDigitalChannel( int subdev, int channel ) throw(UniSetT
}
// -----------------------------------------------------------------------------
void ComediInterface::setDigitalChannel( int subdev, int channel, bool bit )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
if( comedi_dio_write(card, subdev, channel, bit) < 0 )
{
......@@ -103,7 +103,7 @@ throw(UniSetTypes::Exception)
// -----------------------------------------------------------------------------
void ComediInterface::configureChannel( int subdev, int channel, ChannelType t,
int range, int aref )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
switch( t )
{
......@@ -162,7 +162,7 @@ throw(UniSetTypes::Exception)
}
// -----------------------------------------------------------------------------
void ComediInterface::configureSubdev( int subdev, SubdevType type )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
lsampl_t data[2];
comedi_insn insn;
......
......@@ -20,6 +20,9 @@
#include <string>
#include <comedilib.h>
#include "Exceptions.h"
//--------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*! Интерфейс для работы с в/в */
class ComediInterface
......@@ -29,16 +32,16 @@ class ComediInterface
~ComediInterface();
int getAnalogChannel( int subdev, int channel, int range = 0, int aref = AREF_GROUND )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
void setAnalogChannel( int subdev, int channel, int data, int range = 0, int aref = AREF_GROUND )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
bool getDigitalChannel( int subdev, int channel )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
void setDigitalChannel( int subdev, int channel, bool bit )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
// Конфигурирование входов / выходов
......@@ -62,10 +65,10 @@ class ComediInterface
static std::string type2str( SubdevType t );
static SubdevType str2type( const std::string& s );
void configureSubdev( int subdev, SubdevType type ) throw(UniSetTypes::Exception);
void configureSubdev( int subdev, SubdevType type ) throw(uniset::Exception);
void configureChannel( int subdev, int channel, ChannelType type, int range = 0, int aref = 0 )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
inline const std::string devname()
{
......@@ -79,6 +82,8 @@ class ComediInterface
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // ComediInterface_H_
// -----------------------------------------------------------------------------
......
......@@ -21,9 +21,11 @@
#include "IOControl.h"
#include "IOLogSugar.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace extensions;
// -----------------------------------------------------------------------------
std::ostream& operator<<( std::ostream& os, IOControl::IOInfo& inf )
{
......@@ -39,7 +41,7 @@ std::ostream& operator<<( std::ostream& os, IOControl::IOInfo& inf )
}
// -----------------------------------------------------------------------------
IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
IOControl::IOControl(uniset::ObjectId id, uniset::ObjectId icID,
const std::shared_ptr<SharedMemory>& ic, int numcards, const std::string& prefix_ ):
UniSetObject(id),
polltime(150),
......@@ -53,16 +55,16 @@ IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
blink_state(true),
blink2_state(true),
blink3_state(true),
testLamp_s(UniSetTypes::DefaultObjectId),
testLamp_s(uniset::DefaultObjectId),
isTestLamp(false),
sidHeartBeat(UniSetTypes::DefaultObjectId),
sidHeartBeat(uniset::DefaultObjectId),
force(false),
force_out(false),
maxCardNum(10),
activated(false),
readconf_ok(false),
term(false),
testMode_as(UniSetTypes::DefaultObjectId),
testMode_as(uniset::DefaultObjectId),
testmode(tmNone),
prev_testmode(tmNone)
{
......@@ -435,7 +437,7 @@ void IOControl::execute()
ptHeartBeat.reset();
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iolog3 << myname << "(execute): " << ex << endl;
}
......@@ -690,7 +692,7 @@ void IOControl::ioread( IOInfo* it )
{
iolog3 << myname << "(iopoll): (BadRange)..." << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iolog3 << myname << "(iopoll): " << ex << endl;
}
......@@ -724,7 +726,7 @@ void IOControl::readConfiguration()
for( ; it.getCurrent(); it.goNext() )
{
if( UniSetTypes::check_filter(it, s_field, s_fvalue) )
if( uniset::check_filter(it, s_field, s_fvalue) )
initIOItem(it);
}
......@@ -733,7 +735,7 @@ void IOControl::readConfiguration()
// ------------------------------------------------------------------------------------------
bool IOControl::readItem( const std::shared_ptr<UniXML>& xml, UniXML::iterator& it, xmlNode* sec )
{
if( UniSetTypes::check_filter(it, s_field, s_fvalue) )
if( uniset::check_filter(it, s_field, s_fvalue) )
initIOItem(it);
return true;
......@@ -938,7 +940,7 @@ void IOControl::initOutputs()
else if( it.stype == UniversalIO::AO )
card->setAnalogChannel(it.subdev, it.channel, it.defval, it.range, it.aref);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iolog3 << myname << "(initOutput): " << ex << endl;
}
......@@ -979,7 +981,7 @@ void IOControl::initIOCard()
card->configureChannel(it.subdev, it.channel, ComediInterface::AO);
}
catch( const Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(initIOCard): sid=" << it.si.id << " " << ex << endl;
}
......@@ -1005,7 +1007,7 @@ void IOControl::blink( BlinkList& lst, bool& bstate )
{
card->setDigitalChannel(io->subdev, io->channel, bstate);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(blink): " << ex << endl;
}
......@@ -1056,8 +1058,8 @@ void IOControl::check_testmode()
// если режим "выключено всё"
// то гасим все выходы
if( testmode == tmOffPoll ||
testmode == tmConfigEnable ||
testmode == tmConfigDisable )
testmode == tmConfigEnable ||
testmode == tmConfigDisable )
{
// выставляем безопасные состояния
for( auto& it : iomap )
......@@ -1091,7 +1093,7 @@ void IOControl::check_testmode()
card->setAnalogChannel(it.subdev, it.channel, it.safety, it.range, it.aref);
}
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iolog3 << myname << "(sigterm): " << ex << endl;
}
......@@ -1100,7 +1102,7 @@ void IOControl::check_testmode()
}
}
catch( const Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(check_testmode): " << ex << endl;
}
......@@ -1165,7 +1167,7 @@ void IOControl::check_testlamp()
}
}
}
catch( const Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(check_testlamp): " << ex << endl;
}
......@@ -1177,7 +1179,7 @@ void IOControl::check_testlamp()
// -----------------------------------------------------------------------------
std::shared_ptr<IOControl> IOControl::init_iocontrol(int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......@@ -1191,7 +1193,7 @@ std::shared_ptr<IOControl> IOControl::init_iocontrol(int argc, const char* const
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(iocontrol): Unknown ID for " << name
<< "' Not found in <objects>" << endl;
......@@ -1369,7 +1371,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
if( testLamp_s != DefaultObjectId )
shm->askSensor(testLamp_s, cmd);
}
catch( const Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(askSensors): " << ex << endl;
}
......@@ -1379,7 +1381,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
if( testMode_as != DefaultObjectId )
shm->askSensor(testMode_as, cmd);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(askSensors): " << ex << endl;
}
......@@ -1400,7 +1402,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
{
shm->askSensor(it.si.id, cmd, myid);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(askSensors): " << ex << endl;
}
......@@ -1408,7 +1410,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
}
}
// -----------------------------------------------------------------------------
void IOControl::sensorInfo( const UniSetTypes::SensorMessage* sm )
void IOControl::sensorInfo( const uniset::SensorMessage* sm )
{
iolog1 << myname << "(sensorInfo): sm->id=" << sm->id
<< " val=" << sm->value << endl;
......@@ -1545,7 +1547,7 @@ void IOControl::sensorInfo( const UniSetTypes::SensorMessage* sm )
}
}
// -----------------------------------------------------------------------------
void IOControl::timerInfo( const UniSetTypes::TimerMessage* tm )
void IOControl::timerInfo( const uniset::TimerMessage* tm )
{
}
......@@ -1682,7 +1684,7 @@ void IOControl::buildCardsList()
cards[cardnum] = new ComediInterface(iodev);
noCards = false;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(buildCardsList): " << ex << endl;
throw;
......@@ -1746,3 +1748,4 @@ void IOControl::buildCardsList()
}
}
// -----------------------------------------------------------------------------
} // end of namespace uniset
......@@ -39,6 +39,9 @@
#include "LogServer.h"
#include "DebugStream.h"
#include "LogAgregator.h"
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*!
\page page_IOControl (IOControl) Реализация процесса ввода/вывода
......@@ -144,11 +147,11 @@
<br>&nbsp;&nbsp; J2
<br>\b lamp - признак, что данный аналоговый датчик является "лампочкой".
<br> Т.е. на самом деле дискретный выход, который может иметь состояния:
<br>UniSetTypes::lmpOFF - выключен
<br>UniSetTypes::lmpON - включен
<br>UniSetTypes::lmpBLINK - мигание с частотой 1
<br>UniSetTypes::lmpBLINK2 - мигание с частотой 2
<br>UniSetTypes::lmpBLINK3 - мигание с частотой 3
<br>uniset::lmpOFF - выключен
<br>uniset::lmpON - включен
<br>uniset::lmpBLINK - мигание с частотой 1
<br>uniset::lmpBLINK2 - мигание с частотой 2
<br>uniset::lmpBLINK3 - мигание с частотой 3
<br>\b no_iotestlamp - игнорировать данную лампочку при тесте ламп.
<br>\b range - диапазон измерения аналогового входа (см. libcomedi)
......@@ -223,13 +226,13 @@ class IOControl:
public UniSetObject
{
public:
IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& shm = nullptr, int numcards = 2, const std::string& prefix = "io" );
IOControl( uniset::ObjectId id, uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& shm = nullptr, int numcards = 2, const std::string& prefix = "io" );
virtual ~IOControl();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<IOControl> init_iocontrol( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "io" );
uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "io" );
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
......@@ -314,10 +317,10 @@ class IOControl:
void blink();
// действия при завершении работы
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sigterm( int signo ) override;
virtual bool activateObject() override;
......@@ -356,7 +359,7 @@ class IOControl:
std::string s_fvalue;
std::shared_ptr<SMInterface> shm;
UniSetTypes::ObjectId myid = { UniSetTypes::DefaultObjectId };
uniset::ObjectId myid = { uniset::DefaultObjectId };
std::string prefix;
typedef std::list<IOInfo*> BlinkList;
......@@ -380,13 +383,13 @@ class IOControl:
PassiveTimer ptBlink3;
bool blink3_state = { false };
UniSetTypes::ObjectId testLamp_s = { UniSetTypes::DefaultObjectId };
uniset::ObjectId testLamp_s = { uniset::DefaultObjectId };
Trigger trTestLamp;
bool isTestLamp = { false };
IOController::IOStateList::iterator itTestLamp;
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
uniset::ObjectId sidHeartBeat;
int maxHeartBeat = { 10 };
IOController::IOStateList::iterator itHeartBeat;
......@@ -400,10 +403,10 @@ class IOControl:
std::atomic_bool activated = { false };
bool readconf_ok = { false };
int activateTimeout;
UniSetTypes::ObjectId sidTestSMReady = { UniSetTypes::DefaultObjectId };
uniset::ObjectId sidTestSMReady = { uniset::DefaultObjectId };
std::atomic_bool term = { false };
UniSetTypes::ObjectId testMode_as = { UniSetTypes::DefaultObjectId };
uniset::ObjectId testMode_as = { uniset::DefaultObjectId };
IOController::IOStateList::iterator itTestMode;
long testmode = { false };
long prev_testmode = { false };
......@@ -416,6 +419,8 @@ class IOControl:
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // IOControl_H_
// -----------------------------------------------------------------------------
......@@ -33,7 +33,7 @@
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
struct equals
{
......
......@@ -21,9 +21,9 @@
#include "IOControl.h"
#include "Extensions.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// --------------------------------------------------------------------------
int main(int argc, const char** argv)
{
......
......@@ -17,6 +17,9 @@
#include <sstream>
#include <iostream>
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
// -------------------------------------------------------------------------
......@@ -117,3 +120,4 @@ void Element::delInput(size_t num )
}
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -22,14 +22,17 @@
#include <list>
#include <ostream>
#include "Exceptions.h"
//--------------------------------------------------------------------------
namespace uniset
{
// --------------------------------------------------------------------------
class LogicException:
public UniSetTypes::Exception
public uniset::Exception
{
public:
LogicException(): UniSetTypes::Exception("LogicException") {}
explicit LogicException( const std::string& err): UniSetTypes::Exception(err) {}
LogicException(): uniset::Exception("LogicException") {}
explicit LogicException( const std::string& err): uniset::Exception(err) {}
};
......@@ -212,6 +215,7 @@ class TNOT:
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -22,8 +22,8 @@
#include "LProcessor.h"
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
LProcessor::LProcessor( const std::string& name ):
logname(name)
......@@ -74,7 +74,7 @@ void LProcessor::execute( const std::string& lfile )
{
dcrit << logname << "(execute): " << ex << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << logname << "(execute): " << ex << endl;
}
......@@ -104,7 +104,7 @@ void LProcessor::build( const string& lfile )
// считая, что в поле name записано название датчика
for( auto it = sch->extBegin(); it != sch->extEnd(); ++it )
{
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
uniset::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
......@@ -130,7 +130,7 @@ void LProcessor::build( const string& lfile )
for( auto it = sch->outBegin(); it != sch->outEnd(); ++it )
{
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
uniset::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
......@@ -192,7 +192,7 @@ void LProcessor::setOuts()
{
ui.setValue(it.sid, it.el->getOut(), DefaultObjectId);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << "(LProcessor::setOuts): " << ex << endl;
}
......
......@@ -108,6 +108,9 @@
#include "Element.h"
#include "Schema.h"
// --------------------------------------------------------------------------
namespace uniset
{
// --------------------------------------------------------------------------
class LProcessor
{
public:
......@@ -150,7 +153,7 @@ class LProcessor
struct EXTInfo
{
UniSetTypes::ObjectId sid;
uniset::ObjectId sid;
UniversalIO::IOType iotype;
bool state;
std::shared_ptr<Element> el;
......@@ -159,7 +162,7 @@ class LProcessor
struct EXTOutInfo
{
UniSetTypes::ObjectId sid;
uniset::ObjectId sid;
UniversalIO::IOType iotype;
std::shared_ptr<Element> el;
};
......@@ -184,5 +187,7 @@ class LProcessor
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -19,11 +19,11 @@
#include "PassiveLProcessor.h"
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
PassiveLProcessor::PassiveLProcessor( UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
PassiveLProcessor::PassiveLProcessor( uniset::ObjectId objId,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
UniSetObject(objId),
shm(nullptr)
{
......@@ -88,7 +88,7 @@ void PassiveLProcessor::step()
{
LProcessor::step();
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(step): (hb) " << ex << std::endl;
}
......@@ -100,7 +100,7 @@ void PassiveLProcessor::step()
shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset();
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(step): (hb) " << ex << std::endl;
}
......@@ -120,14 +120,14 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
for( auto& it : extInputs )
shm->askSensor(it.sid, cmd);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(askSensors): " << ex << endl;
throw SystemError(myname + "(askSensors): do not ask sensors" );
}
}
// -------------------------------------------------------------------------
void PassiveLProcessor::sensorInfo( const UniSetTypes::SensorMessage* sm )
void PassiveLProcessor::sensorInfo( const uniset::SensorMessage* sm )
{
for( auto& it : extInputs )
{
......@@ -136,13 +136,13 @@ void PassiveLProcessor::sensorInfo( const UniSetTypes::SensorMessage* sm )
}
}
// -------------------------------------------------------------------------
void PassiveLProcessor::timerInfo( const UniSetTypes::TimerMessage* tm )
void PassiveLProcessor::timerInfo( const uniset::TimerMessage* tm )
{
if( tm->id == tidStep )
step();
}
// -------------------------------------------------------------------------
void PassiveLProcessor::sysCommand( const UniSetTypes::SystemMessage* sm )
void PassiveLProcessor::sysCommand( const uniset::SystemMessage* sm )
{
switch( sm->command )
{
......@@ -236,7 +236,7 @@ void PassiveLProcessor::setOuts()
{
shm->setValue( it.sid, it.el->getOut() );
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(setOuts): " << ex << endl;
}
......@@ -255,7 +255,7 @@ void PassiveLProcessor::sigterm( int signo )
{
shm->setValue(it.sid, 0);
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(sigterm): " << ex << endl;
}
......@@ -279,7 +279,7 @@ void PassiveLProcessor::help_print( int argc, const char* const* argv )
}
// -----------------------------------------------------------------------------
std::shared_ptr<PassiveLProcessor> PassiveLProcessor::init_plproc(int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......@@ -293,7 +293,7 @@ std::shared_ptr<PassiveLProcessor> PassiveLProcessor::init_plproc(int argc, cons
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(plproc): идентификатор '" << name
<< "' не найден в конф. файле!"
......
......@@ -27,6 +27,9 @@
#include "SMInterface.h"
#include "LProcessor.h"
// --------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
/*! Реализация LogicProccessor основанная на заказе датчиков */
class PassiveLProcessor:
public UniSetObject,
......@@ -34,8 +37,8 @@ class PassiveLProcessor:
{
public:
PassiveLProcessor(UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "lproc" );
PassiveLProcessor(uniset::ObjectId objId,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "lproc" );
virtual ~PassiveLProcessor();
enum Timers
......@@ -46,7 +49,7 @@ class PassiveLProcessor:
static void help_print( int argc, const char* const* argv );
static std::shared_ptr<PassiveLProcessor> init_plproc( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "plproc" );
protected:
......@@ -56,9 +59,9 @@ class PassiveLProcessor:
virtual void getInputs();
virtual void setOuts();
void sysCommand( const UniSetTypes::SystemMessage* msg ) override;
void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
void sysCommand( const uniset::SystemMessage* msg ) override;
void sensorInfo( const uniset::SensorMessage* sm ) override;
void timerInfo( const uniset::TimerMessage* tm ) override;
void askSensors( const UniversalIO::UIOCommand cmd );
// void initOutput();
......@@ -71,10 +74,12 @@ class PassiveLProcessor:
private:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat = { UniSetTypes::DefaultObjectId };
uniset::ObjectId sidHeartBeat = { uniset::DefaultObjectId };
int maxHeartBeat = { 10 };
IOController::IOStateList::iterator itHeartBeat;
std::mutex mutex_start;
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -18,9 +18,12 @@
#include <iostream>
#include "Extensions.h"
#include "Schema.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
Schema::Schema()
......@@ -219,3 +222,4 @@ std::shared_ptr<Element> Schema::findOut( const string& name )
return nullptr;
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -22,6 +22,9 @@
#include "Element.h"
#include "Schema.h"
// --------------------------------------------------------------------------
namespace uniset
{
// --------------------------------------------------------------------------
class Schema
{
public:
......@@ -187,5 +190,7 @@ class SchemaXML:
protected:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -20,10 +20,12 @@
#include "Extensions.h"
#include "Schema.h"
#include "TDelay.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
SchemaXML::SchemaXML()
{
......@@ -146,3 +148,4 @@ void SchemaXML::read( const string& xmlfile )
}
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -17,9 +17,12 @@
#include <iostream>
#include "Extensions.h"
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TAND::TAND(ElementID id, size_t num, bool st):
TOR(id, num, st)
......@@ -69,3 +72,4 @@ void TAND::setIn(size_t num, bool state )
Element::setChildOut();
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -17,9 +17,12 @@
#include <iostream>
#include "Extensions.h"
#include "TDelay.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TDelay::TDelay(Element::ElementID id, timeout_t delayMS, size_t inCount):
Element(id),
......@@ -99,3 +102,4 @@ void TDelay::setDelay( timeout_t timeMS )
delay = timeMS;
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -19,6 +19,9 @@
// --------------------------------------------------------------------------
#include "PassiveTimer.h"
#include "Element.h"
// --------------------------------------------------------------------------
namespace uniset
{
// ---------------------------------------------------------------------------
// "ON" delay element
// Сбрасывается без задержки.. а срабатывает с задержкой.
......@@ -53,6 +56,8 @@ class TDelay:
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
// ---------------------------------------------------------------------------
......
......@@ -18,9 +18,12 @@
#include <iostream>
#include "Extensions.h"
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TNOT::TNOT( ElementID id, bool out_default ):
Element(id),
......@@ -42,3 +45,4 @@ void TNOT::setIn( size_t num, bool state )
Element::setChildOut();
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -18,9 +18,12 @@
#include <iostream>
#include "Extensions.h"
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TOR::TOR(ElementID id, size_t num, bool st):
Element(id),
......@@ -83,3 +86,4 @@ void TOR::setIn( size_t num, bool state )
Element::setChildOut();
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -20,8 +20,8 @@
#include "LProcessor.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
int main(int argc, const char** argv)
{
......@@ -58,7 +58,7 @@ int main(int argc, const char** argv)
{
cerr << ex << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << ex << endl;
}
......
......@@ -22,8 +22,8 @@
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
int main(int argc, const char** argv)
{
......@@ -95,7 +95,7 @@ int main(int argc, const char** argv)
{
cerr << ex << endl;
}
catch( const Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << ex << endl;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
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