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