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
Utilities/Admin/uniset2-admin
Utilities/Admin/uniset-functions.sh
Utilities/Admin/uniset-start.sh
*/cov-html/*
Utilities/DBServer-MySQL/uniset-mysql-dbserver
Utilities/InfoServer/uniset-infoserver
......@@ -188,3 +189,4 @@ tests/tests
tests/tests_with_conf
testsuite/atconfig
*
\ No newline at end of file
......@@ -55,25 +55,25 @@ interface IOController_i : UniSetManager_i
/*! Информация о датчике */
struct SensorInfo
{
UniSetTypes::ObjectId id; /*!< идентификатор датчика */
UniSetTypes::ObjectId node; /*!< узел на котором он находится */
uniset::ObjectId id; /*!< идентификатор датчика */
uniset::ObjectId node; /*!< узел на котором он находится */
};
long getValue(in UniSetTypes::ObjectId sid) raises(NameNotFound,Undefined);
void setValue(in UniSetTypes::ObjectId sid, in long value,
in UniSetTypes::ObjectId sup_id) raises(NameNotFound,Undefined);
long getValue(in uniset::ObjectId sid) raises(NameNotFound,Undefined);
void setValue(in uniset::ObjectId sid, in long value,
in uniset::ObjectId sup_id) raises(NameNotFound,Undefined);
// установка неопределённого состояния
// (пока работает только для аналоговых датчиков)
void setUndefinedState(in UniSetTypes::ObjectId sid, in boolean undefined, in UniSetTypes::ObjectId sup_id )
void setUndefinedState(in uniset::ObjectId sid, in boolean undefined, in uniset::ObjectId sup_id )
raises(NameNotFound);
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
{
......@@ -84,8 +84,8 @@ interface IOController_i : UniSetManager_i
short precision; /*!< точность */
};
void calibrate( in UniSetTypes::ObjectId sid, in CalibrateInfo ci, in UniSetTypes::ObjectId adminId ) raises(NameNotFound);
CalibrateInfo getCalibrateInfo( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
void calibrate( in uniset::ObjectId sid, in CalibrateInfo ci, in uniset::ObjectId adminId ) raises(NameNotFound);
CalibrateInfo getCalibrateInfo( in uniset::ObjectId sid ) raises(NameNotFound);
// --- Интерфес получения информации о всех датчиках ---
/*! Информация датчике */
......@@ -102,19 +102,19 @@ interface IOController_i : UniSetManager_i
CalibrateInfo ci; /*!< калибровочные параметры */
unsigned long tv_sec; /*!< время последнего изменения датчика, секунды (clock_gettime(CLOCK_REALTIME) */
unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */
UniSetTypes::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */
uniset::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */
boolean dbignore; /*!< не сохранять изменения в БД */
};
typedef sequence<SensorIOInfo> SensorInfoSeq;
SensorInfoSeq getSensorsMap();
SensorIOInfo getSensorIOInfo( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
SensorIOInfo getSensorIOInfo( in uniset::ObjectId sid ) raises(NameNotFound);
// -- Функции работы со списком датчиков --
/*! Получение состояния датчиков. */
SensorInfoSeq getSensorSeq( in UniSetTypes::IDSeq lst );
SensorInfoSeq getSensorSeq( in uniset::IDSeq lst );
/*! Информация о "выходе" */
struct OutInfo
......@@ -130,7 +130,7 @@ interface IOController_i : UniSetManager_i
\return Возвращает список входов/выходов изменить состояние которых не удалось.
Будет пустым если всё хорошо.
*/
UniSetTypes::IDSeq setOutputSeq( in OutSeq lst, in UniSetTypes::ObjectId sup_id );
uniset::IDSeq setOutputSeq( in OutSeq lst, in uniset::ObjectId sup_id );
/*! Информация о датчике */
......@@ -141,10 +141,10 @@ interface IOController_i : UniSetManager_i
// могут быть проблеммы в 64bit-ных
unsigned long tv_sec; /*!< время последнего изменения датчика, секунды (clock_gettime(CLOCK_REALTIME) */
unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */
UniSetTypes::ObjectId supplier; /*!< идентификатор того, кто менял датчик (последний раз) */
uniset::ObjectId supplier; /*!< идентификатор того, кто менял датчик (последний раз) */
};
ShortIOInfo getChangedTime( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
ShortIOInfo getChangedTime( in uniset::ObjectId sid ) raises(NameNotFound);
/*! Информация о дискретном датчике */
......@@ -180,15 +180,15 @@ interface IONotifyController_i : IOController_i
/*! Универсальная функция заказа уведомления об изменнии датчика.
* \sa UniversalIO::UniversalIOController::askSensor()
*/
void askSensor(in UniSetTypes::ObjectId sid, in UniSetTypes::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
void askSensor(in uniset::ObjectId sid, in uniset::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
/*!
Заказ сразу списка объектов.
\return Возвращает список объектов заказ по котором не прошёл.
Будет пустым если всё хорошо.
*/
UniSetTypes::IDSeq askSensorsSeq( in UniSetTypes::IDSeq lst,
in UniSetTypes::ConsumerInfo ci,
uniset::IDSeq askSensorsSeq( in uniset::IDSeq lst,
in uniset::ConsumerInfo ci,
in UniversalIO::UIOCommand cmd );
......@@ -202,7 +202,7 @@ interface IONotifyController_i : IOController_i
struct ThresholdInfo
{
UniSetTypes::ThresholdId id;
uniset::ThresholdId id;
long hilimit; /*!< верхняя граница срабатывания */
long lowlimit; /*!< нижняя гранийа срабатывания */
ThresholdState state;
......@@ -222,7 +222,7 @@ interface IONotifyController_i : IOController_i
* Если invert=false, порог срабатывает при условии >= hilimit и отпускается при <= lowlimit
* Если invert=true, порог срабатывает при условии <= lowlimit и отпускается при <= hilimit
*/
void askThreshold(in UniSetTypes::ObjectId sid, in UniSetTypes::ConsumerInfo ci, in UniSetTypes::ThresholdId tid,
void askThreshold(in uniset::ObjectId sid, in uniset::ConsumerInfo ci, in uniset::ThresholdId tid,
in long lowLimit, in long hiLimit, in boolean invert,
in UniversalIO::UIOCommand cmd ) raises(NameNotFound, IOBadParam, BadRange);
......@@ -230,7 +230,7 @@ interface IONotifyController_i : IOController_i
/*! Получение информации о пороге
* Т.к. пороги могут иметь одинаковый tid для разных аналоговых датчиков, то передаётся и SensorInfo
*/
ThresholdInfo getThresholdInfo( in UniSetTypes::ObjectId sid, in UniSetTypes::ThresholdId tid ) raises(NameNotFound);
ThresholdInfo getThresholdInfo( in uniset::ObjectId sid, in uniset::ThresholdId tid ) raises(NameNotFound);
struct ThresholdList
{
......@@ -243,7 +243,7 @@ interface IONotifyController_i : IOController_i
typedef sequence<ThresholdList> ThresholdsListSeq;
/*! получить список порогов для датчка "si" */
ThresholdList getThresholds( in UniSetTypes::ObjectId sid ) raises(NameNotFound);
ThresholdList getThresholds( in uniset::ObjectId sid ) raises(NameNotFound);
/*! получить список ВСЕХ датчиков по которым созданы пороги */
ThresholdsListSeq getThresholdsList();
......
......@@ -21,13 +21,10 @@
#ifndef UniSetBaseConstants_IDL_
#define UniSetBaseConstants_IDL_
// --------------------------------------------------------------------------
//module UniSet
//{
module UniSetTypes
module uniset
{
const unsigned short SizeOfTransportMessage=@SIZE_OF_TRANSPORT_MESSAGE@;
const unsigned short SizeOfObjectType=30;
};
//}; // end of module UniSet
// --------------------------------------------------------------------------------------------------------------
#endif // of UniSetBaseConstants_IDL
......@@ -40,7 +40,7 @@
interface UniSetManager_i : UniSetObject_i
{
/*!< распространить сообщение всем подчиненным объектам */
void broadcast(in UniSetTypes::TransportMessage msg);
void broadcast(in uniset::TransportMessage msg);
/*! получение информации о состоянии подчиненных объектов(менеджеров)
* \param userparam - Необязательный пользовательский параметр (см. UniSetObject_i::getInfo()).
......@@ -58,7 +58,7 @@
* \todo Подумать насчет применения итератора, при слишком
* большом( >1000 ) количестве подчиненных объектов...
*/
UniSetTypes::SimpleInfoSeq getObjectsInfo( in long MaxLength, in long userparam );
uniset::SimpleInfoSeq getObjectsInfo( in long MaxLength, in long userparam );
};
//}; // end of module UniSet
......
......@@ -36,18 +36,18 @@
*/
interface UniSetObject_i
{
UniSetTypes::ObjectId getId(); /*!< получение идентификатора объекта */
UniSetTypes::ObjectType getType(); /*!< получение типа объекта */
uniset::ObjectId getId(); /*!< получение идентификатора объекта */
uniset::ObjectType getType(); /*!< получение типа объекта */
/*! получение информации о внутреннем состоянии объекта
\param userparam - Необязательный пользовательский параметр
*/
UniSetTypes::SimpleInfo getInfo( in long userparam );
uniset::SimpleInfo getInfo( in long userparam );
boolean exist(); /*!< проверка существования объекта */
/*! Функция посылки сообщения объекту */
void push(in UniSetTypes::TransportMessage msg);
void push(in uniset::TransportMessage msg);
};
//}; // end of module UniSet
......
......@@ -25,7 +25,7 @@
// --------------------------------------------------------------------------
//module UniSet
//{
module UniSetTypes
module uniset
{
typedef long ObjectId; /*!< идентификатор объекта */
typedef long ThresholdId; /*!< идентификатор порога */
......@@ -82,7 +82,7 @@
typedef sequence<ObjectId> IDSeq;
};// end of module UniSetTypes
};// end of module uniset
module UniversalIO
......
......@@ -12,7 +12,7 @@
#endif
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
using namespace ModbusRTU;
// -------------------------------------------------------------------------
MBSlave::MBSlave(const std::unordered_set<ModbusAddr>& _vaddr, const std::string& dev, const std::string& speed, bool use485 ):
......
......@@ -12,7 +12,7 @@
class MBSlave
{
public:
MBSlave( const std::unordered_set<ModbusRTU::ModbusAddr>& vaddr, const std::string& dev, const std::string& speed, bool use485 = false );
MBSlave( const std::unordered_set<uniset::ModbusRTU::ModbusAddr>& vaddr, const std::string& dev, const std::string& speed, bool use485 = false );
~MBSlave();
inline void setVerbose( bool state )
......@@ -42,67 +42,67 @@ class MBSlave
void sigterm( int signo );
/*! обработка 0x01 */
ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode readCoilStatus( uniset::ModbusRTU::ReadCoilMessage& query,
uniset::ModbusRTU::ReadCoilRetMessage& reply );
/*! обработка 0x02 */
ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputStatus( uniset::ModbusRTU::ReadInputStatusMessage& query,
uniset::ModbusRTU::ReadInputStatusRetMessage& reply );
/*! обработка 0x03 */
ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readOutputRegisters( uniset::ModbusRTU::ReadOutputMessage& query,
uniset::ModbusRTU::ReadOutputRetMessage& reply );
/*! обработка 0x04 */
ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputRegisters( uniset::ModbusRTU::ReadInputMessage& query,
uniset::ModbusRTU::ReadInputRetMessage& reply );
/*! обработка 0x05 */
ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceSingleCoil( uniset::ModbusRTU::ForceSingleCoilMessage& query,
uniset::ModbusRTU::ForceSingleCoilRetMessage& reply );
/*! обработка 0x0F */
ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceMultipleCoils( uniset::ModbusRTU::ForceCoilsMessage& query,
uniset::ModbusRTU::ForceCoilsRetMessage& reply );
/*! обработка 0x10 */
ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputRegisters( uniset::ModbusRTU::WriteOutputMessage& query,
uniset::ModbusRTU::WriteOutputRetMessage& reply );
/*! обработка 0x06 */
ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputSingleRegister( uniset::ModbusRTU::WriteSingleOutputMessage& query,
uniset::ModbusRTU::WriteSingleOutputRetMessage& reply );
/*! обработка запросов на чтение ошибок */
ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
uniset::ModbusRTU::mbErrCode journalCommand( uniset::ModbusRTU::JournalCommandMessage& query,
uniset::ModbusRTU::JournalCommandRetMessage& reply );
/*! обработка запроса на установку времени */
ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
uniset::ModbusRTU::mbErrCode setDateTime( uniset::ModbusRTU::SetDateTimeMessage& query,
uniset::ModbusRTU::SetDateTimeRetMessage& reply );
/*! обработка запроса удалённого сервиса */
ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
uniset::ModbusRTU::mbErrCode remoteService( uniset::ModbusRTU::RemoteServiceMessage& query,
uniset::ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
uniset::ModbusRTU::mbErrCode fileTransfer( uniset::ModbusRTU::FileTransferMessage& query,
uniset::ModbusRTU::FileTransferRetMessage& reply );
ModbusRTU::mbErrCode diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply );
uniset::ModbusRTU::mbErrCode diagnostics( uniset::ModbusRTU::DiagnosticMessage& query,
uniset::ModbusRTU::DiagnosticRetMessage& reply );
ModbusRTU::mbErrCode read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply );
uniset::ModbusRTU::mbErrCode read4314( uniset::ModbusRTU::MEIMessageRDI& query,
uniset::ModbusRTU::MEIMessageRetRDI& reply );
/*! интерфейс ModbusRTUSlave для обмена по RS */
ModbusRTUSlaveSlot* rscomm;
std::unordered_set<ModbusRTU::ModbusAddr> vaddr; /*!< адреса на которые отвечаем */
uniset::ModbusRTUSlaveSlot* rscomm;
std::unordered_set<uniset::ModbusRTU::ModbusAddr> vaddr; /*!< адреса на которые отвечаем */
bool verbose;
#if 0
typedef std::unordered_map<ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
typedef std::unordered_map<uniset::ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
ExchangeErrorMap errmap; /*!< статистика обмена */
ModbusRTU::mbErrCode prev;
uniset::ModbusRTU::mbErrCode prev;
// можно было бы сделать unsigned, но аналоговые датчики у нас имеют
......
......@@ -12,7 +12,7 @@
#endif
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
using namespace ModbusRTU;
// -------------------------------------------------------------------------
MBTCPServer::MBTCPServer(const std::unordered_set<ModbusAddr>& myaddr, const string& inetaddr, int port, bool verb ):
......
......@@ -10,7 +10,7 @@
class MBTCPServer
{
public:
MBTCPServer( const std::unordered_set<ModbusRTU::ModbusAddr>& myaddr, const std::string& inetaddr, int port = 502, bool verbose = false );
MBTCPServer( const std::unordered_set<uniset::ModbusRTU::ModbusAddr>& myaddr, const std::string& inetaddr, int port = 502, bool verbose = false );
~MBTCPServer();
inline void setVerbose( bool state )
......@@ -23,7 +23,7 @@ class MBTCPServer
replyVal = val;
}
inline timeout_t setAfterSendPause( timeout_t msec )
inline uniset::timeout_t setAfterSendPause( uniset::timeout_t msec )
{
return sslot->setAfterSendPause(msec);
}
......@@ -38,70 +38,70 @@ class MBTCPServer
void sigterm( int signo );
/*! обработка 0x01 */
ModbusRTU::mbErrCode readCoilStatus( ModbusRTU::ReadCoilMessage& query,
ModbusRTU::ReadCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode readCoilStatus( uniset::ModbusRTU::ReadCoilMessage& query,
uniset::ModbusRTU::ReadCoilRetMessage& reply );
/*! обработка 0x02 */
ModbusRTU::mbErrCode readInputStatus( ModbusRTU::ReadInputStatusMessage& query,
ModbusRTU::ReadInputStatusRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputStatus( uniset::ModbusRTU::ReadInputStatusMessage& query,
uniset::ModbusRTU::ReadInputStatusRetMessage& reply );
/*! обработка 0x03 */
ModbusRTU::mbErrCode readOutputRegisters( ModbusRTU::ReadOutputMessage& query,
ModbusRTU::ReadOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readOutputRegisters( uniset::ModbusRTU::ReadOutputMessage& query,
uniset::ModbusRTU::ReadOutputRetMessage& reply );
/*! обработка 0x04 */
ModbusRTU::mbErrCode readInputRegisters( ModbusRTU::ReadInputMessage& query,
ModbusRTU::ReadInputRetMessage& reply );
uniset::ModbusRTU::mbErrCode readInputRegisters( uniset::ModbusRTU::ReadInputMessage& query,
uniset::ModbusRTU::ReadInputRetMessage& reply );
/*! обработка 0x05 */
ModbusRTU::mbErrCode forceSingleCoil( ModbusRTU::ForceSingleCoilMessage& query,
ModbusRTU::ForceSingleCoilRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceSingleCoil( uniset::ModbusRTU::ForceSingleCoilMessage& query,
uniset::ModbusRTU::ForceSingleCoilRetMessage& reply );
/*! обработка 0x0F */
ModbusRTU::mbErrCode forceMultipleCoils( ModbusRTU::ForceCoilsMessage& query,
ModbusRTU::ForceCoilsRetMessage& reply );
uniset::ModbusRTU::mbErrCode forceMultipleCoils( uniset::ModbusRTU::ForceCoilsMessage& query,
uniset::ModbusRTU::ForceCoilsRetMessage& reply );
/*! обработка 0x10 */
ModbusRTU::mbErrCode writeOutputRegisters( ModbusRTU::WriteOutputMessage& query,
ModbusRTU::WriteOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputRegisters( uniset::ModbusRTU::WriteOutputMessage& query,
uniset::ModbusRTU::WriteOutputRetMessage& reply );
/*! обработка 0x06 */
ModbusRTU::mbErrCode writeOutputSingleRegister( ModbusRTU::WriteSingleOutputMessage& query,
ModbusRTU::WriteSingleOutputRetMessage& reply );
uniset::ModbusRTU::mbErrCode writeOutputSingleRegister( uniset::ModbusRTU::WriteSingleOutputMessage& query,
uniset::ModbusRTU::WriteSingleOutputRetMessage& reply );
ModbusRTU::mbErrCode diagnostics( ModbusRTU::DiagnosticMessage& query,
ModbusRTU::DiagnosticRetMessage& reply );
uniset::ModbusRTU::mbErrCode diagnostics( uniset::ModbusRTU::DiagnosticMessage& query,
uniset::ModbusRTU::DiagnosticRetMessage& reply );
ModbusRTU::mbErrCode read4314( ModbusRTU::MEIMessageRDI& query,
ModbusRTU::MEIMessageRetRDI& reply );
uniset::ModbusRTU::mbErrCode read4314( uniset::ModbusRTU::MEIMessageRDI& query,
uniset::ModbusRTU::MEIMessageRetRDI& reply );
/*! обработка запросов на чтение ошибок */
ModbusRTU::mbErrCode journalCommand( ModbusRTU::JournalCommandMessage& query,
ModbusRTU::JournalCommandRetMessage& reply );
uniset::ModbusRTU::mbErrCode journalCommand( uniset::ModbusRTU::JournalCommandMessage& query,
uniset::ModbusRTU::JournalCommandRetMessage& reply );
/*! обработка запроса на установку времени */
ModbusRTU::mbErrCode setDateTime( ModbusRTU::SetDateTimeMessage& query,
ModbusRTU::SetDateTimeRetMessage& reply );
uniset::ModbusRTU::mbErrCode setDateTime( uniset::ModbusRTU::SetDateTimeMessage& query,
uniset::ModbusRTU::SetDateTimeRetMessage& reply );
/*! обработка запроса удалённого сервиса */
ModbusRTU::mbErrCode remoteService( ModbusRTU::RemoteServiceMessage& query,
ModbusRTU::RemoteServiceRetMessage& reply );
uniset::ModbusRTU::mbErrCode remoteService( uniset::ModbusRTU::RemoteServiceMessage& query,
uniset::ModbusRTU::RemoteServiceRetMessage& reply );
ModbusRTU::mbErrCode fileTransfer( ModbusRTU::FileTransferMessage& query,
ModbusRTU::FileTransferRetMessage& reply );
uniset::ModbusRTU::mbErrCode fileTransfer( uniset::ModbusRTU::FileTransferMessage& query,
uniset::ModbusRTU::FileTransferRetMessage& reply );
/*! интерфейс ModbusSlave для обмена по RS */
ModbusTCPServerSlot* sslot;
std::unordered_set<ModbusRTU::ModbusAddr> vaddr; /*!< адреса данного узла */
uniset::ModbusTCPServerSlot* sslot;
std::unordered_set<uniset::ModbusRTU::ModbusAddr> vaddr; /*!< адреса данного узла */
bool verbose = { false };
long replyVal = { -1 };
#if 0
typedef std::unordered_map<ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
typedef std::unordered_map<uniset::ModbusRTU::mbErrCode, unsigned int> ExchangeErrorMap;
ExchangeErrorMap errmap; /*!< статистика обмена */
ModbusRTU::mbErrCode prev;
uniset::ModbusRTU::mbErrCode prev;
// можно было бы сделать unsigned, но аналоговые датчики у нас имеют
......
......@@ -5,7 +5,7 @@
#include "Debug.h"
#include "MBSlave.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......
......@@ -6,7 +6,7 @@
#include "modbus/ModbusRTUMaster.h"
#include "modbus/ModbusHelpers.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -346,7 +346,7 @@ int main( int argc, char** argv )
if( !checkArg(optind + 3, argc, argv) )
break;
fn = (ModbusRTU::SlaveFunctionCode)UniSetTypes::uni_atoi(argv[optind + 3]);
fn = (ModbusRTU::SlaveFunctionCode)uniset::uni_atoi(argv[optind + 3]);
}
break;
......@@ -365,7 +365,7 @@ int main( int argc, char** argv )
if( !checkArg(optind + 1, argc, argv) )
break;
fn = (ModbusRTU::SlaveFunctionCode)UniSetTypes::uni_atoi(argv[optind + 1]);
fn = (ModbusRTU::SlaveFunctionCode)uniset::uni_atoi(argv[optind + 1]);
}
break;
......@@ -664,7 +664,7 @@ int main( int argc, char** argv )
ModbusRTU::ModbusAddr a = ModbusHelpers::autodetectSlave(&mb, beg, end, reg, fn);
cout << "autodetect modbus slave: " << ModbusRTU::addr2str(a) << endl;
}
catch( UniSetTypes::TimeOut )
catch( uniset::TimeOut )
{
cout << "slave not autodetect..." << endl;
}
......@@ -688,7 +688,7 @@ int main( int argc, char** argv )
cout << "autodetect: slaveaddr=" << ModbusRTU::addr2str(slaveaddr)
<< " speed=" << ComPort::getSpeed(s) << endl;
}
catch( UniSetTypes::TimeOut )
catch( uniset::TimeOut )
{
cout << "speed not autodetect for slaveaddr="
<< ModbusRTU::addr2str(slaveaddr) << endl;
......
......@@ -5,7 +5,7 @@
#include "MBSlave.h"
#include "ComPort485F.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -92,7 +92,7 @@ int main( int argc, char** argv )
}
}
auto avec = UniSetTypes::explode_str(myaddr, ',');
auto avec = uniset::explode_str(myaddr, ',');
std::unordered_set<ModbusRTU::ModbusAddr> vaddr;
for( const auto& a : avec )
......
......@@ -4,7 +4,7 @@
#include "Debug.h"
#include "modbus/ModbusTCPMaster.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -215,7 +215,7 @@ int main( int argc, char** argv )
{
cerr << "(mbtester): " << err << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(mbtester): " << ex << endl;
}
......
......@@ -4,7 +4,7 @@
#include "Debug.h"
#include "MBTCPServer.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -98,7 +98,7 @@ int main( int argc, char** argv )
}
}
auto avec = UniSetTypes::explode_str(myaddr, ',');
auto avec = uniset::explode_str(myaddr, ',');
std::unordered_set<ModbusRTU::ModbusAddr> vaddr;
for( const auto& a : avec )
......
......@@ -6,7 +6,7 @@
#include "Debug.h"
#include "modbus/ModbusTCPMaster.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -713,7 +713,7 @@ int main( int argc, char** argv )
{
cerr << "(mbtester): " << err << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(mbtester): " << ex << endl;
}
......
......@@ -3,7 +3,7 @@
#include "NullController.h"
#include "PassiveTimer.h"
// --------------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------------
......
......@@ -7,10 +7,10 @@
#include "NCRestorer.h"
// --------------------------------------------------------------------------
class NullController:
public IONotifyController
public uniset::IONotifyController
{
public:
NullController( UniSetTypes::ObjectId id, const std::string& restorfile,
NullController( uniset::ObjectId id, const std::string& restorfile,
const std::string& s_filterField = "",
const std::string& s_filterValue = "",
const std::string& c_filterField = "",
......
......@@ -4,7 +4,7 @@
#include "Debug.h"
#include "PassiveTimer.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
......@@ -52,7 +52,7 @@ int main(int argc, char** argv)
ObjectId ID = conf->oind->getIdByName(conf->getControllersSection() + "/" + name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(nullController): идентификатор '" << name
<< "' не найден в конф. файле!"
......
......@@ -3,7 +3,7 @@
#include "UInterface.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
void help_print()
{
......@@ -18,7 +18,7 @@ void help_print()
}
// -----------------------------------------------------------------------------
struct ExtInfo:
public UniSetTypes::ParamSInfo
public uniset::ParamSInfo
{
UniversalIO::IOType iotype;
};
......@@ -50,7 +50,7 @@ int main( int argc, char** argv )
return 1;
}
auto lst = UniSetTypes::getSInfoList(sid, conf);
auto lst = uniset::getSInfoList(sid, conf);
if( lst.empty() )
{
......@@ -135,7 +135,7 @@ int main( int argc, char** argv )
{
ui.setValue(it.si, j, DefaultObjectId);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << endl << "save id=" << it.fname << " " << ex << endl;
}
......@@ -162,7 +162,7 @@ int main( int argc, char** argv )
{
ui.setValue(it->si, i, DefaultObjectId);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << endl << "save id=" << it->fname << " " << ex << endl;
}
......@@ -172,7 +172,7 @@ int main( int argc, char** argv )
msleep(amsec);
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << endl << "(simitator): " << ex << endl;
return 1;
......
......@@ -4,7 +4,7 @@
#include "Configuration.h"
#include "SMonitor.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
......@@ -30,7 +30,7 @@ int main( int argc, const char** argv )
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(main): идентификатор '" << name
<< "' не найден в конф. файле!"
......@@ -47,7 +47,7 @@ int main( int argc, const char** argv )
act->run(false);
return 0;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cout << "(main):" << ex << endl;
}
......
......@@ -3,7 +3,7 @@
#include "SViewer.h"
#include "Configuration.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static void short_usage()
......
......@@ -6,7 +6,7 @@
#include "LogServer.h"
#include "Exceptions.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -------------------------------------------------------------------------
static struct option longopts[] =
......@@ -94,7 +94,7 @@ int main( int argc, char* argv[], char* envp[] )
cerr << "(log-stdin): " << err << endl;
return 1;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(log-stdin): " << ex << endl;
return 1;
......
......@@ -11,7 +11,7 @@
#include <unistd.h>
#include <cstring>
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -------------------------------------------------------------------------
static void print_help()
......@@ -105,7 +105,7 @@ int main( int argc, char* argv[], char* envp[] )
cerr << "(logserver-wrap): " << err << endl;
return 1;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(logserver-wrap): " << ex << endl;
return 1;
......
......@@ -9,7 +9,7 @@
#include "LogReader.h"
#include "LogServerTypes.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -317,7 +317,7 @@ int main( int argc, char** argv )
{
cerr << "(log): " << err << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(log): " << ex << endl;
}
......
......@@ -2,7 +2,7 @@
#include "Debug.h"
#include "Configuration.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main( int argc, char** argv )
......
......@@ -8,7 +8,7 @@
#include "LogServer.h"
#include "LogAgregator.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
static struct option longopts[] =
......@@ -209,7 +209,7 @@ int main( int argc, char** argv )
{
cerr << "(logserver): " << err << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(logserver): " << ex << endl;
}
......
......@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
updateOutputs(forceOut);
updatePreviousValues();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -115,7 +115,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
msleep( sleep_msec );
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* _sm )
{
<xsl:for-each select="//sensors/item/consumers/consumer">
<xsl:if test="normalize-space(../../@msg)!='1'">
......@@ -146,7 +146,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
<xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="../../@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="../../@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -163,7 +163,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
</xsl:for-each>
}
// -----------------------------------------------------------------------------
UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
uniset::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
if( smTestID != DefaultObjectId )
return smTestID;
......@@ -206,7 +206,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each>
return;
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -218,9 +218,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId _sid, long _val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
// ui->setState(sid,state);
......@@ -243,13 +243,13 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
ui->setValue(_sid,_val);
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId _sid, UniversalIO::UIOCommand _cmd, uniset::ObjectId _node )
{
ui->askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
try
{
......@@ -267,7 +267,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid);
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -321,7 +321,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
</xsl:if>
</xsl:if>
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -356,7 +356,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -371,7 +371,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -100,7 +100,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
// обновление списка предыдущих состояний
updatePreviousValues();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
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
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* _sm )
{
sensorInfo(_sm);
}
......@@ -144,7 +144,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
<xsl:if test="normalize-space(../../@msg)!='1'">
<xsl:if test="normalize-space(@name)=$OID">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="../../@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="../../@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -161,7 +161,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId _sid, UniversalIO::UIOCommand _cmd, uniset::ObjectId _node )
{
if( _cmd == UniversalIO::UIONotify )
{
......@@ -176,9 +176,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _s
}
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId _sid, long _val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
// ui->setState(sid,state);
......@@ -201,7 +201,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _si
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
<xsl:for-each select="//sensors/item/consumers/consumer">
<xsl:if test="normalize-space(../../@msg)!='1'">
......@@ -233,7 +233,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
-->
}
// -----------------------------------------------------------------------------
UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
uniset::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
if( smTestID != DefaultObjectId )
return smTestID;
......@@ -261,7 +261,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
</xsl:if>
</xsl:if>
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -296,7 +296,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>, getId() );
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -311,7 +311,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
si.node = node_<xsl:value-of select="../../@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -85,7 +85,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -95,7 +95,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexcept
updateOutputs(forceOut);
updatePreviousValues();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
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
msleep( sleep_msec );
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId _sid, long _val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId _sid, long _val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
<xsl:for-each select="//smap/item">
......@@ -162,7 +162,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
-->
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* _sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* _sm )
{
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@vartype)='in'">
......@@ -187,7 +187,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -202,12 +202,12 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId _sid, UniversalIO::UIOCommand _cmd, UniSetTypes::ObjectId _node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId _sid, UniversalIO::UIOCommand _cmd, uniset::ObjectId _node )
{
ui->askRemoteSensor(_sid,_cmd,_node,getId());
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
try
{
......@@ -221,7 +221,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid);
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getValue): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each>
return;
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(preAskSensors): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -280,7 +280,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
{
priv_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui->getValue(<xsl:value-of select="@name"/>, node_<xsl:value-of select="@name"/>);
}
catch( UniSetTypes::Exception&amp; ex )
catch( uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -297,7 +297,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
si.node = node_<xsl:value-of select="@name"/>;
ui->setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() );
}
catch( UniSetTypes::Exception&amp; ex )
catch( uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -315,7 +315,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
si.node = node_<xsl:value-of select="@name"/>;
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
catch( UniSetTypes::Exception&amp; ex )
catch( uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -88,7 +88,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -98,7 +98,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
updateOutputs(forceOut);
updatePreviousValues();
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(execute): " &lt;&lt; ex &lt;&lt; endl;
}
......@@ -118,9 +118,9 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback() noexept
msleep( sleep_msec );
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( UniSetTypes::ObjectId sid, long val )
void <xsl:value-of select="$CLASSNAME"/>_SK::setValue( uniset::ObjectId sid, long val )
{
if( _sid == UniSetTypes::DefaultObjectId )
if( _sid == uniset::DefaultObjectId )
return;
<xsl:for-each select="//smap/item">
......@@ -163,7 +163,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
</xsl:for-each>
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId sid, UniversalIO::UIOCommand cmd, UniSetTypes::ObjectId node )
void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( uniset::ObjectId sid, UniversalIO::UIOCommand cmd, uniset::ObjectId node )
{
if( cmd == UniversalIO::UIONotify )
{
......@@ -178,7 +178,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::askSensor( UniSetTypes::ObjectId si
}
}
// -----------------------------------------------------------------------------
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _sid )
long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( uniset::ObjectId _sid )
{
<xsl:for-each select="//smap/item">
if( _sid == <xsl:value-of select="@name"/> )
......@@ -188,7 +188,7 @@ long <xsl:value-of select="$CLASSNAME"/>_SK::getValue( UniSetTypes::ObjectId _si
return ui->getValue(_sid);
}
// -----------------------------------------------------------------------------
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const UniSetTypes::SensorMessage* sm )
void <xsl:value-of select="$CLASSNAME"/>_SK::preSensorInfo( const uniset::SensorMessage* sm )
{
sensorInfo(sm);
}
......@@ -197,7 +197,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
<xsl:for-each select="//smap/item">
<xsl:if test="normalize-space(@initFromSM)!=''">
if( <xsl:value-of select="@name"/> != UniSetTypes::DefaultObjectId )
if( <xsl:value-of select="@name"/> != uniset::DefaultObjectId )
{
try
{
......@@ -221,7 +221,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
if( <xsl:value-of select="@name"/> != DefaultObjectId )
priv_<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/> = ui->getValue(<xsl:value-of select="@name"/>,node_<xsl:value-of select="@name"/>);
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(getdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -238,7 +238,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si, <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>, getId() );
}
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -256,7 +256,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si,<xsl:value-of select="$setval"/>, getId() );
}
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setdata): " &lt;&lt; ex &lt;&lt; endl;
throw;
......@@ -273,7 +273,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
ui->setValue( si,(long)m_<xsl:value-of select="@name"/>, getId() );
}
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
mycrit &lt;&lt; myname &lt;&lt; "(setmsg): " &lt;&lt; ex &lt;&lt; endl;
throw;
......
......@@ -53,14 +53,14 @@
// -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject</xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public uniset::UniSetObject</xsl:if>
{
public:
<xsl:if test="not(normalize-space($OID))=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id = UniSetTypes::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>"), const string&amp; argprefix="" );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id = uniset::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>"), const string&amp; argprefix="" );
</xsl:if>
<xsl:if test="normalize-space($OID)=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>") );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id, xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($OID)"/>") );
</xsl:if>
<xsl:value-of select="$CLASSNAME"/>_SK();
......
......@@ -52,14 +52,14 @@
// -----------------------------------------------------------------------------
class <xsl:value-of select="$CLASSNAME"/>_SK:
<xsl:if test="normalize-space($BASECLASS)!=''">public <xsl:value-of select="normalize-space($BASECLASS)"/></xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public UniSetObject</xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">public uniset::UniSetObject</xsl:if>
{
public:
<xsl:if test="not(normalize-space($OID))=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id = UniSetTypes::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id = uniset::uniset_conf()->getObjectID("<xsl:value-of select="$OID"/>"), xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
</xsl:if>
<xsl:if test="normalize-space($OID)=''">
<xsl:value-of select="$CLASSNAME"/>_SK( UniSetTypes::ObjectId id, xmlNode* node=UniSetTypes::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
<xsl:value-of select="$CLASSNAME"/>_SK( uniset::ObjectId id, xmlNode* node=uniset::uniset_conf()->getNode("<xsl:value-of select="normalize-space($CNAME)"/>"), const std::string&amp; argprefix="<xsl:value-of select="normalize-space($ARGPREFIX)"/>" );
</xsl:if>
<xsl:value-of select="$CLASSNAME"/>_SK();
virtual ~<xsl:value-of select="$CLASSNAME"/>_SK();
......@@ -68,16 +68,16 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
// Используемые идентификаторы
<xsl:for-each select="//smap/item">
const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const UniSetTypes::ObjectId node_<xsl:value-of select="@name"/>;
const uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const uniset::ObjectId node_<xsl:value-of select="@name"/>;
<xsl:if test="normalize-space(@vartype)='io'">#error (uniset-codegen): vartype='io' NO LONGER SUPPORTED! (ignore variable: '<xsl:value-of select="@name"/>')
</xsl:if>
</xsl:for-each>
// Используемые идентификаторы сообщений
<xsl:for-each select="//msgmap/item">
const UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const UniSetTypes::ObjectId node_<xsl:value-of select="@name"/>;
const uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
const uniset::ObjectId node_<xsl:value-of select="@name"/>;
bool m_<xsl:value-of select="@name"/>; /*!&lt; текущее состояние /> */
</xsl:for-each>
......@@ -106,9 +106,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:if>
<xsl:if test="normalize-space(@type)='str'">std::string <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='sensor'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='sensor'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='object'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='object'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
</xsl:if>
</xsl:for-each>
......@@ -134,9 +134,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:if>
<xsl:if test="normalize-space(@type)='str'">std::string <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='sensor'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='sensor'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='object'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='object'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
</xsl:if>
</xsl:if>
......@@ -163,7 +163,7 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:if>
<xsl:if test="normalize-space(@type)='str'">std::string <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
<xsl:if test="normalize-space(@type)='sensor'">UniSetTypes::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
<xsl:if test="normalize-space(@type)='sensor'">uniset::ObjectId <xsl:value-of select="@name"/>; /*!&lt; <xsl:value-of select="@comment"/> */
</xsl:if>
</xsl:if>
</xsl:for-each>// --- end of private variables ---
......
......@@ -36,7 +36,7 @@
#include "<xsl:value-of select="$CLASSNAME"/>.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
int main( int argc,char* argv[] )
{
......@@ -57,7 +57,7 @@ int main( int argc,char* argv[] )
if( !name.empty() )
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr &lt;&lt; "(main): идентификатор '" &lt;&lt; name
&lt;&lt; "' не найден в конф. файле!"
......@@ -75,7 +75,7 @@ int main( int argc,char* argv[] )
act-&gt;run(false);
return 0;
}
catch( const UniSetTypes::Exception&amp; ex )
catch( const uniset::Exception&amp; ex )
{
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
}
......
......@@ -38,7 +38,7 @@
#include "<xsl:value-of select="$CLASSNAME"/>.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
{
......@@ -62,7 +62,7 @@ int main( int argc, const char** argv )
if( !name.empty() )
{
ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr &lt;&lt; "(main): идентификатор '" &lt;&lt; name
&lt;&lt; "' не найден в конф. файле!"
......@@ -82,7 +82,7 @@ int main( int argc, const char** argv )
act-&gt;run(false);
return 0;
}
catch( const UniSetTypes::Exception&amp; ex)
catch( const uniset::Exception&amp; ex)
{
cerr &lt;&lt; "(main): " &lt;&lt; ex &lt;&lt; endl;
}
......
......@@ -3,7 +3,7 @@
#include <UniSetActivator.h>
#include "Skel.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
......
......@@ -2,9 +2,9 @@
#include "Skel.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
Skel::Skel( UniSetTypes::ObjectId id, xmlNode* confnode ):
Skel::Skel( uniset::ObjectId id, xmlNode* confnode ):
Skel_SK( id, confnode )
{
}
......
......@@ -8,15 +8,15 @@ class Skel:
public Skel_SK
{
public:
Skel( UniSetTypes::ObjectId id, xmlNode* confnode = UniSetTypes::uniset_conf()->getNode("Skel") );
Skel( uniset::ObjectId id, xmlNode* confnode = uniset::uniset_conf()->getNode("Skel") );
virtual ~Skel();
protected:
Skel();
virtual void step() override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void askSensors( UniversalIO::UIOCommand cmd ) override;
private:
......
......@@ -2,9 +2,9 @@
#include "TestGen.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
TestGen::TestGen( UniSetTypes::ObjectId id, xmlNode* confnode ):
TestGen::TestGen( uniset::ObjectId id, xmlNode* confnode ):
TestGen_SK( id, confnode )
{
vmonit(int_var);
......@@ -91,7 +91,7 @@ void TestGen::httpGetUserData( nlohmann::json& jdata )
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 )
askTimer(1, 2000);
......
......@@ -8,23 +8,23 @@ class TestGen:
public TestGen_SK
{
public:
TestGen( UniSetTypes::ObjectId id, xmlNode* confnode = UniSetTypes::uniset_conf()->getNode("TestGen") );
TestGen( uniset::ObjectId id, xmlNode* confnode = uniset::uniset_conf()->getNode("TestGen") );
virtual ~TestGen();
protected:
TestGen();
virtual void step() override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sigterm( int signo ) override;
virtual void httpGetUserData( nlohmann::json& jdata ) override;
private:
bool bool_var = { false };
int int_var = {0};
timeout_t t_val = { 0 };
uniset::timeout_t t_val = { 0 };
};
// -----------------------------------------------------------------------------
#endif // TestGen_H_
......
......@@ -2,9 +2,9 @@
#include "TestGenAlone.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
TestGenAlone::TestGenAlone( UniSetTypes::ObjectId id, xmlNode* confnode ):
TestGenAlone::TestGenAlone( uniset::ObjectId id, xmlNode* confnode ):
TestGenAlone_SK( id, confnode )
{
}
......
......@@ -8,14 +8,14 @@ class TestGenAlone:
public TestGenAlone_SK
{
public:
TestGenAlone( UniSetTypes::ObjectId id, xmlNode* confnode = UniSetTypes::uniset_conf()->getNode("TestGenAlone") );
TestGenAlone( uniset::ObjectId id, xmlNode* confnode = uniset::uniset_conf()->getNode("TestGenAlone") );
virtual ~TestGenAlone();
protected:
virtual void step() override;
void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
void sensorInfo( const uniset::SensorMessage* sm ) override;
void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sigterm( int signo ) override;
private:
......
......@@ -31,7 +31,7 @@
#include "UniXML.h"
#include "DBLogSugar.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
DBServer_MySQL::DBServer_MySQL(ObjectId id, const std::string& prefix ):
......@@ -66,7 +66,7 @@ DBServer_MySQL::~DBServer_MySQL()
db->close();
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::sysCommand( const UniSetTypes::SystemMessage* sm )
void DBServer_MySQL::sysCommand( const uniset::SystemMessage* sm )
{
DBServer::sysCommand(sm);
......@@ -95,7 +95,7 @@ void DBServer_MySQL::sysCommand( const UniSetTypes::SystemMessage* sm )
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
void DBServer_MySQL::confirmInfo( const uniset::ConfirmMessage* cem )
{
try
{
......@@ -115,7 +115,7 @@ void DBServer_MySQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(update_confirm): " << ex << endl;
}
......@@ -194,7 +194,7 @@ void DBServer_MySQL::flushBuffer()
}
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::sensorInfo( const UniSetTypes::SensorMessage* si )
void DBServer_MySQL::sensorInfo( const uniset::SensorMessage* si )
{
try
{
......@@ -230,7 +230,7 @@ void DBServer_MySQL::sensorInfo( const UniSetTypes::SensorMessage* si )
dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl;
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(insert_main_history): " << ex << endl;
}
......@@ -254,7 +254,7 @@ void DBServer_MySQL::initDBServer()
auto conf = uniset_conf();
if( conf->getDBServer() == UniSetTypes::DefaultObjectId )
if( conf->getDBServer() == uniset::DefaultObjectId )
{
ostringstream msg;
msg << myname << "(init): DBServer OFF for this node.."
......@@ -276,8 +276,8 @@ void DBServer_MySQL::initDBServer()
string user(conf->getProp(node, "dbuser"));
string password(conf->getProp(node, "dbpass"));
tblMap[UniSetTypes::Message::SensorInfo] = "main_history";
tblMap[UniSetTypes::Message::Confirm] = "main_history";
tblMap[uniset::Message::SensorInfo] = "main_history";
tblMap[uniset::Message::Confirm] = "main_history";
PingTime = conf->getIntProp(node, "pingTime");
ReconnectTime = conf->getIntProp(node, "reconnectTime");
......@@ -349,7 +349,7 @@ void DBServer_MySQL::createTables( MySQLInterface* db )
}
}
//--------------------------------------------------------------------------------------------
void DBServer_MySQL::timerInfo( const UniSetTypes::TimerMessage* tm )
void DBServer_MySQL::timerInfo( const uniset::TimerMessage* tm )
{
DBServer::timerInfo(tm);
......@@ -413,7 +413,7 @@ std::shared_ptr<DBServer_MySQL> DBServer_MySQL::init_dbserver( int argc, const c
{
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(DBServer_MySQL): Unknown ObjectID for '" << name << endl;
return 0;
......
......@@ -26,6 +26,9 @@
#include "UniSetTypes.h"
#include "MySQLInterface.h"
#include "DBServer.h"
// -------------------------------------------------------------------------
namespace uniset
{
//------------------------------------------------------------------------------------------
/*!
\page page_DBServer_MySQL (DBServer_MySQL) Реализация сервиса ведения БД на основе MySQL
......@@ -135,7 +138,7 @@ class DBServer_MySQL:
public DBServer
{
public:
DBServer_MySQL( UniSetTypes::ObjectId id, const std::string& prefix );
DBServer_MySQL( uniset::ObjectId id, const std::string& prefix );
explicit DBServer_MySQL( const std::string& prefix );
virtual ~DBServer_MySQL();
......@@ -161,10 +164,10 @@ class DBServer_MySQL:
virtual void initDB( std::shared_ptr<MySQLInterface>& db ) {};
virtual void initDBTableMap(DBTableMap& tblMap) {};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void confirmInfo( const uniset::ConfirmMessage* cmsg ) override;
bool writeToBase( const string& query );
void createTables( MySQLInterface* db );
......@@ -196,11 +199,13 @@ class DBServer_MySQL:
bool lastRemove;
void flushBuffer();
UniSetTypes::uniset_rwmutex mqbuf;
uniset::uniset_rwmutex mqbuf;
private:
DBTableMap tblMap;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
//------------------------------------------------------------------------------------------
#endif
......@@ -22,7 +22,7 @@
#include "UniSetTypes.h"
#include "MySQLInterface.h"
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------------------
MySQLInterface::MySQLInterface():
......
......@@ -29,6 +29,9 @@
//#define USE_OLD_FUNCTIONS
#include <mysql/mysql.h>
#include <DBInterface.h>
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------
class MySQLInterface:
public DBNetInterface
......@@ -79,4 +82,6 @@ class MySQLInterface:
bool connected;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------------
#endif
......@@ -3,7 +3,7 @@
#include "UniSetActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......
......@@ -3,7 +3,7 @@
#include "Exceptions.h"
#include "MySQLInterface.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......@@ -48,7 +48,7 @@ int main(int argc, char** argv)
db.close();
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(test): " << ex << endl;
}
......
......@@ -26,7 +26,7 @@
#include "UniXML.h"
#include "DBLogSugar.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
DBServer_PostgreSQL::DBServer_PostgreSQL(ObjectId id, const std::string& prefix ):
......@@ -74,7 +74,7 @@ DBServer_PostgreSQL::~DBServer_PostgreSQL()
db->close();
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::sysCommand( const UniSetTypes::SystemMessage* sm )
void DBServer_PostgreSQL::sysCommand( const uniset::SystemMessage* sm )
{
DBServer::sysCommand(sm);
......@@ -104,7 +104,7 @@ void DBServer_PostgreSQL::sysCommand( const UniSetTypes::SystemMessage* sm )
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
void DBServer_PostgreSQL::confirmInfo( const uniset::ConfirmMessage* cem )
{
DBServer::confirmInfo(cem);
......@@ -129,7 +129,7 @@ void DBServer_PostgreSQL::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(update_confirm): " << ex << endl;
}
......@@ -244,7 +244,7 @@ void DBServer_PostgreSQL::flushInsertBuffer()
}
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::sensorInfo( const UniSetTypes::SensorMessage* si )
void DBServer_PostgreSQL::sensorInfo( const uniset::SensorMessage* si )
{
try
{
......@@ -275,7 +275,7 @@ void DBServer_PostgreSQL::sensorInfo( const UniSetTypes::SensorMessage* si )
if( ibufSize >= ibufMaxSize )
flushInsertBuffer();
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(insert_main_history): " << ex << endl;
}
......@@ -299,7 +299,7 @@ void DBServer_PostgreSQL::initDBServer()
auto conf = uniset_conf();
if( conf->getDBServer() == UniSetTypes::DefaultObjectId )
if( conf->getDBServer() == uniset::DefaultObjectId )
{
ostringstream msg;
msg << myname << "(init): DBServer OFF for this node.."
......@@ -330,8 +330,8 @@ void DBServer_PostgreSQL::initDBServer()
std::string sfactor = conf->getArg2Param("--" + prefix + "-ibuf-overflow-cleanfactor", it.getProp("ibufOverflowCleanFactor"), "0.5");
ibufOverflowCleanFactor = atof(sfactor.c_str());
tblMap[UniSetTypes::Message::SensorInfo] = "main_history";
tblMap[UniSetTypes::Message::Confirm] = "main_history";
tblMap[uniset::Message::SensorInfo] = "main_history";
tblMap[uniset::Message::Confirm] = "main_history";
PingTime = conf->getArgPInt("--" + prefix + "-pingTime", it.getProp("pingTime"), 15000);
ReconnectTime = conf->getArgPInt("--" + prefix + "-reconnectTime", it.getProp("reconnectTime"), 30000);
......@@ -402,7 +402,7 @@ void DBServer_PostgreSQL::createTables( std::shared_ptr<PostgreSQLInterface>& db
}
}
//--------------------------------------------------------------------------------------------
void DBServer_PostgreSQL::timerInfo( const UniSetTypes::TimerMessage* tm )
void DBServer_PostgreSQL::timerInfo( const uniset::TimerMessage* tm )
{
DBServer::timerInfo(tm);
......@@ -488,7 +488,7 @@ std::shared_ptr<DBServer_PostgreSQL> DBServer_PostgreSQL::init_dbserver( int arg
{
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(DBServer_PostgreSQL): Unknown ObjectID for '" << name << endl;
return 0;
......
......@@ -22,6 +22,9 @@
#include "UniSetTypes.h"
#include "PostgreSQLInterface.h"
#include "DBServer.h"
// -------------------------------------------------------------------------
namespace uniset
{
//------------------------------------------------------------------------------------------
/*!
* \brief The DBServer_PostgreSQL class
......@@ -52,7 +55,7 @@ class DBServer_PostgreSQL:
public DBServer
{
public:
DBServer_PostgreSQL( UniSetTypes::ObjectId id, const std::string& prefix );
DBServer_PostgreSQL( uniset::ObjectId id, const std::string& prefix );
DBServer_PostgreSQL();
virtual ~DBServer_PostgreSQL();
......@@ -78,10 +81,10 @@ class DBServer_PostgreSQL:
virtual void initDB( std::shared_ptr<PostgreSQLInterface>& db ) {};
virtual void initDBTableMap(DBTableMap& tblMap) {};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void confirmInfo( const uniset::ConfirmMessage* cmsg ) override;
virtual void sigterm( int signo ) override;
bool writeToBase( const string& query );
......@@ -131,5 +134,7 @@ class DBServer_PostgreSQL:
DBTableMap tblMap;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
//------------------------------------------------------------------------------------------
#endif
......@@ -20,7 +20,7 @@
#include "PostgreSQLInterface.h"
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
using namespace pqxx;
// --------------------------------------------------------------------------
......
......@@ -25,6 +25,9 @@
#include <pqxx/pqxx>
#include <PassiveTimer.h>
#include <DBInterface.h>
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------
class PostgreSQLInterface:
public DBNetInterface
......@@ -67,6 +70,8 @@ class PostgreSQLInterface:
std::string lastE;
double last_inserted_id;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------
#endif
// ----------------------------------------------------------------------------------
......@@ -3,7 +3,7 @@
#include "UniSetActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......@@ -26,7 +26,7 @@ int main(int argc, char** argv)
act->add(dbs);
act->run(false);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(DBServer_PosgreSQL::main): " << ex << endl;
}
......
......@@ -3,7 +3,7 @@
#include "Exceptions.h"
#include "PostgreSQLInterface.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......@@ -101,7 +101,7 @@ int main(int argc, char** argv)
db.close();
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(test): " << ex << endl;
}
......
......@@ -31,7 +31,7 @@
#include "UniXML.h"
#include "DBLogSugar.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
DBServer_SQLite::DBServer_SQLite( ObjectId id, const std::string& prefix ):
......@@ -64,7 +64,7 @@ DBServer_SQLite::~DBServer_SQLite()
db->close();
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::sysCommand( const UniSetTypes::SystemMessage* sm )
void DBServer_SQLite::sysCommand( const uniset::SystemMessage* sm )
{
DBServer::sysCommand(sm);
......@@ -92,7 +92,7 @@ void DBServer_SQLite::sysCommand( const UniSetTypes::SystemMessage* sm )
}
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
void DBServer_SQLite::confirmInfo( const uniset::ConfirmMessage* cem )
{
try
{
......@@ -112,7 +112,7 @@ void DBServer_SQLite::confirmInfo( const UniSetTypes::ConfirmMessage* cem )
dbcrit << myname << "(update_confirm): db error: " << db->error() << endl;
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(update_confirm): " << ex << endl;
}
......@@ -177,7 +177,7 @@ void DBServer_SQLite::flushBuffer()
}
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::sensorInfo( const UniSetTypes::SensorMessage* si )
void DBServer_SQLite::sensorInfo( const uniset::SensorMessage* si )
{
try
{
......@@ -213,7 +213,7 @@ void DBServer_SQLite::sensorInfo( const UniSetTypes::SensorMessage* si )
dbcrit << myname << "(insert) sensor msg error: " << db->error() << endl;
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dbcrit << myname << "(insert_main_history): " << ex << endl;
}
......@@ -237,7 +237,7 @@ void DBServer_SQLite::initDBServer()
auto conf = uniset_conf();
if( conf->getDBServer() == UniSetTypes::DefaultObjectId )
if( conf->getDBServer() == uniset::DefaultObjectId )
{
ostringstream msg;
msg << myname << "(init): DBServer OFF for this node.."
......@@ -256,8 +256,8 @@ void DBServer_SQLite::initDBServer()
dbinfo << myname << "(init): init connection.." << endl;
string dbfile(conf->getProp(node, "dbfile"));
tblMap[UniSetTypes::Message::SensorInfo] = "main_history";
tblMap[UniSetTypes::Message::Confirm] = "main_history";
tblMap[uniset::Message::SensorInfo] = "main_history";
tblMap[uniset::Message::Confirm] = "main_history";
PingTime = conf->getIntProp(node, "pingTime");
ReconnectTime = conf->getIntProp(node, "reconnectTime");
......@@ -324,7 +324,7 @@ void DBServer_SQLite::createTables( SQLiteInterface* db )
}
}
//--------------------------------------------------------------------------------------------
void DBServer_SQLite::timerInfo( const UniSetTypes::TimerMessage* tm )
void DBServer_SQLite::timerInfo( const uniset::TimerMessage* tm )
{
DBServer::timerInfo(tm);
......@@ -388,7 +388,7 @@ std::shared_ptr<DBServer_SQLite> DBServer_SQLite::init_dbserver( int argc, const
{
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(DBServer_SQLite): Unknown ObjectID for '" << name << endl;
return 0;
......
......@@ -26,6 +26,9 @@
#include "UniSetTypes.h"
#include "SQLiteInterface.h"
#include "DBServer.h"
// -------------------------------------------------------------------------
namespace uniset
{
//------------------------------------------------------------------------------------------
/*!
\page page_DBServer_SQLite (DBServer_SQLite) Реализация сервиса ведения БД на основе SQLite
......@@ -135,7 +138,7 @@ class DBServer_SQLite:
public DBServer
{
public:
DBServer_SQLite( UniSetTypes::ObjectId id, const std::string& prefix );
DBServer_SQLite( uniset::ObjectId id, const std::string& prefix );
explicit DBServer_SQLite( const std::string& prefix );
virtual ~DBServer_SQLite();
......@@ -161,10 +164,10 @@ class DBServer_SQLite:
virtual void initDB( std::shared_ptr<SQLiteInterface>& db ) {};
virtual void initDBTableMap(DBTableMap& tblMap) {};
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void confirmInfo( const UniSetTypes::ConfirmMessage* cmsg ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void confirmInfo( const uniset::ConfirmMessage* cmsg ) override;
bool writeToBase( const string& query );
void createTables( SQLiteInterface* db );
......@@ -196,11 +199,13 @@ class DBServer_SQLite:
bool lastRemove;
void flushBuffer();
UniSetTypes::uniset_rwmutex mqbuf;
uniset::uniset_rwmutex mqbuf;
private:
DBTableMap tblMap;
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
//------------------------------------------------------------------------------------------
#endif
......@@ -24,7 +24,7 @@
#include "SQLiteInterface.h"
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// --------------------------------------------------------------------------
SQLiteInterface::SQLiteInterface():
......@@ -76,7 +76,7 @@ bool SQLiteInterface::connect( const std::string& param )
bool SQLiteInterface::connect( const string& dbfile, bool create )
{
// т.к. sqlite3 по умолчанию, создаёт файл при открытии, то проверим "сами"
// if( !create && !UniSetTypes::file_exist(dbfile) )
// if( !create && !uniset::file_exist(dbfile) )
// return false;
int flags = create ? 0 : SQLITE_OPEN_READWRITE;
......
......@@ -28,6 +28,9 @@
#include <sqlite3.h>
#include "PassiveTimer.h"
#include <DBInterface.h>
// -------------------------------------------------------------------------
namespace uniset
{
// ----------------------------------------------------------------------------
/*! \page SQLiteIntarface Интерфейс к SQLite
......@@ -135,7 +138,8 @@ class SQLiteInterface:
timeout_t opTimeout;
timeout_t opCheckPause;
};
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// ----------------------------------------------------------------------------
#endif
// ----------------------------------------------------------------------------------
......@@ -3,7 +3,7 @@
#include "UniSetActivator.h"
#include "Debug.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......
......@@ -3,7 +3,7 @@
#include "Exceptions.h"
#include "SQLiteInterface.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char** argv)
......
......@@ -19,7 +19,7 @@
#include <cstring>
#include "ComediInterface.h"
// -----------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// -----------------------------------------------------------------------------
ComediInterface::ComediInterface( const std::string& dev ):
......@@ -42,7 +42,7 @@ ComediInterface::~ComediInterface()
}
// -----------------------------------------------------------------------------
int ComediInterface::getAnalogChannel( int subdev, int channel, int range, int aref )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
lsampl_t data = 0;
int ret = comedi_data_read(card, subdev, channel, range, aref, &data);
......@@ -61,7 +61,7 @@ throw(UniSetTypes::Exception)
}
// -----------------------------------------------------------------------------
void ComediInterface::setAnalogChannel( int subdev, int channel, int data, int range, int aref )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
if( comedi_data_write(card, subdev, channel, range, aref, data) < 0 )
{
......@@ -74,7 +74,7 @@ throw(UniSetTypes::Exception)
}
}
// -----------------------------------------------------------------------------
bool ComediInterface::getDigitalChannel( int subdev, int channel ) throw(UniSetTypes::Exception)
bool ComediInterface::getDigitalChannel( int subdev, int channel ) throw(uniset::Exception)
{
lsampl_t data = 0;
......@@ -90,7 +90,7 @@ bool ComediInterface::getDigitalChannel( int subdev, int channel ) throw(UniSetT
}
// -----------------------------------------------------------------------------
void ComediInterface::setDigitalChannel( int subdev, int channel, bool bit )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
if( comedi_dio_write(card, subdev, channel, bit) < 0 )
{
......@@ -103,7 +103,7 @@ throw(UniSetTypes::Exception)
// -----------------------------------------------------------------------------
void ComediInterface::configureChannel( int subdev, int channel, ChannelType t,
int range, int aref )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
switch( t )
{
......@@ -162,7 +162,7 @@ throw(UniSetTypes::Exception)
}
// -----------------------------------------------------------------------------
void ComediInterface::configureSubdev( int subdev, SubdevType type )
throw(UniSetTypes::Exception)
throw(uniset::Exception)
{
lsampl_t data[2];
comedi_insn insn;
......
......@@ -20,6 +20,9 @@
#include <string>
#include <comedilib.h>
#include "Exceptions.h"
//--------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*! Интерфейс для работы с в/в */
class ComediInterface
......@@ -29,16 +32,16 @@ class ComediInterface
~ComediInterface();
int getAnalogChannel( int subdev, int channel, int range = 0, int aref = AREF_GROUND )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
void setAnalogChannel( int subdev, int channel, int data, int range = 0, int aref = AREF_GROUND )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
bool getDigitalChannel( int subdev, int channel )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
void setDigitalChannel( int subdev, int channel, bool bit )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
// Конфигурирование входов / выходов
......@@ -62,10 +65,10 @@ class ComediInterface
static std::string type2str( SubdevType t );
static SubdevType str2type( const std::string& s );
void configureSubdev( int subdev, SubdevType type ) throw(UniSetTypes::Exception);
void configureSubdev( int subdev, SubdevType type ) throw(uniset::Exception);
void configureChannel( int subdev, int channel, ChannelType type, int range = 0, int aref = 0 )
throw(UniSetTypes::Exception);
throw(uniset::Exception);
inline const std::string devname()
{
......@@ -79,6 +82,8 @@ class ComediInterface
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // ComediInterface_H_
// -----------------------------------------------------------------------------
......
......@@ -21,9 +21,11 @@
#include "IOControl.h"
#include "IOLogSugar.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace extensions;
// -----------------------------------------------------------------------------
std::ostream& operator<<( std::ostream& os, IOControl::IOInfo& inf )
{
......@@ -39,7 +41,7 @@ std::ostream& operator<<( std::ostream& os, IOControl::IOInfo& inf )
}
// -----------------------------------------------------------------------------
IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
IOControl::IOControl(uniset::ObjectId id, uniset::ObjectId icID,
const std::shared_ptr<SharedMemory>& ic, int numcards, const std::string& prefix_ ):
UniSetObject(id),
polltime(150),
......@@ -53,16 +55,16 @@ IOControl::IOControl(UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
blink_state(true),
blink2_state(true),
blink3_state(true),
testLamp_s(UniSetTypes::DefaultObjectId),
testLamp_s(uniset::DefaultObjectId),
isTestLamp(false),
sidHeartBeat(UniSetTypes::DefaultObjectId),
sidHeartBeat(uniset::DefaultObjectId),
force(false),
force_out(false),
maxCardNum(10),
activated(false),
readconf_ok(false),
term(false),
testMode_as(UniSetTypes::DefaultObjectId),
testMode_as(uniset::DefaultObjectId),
testmode(tmNone),
prev_testmode(tmNone)
{
......@@ -435,7 +437,7 @@ void IOControl::execute()
ptHeartBeat.reset();
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
iolog3 << myname << "(execute): " << ex << endl;
}
......@@ -690,7 +692,7 @@ void IOControl::ioread( IOInfo* it )
{
iolog3 << myname << "(iopoll): (BadRange)..." << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
iolog3 << myname << "(iopoll): " << ex << endl;
}
......@@ -724,7 +726,7 @@ void IOControl::readConfiguration()
for( ; it.getCurrent(); it.goNext() )
{
if( UniSetTypes::check_filter(it, s_field, s_fvalue) )
if( uniset::check_filter(it, s_field, s_fvalue) )
initIOItem(it);
}
......@@ -733,7 +735,7 @@ void IOControl::readConfiguration()
// ------------------------------------------------------------------------------------------
bool IOControl::readItem( const std::shared_ptr<UniXML>& xml, UniXML::iterator& it, xmlNode* sec )
{
if( UniSetTypes::check_filter(it, s_field, s_fvalue) )
if( uniset::check_filter(it, s_field, s_fvalue) )
initIOItem(it);
return true;
......@@ -938,7 +940,7 @@ void IOControl::initOutputs()
else if( it.stype == UniversalIO::AO )
card->setAnalogChannel(it.subdev, it.channel, it.defval, it.range, it.aref);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
iolog3 << myname << "(initOutput): " << ex << endl;
}
......@@ -979,7 +981,7 @@ void IOControl::initIOCard()
card->configureChannel(it.subdev, it.channel, ComediInterface::AO);
}
catch( const UniSetTypes::Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(initIOCard): sid=" << it.si.id << " " << ex << endl;
}
......@@ -1005,7 +1007,7 @@ void IOControl::blink( BlinkList& lst, bool& bstate )
{
card->setDigitalChannel(io->subdev, io->channel, bstate);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(blink): " << ex << endl;
}
......@@ -1091,7 +1093,7 @@ void IOControl::check_testmode()
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;
}
......@@ -1100,7 +1102,7 @@ void IOControl::check_testmode()
}
}
catch( const UniSetTypes::Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(check_testmode): " << ex << endl;
}
......@@ -1165,7 +1167,7 @@ void IOControl::check_testlamp()
}
}
}
catch( const UniSetTypes::Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(check_testlamp): " << ex << endl;
}
......@@ -1177,7 +1179,7 @@ void IOControl::check_testlamp()
// -----------------------------------------------------------------------------
std::shared_ptr<IOControl> IOControl::init_iocontrol(int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......@@ -1191,7 +1193,7 @@ std::shared_ptr<IOControl> IOControl::init_iocontrol(int argc, const char* const
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(iocontrol): Unknown ID for " << name
<< "' Not found in <objects>" << endl;
......@@ -1369,7 +1371,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
if( testLamp_s != DefaultObjectId )
shm->askSensor(testLamp_s, cmd);
}
catch( const UniSetTypes::Exception& ex)
catch( const uniset::Exception& ex)
{
iocrit << myname << "(askSensors): " << ex << endl;
}
......@@ -1379,7 +1381,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
if( testMode_as != DefaultObjectId )
shm->askSensor(testMode_as, cmd);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(askSensors): " << ex << endl;
}
......@@ -1400,7 +1402,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
{
shm->askSensor(it.si.id, cmd, myid);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(askSensors): " << ex << endl;
}
......@@ -1408,7 +1410,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
}
}
// -----------------------------------------------------------------------------
void IOControl::sensorInfo( const UniSetTypes::SensorMessage* sm )
void IOControl::sensorInfo( const uniset::SensorMessage* sm )
{
iolog1 << myname << "(sensorInfo): sm->id=" << sm->id
<< " val=" << sm->value << endl;
......@@ -1545,7 +1547,7 @@ void IOControl::sensorInfo( const UniSetTypes::SensorMessage* sm )
}
}
// -----------------------------------------------------------------------------
void IOControl::timerInfo( const UniSetTypes::TimerMessage* tm )
void IOControl::timerInfo( const uniset::TimerMessage* tm )
{
}
......@@ -1682,7 +1684,7 @@ void IOControl::buildCardsList()
cards[cardnum] = new ComediInterface(iodev);
noCards = false;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
iocrit << myname << "(buildCardsList): " << ex << endl;
throw;
......@@ -1746,3 +1748,4 @@ void IOControl::buildCardsList()
}
}
// -----------------------------------------------------------------------------
} // end of namespace uniset
......@@ -39,6 +39,9 @@
#include "LogServer.h"
#include "DebugStream.h"
#include "LogAgregator.h"
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*!
\page page_IOControl (IOControl) Реализация процесса ввода/вывода
......@@ -144,11 +147,11 @@
<br>&nbsp;&nbsp; J2
<br>\b lamp - признак, что данный аналоговый датчик является "лампочкой".
<br> Т.е. на самом деле дискретный выход, который может иметь состояния:
<br>UniSetTypes::lmpOFF - выключен
<br>UniSetTypes::lmpON - включен
<br>UniSetTypes::lmpBLINK - мигание с частотой 1
<br>UniSetTypes::lmpBLINK2 - мигание с частотой 2
<br>UniSetTypes::lmpBLINK3 - мигание с частотой 3
<br>uniset::lmpOFF - выключен
<br>uniset::lmpON - включен
<br>uniset::lmpBLINK - мигание с частотой 1
<br>uniset::lmpBLINK2 - мигание с частотой 2
<br>uniset::lmpBLINK3 - мигание с частотой 3
<br>\b no_iotestlamp - игнорировать данную лампочку при тесте ламп.
<br>\b range - диапазон измерения аналогового входа (см. libcomedi)
......@@ -223,12 +226,12 @@ class IOControl:
public UniSetObject
{
public:
IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& shm = nullptr, int numcards = 2, const std::string& prefix = "io" );
IOControl( uniset::ObjectId id, uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& shm = nullptr, int numcards = 2, const std::string& prefix = "io" );
virtual ~IOControl();
/*! глобальная функция для инициализации объекта */
static std::shared_ptr<IOControl> init_iocontrol( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic = nullptr,
uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "io" );
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
......@@ -314,10 +317,10 @@ class IOControl:
void blink();
// действия при завершении работы
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void sigterm( int signo ) override;
virtual bool activateObject() override;
......@@ -356,7 +359,7 @@ class IOControl:
std::string s_fvalue;
std::shared_ptr<SMInterface> shm;
UniSetTypes::ObjectId myid = { UniSetTypes::DefaultObjectId };
uniset::ObjectId myid = { uniset::DefaultObjectId };
std::string prefix;
typedef std::list<IOInfo*> BlinkList;
......@@ -380,13 +383,13 @@ class IOControl:
PassiveTimer ptBlink3;
bool blink3_state = { false };
UniSetTypes::ObjectId testLamp_s = { UniSetTypes::DefaultObjectId };
uniset::ObjectId testLamp_s = { uniset::DefaultObjectId };
Trigger trTestLamp;
bool isTestLamp = { false };
IOController::IOStateList::iterator itTestLamp;
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat;
uniset::ObjectId sidHeartBeat;
int maxHeartBeat = { 10 };
IOController::IOStateList::iterator itHeartBeat;
......@@ -400,10 +403,10 @@ class IOControl:
std::atomic_bool activated = { false };
bool readconf_ok = { false };
int activateTimeout;
UniSetTypes::ObjectId sidTestSMReady = { UniSetTypes::DefaultObjectId };
uniset::ObjectId sidTestSMReady = { uniset::DefaultObjectId };
std::atomic_bool term = { false };
UniSetTypes::ObjectId testMode_as = { UniSetTypes::DefaultObjectId };
uniset::ObjectId testMode_as = { uniset::DefaultObjectId };
IOController::IOStateList::iterator itTestMode;
long testmode = { false };
long prev_testmode = { false };
......@@ -416,6 +419,8 @@ class IOControl:
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // IOControl_H_
// -----------------------------------------------------------------------------
......@@ -33,7 +33,7 @@
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
struct equals
{
......
......@@ -21,9 +21,9 @@
#include "IOControl.h"
#include "Extensions.h"
// --------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// --------------------------------------------------------------------------
int main(int argc, const char** argv)
{
......
......@@ -17,6 +17,9 @@
#include <sstream>
#include <iostream>
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
// -------------------------------------------------------------------------
......@@ -117,3 +120,4 @@ void Element::delInput(size_t num )
}
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -22,14 +22,17 @@
#include <list>
#include <ostream>
#include "Exceptions.h"
//--------------------------------------------------------------------------
namespace uniset
{
// --------------------------------------------------------------------------
class LogicException:
public UniSetTypes::Exception
public uniset::Exception
{
public:
LogicException(): UniSetTypes::Exception("LogicException") {}
explicit LogicException( const std::string& err): UniSetTypes::Exception(err) {}
LogicException(): uniset::Exception("LogicException") {}
explicit LogicException( const std::string& err): uniset::Exception(err) {}
};
......@@ -212,6 +215,7 @@ class TNOT:
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -22,8 +22,8 @@
#include "LProcessor.h"
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
LProcessor::LProcessor( const std::string& name ):
logname(name)
......@@ -74,7 +74,7 @@ void LProcessor::execute( const std::string& lfile )
{
dcrit << logname << "(execute): " << ex << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << logname << "(execute): " << ex << endl;
}
......@@ -104,7 +104,7 @@ void LProcessor::build( const string& lfile )
// считая, что в поле name записано название датчика
for( auto it = sch->extBegin(); it != sch->extEnd(); ++it )
{
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
uniset::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
......@@ -130,7 +130,7 @@ void LProcessor::build( const string& lfile )
for( auto it = sch->outBegin(); it != sch->outEnd(); ++it )
{
UniSetTypes::ObjectId sid = conf->getSensorID(it->name);
uniset::ObjectId sid = conf->getSensorID(it->name);
if( sid == DefaultObjectId )
{
......@@ -192,7 +192,7 @@ void LProcessor::setOuts()
{
ui.setValue(it.sid, it.el->getOut(), DefaultObjectId);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << "(LProcessor::setOuts): " << ex << endl;
}
......
......@@ -108,6 +108,9 @@
#include "Element.h"
#include "Schema.h"
// --------------------------------------------------------------------------
namespace uniset
{
// --------------------------------------------------------------------------
class LProcessor
{
public:
......@@ -150,7 +153,7 @@ class LProcessor
struct EXTInfo
{
UniSetTypes::ObjectId sid;
uniset::ObjectId sid;
UniversalIO::IOType iotype;
bool state;
std::shared_ptr<Element> el;
......@@ -159,7 +162,7 @@ class LProcessor
struct EXTOutInfo
{
UniSetTypes::ObjectId sid;
uniset::ObjectId sid;
UniversalIO::IOType iotype;
std::shared_ptr<Element> el;
};
......@@ -184,5 +187,7 @@ class LProcessor
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -19,11 +19,11 @@
#include "PassiveLProcessor.h"
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
PassiveLProcessor::PassiveLProcessor( UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
PassiveLProcessor::PassiveLProcessor( uniset::ObjectId objId,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic, const std::string& prefix ):
UniSetObject(objId),
shm(nullptr)
{
......@@ -88,7 +88,7 @@ void PassiveLProcessor::step()
{
LProcessor::step();
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(step): (hb) " << ex << std::endl;
}
......@@ -100,7 +100,7 @@ void PassiveLProcessor::step()
shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset();
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(step): (hb) " << ex << std::endl;
}
......@@ -120,14 +120,14 @@ void PassiveLProcessor::askSensors( UniversalIO::UIOCommand cmd )
for( auto& it : extInputs )
shm->askSensor(it.sid, cmd);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(askSensors): " << ex << endl;
throw SystemError(myname + "(askSensors): do not ask sensors" );
}
}
// -------------------------------------------------------------------------
void PassiveLProcessor::sensorInfo( const UniSetTypes::SensorMessage* sm )
void PassiveLProcessor::sensorInfo( const uniset::SensorMessage* sm )
{
for( auto& it : extInputs )
{
......@@ -136,13 +136,13 @@ void PassiveLProcessor::sensorInfo( const UniSetTypes::SensorMessage* sm )
}
}
// -------------------------------------------------------------------------
void PassiveLProcessor::timerInfo( const UniSetTypes::TimerMessage* tm )
void PassiveLProcessor::timerInfo( const uniset::TimerMessage* tm )
{
if( tm->id == tidStep )
step();
}
// -------------------------------------------------------------------------
void PassiveLProcessor::sysCommand( const UniSetTypes::SystemMessage* sm )
void PassiveLProcessor::sysCommand( const uniset::SystemMessage* sm )
{
switch( sm->command )
{
......@@ -236,7 +236,7 @@ void PassiveLProcessor::setOuts()
{
shm->setValue( it.sid, it.el->getOut() );
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(setOuts): " << ex << endl;
}
......@@ -255,7 +255,7 @@ void PassiveLProcessor::sigterm( int signo )
{
shm->setValue(it.sid, 0);
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
dcrit << myname << "(sigterm): " << ex << endl;
}
......@@ -279,7 +279,7 @@ void PassiveLProcessor::help_print( int argc, const char* const* argv )
}
// -----------------------------------------------------------------------------
std::shared_ptr<PassiveLProcessor> PassiveLProcessor::init_plproc(int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......@@ -293,7 +293,7 @@ std::shared_ptr<PassiveLProcessor> PassiveLProcessor::init_plproc(int argc, cons
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(plproc): идентификатор '" << name
<< "' не найден в конф. файле!"
......
......@@ -27,6 +27,9 @@
#include "SMInterface.h"
#include "LProcessor.h"
// --------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
/*! Реализация LogicProccessor основанная на заказе датчиков */
class PassiveLProcessor:
public UniSetObject,
......@@ -34,8 +37,8 @@ class PassiveLProcessor:
{
public:
PassiveLProcessor(UniSetTypes::ObjectId objId,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "lproc" );
PassiveLProcessor(uniset::ObjectId objId,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "lproc" );
virtual ~PassiveLProcessor();
enum Timers
......@@ -46,7 +49,7 @@ class PassiveLProcessor:
static void help_print( int argc, const char* const* argv );
static std::shared_ptr<PassiveLProcessor> init_plproc( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
uniset::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr,
const std::string& prefix = "plproc" );
protected:
......@@ -56,9 +59,9 @@ class PassiveLProcessor:
virtual void getInputs();
virtual void setOuts();
void sysCommand( const UniSetTypes::SystemMessage* msg ) override;
void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
void sysCommand( const uniset::SystemMessage* msg ) override;
void sensorInfo( const uniset::SensorMessage* sm ) override;
void timerInfo( const uniset::TimerMessage* tm ) override;
void askSensors( const UniversalIO::UIOCommand cmd );
// void initOutput();
......@@ -71,10 +74,12 @@ class PassiveLProcessor:
private:
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat = { UniSetTypes::DefaultObjectId };
uniset::ObjectId sidHeartBeat = { uniset::DefaultObjectId };
int maxHeartBeat = { 10 };
IOController::IOStateList::iterator itHeartBeat;
std::mutex mutex_start;
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -18,9 +18,12 @@
#include <iostream>
#include "Extensions.h"
#include "Schema.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
Schema::Schema()
......@@ -219,3 +222,4 @@ std::shared_ptr<Element> Schema::findOut( const string& name )
return nullptr;
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -22,6 +22,9 @@
#include "Element.h"
#include "Schema.h"
// --------------------------------------------------------------------------
namespace uniset
{
// --------------------------------------------------------------------------
class Schema
{
public:
......@@ -187,5 +190,7 @@ class SchemaXML:
protected:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
......@@ -20,10 +20,12 @@
#include "Extensions.h"
#include "Schema.h"
#include "TDelay.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
SchemaXML::SchemaXML()
{
......@@ -146,3 +148,4 @@ void SchemaXML::read( const string& xmlfile )
}
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -17,9 +17,12 @@
#include <iostream>
#include "Extensions.h"
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TAND::TAND(ElementID id, size_t num, bool st):
TOR(id, num, st)
......@@ -69,3 +72,4 @@ void TAND::setIn(size_t num, bool state )
Element::setChildOut();
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -17,9 +17,12 @@
#include <iostream>
#include "Extensions.h"
#include "TDelay.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TDelay::TDelay(Element::ElementID id, timeout_t delayMS, size_t inCount):
Element(id),
......@@ -99,3 +102,4 @@ void TDelay::setDelay( timeout_t timeMS )
delay = timeMS;
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -19,6 +19,9 @@
// --------------------------------------------------------------------------
#include "PassiveTimer.h"
#include "Element.h"
// --------------------------------------------------------------------------
namespace uniset
{
// ---------------------------------------------------------------------------
// "ON" delay element
// Сбрасывается без задержки.. а срабатывает с задержкой.
......@@ -53,6 +56,8 @@ class TDelay:
private:
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// ---------------------------------------------------------------------------
#endif
// ---------------------------------------------------------------------------
......
......@@ -18,9 +18,12 @@
#include <iostream>
#include "Extensions.h"
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TNOT::TNOT( ElementID id, bool out_default ):
Element(id),
......@@ -42,3 +45,4 @@ void TNOT::setIn( size_t num, bool state )
Element::setChildOut();
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -18,9 +18,12 @@
#include <iostream>
#include "Extensions.h"
#include "Element.h"
// -----------------------------------------------------------------------------
namespace uniset
{
// -------------------------------------------------------------------------
using namespace std;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -------------------------------------------------------------------------
TOR::TOR(ElementID id, size_t num, bool st):
Element(id),
......@@ -83,3 +86,4 @@ void TOR::setIn( size_t num, bool state )
Element::setChildOut();
}
// -------------------------------------------------------------------------
} // end of namespace uniset
......@@ -20,8 +20,8 @@
#include "LProcessor.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
int main(int argc, const char** argv)
{
......@@ -58,7 +58,7 @@ int main(int argc, const char** argv)
{
cerr << ex << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << ex << endl;
}
......
......@@ -22,8 +22,8 @@
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
int main(int argc, const char** argv)
{
......@@ -95,7 +95,7 @@ int main(int argc, const char** argv)
{
cerr << ex << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << ex << endl;
}
......
......@@ -3,7 +3,7 @@
#include "NCRestorer.h"
#include "NullSM.h"
// --------------------------------------------------------------------------------
using namespace UniSetTypes;
using namespace uniset;
using namespace std;
// --------------------------------------------------------------------------------
......
......@@ -7,19 +7,19 @@
#include "NCRestorer.h"
// --------------------------------------------------------------------------
class NullSM:
public IONotifyController
public uniset::IONotifyController
{
public:
NullSM( UniSetTypes::ObjectId id, const std::string& datfile );
NullSM( uniset::ObjectId id, const std::string& datfile );
virtual ~NullSM();
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 dumpThresholdList( const UniSetTypes::ObjectId sid, const IONotifyController::ThresholdExtList& lst ) override {};
virtual void dumpOrdersList( const uniset::ObjectId sid, const IONotifyController::ConsumerListInfo& lst ) override {};
virtual void dumpThresholdList( const uniset::ObjectId sid, const IONotifyController::ThresholdExtList& lst ) override {};
private:
......
......@@ -8,7 +8,7 @@
#include "TDelay.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// -----------------------------------------------------------------------------
static shared_ptr<UInterface> ui;
......
......@@ -8,7 +8,7 @@
#include "LProcessor.h"
// --------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace uniset;
// --------------------------------------------------------------------------
int main(int argc, const char* argv[] )
{
......@@ -66,7 +66,7 @@ int main(int argc, const char* argv[] )
{
cerr << "(tests): " << err << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
cerr << "(tests): " << ex << endl;
}
......
......@@ -19,10 +19,10 @@
#include "MQTTPublisher.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
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 ):
mosquittopp(NULL),
UObject_SK(objId, cnode, string(prefix + "-")),
......@@ -79,7 +79,7 @@ MQTTPublisher::MQTTPublisher(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSet
for( ; sit.getCurrent(); sit++ )
{
if( !UniSetTypes::check_filter(sit, ff, fv) )
if( !uniset::check_filter(sit, ff, fv) )
continue;
std::string sname = sit.getProp("name");
......@@ -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,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......@@ -239,7 +239,7 @@ std::shared_ptr<MQTTPublisher> MQTTPublisher::init_mqttpublisher(int argc, const
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
dcrit << "(MQTTPublisher): Not found ID for '" << name
<< " in '" << conf->getObjectsSection() << "' section" << endl;
......@@ -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);
......
......@@ -25,6 +25,9 @@
#include "SMInterface.h"
#include "SharedMemory.h"
#include "extensions/Extensions.h"
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*!
\page page_MQTTPublisher Реализация MQTT издателя
......@@ -105,13 +108,13 @@ class MQTTPublisher:
public UObject_SK
{
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" );
virtual ~MQTTPublisher();
/*! глобальная функция для инициализации объекта */
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" );
/*! глобальная функция для вывода help-а */
......@@ -125,23 +128,23 @@ class MQTTPublisher:
MQTTPublisher();
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 bool deactivateObject() override;
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
std::shared_ptr<SMInterface> shm;
struct MQTTInfo
{
UniSetTypes::ObjectId sid;
uniset::ObjectId sid;
std::string pubname;
MQTTInfo( UniSetTypes::ObjectId id, const std::string& name ):
MQTTInfo( uniset::ObjectId id, const std::string& name ):
sid(id), pubname(name) {}
};
typedef std::unordered_map<UniSetTypes::ObjectId, MQTTInfo> MQTTMap;
typedef std::unordered_map<uniset::ObjectId, MQTTInfo> MQTTMap;
struct RangeInfo
{
......@@ -155,7 +158,7 @@ class MQTTPublisher:
struct MQTTTextInfo
{
UniSetTypes::ObjectId sid;
uniset::ObjectId sid;
std::string pubname;
UniXML::iterator xmlnode;
......@@ -169,7 +172,7 @@ class MQTTPublisher:
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;
MQTTTextMap textpublist;
......@@ -183,6 +186,8 @@ class MQTTPublisher:
int port = { 1883 };
int keepalive = { 60 };
};
// ----------------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // _MQTTPublisher_H_
// -----------------------------------------------------------------------------
......@@ -22,8 +22,8 @@
#include "Extensions.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
{
......@@ -77,7 +77,7 @@ int main( int argc, const char** argv )
act->run(false);
return 0;
}
catch( UniSetTypes::Exception& ex )
catch( uniset::Exception& ex )
{
cerr << "(mqttpublisher): " << ex << std::endl;
}
......
......@@ -23,12 +23,14 @@
#include <ORepHelpers.h>
#include "MBExchange.h"
#include "modbus/MBLogSugar.h"
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
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 ):
UniSetObject(objId),
allInitOK(false),
......@@ -48,7 +50,7 @@ MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
ic(_ic)
{
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();
mutex_start.setName(myname + "_mutex_start");
......@@ -58,7 +60,7 @@ MBExchange::MBExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId,
cnode = conf->getNode(conf_name);
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);
......@@ -319,7 +321,7 @@ void MBExchange::step()
shm->localSetValue(itHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset();
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mbcrit << myname << "(step): (hb) " << ex << std::endl;
}
......@@ -379,7 +381,7 @@ void MBExchange::readConfiguration()
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);
}
......@@ -388,7 +390,7 @@ void MBExchange::readConfiguration()
// ------------------------------------------------------------------------------------------
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);
return true;
......@@ -928,7 +930,7 @@ bool MBExchange::initSMValue( ModbusRTU::ModbusData* data, int count, RSProperty
{
mblog3 << myname << "(initSMValue): (BadRange)..." << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mblog3 << myname << "(initSMValue): " << ex << endl;
}
......@@ -1188,7 +1190,7 @@ void MBExchange::updateSM()
{
mblog3 << myname << "(updateSM): (BadRange)..." << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mblog3 << myname << "(updateSM): " << ex << endl;
}
......@@ -1236,7 +1238,7 @@ void MBExchange::updateSM()
{
mblog3 << myname << "(updateSM): (BadRange)..." << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mblog3 << myname << "(updateSM): " << ex << endl;
}
......@@ -1651,7 +1653,7 @@ void MBExchange::updateRSProperty( RSProperty* p, bool write_only )
{
mblog3 << myname << "(updateRSProperty): (BadRange)..." << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mblog3 << myname << "(updateRSProperty): " << ex << endl;
}
......@@ -1911,7 +1913,7 @@ void MBExchange::updateMTR( RegMap::iterator& rit )
{
mblog3 << myname << "(updateMTR): (BadRange)..." << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mblog3 << myname << "(updateMTR): " << ex << endl;
}
......@@ -2002,7 +2004,7 @@ void MBExchange::updateRTU188( RegMap::iterator& rit )
{
mblog3 << myname << "(updateRTU188): (BadRange)..." << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mblog3 << myname << "(updateRTU188): " << ex << endl;
}
......@@ -2136,7 +2138,7 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML::iterator& it )
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 )
{
......@@ -2158,7 +2160,7 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML::iterator& it )
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 )
{
......@@ -2216,7 +2218,7 @@ bool MBExchange::initRegInfo( std::shared_ptr<RegInfo>& r, UniXML::iterator& it,
if( !initRTU188item(it, r) )
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->mbfunc = RTUStorage::getFunction(r->rtuJack, r->rtuChan, t);
......@@ -2257,7 +2259,7 @@ bool MBExchange::initRegInfo( std::shared_ptr<RegInfo>& r, UniXML::iterator& it,
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 )
{
......@@ -2546,7 +2548,7 @@ bool MBExchange::initItem( UniXML::iterator& it )
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 )
{
......@@ -2633,7 +2635,7 @@ bool MBExchange::initRTU188item( UniXML::iterator& it, std::shared_ptr<RegInfo>&
return false;
}
p->rtuChan = UniSetTypes::uni_atoi(chan);
p->rtuChan = uniset::uni_atoi(chan);
mblog2 << myname << "(readRTU188Item): add jack='" << jack << "'"
<< " channel='" << p->rtuChan << "'" << endl;
......@@ -2784,7 +2786,7 @@ bool MBExchange::activateObject()
// см. sysCommand()
{
setProcActive(false);
UniSetTypes::uniset_rwmutex_rlock l(mutex_start);
uniset::uniset_rwmutex_rlock l(mutex_start);
UniSetObject::activateObject();
if( !shm->isLocalwork() )
......@@ -2797,7 +2799,7 @@ bool MBExchange::activateObject()
return true;
}
// ------------------------------------------------------------------------------------------
void MBExchange::sysCommand( const UniSetTypes::SystemMessage* sm )
void MBExchange::sysCommand( const uniset::SystemMessage* sm )
{
switch( sm->command )
{
......@@ -2841,7 +2843,7 @@ void MBExchange::sysCommand( const UniSetTypes::SystemMessage* sm )
mbcrit << myname << "(sysCommand): ************* don`t activate?! ************" << endl;
{
UniSetTypes::uniset_rwmutex_rlock l(mutex_start);
uniset::uniset_rwmutex_rlock l(mutex_start);
askSensors(UniversalIO::UIONotify);
initOutput();
}
......@@ -2922,7 +2924,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
if( sidExchangeMode != DefaultObjectId )
shm->askSensor(sidExchangeMode, cmd);
}
catch( UniSetTypes::Exception& ex )
catch( uniset::Exception& ex )
{
mbwarn << myname << "(askSensors): " << ex << std::endl;
}
......@@ -2940,7 +2942,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
if( d->mode_id != DefaultObjectId )
shm->askSensor(d->mode_id, cmd);
}
catch( UniSetTypes::Exception& ex )
catch( uniset::Exception& ex )
{
mbwarn << myname << "(askSensors): " << ex << std::endl;
}
......@@ -2967,7 +2969,7 @@ void MBExchange::askSensors( UniversalIO::UIOCommand cmd )
{
shm->askSensor(i->si.id, cmd);
}
catch( UniSetTypes::Exception& ex )
catch( uniset::Exception& ex )
{
mbwarn << myname << "(askSensors): " << ex << std::endl;
}
......@@ -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 )
{
......@@ -3223,7 +3225,7 @@ void MBExchange::updateRespondSensors()
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;
}
......@@ -3251,7 +3253,7 @@ void MBExchange::execute()
{
step();
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mbcrit << myname << "(execute): " << ex << std::endl;
}
......@@ -3284,9 +3286,9 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::ExchangeMode& em )
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;
......@@ -3324,3 +3326,4 @@ std::string MBExchange::RTUDevice::getShortInfo() const
return std::move( s.str() );
}
// ----------------------------------------------------------------------------
} // end of namespace uniset
......@@ -45,6 +45,9 @@
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#endif
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*!
\par Базовый класс для реализация обмена по протоколу Modbus [RTU|TCP].
......@@ -53,7 +56,7 @@ class MBExchange:
public UniSetObject
{
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" );
virtual ~MBExchange();
......@@ -177,13 +180,13 @@ class MBExchange:
RTUDevice():
mbaddr(0),
dtype(dtUnknown),
resp_id(UniSetTypes::DefaultObjectId),
resp_id(uniset::DefaultObjectId),
resp_state(false),
resp_invert(false),
numreply(0),
prev_numreply(0),
ask_every_reg(false),
mode_id(UniSetTypes::DefaultObjectId),
mode_id(uniset::DefaultObjectId),
mode(emNone),
speed(ComPort::ComSpeed38400),
rtu188(0)
......@@ -196,7 +199,7 @@ class MBExchange:
DeviceType dtype; /*!< тип устройства */
// resp - respond..(контроль наличия связи)
UniSetTypes::ObjectId resp_id;
uniset::ObjectId resp_id;
IOController::IOStateList::iterator resp_it;
DelayTimer resp_Delay; // таймер для формирования задержки на отпускание (пропадание связи)
PassiveTimer resp_ptInit; // таймер для формирования задержки на инициализацию связи (задержка на выставление датчика связи после запуска)
......@@ -211,7 +214,7 @@ class MBExchange:
bool ask_every_reg; /*!< опрашивать ли каждый регистр, независимо от результата опроса предыдущего. По умолчанию false - прервать опрос при первом же timeout */
// режим работы
UniSetTypes::ObjectId mode_id;
uniset::ObjectId mode_id;
IOController::IOStateList::iterator mode_it;
long mode; // режим работы с устройством (см. ExchangeMode)
......@@ -249,13 +252,13 @@ class MBExchange:
return mblog;
}
virtual UniSetTypes::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
protected:
virtual void step();
virtual void sysCommand( const UniSetTypes::SystemMessage* msg ) override;
virtual void sensorInfo( const UniSetTypes::SensorMessage* sm ) override;
virtual void timerInfo( const UniSetTypes::TimerMessage* tm ) override;
virtual void sysCommand( const uniset::SystemMessage* msg ) override;
virtual void sensorInfo( const uniset::SensorMessage* sm ) override;
virtual void timerInfo( const uniset::TimerMessage* tm ) override;
virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void initOutput();
virtual void sigterm( int signo ) override;
......@@ -286,7 +289,7 @@ class MBExchange:
RTUDeviceMap devices;
InitList initRegList; /*!< список регистров для инициализации */
// UniSetTypes::uniset_rwmutex pollMutex;
// uniset::uniset_rwmutex pollMutex;
virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) = 0;
......@@ -335,7 +338,7 @@ class MBExchange:
std::shared_ptr<SMInterface> shm;
timeout_t initPause = { 3000 };
UniSetTypes::uniset_rwmutex mutex_start;
uniset::uniset_rwmutex mutex_start;
bool force = { false }; /*!< флаг означающий, что надо сохранять в SM, даже если значение не менялось */
bool force_out = { false }; /*!< флаг означающий, принудительного чтения выходов */
......@@ -345,12 +348,12 @@ class MBExchange:
size_t maxQueryCount = { ModbusRTU::MAXDATALEN }; /*!< максимальное количество регистров для одного запроса */
PassiveTimer ptHeartBeat;
UniSetTypes::ObjectId sidHeartBeat = { UniSetTypes::DefaultObjectId };
uniset::ObjectId sidHeartBeat = { uniset::DefaultObjectId };
long maxHeartBeat = { 10 };
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;
long exchangeMode = {emNone}; /*!< режим работы см. ExchangeMode */
......@@ -405,6 +408,8 @@ class MBExchange:
MBExchange();
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // _MBExchange_H_
// -----------------------------------------------------------------------------
......@@ -23,16 +23,16 @@
#include "modbus/MBLogSugar.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
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 ):
MBExchange(objId, shmId, ic, prefix),
force_disconnect(true)
{
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();
......@@ -47,13 +47,13 @@ MBTCPMaster::MBTCPMaster(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI
iaddr = conf->getArgParam(pname, it.getProp("gateway_iaddr"));
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");
port = conf->getArgInt(tmp, it.getProp("gateway_port"));
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;
......@@ -127,7 +127,7 @@ std::shared_ptr<ModbusClient> MBTCPMaster::initMB( bool reopen )
return mbtcp;
}
// -----------------------------------------------------------------------------
void MBTCPMaster::sysCommand( const UniSetTypes::SystemMessage* sm )
void MBTCPMaster::sysCommand( const uniset::SystemMessage* sm )
{
MBExchange::sysCommand(sm);
......@@ -145,7 +145,7 @@ void MBTCPMaster::poll_thread()
// ждём начала работы..(см. MBExchange::activateObject)
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 )
}
// -----------------------------------------------------------------------------
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 )
{
auto conf = uniset_conf();
......@@ -246,7 +246,7 @@ std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* co
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
dcrit << "(MBTCPMaster): идентификатор '" << name
<< "' не найден в конф. файле!"
......@@ -258,9 +258,9 @@ std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* co
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;
......
......@@ -24,6 +24,9 @@
#include <memory>
#include "MBExchange.h"
#include "modbus/ModbusTCPMaster.h"
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*!
\page page_ModbusTCP Реализация ModbusTCP master
......@@ -219,22 +222,22 @@ class MBTCPMaster:
public MBExchange
{
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" );
virtual ~MBTCPMaster();
/*! глобальная функция для инициализации объекта */
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" );
/*! глобальная функция для вывода help-а */
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:
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 void sigterm( int signo ) override;
virtual bool deactivateObject() override;
......@@ -255,6 +258,8 @@ class MBTCPMaster:
// делаем опрос в отдельном потоке
std::shared_ptr<ThreadCreator<MBTCPMaster>> pollThread; /*!< поток опроса */
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // _MBTCPMaster_H_
// -----------------------------------------------------------------------------
......@@ -24,16 +24,16 @@
#include "modbus/MBLogSugar.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
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 ):
MBExchange(objId, shmId, ic, prefix),
force_disconnect(true)
{
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();
......@@ -59,7 +59,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err;
err << myname << "(init): not found <GateList>";
mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
throw uniset::SystemError(err.str());
}
if( !it1.goChildren() )
......@@ -67,7 +67,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err;
err << myname << "(init): empty <GateList> ?!";
mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
throw uniset::SystemError(err.str());
}
for( ; it1.getCurrent(); it1++ )
......@@ -87,7 +87,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err;
err << myname << "(init): ip='' in <GateList>";
mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
throw uniset::SystemError(err.str());
}
sinf->port = it1.getIntProp("port");
......@@ -97,7 +97,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err;
err << myname << "(init): ERROR: port=''" << sinf->port << " for ip='" << sinf->ip << "' in <GateList>";
mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
throw uniset::SystemError(err.str());
}
if( !it1.getProp("respondSensor").empty() )
......@@ -109,7 +109,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
ostringstream err;
err << myname << "(init): ERROR: Unknown SensorID for '" << it1.getProp("respondSensor") << "' in <GateList>";
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
ostringstream err;
err << myname << "(init): empty <GateList>!";
mbcrit << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
throw uniset::SystemError(err.str());
}
mblist.sort();
......@@ -430,7 +430,7 @@ bool MBTCPMultiMaster::MBSlaveInfo::init( std::shared_ptr<DebugStream>& mblog )
return initOK;
}
// -----------------------------------------------------------------------------
void MBTCPMultiMaster::sysCommand( const UniSetTypes::SystemMessage* sm )
void MBTCPMultiMaster::sysCommand( const uniset::SystemMessage* sm )
{
MBExchange::sysCommand(sm);
......@@ -450,7 +450,7 @@ void MBTCPMultiMaster::poll_thread()
// ждём начала работы..(см. MBExchange::activateObject)
while( !checkProcActive() )
{
UniSetTypes::uniset_rwmutex_rlock l(mutex_start);
uniset::uniset_rwmutex_rlock l(mutex_start);
}
// работаем..
......@@ -520,7 +520,7 @@ void MBTCPMultiMaster::check_thread()
it->respond_init = true;
}
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
mbcrit << myname << "(check): (respond) " << it->myname << " : " << ex << std::endl;
}
......@@ -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,
UniSetTypes::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
uniset::ObjectId icID, const std::shared_ptr<SharedMemory>& ic,
const std::string& prefix )
{
auto conf = uniset_conf();
......@@ -732,7 +732,7 @@ std::shared_ptr<MBTCPMultiMaster> MBTCPMultiMaster::init_mbmaster( int argc, con
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
dcrit << "(MBTCPMultiMaster): идентификатор '" << name
<< "' не найден в конф. файле!"
......@@ -761,9 +761,9 @@ const std::string MBTCPMultiMaster::MBSlaveInfo::getShortInfo() const
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;
......
......@@ -23,6 +23,9 @@
#include <vector>
#include "MBExchange.h"
#include "modbus/ModbusTCPMaster.h"
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
/*!
\page page_ModbusTCPMulti Реализация ModbusTCP 'multi' master
......@@ -283,22 +286,22 @@ class MBTCPMultiMaster:
public MBExchange
{
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" );
virtual ~MBTCPMultiMaster();
/*! глобальная функция для инициализации объекта */
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" );
/*! глобальная функция для вывода help-а */
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:
virtual void sysCommand( const UniSetTypes::SystemMessage* sm ) override;
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
virtual void initIterators() override;
virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) override;
virtual void sigterm( int signo ) override;
......@@ -309,7 +312,7 @@ class MBTCPMultiMaster:
void check_thread();
void final_thread();
UniSetTypes::uniset_rwmutex mbMutex;
uniset::uniset_rwmutex mbMutex;
bool force_disconnect;
timeout_t checktime;
......@@ -319,7 +322,7 @@ class MBTCPMultiMaster:
struct MBSlaveInfo
{
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),
force_disconnect(true),
myname(""), use(false), initOK(false), ignore(false) {}
......@@ -335,7 +338,7 @@ class MBTCPMultiMaster:
ModbusRTU::ModbusData checkReg = { 0 };
bool respond;
UniSetTypes::ObjectId respond_id;
uniset::ObjectId respond_id;
IOController::IOStateList::iterator respond_it;
bool respond_invert;
bool respond_init = { false };
......@@ -379,6 +382,8 @@ class MBTCPMultiMaster:
std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > pollThread; /*!< поток опроса */
std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > checkThread; /*!< поток проверки связи по другим каналам */
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // _MBTCPMultiMaster_H_
// -----------------------------------------------------------------------------
......@@ -21,10 +21,10 @@
#include "modbus/MBLogSugar.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace uniset;
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_ ):
MBExchange(objId, shmId, ic, prefix_),
mbrtu(0),
......@@ -34,7 +34,7 @@ RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI
rs_pre_clean(false)
{
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();
......@@ -67,7 +67,7 @@ RTUExchange::RTUExchange(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmI
devname = conf->getArgParam("--" + prefix + "-dev", it.getProp("device"));
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"));
......@@ -160,7 +160,7 @@ std::shared_ptr<ModbusClient> RTUExchange::initMB( bool reopen )
mbinfo << myname << "(init): dev=" << devname << " speed=" << ComPort::getSpeed( mbrtu->getSpeed() ) << endl;
}
catch( const UniSetTypes::Exception& ex )
catch( const uniset::Exception& ex )
{
//if( mbrtu )
// delete mbrtu;
......@@ -335,7 +335,7 @@ bool RTUExchange::poll()
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 )
{
auto conf = uniset_conf();
......@@ -350,7 +350,7 @@ std::shared_ptr<RTUExchange> RTUExchange::init_rtuexchange(int argc, const char*
ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId )
if( ID == uniset::DefaultObjectId )
{
cerr << "(rtuexchange): Not found ID for '" << name
<< "'!"
......
......@@ -24,18 +24,21 @@
#include "MBExchange.h"
#include "modbus/ModbusRTUMaster.h"
#include "RTUStorage.h"
// --------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
class RTUExchange:
public MBExchange
{
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" );
virtual ~RTUExchange();
/*! глобальная функция для инициализации объекта */
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" );
/*! глобальная функция для вывода help-а */
......@@ -60,6 +63,8 @@ class RTUExchange:
bool rs_pre_clean;
};
// --------------------------------------------------------------------------
} // end of namespace uniset
// -----------------------------------------------------------------------------
#endif // _RS_EXCHANGE_H_
// -----------------------------------------------------------------------------
......@@ -20,6 +20,9 @@
#include <string>
#include "modbus/ModbusRTUMaster.h"
#include "RTUStorage.h"
// -------------------------------------------------------------------------
namespace uniset
{
// -----------------------------------------------------------------------------
using namespace std;
// -----------------------------------------------------------------------------
......@@ -735,3 +738,4 @@ std::string RTUStorage::j2s( RTUStorage::RTUJack jack )
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