Commit 8e133a62 authored by Pavel Vainerman's avatar Pavel Vainerman

Введение namespace uniset

(UniSetTypes --> uniset, UniSetExtensions --> uniset::extensions::)
parent 010be9bd
...@@ -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
...@@ -55,25 +55,25 @@ interface IOController_i : UniSetManager_i ...@@ -55,25 +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);
UniversalIO::IOType getIOType(in UniSetTypes::ObjectId sid) raises(NameNotFound); UniversalIO::IOType getIOType(in uniset::ObjectId sid) raises(NameNotFound);
// --- Интерфейс для конфигурирования --- // --- Интерфейс для конфигурирования ---
/*! Получение неколиброванного значения */ /*! Получение неколиброванного значения */
long getRawValue( in UniSetTypes::ObjectId sid ) raises(NameNotFound); long getRawValue( in uniset::ObjectId sid ) raises(NameNotFound);
struct CalibrateInfo struct CalibrateInfo
{ {
...@@ -84,8 +84,8 @@ interface IOController_i : UniSetManager_i ...@@ -84,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);
// --- Интерфес получения информации о всех датчиках --- // --- Интерфес получения информации о всех датчиках ---
/*! Информация датчике */ /*! Информация датчике */
...@@ -102,19 +102,19 @@ interface IOController_i : UniSetManager_i ...@@ -102,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
...@@ -130,7 +130,7 @@ interface IOController_i : UniSetManager_i ...@@ -130,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 );
/*! Информация о датчике */ /*! Информация о датчике */
...@@ -141,10 +141,10 @@ interface IOController_i : UniSetManager_i ...@@ -141,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 getChangedTime( in uniset::ObjectId sid ) raises(NameNotFound);
/*! Информация о дискретном датчике */ /*! Информация о дискретном датчике */
...@@ -180,15 +180,15 @@ interface IONotifyController_i : IOController_i ...@@ -180,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 );
...@@ -202,7 +202,7 @@ interface IONotifyController_i : IOController_i ...@@ -202,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;
...@@ -222,7 +222,7 @@ interface IONotifyController_i : IOController_i ...@@ -222,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);
...@@ -230,7 +230,7 @@ interface IONotifyController_i : IOController_i ...@@ -230,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
{ {
...@@ -243,7 +243,7 @@ interface IONotifyController_i : IOController_i ...@@ -243,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 long userparam );
}; };
//}; // end of module UniSet //}; // end of module UniSet
......
...@@ -36,18 +36,18 @@ ...@@ -36,18 +36,18 @@
*/ */
interface UniSetObject_i interface UniSetObject_i
{ {
UniSetTypes::ObjectId getId(); /*!< получение идентификатора объекта */ uniset::ObjectId getId(); /*!< получение идентификатора объекта */
UniSetTypes::ObjectType getType(); /*!< получение типа объекта */ uniset::ObjectType getType(); /*!< получение типа объекта */
/*! получение информации о внутреннем состоянии объекта /*! получение информации о внутреннем состоянии объекта
\param userparam - Необязательный пользовательский параметр \param userparam - Необязательный пользовательский параметр
*/ */
UniSetTypes::SimpleInfo getInfo( in long userparam ); uniset::SimpleInfo getInfo( in long userparam );
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
......
...@@ -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 ):
......
...@@ -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 ):
......
...@@ -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 UniSetTypes::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 UniSetTypes::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
<< "' не найден в конф. файле!" << "' не найден в конф. файле!"
......
...@@ -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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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;
} }
...@@ -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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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,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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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;
......
...@@ -53,14 +53,14 @@ ...@@ -53,14 +53,14 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK: class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:if> <xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject</xsl:if> <xsl:if test="normalize-space($BASECLASS)=''">public uniset::UniSetObject</xsl:if>
{ {
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();
......
...@@ -52,14 +52,14 @@ ...@@ -52,14 +52,14 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK: class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:if> <xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject</xsl:if> <xsl:if test="normalize-space($BASECLASS)=''">public uniset::UniSetObject</xsl:if>
{ {
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 +68,16 @@ class <xsl:value-of select="$CLASSNAME"/>_SK: ...@@ -68,16 +68,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 +106,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK: ...@@ -106,9 +106,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 +134,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK: ...@@ -134,9 +134,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 +163,7 @@ class <xsl:value-of select="$CLASSNAME"/>_SK: ...@@ -163,7 +163,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 UniSetTypes::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 UniSetTypes::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:
......
...@@ -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);
...@@ -91,7 +91,7 @@ void TestGen::httpGetUserData( nlohmann::json& jdata ) ...@@ -91,7 +91,7 @@ void TestGen::httpGetUserData( nlohmann::json& jdata )
jdata["myMessage"] = "This is text fot test httpGetUserData"; jdata["myMessage"] = "This is text fot test httpGetUserData";
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void TestGen::sysCommand( const UniSetTypes::SystemMessage* sm ) void TestGen::sysCommand( const uniset::SystemMessage* sm )
{ {
if( sm->command == SystemMessage::StartUp ) if( sm->command == SystemMessage::StartUp )
askTimer(1, 2000); askTimer(1, 2000);
......
...@@ -8,23 +8,23 @@ class TestGen: ...@@ -8,23 +8,23 @@ 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;
virtual void httpGetUserData( nlohmann::json& jdata ) override; virtual void httpGetUserData( nlohmann::json& jdata ) override;
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:
......
...@@ -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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
dbcrit << myname << "(update_confirm): " << ex << endl; dbcrit << myname << "(update_confirm): " << ex << endl;
} }
...@@ -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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
iocrit << myname << "(blink): " << ex << endl; iocrit << myname << "(blink): " << ex << endl;
} }
...@@ -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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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,12 +226,12 @@ class IOControl: ...@@ -223,12 +226,12 @@ 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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::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 UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
cerr << ex << endl; cerr << ex << endl;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "NCRestorer.h" #include "NCRestorer.h"
#include "NullSM.h" #include "NullSM.h"
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
using namespace UniSetTypes; using namespace uniset;
using namespace std; using namespace std;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
......
...@@ -7,19 +7,19 @@ ...@@ -7,19 +7,19 @@
#include "NCRestorer.h" #include "NCRestorer.h"
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
class NullSM: class NullSM:
public IONotifyController public uniset::IONotifyController
{ {
public: public:
NullSM( UniSetTypes::ObjectId id, const std::string& datfile ); NullSM( uniset::ObjectId id, const std::string& datfile );
virtual ~NullSM(); virtual ~NullSM();
protected: protected:
virtual void logging( UniSetTypes::SensorMessage& sm ) override {}; virtual void logging( uniset::SensorMessage& sm ) override {};
virtual void dumpOrdersList( const UniSetTypes::ObjectId sid, const IONotifyController::ConsumerListInfo& lst ) override {}; virtual void dumpOrdersList( const uniset::ObjectId sid, const IONotifyController::ConsumerListInfo& lst ) override {};
virtual void dumpThresholdList( const UniSetTypes::ObjectId sid, const IONotifyController::ThresholdExtList& lst ) override {}; virtual void dumpThresholdList( const uniset::ObjectId sid, const IONotifyController::ThresholdExtList& lst ) override {};
private: private:
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "TDelay.h" #include "TDelay.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace uniset;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
static shared_ptr<UInterface> ui; static shared_ptr<UInterface> ui;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "LProcessor.h" #include "LProcessor.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[] )
{ {
...@@ -66,7 +66,7 @@ int main(int argc, const char* argv[] ) ...@@ -66,7 +66,7 @@ int main(int argc, const char* argv[] )
{ {
cerr << "(tests): " << err << endl; cerr << "(tests): " << err << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
cerr << "(tests): " << ex << endl; cerr << "(tests): " << ex << endl;
} }
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
#include "MQTTPublisher.h" #include "MQTTPublisher.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace uniset;
using namespace UniSetExtensions; using namespace uniset::extensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MQTTPublisher::MQTTPublisher(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic, MQTTPublisher::MQTTPublisher(uniset::ObjectId objId, xmlNode* cnode, uniset::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic,
const string& prefix ): const string& prefix ):
mosquittopp(NULL), mosquittopp(NULL),
UObject_SK(objId, cnode, string(prefix + "-")), UObject_SK(objId, cnode, string(prefix + "-")),
...@@ -79,7 +79,7 @@ MQTTPublisher::MQTTPublisher(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSet ...@@ -79,7 +79,7 @@ MQTTPublisher::MQTTPublisher(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSet
for( ; sit.getCurrent(); sit++ ) for( ; sit.getCurrent(); sit++ )
{ {
if( !UniSetTypes::check_filter(sit, ff, fv) ) if( !uniset::check_filter(sit, ff, fv) )
continue; continue;
std::string sname = sit.getProp("name"); std::string sname = sit.getProp("name");
...@@ -224,7 +224,7 @@ void MQTTPublisher::on_subscribe( int mid, int qos_count, const int* granted_qos ...@@ -224,7 +224,7 @@ void MQTTPublisher::on_subscribe( int mid, int qos_count, const int* granted_qos
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
std::shared_ptr<MQTTPublisher> MQTTPublisher::init_mqttpublisher(int argc, const char* const* argv, std::shared_ptr<MQTTPublisher> MQTTPublisher::init_mqttpublisher(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();
...@@ -239,7 +239,7 @@ std::shared_ptr<MQTTPublisher> MQTTPublisher::init_mqttpublisher(int argc, const ...@@ -239,7 +239,7 @@ std::shared_ptr<MQTTPublisher> MQTTPublisher::init_mqttpublisher(int argc, const
ObjectId ID = conf->getObjectID(name); ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId ) if( ID == uniset::DefaultObjectId )
{ {
dcrit << "(MQTTPublisher): Not found ID for '" << name dcrit << "(MQTTPublisher): Not found ID for '" << name
<< " in '" << conf->getObjectsSection() << "' section" << endl; << " in '" << conf->getObjectsSection() << "' section" << endl;
...@@ -276,7 +276,7 @@ void MQTTPublisher::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -276,7 +276,7 @@ void MQTTPublisher::askSensors( UniversalIO::UIOCommand cmd )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MQTTPublisher::sensorInfo( const UniSetTypes::SensorMessage* sm ) void MQTTPublisher::sensorInfo( const uniset::SensorMessage* sm )
{ {
auto i = publist.find(sm->id); auto i = publist.find(sm->id);
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "SMInterface.h" #include "SMInterface.h"
#include "SharedMemory.h" #include "SharedMemory.h"
#include "extensions/Extensions.h" #include "extensions/Extensions.h"
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! /*!
\page page_MQTTPublisher Реализация MQTT издателя \page page_MQTTPublisher Реализация MQTT издателя
...@@ -105,13 +108,13 @@ class MQTTPublisher: ...@@ -105,13 +108,13 @@ class MQTTPublisher:
public UObject_SK public UObject_SK
{ {
public: public:
MQTTPublisher( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, MQTTPublisher( uniset::ObjectId objId, xmlNode* cnode, uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mqtt" ); const std::string& prefix = "mqtt" );
virtual ~MQTTPublisher(); virtual ~MQTTPublisher();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static std::shared_ptr<MQTTPublisher> init_mqttpublisher( int argc, const char* const* argv, static std::shared_ptr<MQTTPublisher> init_mqttpublisher( 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 = "mqtt" ); const std::string& prefix = "mqtt" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
...@@ -125,23 +128,23 @@ class MQTTPublisher: ...@@ -125,23 +128,23 @@ class MQTTPublisher:
MQTTPublisher(); MQTTPublisher();
virtual void askSensors( UniversalIO::UIOCommand cmd ) override; virtual void askSensors( UniversalIO::UIOCommand cmd ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override; virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void sigterm( int signo ) override; virtual void sigterm( int signo ) override;
virtual bool deactivateObject() override; virtual bool deactivateObject() override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override; virtual void sysCommand( const uniset::SystemMessage* sm ) override;
std::shared_ptr<SMInterface> shm; std::shared_ptr<SMInterface> shm;
struct MQTTInfo struct MQTTInfo
{ {
UniSetTypes::ObjectId sid; uniset::ObjectId sid;
std::string pubname; std::string pubname;
MQTTInfo( UniSetTypes::ObjectId id, const std::string& name ): MQTTInfo( uniset::ObjectId id, const std::string& name ):
sid(id), pubname(name) {} sid(id), pubname(name) {}
}; };
typedef std::unordered_map<UniSetTypes::ObjectId, MQTTInfo> MQTTMap; typedef std::unordered_map<uniset::ObjectId, MQTTInfo> MQTTMap;
struct RangeInfo struct RangeInfo
{ {
...@@ -155,7 +158,7 @@ class MQTTPublisher: ...@@ -155,7 +158,7 @@ class MQTTPublisher:
struct MQTTTextInfo struct MQTTTextInfo
{ {
UniSetTypes::ObjectId sid; uniset::ObjectId sid;
std::string pubname; std::string pubname;
UniXML::iterator xmlnode; UniXML::iterator xmlnode;
...@@ -169,7 +172,7 @@ class MQTTPublisher: ...@@ -169,7 +172,7 @@ class MQTTPublisher:
std::string replace( RangeInfo* ri, long value ); std::string replace( RangeInfo* ri, long value );
}; };
typedef std::unordered_map<UniSetTypes::ObjectId, MQTTTextInfo> MQTTTextMap; typedef std::unordered_map<uniset::ObjectId, MQTTTextInfo> MQTTTextMap;
MQTTMap publist; MQTTMap publist;
MQTTTextMap textpublist; MQTTTextMap textpublist;
...@@ -183,6 +186,8 @@ class MQTTPublisher: ...@@ -183,6 +186,8 @@ class MQTTPublisher:
int port = { 1883 }; int port = { 1883 };
int keepalive = { 60 }; int keepalive = { 60 };
}; };
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _MQTTPublisher_H_ #endif // _MQTTPublisher_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include "Extensions.h" #include "Extensions.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 )
{ {
...@@ -77,7 +77,7 @@ int main( int argc, const char** argv ) ...@@ -77,7 +77,7 @@ int main( int argc, const char** argv )
act->run(false); act->run(false);
return 0; return 0;
} }
catch( UniSetTypes::Exception& ex ) catch( uniset::Exception& ex )
{ {
cerr << "(mqttpublisher): " << ex << std::endl; cerr << "(mqttpublisher): " << ex << std::endl;
} }
......
...@@ -23,12 +23,14 @@ ...@@ -23,12 +23,14 @@
#include <ORepHelpers.h> #include <ORepHelpers.h>
#include "MBExchange.h" #include "MBExchange.h"
#include "modbus/MBLogSugar.h" #include "modbus/MBLogSugar.h"
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace uniset::extensions;
using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, MBExchange::MBExchange(uniset::ObjectId objId, uniset::ObjectId shmId,
const std::shared_ptr<SharedMemory>& _ic, const std::string& prefix ): const std::shared_ptr<SharedMemory>& _ic, const std::string& prefix ):
UniSetObject(objId), UniSetObject(objId),
allInitOK(false), allInitOK(false),
...@@ -48,7 +50,7 @@ MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, ...@@ -48,7 +50,7 @@ MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
ic(_ic) ic(_ic)
{ {
if( objId == DefaultObjectId ) if( objId == DefaultObjectId )
throw UniSetTypes::SystemError("(MBExchange): objId=-1?!! Use --" + prefix + "-name" ); throw uniset::SystemError("(MBExchange): objId=-1?!! Use --" + prefix + "-name" );
auto conf = uniset_conf(); auto conf = uniset_conf();
mutex_start.setName(myname + "_mutex_start"); mutex_start.setName(myname + "_mutex_start");
...@@ -58,7 +60,7 @@ MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, ...@@ -58,7 +60,7 @@ MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
cnode = conf->getNode(conf_name); cnode = conf->getNode(conf_name);
if( cnode == NULL ) if( cnode == NULL )
throw UniSetTypes::SystemError("(MBExchange): Not found node <" + conf_name + " ...> for " + myname ); throw uniset::SystemError("(MBExchange): Not found node <" + conf_name + " ...> for " + myname );
shm = make_shared<SMInterface>(shmId, ui, objId, ic); shm = make_shared<SMInterface>(shmId, ui, objId, ic);
...@@ -319,7 +321,7 @@ void MBExchange::step() ...@@ -319,7 +321,7 @@ void MBExchange::step()
shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId()); shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset(); ptHeartBeat.reset();
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mbcrit << myname << "(step): (hb) " << ex << std::endl; mbcrit << myname << "(step): (hb) " << ex << std::endl;
} }
...@@ -379,7 +381,7 @@ void MBExchange::readConfiguration() ...@@ -379,7 +381,7 @@ void MBExchange::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) )
initItem(it); initItem(it);
} }
...@@ -388,7 +390,7 @@ void MBExchange::readConfiguration() ...@@ -388,7 +390,7 @@ void MBExchange::readConfiguration()
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
bool MBExchange::readItem( const std::shared_ptr<UniXML>& xml, UniXML::iterator& it, xmlNode* sec ) bool MBExchange::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) )
initItem(it); initItem(it);
return true; return true;
...@@ -928,7 +930,7 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty ...@@ -928,7 +930,7 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty
{ {
mblog3 << myname << "(initSMValue): (BadRange)..." << endl; mblog3 << myname << "(initSMValue): (BadRange)..." << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mblog3 << myname << "(initSMValue): " << ex << endl; mblog3 << myname << "(initSMValue): " << ex << endl;
} }
...@@ -1188,7 +1190,7 @@ void MBExchange::updateSM() ...@@ -1188,7 +1190,7 @@ void MBExchange::updateSM()
{ {
mblog3 << myname << "(updateSM): (BadRange)..." << endl; mblog3 << myname << "(updateSM): (BadRange)..." << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mblog3 << myname << "(updateSM): " << ex << endl; mblog3 << myname << "(updateSM): " << ex << endl;
} }
...@@ -1236,7 +1238,7 @@ void MBExchange::updateSM() ...@@ -1236,7 +1238,7 @@ void MBExchange::updateSM()
{ {
mblog3 << myname << "(updateSM): (BadRange)..." << endl; mblog3 << myname << "(updateSM): (BadRange)..." << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mblog3 << myname << "(updateSM): " << ex << endl; mblog3 << myname << "(updateSM): " << ex << endl;
} }
...@@ -1651,7 +1653,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only ) ...@@ -1651,7 +1653,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{ {
mblog3 << myname << "(updateRSProperty): (BadRange)..." << endl; mblog3 << myname << "(updateRSProperty): (BadRange)..." << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mblog3 << myname << "(updateRSProperty): " << ex << endl; mblog3 << myname << "(updateRSProperty): " << ex << endl;
} }
...@@ -1911,7 +1913,7 @@ void MBExchange::updateMTR( RegMap::iterator& rit ) ...@@ -1911,7 +1913,7 @@ void MBExchange::updateMTR( RegMap::iterator& rit )
{ {
mblog3 << myname << "(updateMTR): (BadRange)..." << endl; mblog3 << myname << "(updateMTR): (BadRange)..." << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mblog3 << myname << "(updateMTR): " << ex << endl; mblog3 << myname << "(updateMTR): " << ex << endl;
} }
...@@ -2002,7 +2004,7 @@ void MBExchange::updateRTU188( RegMap::iterator& rit ) ...@@ -2002,7 +2004,7 @@ void MBExchange::updateRTU188( RegMap::iterator& rit )
{ {
mblog3 << myname << "(updateRTU188): (BadRange)..." << endl; mblog3 << myname << "(updateRTU188): (BadRange)..." << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mblog3 << myname << "(updateRTU188): " << ex << endl; mblog3 << myname << "(updateRTU188): " << ex << endl;
} }
...@@ -2136,7 +2138,7 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML::iterator& it ) ...@@ -2136,7 +2138,7 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML::iterator& it )
if( !sbit.empty() ) if( !sbit.empty() )
{ {
p.nbit = UniSetTypes::uni_atoi(sbit.c_str()); p.nbit = uniset::uni_atoi(sbit.c_str());
if( p.nbit < 0 || p.nbit >= ModbusRTU::BitsPerData ) if( p.nbit < 0 || p.nbit >= ModbusRTU::BitsPerData )
{ {
...@@ -2158,7 +2160,7 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML::iterator& it ) ...@@ -2158,7 +2160,7 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML::iterator& it )
if( !sbyte.empty() ) if( !sbyte.empty() )
{ {
p.nbyte = UniSetTypes::uni_atoi(sbyte.c_str()); p.nbyte = uniset::uni_atoi(sbyte.c_str());
if( p.nbyte < 0 || p.nbyte > VTypes::Byte::bsize ) if( p.nbyte < 0 || p.nbyte > VTypes::Byte::bsize )
{ {
...@@ -2216,7 +2218,7 @@ bool MBExchange::initRegInfo( std::shared_ptr<RegInfo>& r, UniXML::iterator& it, ...@@ -2216,7 +2218,7 @@ bool MBExchange::initRegInfo( std::shared_ptr<RegInfo>& r, UniXML::iterator& it,
if( !initRTU188item(it, r) ) if( !initRTU188item(it, r) )
return false; return false;
UniversalIO::IOType t = UniSetTypes::getIOType(IOBase::initProp(it, "iotype", prop_prefix, false)); UniversalIO::IOType t = uniset::getIOType(IOBase::initProp(it, "iotype", prop_prefix, false));
r->mbreg = RTUStorage::getRegister(r->rtuJack, r->rtuChan, t); r->mbreg = RTUStorage::getRegister(r->rtuJack, r->rtuChan, t);
r->mbfunc = RTUStorage::getFunction(r->rtuJack, r->rtuChan, t); r->mbfunc = RTUStorage::getFunction(r->rtuJack, r->rtuChan, t);
...@@ -2257,7 +2259,7 @@ bool MBExchange::initRegInfo( std::shared_ptr<RegInfo>& r, UniXML::iterator& it, ...@@ -2257,7 +2259,7 @@ bool MBExchange::initRegInfo( std::shared_ptr<RegInfo>& r, UniXML::iterator& it,
if( !f.empty() ) if( !f.empty() )
{ {
r->mbfunc = (ModbusRTU::SlaveFunctionCode)UniSetTypes::uni_atoi(f.c_str()); r->mbfunc = (ModbusRTU::SlaveFunctionCode)uniset::uni_atoi(f.c_str());
if( r->mbfunc == ModbusRTU::fnUnknown ) if( r->mbfunc == ModbusRTU::fnUnknown )
{ {
...@@ -2546,7 +2548,7 @@ bool MBExchange::initItem( UniXML::iterator& it ) ...@@ -2546,7 +2548,7 @@ bool MBExchange::initItem( UniXML::iterator& it )
if( !s_mbfunc.empty() ) if( !s_mbfunc.empty() )
{ {
ii.mbfunc = (ModbusRTU::SlaveFunctionCode)UniSetTypes::uni_atoi(s_mbfunc); ii.mbfunc = (ModbusRTU::SlaveFunctionCode)uniset::uni_atoi(s_mbfunc);
if( ii.mbfunc == ModbusRTU::fnUnknown ) if( ii.mbfunc == ModbusRTU::fnUnknown )
{ {
...@@ -2633,7 +2635,7 @@ bool MBExchange::initRTU188item( UniXML::iterator& it, std::shared_ptr<RegInfo>& ...@@ -2633,7 +2635,7 @@ bool MBExchange::initRTU188item( UniXML::iterator& it, std::shared_ptr<RegInfo>&
return false; return false;
} }
p->rtuChan = UniSetTypes::uni_atoi(chan); p->rtuChan = uniset::uni_atoi(chan);
mblog2 << myname << "(readRTU188Item): add jack='" << jack << "'" mblog2 << myname << "(readRTU188Item): add jack='" << jack << "'"
<< " channel='" << p->rtuChan << "'" << endl; << " channel='" << p->rtuChan << "'" << endl;
...@@ -2784,7 +2786,7 @@ bool MBExchange::activateObject() ...@@ -2784,7 +2786,7 @@ bool MBExchange::activateObject()
// см. sysCommand() // см. sysCommand()
{ {
setProcActive(false); setProcActive(false);
UniSetTypes::uniset_rwmutex_rlock l(mutex_start); uniset::uniset_rwmutex_rlock l(mutex_start);
UniSetObject::activateObject(); UniSetObject::activateObject();
if( !shm->isLocalwork() ) if( !shm->isLocalwork() )
...@@ -2797,7 +2799,7 @@ bool MBExchange::activateObject() ...@@ -2797,7 +2799,7 @@ bool MBExchange::activateObject()
return true; return true;
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void MBExchange::sysCommand( const UniSetTypes::SystemMessage* sm ) void MBExchange::sysCommand( const uniset::SystemMessage* sm )
{ {
switch( sm->command ) switch( sm->command )
{ {
...@@ -2841,7 +2843,7 @@ void MBExchange::sysCommand( const UniSetTypes::SystemMessage* sm ) ...@@ -2841,7 +2843,7 @@ void MBExchange::sysCommand( const UniSetTypes::SystemMessage* sm )
mbcrit << myname << "(sysCommand): ************* don`t activate?! ************" << endl; mbcrit << myname << "(sysCommand): ************* don`t activate?! ************" << endl;
{ {
UniSetTypes::uniset_rwmutex_rlock l(mutex_start); uniset::uniset_rwmutex_rlock l(mutex_start);
askSensors(UniversalIO::UIONotify); askSensors(UniversalIO::UIONotify);
initOutput(); initOutput();
} }
...@@ -2922,7 +2924,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -2922,7 +2924,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
if( sidExchangeMode != DefaultObjectId ) if( sidExchangeMode != DefaultObjectId )
shm->askSensor(sidExchangeMode, cmd); shm->askSensor(sidExchangeMode, cmd);
} }
catch( UniSetTypes::Exception& ex ) catch( uniset::Exception& ex )
{ {
mbwarn << myname << "(askSensors): " << ex << std::endl; mbwarn << myname << "(askSensors): " << ex << std::endl;
} }
...@@ -2940,7 +2942,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -2940,7 +2942,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
if( d->mode_id != DefaultObjectId ) if( d->mode_id != DefaultObjectId )
shm->askSensor(d->mode_id, cmd); shm->askSensor(d->mode_id, cmd);
} }
catch( UniSetTypes::Exception& ex ) catch( uniset::Exception& ex )
{ {
mbwarn << myname << "(askSensors): " << ex << std::endl; mbwarn << myname << "(askSensors): " << ex << std::endl;
} }
...@@ -2967,7 +2969,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -2967,7 +2969,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
{ {
shm->askSensor(i->si.id, cmd); shm->askSensor(i->si.id, cmd);
} }
catch( UniSetTypes::Exception& ex ) catch( uniset::Exception& ex )
{ {
mbwarn << myname << "(askSensors): " << ex << std::endl; mbwarn << myname << "(askSensors): " << ex << std::endl;
} }
...@@ -2981,7 +2983,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -2981,7 +2983,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
} }
} }
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
void MBExchange::sensorInfo( const UniSetTypes::SensorMessage* sm ) void MBExchange::sensorInfo( const uniset::SensorMessage* sm )
{ {
if( sm->id == sidExchangeMode ) if( sm->id == sidExchangeMode )
{ {
...@@ -3223,7 +3225,7 @@ void MBExchange::updateRespondSensors() ...@@ -3223,7 +3225,7 @@ void MBExchange::updateRespondSensors()
shm->localSetValue(d->resp_it, d->resp_id, ( set ? 1 : 0 ), getId()); shm->localSetValue(d->resp_it, d->resp_id, ( set ? 1 : 0 ), getId());
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mbcrit << myname << "(step): (respond) " << ex << std::endl; mbcrit << myname << "(step): (respond) " << ex << std::endl;
} }
...@@ -3251,7 +3253,7 @@ void MBExchange::execute() ...@@ -3251,7 +3253,7 @@ void MBExchange::execute()
{ {
step(); step();
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mbcrit << myname << "(execute): " << ex << std::endl; mbcrit << myname << "(execute): " << ex << std::endl;
} }
...@@ -3284,9 +3286,9 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::ExchangeMode& em ) ...@@ -3284,9 +3286,9 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::ExchangeMode& em )
return os; return os;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UniSetTypes::SimpleInfo* MBExchange::getInfo( CORBA::Long userparam ) uniset::SimpleInfo* MBExchange::getInfo( CORBA::Long userparam )
{ {
UniSetTypes::SimpleInfo_var i = UniSetObject::getInfo(userparam); uniset::SimpleInfo_var i = UniSetObject::getInfo(userparam);
ostringstream inf; ostringstream inf;
...@@ -3324,3 +3326,4 @@ std::string MBExchange::RTUDevice::getShortInfo() const ...@@ -3324,3 +3326,4 @@ std::string MBExchange::RTUDevice::getShortInfo() const
return std::move( s.str() ); return std::move( s.str() );
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
} // end of namespace uniset
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
#ifndef vmonit #ifndef vmonit
#define vmonit( var ) vmon.add( #var, var ) #define vmonit( var ) vmon.add( #var, var )
#endif #endif
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! /*!
\par Базовый класс для реализация обмена по протоколу Modbus [RTU|TCP]. \par Базовый класс для реализация обмена по протоколу Modbus [RTU|TCP].
...@@ -53,7 +56,7 @@ class MBExchange: ...@@ -53,7 +56,7 @@ class MBExchange:
public UniSetObject public UniSetObject
{ {
public: public:
MBExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, MBExchange( uniset::ObjectId objId, uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mb" ); const std::string& prefix = "mb" );
virtual ~MBExchange(); virtual ~MBExchange();
...@@ -177,13 +180,13 @@ class MBExchange: ...@@ -177,13 +180,13 @@ class MBExchange:
RTUDevice(): RTUDevice():
mbaddr(0), mbaddr(0),
dtype(dtUnknown), dtype(dtUnknown),
resp_id(UniSetTypes::DefaultObjectId), resp_id(uniset::DefaultObjectId),
resp_state(false), resp_state(false),
resp_invert(false), resp_invert(false),
numreply(0), numreply(0),
prev_numreply(0), prev_numreply(0),
ask_every_reg(false), ask_every_reg(false),
mode_id(UniSetTypes::DefaultObjectId), mode_id(uniset::DefaultObjectId),
mode(emNone), mode(emNone),
speed(ComPort::ComSpeed38400), speed(ComPort::ComSpeed38400),
rtu188(0) rtu188(0)
...@@ -196,7 +199,7 @@ class MBExchange: ...@@ -196,7 +199,7 @@ class MBExchange:
DeviceType dtype; /*!< тип устройства */ DeviceType dtype; /*!< тип устройства */
// resp - respond..(контроль наличия связи) // resp - respond..(контроль наличия связи)
UniSetTypes::ObjectId resp_id; uniset::ObjectId resp_id;
IOController::IOStateList::iterator resp_it; IOController::IOStateList::iterator resp_it;
DelayTimer resp_Delay; // таймер для формирования задержки на отпускание (пропадание связи) DelayTimer resp_Delay; // таймер для формирования задержки на отпускание (пропадание связи)
PassiveTimer resp_ptInit; // таймер для формирования задержки на инициализацию связи (задержка на выставление датчика связи после запуска) PassiveTimer resp_ptInit; // таймер для формирования задержки на инициализацию связи (задержка на выставление датчика связи после запуска)
...@@ -211,7 +214,7 @@ class MBExchange: ...@@ -211,7 +214,7 @@ class MBExchange:
bool ask_every_reg; /*!< опрашивать ли каждый регистр, независимо от результата опроса предыдущего. По умолчанию false - прервать опрос при первом же timeout */ bool ask_every_reg; /*!< опрашивать ли каждый регистр, независимо от результата опроса предыдущего. По умолчанию false - прервать опрос при первом же timeout */
// режим работы // режим работы
UniSetTypes::ObjectId mode_id; uniset::ObjectId mode_id;
IOController::IOStateList::iterator mode_it; IOController::IOStateList::iterator mode_it;
long mode; // режим работы с устройством (см. ExchangeMode) long mode; // режим работы с устройством (см. ExchangeMode)
...@@ -249,13 +252,13 @@ class MBExchange: ...@@ -249,13 +252,13 @@ class MBExchange:
return mblog; return mblog;
} }
virtual UniSetTypes::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override; virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
protected: protected:
virtual void step(); virtual void step();
virtual void sysCommand( const UniSetTypes::SystemMessage* msg ) override; virtual void sysCommand( const uniset::SystemMessage* msg ) 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 ); virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void initOutput(); virtual void initOutput();
virtual void sigterm( int signo ) override; virtual void sigterm( int signo ) override;
...@@ -286,7 +289,7 @@ class MBExchange: ...@@ -286,7 +289,7 @@ class MBExchange:
RTUDeviceMap devices; RTUDeviceMap devices;
InitList initRegList; /*!< список регистров для инициализации */ InitList initRegList; /*!< список регистров для инициализации */
// UniSetTypes::uniset_rwmutex pollMutex; // uniset::uniset_rwmutex pollMutex;
virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) = 0; virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) = 0;
...@@ -335,7 +338,7 @@ class MBExchange: ...@@ -335,7 +338,7 @@ class MBExchange:
std::shared_ptr<SMInterface> shm; std::shared_ptr<SMInterface> shm;
timeout_t initPause = { 3000 }; timeout_t initPause = { 3000 };
UniSetTypes::uniset_rwmutex mutex_start; uniset::uniset_rwmutex mutex_start;
bool force = { false }; /*!< флаг означающий, что надо сохранять в SM, даже если значение не менялось */ bool force = { false }; /*!< флаг означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out = { false }; /*!< флаг означающий, принудительного чтения выходов */ bool force_out = { false }; /*!< флаг означающий, принудительного чтения выходов */
...@@ -345,12 +348,12 @@ class MBExchange: ...@@ -345,12 +348,12 @@ class MBExchange:
size_t maxQueryCount = { ModbusRTU::MAXDATALEN }; /*!< максимальное количество регистров для одного запроса */ size_t maxQueryCount = { ModbusRTU::MAXDATALEN }; /*!< максимальное количество регистров для одного запроса */
PassiveTimer ptHeartBeat; PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat = { UniSetTypes::DefaultObjectId }; uniset::ObjectId sidHeartBeat = { uniset::DefaultObjectId };
long maxHeartBeat = { 10 }; long maxHeartBeat = { 10 };
IOController::IOStateList::iterator itHeartBeat; IOController::IOStateList::iterator itHeartBeat;
UniSetTypes::ObjectId test_id = { UniSetTypes::DefaultObjectId }; uniset::ObjectId test_id = { uniset::DefaultObjectId };
UniSetTypes::ObjectId sidExchangeMode = { UniSetTypes::DefaultObjectId }; /*!< иденидентификатор для датчика режима работы */ uniset::ObjectId sidExchangeMode = { uniset::DefaultObjectId }; /*!< иденидентификатор для датчика режима работы */
IOController::IOStateList::iterator itExchangeMode; IOController::IOStateList::iterator itExchangeMode;
long exchangeMode = {emNone}; /*!< режим работы см. ExchangeMode */ long exchangeMode = {emNone}; /*!< режим работы см. ExchangeMode */
...@@ -405,6 +408,8 @@ class MBExchange: ...@@ -405,6 +408,8 @@ class MBExchange:
MBExchange(); MBExchange();
}; };
// --------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _MBExchange_H_ #endif // _MBExchange_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -23,16 +23,16 @@ ...@@ -23,16 +23,16 @@
#include "modbus/MBLogSugar.h" #include "modbus/MBLogSugar.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace uniset;
using namespace UniSetExtensions; using namespace uniset::extensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MBTCPMaster::MBTCPMaster(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, MBTCPMaster::MBTCPMaster(uniset::ObjectId objId, uniset::ObjectId shmId,
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ): const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
MBExchange(objId, shmId, ic, prefix), MBExchange(objId, shmId, ic, prefix),
force_disconnect(true) force_disconnect(true)
{ {
if( objId == DefaultObjectId ) if( objId == DefaultObjectId )
throw UniSetTypes::SystemError("(MBTCPMaster): objId=-1?!! Use --" + prefix + "-name" ); throw uniset::SystemError("(MBTCPMaster): objId=-1?!! Use --" + prefix + "-name" );
auto conf = uniset_conf(); auto conf = uniset_conf();
...@@ -47,13 +47,13 @@ MBTCPMaster::MBTCPMaster(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI ...@@ -47,13 +47,13 @@ MBTCPMaster::MBTCPMaster(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI
iaddr = conf->getArgParam(pname, it.getProp("gateway_iaddr")); iaddr = conf->getArgParam(pname, it.getProp("gateway_iaddr"));
if( iaddr.empty() ) if( iaddr.empty() )
throw UniSetTypes::SystemError(myname + "(MBMaster): Unknown inet addr...(Use: " + pname + ")" ); throw uniset::SystemError(myname + "(MBMaster): Unknown inet addr...(Use: " + pname + ")" );
string tmp("--" + prefix + "-gateway-port"); string tmp("--" + prefix + "-gateway-port");
port = conf->getArgInt(tmp, it.getProp("gateway_port")); port = conf->getArgInt(tmp, it.getProp("gateway_port"));
if( port <= 0 ) if( port <= 0 )
throw UniSetTypes::SystemError(myname + "(MBMaster): Unknown inet port...(Use: " + tmp + ")" ); throw uniset::SystemError(myname + "(MBMaster): Unknown inet port...(Use: " + tmp + ")" );
mbinfo << myname << "(init): gateway " << iaddr << ":" << port << endl; mbinfo << myname << "(init): gateway " << iaddr << ":" << port << endl;
...@@ -127,7 +127,7 @@ std::shared_ptr<ModbusClient> MBTCPMaster::initMB( bool reopen ) ...@@ -127,7 +127,7 @@ std::shared_ptr<ModbusClient> MBTCPMaster::initMB( bool reopen )
return mbtcp; return mbtcp;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MBTCPMaster::sysCommand( const UniSetTypes::SystemMessage* sm ) void MBTCPMaster::sysCommand( const uniset::SystemMessage* sm )
{ {
MBExchange::sysCommand(sm); MBExchange::sysCommand(sm);
...@@ -145,7 +145,7 @@ void MBTCPMaster::poll_thread() ...@@ -145,7 +145,7 @@ void MBTCPMaster::poll_thread()
// ждём начала работы..(см. MBExchange::activateObject) // ждём начала работы..(см. MBExchange::activateObject)
while( !checkProcActive() ) while( !checkProcActive() )
{ {
UniSetTypes::uniset_rwmutex_rlock l(mutex_start); uniset::uniset_rwmutex_rlock l(mutex_start);
} }
// работаем // работаем
...@@ -232,7 +232,7 @@ void MBTCPMaster::help_print( int argc, const char* const* argv ) ...@@ -232,7 +232,7 @@ void MBTCPMaster::help_print( int argc, const char* const* argv )
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* const* argv, std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(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();
...@@ -246,7 +246,7 @@ std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* co ...@@ -246,7 +246,7 @@ std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* co
ObjectId ID = conf->getObjectID(name); ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId ) if( ID == uniset::DefaultObjectId )
{ {
dcrit << "(MBTCPMaster): идентификатор '" << name dcrit << "(MBTCPMaster): идентификатор '" << name
<< "' не найден в конф. файле!" << "' не найден в конф. файле!"
...@@ -258,9 +258,9 @@ std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* co ...@@ -258,9 +258,9 @@ std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* co
return make_shared<MBTCPMaster>(ID, icID, ic, prefix); return make_shared<MBTCPMaster>(ID, icID, ic, prefix);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UniSetTypes::SimpleInfo* MBTCPMaster::getInfo( CORBA::Long userparam ) uniset::SimpleInfo* MBTCPMaster::getInfo( CORBA::Long userparam )
{ {
UniSetTypes::SimpleInfo_var i = MBExchange::getInfo(userparam); uniset::SimpleInfo_var i = MBExchange::getInfo(userparam);
ostringstream inf; ostringstream inf;
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include <memory> #include <memory>
#include "MBExchange.h" #include "MBExchange.h"
#include "modbus/ModbusTCPMaster.h" #include "modbus/ModbusTCPMaster.h"
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! /*!
\page page_ModbusTCP Реализация ModbusTCP master \page page_ModbusTCP Реализация ModbusTCP master
...@@ -219,22 +222,22 @@ class MBTCPMaster: ...@@ -219,22 +222,22 @@ class MBTCPMaster:
public MBExchange public MBExchange
{ {
public: public:
MBTCPMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, MBTCPMaster( uniset::ObjectId objId, uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbtcp" ); const std::string& prefix = "mbtcp" );
virtual ~MBTCPMaster(); virtual ~MBTCPMaster();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static std::shared_ptr<MBTCPMaster> init_mbmaster( int argc, const char* const* argv, static std::shared_ptr<MBTCPMaster> init_mbmaster( 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 = "mbtcp" ); const std::string& prefix = "mbtcp" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
virtual UniSetTypes::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override; virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
protected: protected:
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override; virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) override; virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) override;
virtual void sigterm( int signo ) override; virtual void sigterm( int signo ) override;
virtual bool deactivateObject() override; virtual bool deactivateObject() override;
...@@ -255,6 +258,8 @@ class MBTCPMaster: ...@@ -255,6 +258,8 @@ class MBTCPMaster:
// делаем опрос в отдельном потоке // делаем опрос в отдельном потоке
std::shared_ptr<ThreadCreator<MBTCPMaster>> pollThread; /*!< поток опроса */ std::shared_ptr<ThreadCreator<MBTCPMaster>> pollThread; /*!< поток опроса */
}; };
// --------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _MBTCPMaster_H_ #endif // _MBTCPMaster_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#include "modbus/MBLogSugar.h" #include "modbus/MBLogSugar.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace uniset;
using namespace UniSetExtensions; using namespace uniset::extensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, MBTCPMultiMaster::MBTCPMultiMaster( uniset::ObjectId objId, uniset::ObjectId shmId,
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ): const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
MBExchange(objId, shmId, ic, prefix), MBExchange(objId, shmId, ic, prefix),
force_disconnect(true) force_disconnect(true)
{ {
if( objId == DefaultObjectId ) if( objId == DefaultObjectId )
throw UniSetTypes::SystemError("(MBTCPMultiMaster): objId=-1?!! Use --" + prefix + "-name" ); throw uniset::SystemError("(MBTCPMultiMaster): objId=-1?!! Use --" + prefix + "-name" );
auto conf = uniset_conf(); auto conf = uniset_conf();
...@@ -59,7 +59,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -59,7 +59,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err; ostringstream err;
err << myname << "(init): not found <GateList>"; err << myname << "(init): not found <GateList>";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str()); throw uniset::SystemError(err.str());
} }
if( !it1.goChildren() ) if( !it1.goChildren() )
...@@ -67,7 +67,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -67,7 +67,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err; ostringstream err;
err << myname << "(init): empty <GateList> ?!"; err << myname << "(init): empty <GateList> ?!";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str()); throw uniset::SystemError(err.str());
} }
for( ; it1.getCurrent(); it1++ ) for( ; it1.getCurrent(); it1++ )
...@@ -87,7 +87,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -87,7 +87,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err; ostringstream err;
err << myname << "(init): ip='' in <GateList>"; err << myname << "(init): ip='' in <GateList>";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str()); throw uniset::SystemError(err.str());
} }
sinf->port = it1.getIntProp("port"); sinf->port = it1.getIntProp("port");
...@@ -97,7 +97,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -97,7 +97,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err; ostringstream err;
err << myname << "(init): ERROR: port=''" << sinf->port << " for ip='" << sinf->ip << "' in <GateList>"; err << myname << "(init): ERROR: port=''" << sinf->port << " for ip='" << sinf->ip << "' in <GateList>";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str()); throw uniset::SystemError(err.str());
} }
if( !it1.getProp("respondSensor").empty() ) if( !it1.getProp("respondSensor").empty() )
...@@ -109,7 +109,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -109,7 +109,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err; ostringstream err;
err << myname << "(init): ERROR: Unknown SensorID for '" << it1.getProp("respondSensor") << "' in <GateList>"; err << myname << "(init): ERROR: Unknown SensorID for '" << it1.getProp("respondSensor") << "' in <GateList>";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str()); throw uniset::SystemError(err.str());
} }
} }
...@@ -170,7 +170,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -170,7 +170,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err; ostringstream err;
err << myname << "(init): empty <GateList>!"; err << myname << "(init): empty <GateList>!";
mbcrit << err.str() << endl; mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str()); throw uniset::SystemError(err.str());
} }
mblist.sort(); mblist.sort();
...@@ -430,7 +430,7 @@ bool MBTCPMultiMaster::MBSlaveInfo::init( std::shared_ptr<DebugStream>& mblog ) ...@@ -430,7 +430,7 @@ bool MBTCPMultiMaster::MBSlaveInfo::init( std::shared_ptr<DebugStream>& mblog )
return initOK; return initOK;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MBTCPMultiMaster::sysCommand( const UniSetTypes::SystemMessage* sm ) void MBTCPMultiMaster::sysCommand( const uniset::SystemMessage* sm )
{ {
MBExchange::sysCommand(sm); MBExchange::sysCommand(sm);
...@@ -450,7 +450,7 @@ void MBTCPMultiMaster::poll_thread() ...@@ -450,7 +450,7 @@ void MBTCPMultiMaster::poll_thread()
// ждём начала работы..(см. MBExchange::activateObject) // ждём начала работы..(см. MBExchange::activateObject)
while( !checkProcActive() ) while( !checkProcActive() )
{ {
UniSetTypes::uniset_rwmutex_rlock l(mutex_start); uniset::uniset_rwmutex_rlock l(mutex_start);
} }
// работаем.. // работаем..
...@@ -520,7 +520,7 @@ void MBTCPMultiMaster::check_thread() ...@@ -520,7 +520,7 @@ void MBTCPMultiMaster::check_thread()
it->respond_init = true; it->respond_init = true;
} }
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
mbcrit << myname << "(check): (respond) " << it->myname << " : " << ex << std::endl; mbcrit << myname << "(check): (respond) " << it->myname << " : " << ex << std::endl;
} }
...@@ -717,7 +717,7 @@ void MBTCPMultiMaster::help_print( int argc, const char* const* argv ) ...@@ -717,7 +717,7 @@ void MBTCPMultiMaster::help_print( int argc, const char* const* argv )
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
std::shared_ptr<MBTCPMultiMaster> MBTCPMultiMaster::init_mbmaster( int argc, const char* const* argv, std::shared_ptr<MBTCPMultiMaster> MBTCPMultiMaster::init_mbmaster( 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();
...@@ -732,7 +732,7 @@ std::shared_ptr<MBTCPMultiMaster> MBTCPMultiMaster::init_mbmaster( int argc, con ...@@ -732,7 +732,7 @@ std::shared_ptr<MBTCPMultiMaster> MBTCPMultiMaster::init_mbmaster( int argc, con
ObjectId ID = conf->getObjectID(name); ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId ) if( ID == uniset::DefaultObjectId )
{ {
dcrit << "(MBTCPMultiMaster): идентификатор '" << name dcrit << "(MBTCPMultiMaster): идентификатор '" << name
<< "' не найден в конф. файле!" << "' не найден в конф. файле!"
...@@ -761,9 +761,9 @@ const std::string MBTCPMultiMaster::MBSlaveInfo::getShortInfo() const ...@@ -761,9 +761,9 @@ const std::string MBTCPMultiMaster::MBSlaveInfo::getShortInfo() const
return std::move(s.str()); return std::move(s.str());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
UniSetTypes::SimpleInfo* MBTCPMultiMaster::getInfo( CORBA::Long userparam ) uniset::SimpleInfo* MBTCPMultiMaster::getInfo( CORBA::Long userparam )
{ {
UniSetTypes::SimpleInfo_var i = MBExchange::getInfo(userparam); uniset::SimpleInfo_var i = MBExchange::getInfo(userparam);
ostringstream inf; ostringstream inf;
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include <vector> #include <vector>
#include "MBExchange.h" #include "MBExchange.h"
#include "modbus/ModbusTCPMaster.h" #include "modbus/ModbusTCPMaster.h"
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! /*!
\page page_ModbusTCPMulti Реализация ModbusTCP 'multi' master \page page_ModbusTCPMulti Реализация ModbusTCP 'multi' master
...@@ -283,22 +286,22 @@ class MBTCPMultiMaster: ...@@ -283,22 +286,22 @@ class MBTCPMultiMaster:
public MBExchange public MBExchange
{ {
public: public:
MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, MBTCPMultiMaster( uniset::ObjectId objId, uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "mbtcp" ); const std::string& prefix = "mbtcp" );
virtual ~MBTCPMultiMaster(); virtual ~MBTCPMultiMaster();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static std::shared_ptr<MBTCPMultiMaster> init_mbmaster(int argc, const char* const* argv, static std::shared_ptr<MBTCPMultiMaster> init_mbmaster(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 = "mbtcp" ); const std::string& prefix = "mbtcp" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
virtual UniSetTypes::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override; virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
protected: protected:
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override; virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void initIterators() override; virtual void initIterators() override;
virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) override; virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) override;
virtual void sigterm( int signo ) override; virtual void sigterm( int signo ) override;
...@@ -309,7 +312,7 @@ class MBTCPMultiMaster: ...@@ -309,7 +312,7 @@ class MBTCPMultiMaster:
void check_thread(); void check_thread();
void final_thread(); void final_thread();
UniSetTypes::uniset_rwmutex mbMutex; uniset::uniset_rwmutex mbMutex;
bool force_disconnect; bool force_disconnect;
timeout_t checktime; timeout_t checktime;
...@@ -319,7 +322,7 @@ class MBTCPMultiMaster: ...@@ -319,7 +322,7 @@ class MBTCPMultiMaster:
struct MBSlaveInfo struct MBSlaveInfo
{ {
MBSlaveInfo(): ip(""), port(0), mbtcp(0), priority(0), MBSlaveInfo(): ip(""), port(0), mbtcp(0), priority(0),
respond(false), respond_id(UniSetTypes::DefaultObjectId), respond_invert(false), respond(false), respond_id(uniset::DefaultObjectId), respond_invert(false),
recv_timeout(200), aftersend_pause(0), sleepPause_usec(100), recv_timeout(200), aftersend_pause(0), sleepPause_usec(100),
force_disconnect(true), force_disconnect(true),
myname(""), use(false), initOK(false), ignore(false) {} myname(""), use(false), initOK(false), ignore(false) {}
...@@ -335,7 +338,7 @@ class MBTCPMultiMaster: ...@@ -335,7 +338,7 @@ class MBTCPMultiMaster:
ModbusRTU::ModbusData checkReg = { 0 }; ModbusRTU::ModbusData checkReg = { 0 };
bool respond; bool respond;
UniSetTypes::ObjectId respond_id; uniset::ObjectId respond_id;
IOController::IOStateList::iterator respond_it; IOController::IOStateList::iterator respond_it;
bool respond_invert; bool respond_invert;
bool respond_init = { false }; bool respond_init = { false };
...@@ -379,6 +382,8 @@ class MBTCPMultiMaster: ...@@ -379,6 +382,8 @@ class MBTCPMultiMaster:
std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > pollThread; /*!< поток опроса */ std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > pollThread; /*!< поток опроса */
std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > checkThread; /*!< поток проверки связи по другим каналам */ std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > checkThread; /*!< поток проверки связи по другим каналам */
}; };
// --------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _MBTCPMultiMaster_H_ #endif // _MBTCPMultiMaster_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
#include "modbus/MBLogSugar.h" #include "modbus/MBLogSugar.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace uniset;
using namespace UniSetExtensions; using namespace uniset::extensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic, RTUExchange::RTUExchange(uniset::ObjectId objId, uniset::ObjectId shmId, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix_ ): const std::string& prefix_ ):
MBExchange(objId, shmId, ic, prefix_), MBExchange(objId, shmId, ic, prefix_),
mbrtu(0), mbrtu(0),
...@@ -34,7 +34,7 @@ RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI ...@@ -34,7 +34,7 @@ RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI
rs_pre_clean(false) rs_pre_clean(false)
{ {
if( objId == DefaultObjectId ) if( objId == DefaultObjectId )
throw UniSetTypes::SystemError("(RTUExchange): objId=-1?!! Use --" + prefix + "-name" ); throw uniset::SystemError("(RTUExchange): objId=-1?!! Use --" + prefix + "-name" );
auto conf = uniset_conf(); auto conf = uniset_conf();
...@@ -67,7 +67,7 @@ RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI ...@@ -67,7 +67,7 @@ RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI
devname = conf->getArgParam("--" + prefix + "-dev", it.getProp("device")); devname = conf->getArgParam("--" + prefix + "-dev", it.getProp("device"));
if( devname.empty() ) if( devname.empty() )
throw UniSetTypes::SystemError(myname + "(RTUExchange): Unknown device..." ); throw uniset::SystemError(myname + "(RTUExchange): Unknown device..." );
string speed = conf->getArgParam("--" + prefix + "-speed", it.getProp("speed")); string speed = conf->getArgParam("--" + prefix + "-speed", it.getProp("speed"));
...@@ -160,7 +160,7 @@ std::shared_ptr<ModbusClient> RTUExchange::initMB( bool reopen ) ...@@ -160,7 +160,7 @@ std::shared_ptr<ModbusClient> RTUExchange::initMB( bool reopen )
mbinfo << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl; mbinfo << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl;
} }
catch( const UniSetTypes::Exception& ex ) catch( const uniset::Exception& ex )
{ {
//if( mbrtu ) //if( mbrtu )
// delete mbrtu; // delete mbrtu;
...@@ -335,7 +335,7 @@ bool RTUExchange::poll() ...@@ -335,7 +335,7 @@ bool RTUExchange::poll()
return !allNotRespond; return !allNotRespond;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
std::shared_ptr<RTUExchange> RTUExchange::init_rtuexchange(int argc, const char* const* argv, UniSetTypes::ObjectId icID, std::shared_ptr<RTUExchange> RTUExchange::init_rtuexchange(int argc, const char* const* argv, uniset::ObjectId icID,
const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ) const std::shared_ptr<SharedMemory>& ic, const std::string& prefix )
{ {
auto conf = uniset_conf(); auto conf = uniset_conf();
...@@ -350,7 +350,7 @@ std::shared_ptr<RTUExchange> RTUExchange::init_rtuexchange(int argc, const char* ...@@ -350,7 +350,7 @@ std::shared_ptr<RTUExchange> RTUExchange::init_rtuexchange(int argc, const char*
ObjectId ID = conf->getObjectID(name); ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId ) if( ID == uniset::DefaultObjectId )
{ {
cerr << "(rtuexchange): Not found ID for '" << name cerr << "(rtuexchange): Not found ID for '" << name
<< "'!" << "'!"
......
...@@ -24,18 +24,21 @@ ...@@ -24,18 +24,21 @@
#include "MBExchange.h" #include "MBExchange.h"
#include "modbus/ModbusRTUMaster.h" #include "modbus/ModbusRTUMaster.h"
#include "RTUStorage.h" #include "RTUStorage.h"
// --------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class RTUExchange: class RTUExchange:
public MBExchange public MBExchange
{ {
public: public:
RTUExchange( UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmID, RTUExchange( uniset::ObjectId objId, uniset::ObjectId shmID,
const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "rs" ); const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "rs" );
virtual ~RTUExchange(); virtual ~RTUExchange();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static std::shared_ptr<RTUExchange> init_rtuexchange( int argc, const char* const* argv, static std::shared_ptr<RTUExchange> init_rtuexchange( 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 = "rs" ); const std::string& prefix = "rs" );
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
...@@ -60,6 +63,8 @@ class RTUExchange: ...@@ -60,6 +63,8 @@ class RTUExchange:
bool rs_pre_clean; bool rs_pre_clean;
}; };
// --------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _RS_EXCHANGE_H_ #endif // _RS_EXCHANGE_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
#include <string> #include <string>
#include "modbus/ModbusRTUMaster.h" #include "modbus/ModbusRTUMaster.h"
#include "RTUStorage.h" #include "RTUStorage.h"
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -735,3 +738,4 @@ std::string RTUStorage::j2s( RTUStorage::RTUJack jack ) ...@@ -735,3 +738,4 @@ std::string RTUStorage::j2s( RTUStorage::RTUJack jack )
return ""; return "";
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
} // end of namespace uniset
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