merged AI doc, some new pages
This commit is contained in:
+239
-113
@@ -1,10 +1,8 @@
|
||||
/*! \file piconnection.h
|
||||
* \brief
|
||||
* \ingroup IO-Utils
|
||||
* \~\brief
|
||||
* \~english Complex I/O point
|
||||
* \~russian Составное устройство ввода/вывода
|
||||
*/
|
||||
//! \~\file piconnection.h
|
||||
//! \~\ingroup IO-Utils
|
||||
//! \~\brief
|
||||
//! \~english Connection routing helper built on shared devices and packet filters
|
||||
//! \~russian Вспомогательный класс маршрутизации поверх общих устройств и пакетных фильтров
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Complex I/O point
|
||||
@@ -32,267 +30,389 @@
|
||||
|
||||
class PIConfig;
|
||||
|
||||
//! \~\ingroup IO-Utils
|
||||
//! \~\brief
|
||||
//! \~english Routes data between shared devices, packet extractors, channels and periodic senders.
|
||||
//! \~russian Маршрутизирует данные между общими устройствами, извлекателями пакетов, каналами и периодическими отправителями.
|
||||
//!
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! %PIConnection uses a process-wide device pool so several connections can
|
||||
//! share the same physical device. Raw device data may be forwarded into named
|
||||
//! filters, routed through channels, monitored with diagnostics and emitted by
|
||||
//! periodic senders.
|
||||
//! \~russian
|
||||
//! %PIConnection использует общий для процесса пул устройств, поэтому несколько
|
||||
//! соединений могут разделять одно физическое устройство. Сырые данные
|
||||
//! устройств могут передаваться в именованные фильтры, маршрутизироваться по
|
||||
//! каналам, контролироваться диагностикой и отправляться периодическими
|
||||
//! отправителями.
|
||||
class PIP_EXPORT PIConnection: public PIObject {
|
||||
PIOBJECT_SUBCLASS(PIConnection, PIObject);
|
||||
|
||||
public:
|
||||
//! Constructs connection with name "name", or with default name = "connection"
|
||||
//! \~english Constructs an empty connection with name "name".
|
||||
//! \~russian Создает пустое соединение с именем "name".
|
||||
PIConnection(const PIString & name = PIStringAscii("connection"));
|
||||
|
||||
//! Constructs connection and configure it from config file "config" from section "name"
|
||||
//! \~english Constructs a connection and immediately configures it from section "name" of file "config".
|
||||
//! \~russian Создает соединение и сразу настраивает его из секции "name" файла "config".
|
||||
PIConnection(const PIString & config, const PIString & name);
|
||||
|
||||
//! Constructs connection and configure it from config content "string" from section "name"
|
||||
//! \~english Constructs a connection and immediately configures it from section "name" stored in "string".
|
||||
//! \~russian Создает соединение и сразу настраивает его из секции "name", хранящейся в "string".
|
||||
PIConnection(PIString * string, const PIString & name);
|
||||
|
||||
//! \~english Releases all bindings owned by this connection.
|
||||
//! \~russian Освобождает все привязки, принадлежащие этому соединению.
|
||||
~PIConnection();
|
||||
|
||||
/*! \brief Configure connection from config file "config" from section "name". Returns if configuration was successful
|
||||
* \details \b Warning: all devices, filters and channels removed before configure! */
|
||||
//! \~english Reconfigures the connection from section "name" of file "config".
|
||||
//! \~russian Перенастраивает соединение из секции "name" файла "config".
|
||||
//! \~\details
|
||||
//! \~english \b Warning: all devices, filters and channels removed before configure!
|
||||
//! \~russian \b Внимание: все устройства, фильтры и каналы удаляются перед настройкой!
|
||||
bool configureFromConfig(const PIString & config, const PIString & name = PIStringAscii("connection"));
|
||||
|
||||
/*! \brief Configure connection from config content "string" from section "name". Returns if configuration was successful
|
||||
* \details \b Warning: all devices, filters and channels removed before configure! */
|
||||
//! \~english Reconfigures the connection from section "name" stored in "string".
|
||||
//! \~russian Перенастраивает соединение из секции "name", хранящейся в "string".
|
||||
//! \~\details
|
||||
//! \~english \b Warning: all devices, filters and channels removed before configure!
|
||||
//! \~russian \b Внимание: все устройства, фильтры и каналы удаляются перед настройкой!
|
||||
bool configureFromString(PIString * string, const PIString & name = PIStringAscii("connection"));
|
||||
|
||||
//! Returns config file section of current connection configuration
|
||||
//! \~english Serializes current connection state into one configuration section.
|
||||
//! \~russian Сериализует текущее состояние соединения в одну секцию конфигурации.
|
||||
PIString makeConfig() const;
|
||||
|
||||
|
||||
/*! \brief Add device with full path "full_path", open mode "mode" to Device pool and connection
|
||||
* \details Returns pointer to device or null if device can not be created. If "start" is true,
|
||||
* read thread is started immediately. Else, you can start read thread with functions \a startThreadedRead()
|
||||
* or \a startAllThreadedReads(). By default, read thread doesn`t start */
|
||||
//! \~english Adds device "full_path" to the shared device pool and binds it to this connection.
|
||||
//! \~russian Добавляет устройство "full_path" в общий пул устройств и привязывает его к этому соединению.
|
||||
//! \~\details
|
||||
//! \~english Returns the shared device instance or \c nullptr when creation fails. When "start" is \b true, threaded read starts
|
||||
//! immediately.
|
||||
//! \~russian Возвращает общий экземпляр устройства или \c nullptr, если создание не удалось. Если "start" равно \b true, потоковое
|
||||
//! чтение запускается сразу.
|
||||
PIIODevice * addDevice(const PIString & full_path, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite, bool start = false);
|
||||
|
||||
//! \~english Assigns alias "name" to device "dev" inside this connection.
|
||||
//! \~russian Назначает устройству "dev" псевдоним "name" внутри этого соединения.
|
||||
void setDeviceName(PIIODevice * dev, const PIString & name);
|
||||
|
||||
//! \~english Returns all aliases assigned to device "dev" in this connection.
|
||||
//! \~russian Возвращает все псевдонимы устройства "dev" в этом соединении.
|
||||
PIStringList deviceNames(const PIIODevice * dev) const;
|
||||
|
||||
/*! \brief Remove device with full path "full_path" from connection
|
||||
* \details Returns if device was removed. If there is no connection bounded to this device,
|
||||
* it will be removed from Device pool */
|
||||
//! \~english Unbinds device "full_path" from this connection.
|
||||
//! \~russian Отвязывает устройство "full_path" от этого соединения.
|
||||
//! \~\details
|
||||
//! \~english The shared device object is deleted from the pool only when no connections still use it.
|
||||
//! \~russian Общий объект устройства удаляется из пула только тогда, когда им больше не пользуется ни одно соединение.
|
||||
bool removeDevice(const PIString & full_path);
|
||||
|
||||
/*! \brief Remove all device from connection
|
||||
* \details If there is no connection bounded to there devices, they removed from Device pool */
|
||||
//! \~english Removes all devices currently bound to this connection.
|
||||
//! \~russian Удаляет все устройства, привязанные к этому соединению.
|
||||
//! \~\details
|
||||
//! \~english Devices remain in the shared pool while they are still referenced by other connections.
|
||||
//! \~russian Устройства остаются в общем пуле, пока на них ссылаются другие соединения.
|
||||
void removeAllDevices();
|
||||
|
||||
//! Returns device with full path "full_path" or null if there is no such device
|
||||
//! \~english Returns bound device by normalized full path.
|
||||
//! \~russian Возвращает привязанное устройство по нормализованному полному пути.
|
||||
PIIODevice * deviceByFullPath(const PIString & full_path) const;
|
||||
|
||||
//! Returns device with name "name" or null if there is no such device
|
||||
//! \~english Returns bound device by alias.
|
||||
//! \~russian Возвращает привязанное устройство по псевдониму.
|
||||
PIIODevice * deviceByName(const PIString & name) const;
|
||||
|
||||
//! Returns all devices bounded to this connection
|
||||
//! \~english Returns all devices currently bound to this connection.
|
||||
//! \~russian Возвращает все устройства, привязанные к этому соединению.
|
||||
PIVector<PIIODevice *> boundedDevices() const;
|
||||
|
||||
/*! \brief Add filter with name "name" to device with full path "full_path_name" or filter "full_path_name"
|
||||
* \details If there is no filter with name "name", connection create new with split mode "mode" and bound
|
||||
* to it device "full_path_name" or filter "full_path_name". If filter with name "name" already exists,
|
||||
* device "full_path_name" or filter "full_path_name" add to this filter.
|
||||
* This function returns PIPacketExtractor * assosiated with this filter
|
||||
* \n \b Attention! "mode" is altual olny if new filter was created! */
|
||||
//! \~english Creates or reuses filter "name" and binds source "full_path_name" to it.
|
||||
//! \~russian Создает или повторно использует фильтр "name" и привязывает к нему источник "full_path_name".
|
||||
//! \~\details
|
||||
//! \~english If there is no filter with name "name", connection create new with split mode "mode" and bound
|
||||
//! to it device "full_path_name" or filter "full_path_name". If filter with name "name" already exists,
|
||||
//! device "full_path_name" or filter "full_path_name" add to this filter.
|
||||
//! This function returns PIPacketExtractor * assosiated with this filter.
|
||||
//! \~russian Если фильтра с именем "name" не существует, соединение создаст новый фильтр с режимом разделения "mode"
|
||||
//! и привяжет к нему устройство "full_path_name" или фильтр "full_path_name". Если фильтр с именем "name" уже существует,
|
||||
//! устройство "full_path_name" или фильтр "full_path_name" добавляется к этому фильтру.
|
||||
//! Эта функция возвращает PIPacketExtractor *, связанный с этим фильтром.
|
||||
//! \~\note
|
||||
//! \~english \b Attention! "mode" is altual olny if new filter was created!
|
||||
//! \~russian \b Внимание! "mode" актуален только если был создан новый фильтр!
|
||||
//! \~\sa PIPacketExtractor
|
||||
PIPacketExtractor *
|
||||
addFilter(const PIString & name, const PIString & full_path_name, PIPacketExtractor::SplitMode mode = PIPacketExtractor::None);
|
||||
|
||||
//! Add filter with name "name" to device "dev"
|
||||
//! \~english Creates or reuses filter "name" and binds device "dev" to it.
|
||||
//! \~russian Создает или повторно использует фильтр "name" и привязывает к нему устройство "dev".
|
||||
PIPacketExtractor *
|
||||
addFilter(const PIString & name, const PIIODevice * dev, PIPacketExtractor::SplitMode mode = PIPacketExtractor::None) {
|
||||
return addFilter(name, devFPath(dev), mode);
|
||||
}
|
||||
|
||||
//! Add filter with "filter" to device "dev"
|
||||
//! \~english Binds existing extractor object "filter" to source "full_path_name".
|
||||
//! \~russian Привязывает существующий объект извлекателя "filter" к источнику "full_path_name".
|
||||
PIPacketExtractor * addFilter(PIPacketExtractor * filter, const PIString & full_path_name);
|
||||
|
||||
//! Add filter with "filter" to device "dev"
|
||||
//! \~english Binds existing extractor object "filter" to device "dev".
|
||||
//! \~russian Привязывает существующий объект извлекателя "filter" к устройству "dev".
|
||||
PIPacketExtractor * addFilter(PIPacketExtractor * filter, const PIIODevice * dev) { return addFilter(filter, devFPath(dev)); }
|
||||
|
||||
/*! \brief Remove from filter with name "name" device with full path "full_path_name" or filter "full_path_name"
|
||||
* \details If there is no devices bounded to this filter, it will be removed. Returns if device was removed */
|
||||
//! \~english Unbinds source "full_path_name" from filter "name".
|
||||
//! \~russian Отвязывает источник "full_path_name" от фильтра "name".
|
||||
//! \~\details
|
||||
//! \~english Removes the filter itself when it no longer has any bound sources.
|
||||
//! \~russian Удаляет сам фильтр, когда у него больше не остается привязанных источников.
|
||||
bool removeFilter(const PIString & name, const PIString & full_path_name);
|
||||
|
||||
//! Remove from filter with name "name" device or filter "dev"
|
||||
//! \~english Unbinds device or upstream filter "dev" from filter "name".
|
||||
//! \~russian Отвязывает устройство или вышестоящий фильтр "dev" от фильтра "name".
|
||||
bool removeFilter(const PIString & name, const PIIODevice * dev);
|
||||
|
||||
//! Remove filter with name "name". Returns if filter was removed
|
||||
//! \~english Removes filter "name" together with all its bindings.
|
||||
//! \~russian Удаляет фильтр "name" вместе со всеми его привязками.
|
||||
bool removeFilter(const PIString & name);
|
||||
|
||||
//! Remove all filters from connection
|
||||
//! \~english Removes all filters from this connection.
|
||||
//! \~russian Удаляет все фильтры из этого соединения.
|
||||
void removeAllFilters();
|
||||
|
||||
//! Returns all filters of connection
|
||||
//! \~english Returns all filters owned by this connection.
|
||||
//! \~russian Возвращает все фильтры, принадлежащие этому соединению.
|
||||
PIVector<PIPacketExtractor *> filters() const;
|
||||
|
||||
//! Returns all filter names of connection
|
||||
//! \~english Returns names of all filters owned by this connection.
|
||||
//! \~russian Возвращает имена всех фильтров, принадлежащих этому соединению.
|
||||
PIStringList filterNames() const;
|
||||
|
||||
//! Returns PIPacketExtractor * assosiated with filter "name" or null if there is no such filter
|
||||
//! \~english Returns filter "name" or \c nullptr when it does not exist.
|
||||
//! \~russian Возвращает фильтр "name" или \c nullptr, если такого фильтра нет.
|
||||
PIPacketExtractor * filter(const PIString & name) const;
|
||||
|
||||
//! Returns all devices bounded to filter "name"
|
||||
//! \~english Returns all sources currently bound to filter "name".
|
||||
//! \~russian Возвращает все источники, привязанные к фильтру "name".
|
||||
PIVector<PIIODevice *> filterBoundedDevices(const PIString & name) const;
|
||||
|
||||
/*! \brief Add to connection channel from "name_from" to "name_to"
|
||||
* \details "name_from" and "name_to" can be full pathes of devices or device names or filter names.
|
||||
* Returns \b false if there if no such device or filter, else create channel and returns \b true */
|
||||
//! \~english Adds a routing channel from "name_from" to "name_to".
|
||||
//! \~russian Добавляет канал маршрутизации от "name_from" к "name_to".
|
||||
//! \~\details
|
||||
//! \~english Both endpoints may reference a device full path, a device alias or a filter name.
|
||||
//! \~russian Оба конца канала могут ссылаться на полный путь устройства, псевдоним устройства или имя фильтра.
|
||||
bool addChannel(const PIString & name_from, const PIString & name_to);
|
||||
|
||||
//! Add to connection channel from "name_from" to "dev_to"
|
||||
//! \~english Adds a routing channel from "name_from" to device "dev_to".
|
||||
//! \~russian Добавляет канал маршрутизации от "name_from" к устройству "dev_to".
|
||||
bool addChannel(const PIString & name_from, const PIIODevice * dev_to) { return addChannel(name_from, devFPath(dev_to)); }
|
||||
|
||||
//! Add to connection channel from "dev_from" to "name_to"
|
||||
//! \~english Adds a routing channel from device "dev_from" to "name_to".
|
||||
//! \~russian Добавляет канал маршрутизации от устройства "dev_from" к "name_to".
|
||||
bool addChannel(const PIIODevice * dev_from, const PIString & name_to) { return addChannel(devFPath(dev_from), name_to); }
|
||||
|
||||
//! Add to connection channel from "dev_from" to "dev_to"
|
||||
//! \~english Adds a routing channel from device "dev_from" to device "dev_to".
|
||||
//! \~russian Добавляет канал маршрутизации от устройства "dev_from" к устройству "dev_to".
|
||||
bool addChannel(const PIIODevice * dev_from, const PIIODevice * dev_to) { return addChannel(devFPath(dev_from), devFPath(dev_to)); }
|
||||
|
||||
/*! \brief Remove from connection channel from "name_from" to "name_to"
|
||||
* \details "name_from" and "name_to" can be full pathes of devices or filter names.
|
||||
* Returns \b false if there if no such device or filter, else remove channel and returns \b true */
|
||||
//! \~english Removes routing channel from "name_from" to "name_to".
|
||||
//! \~russian Удаляет канал маршрутизации от "name_from" к "name_to".
|
||||
bool removeChannel(const PIString & name_from, const PIString & name_to);
|
||||
|
||||
//! Remove from connection channel from "name_from" to "dev_to"
|
||||
//! \~english Removes routing channel from "name_from" to device "dev_to".
|
||||
//! \~russian Удаляет канал маршрутизации от "name_from" к устройству "dev_to".
|
||||
bool removeChannel(const PIString & name_from, const PIIODevice * dev_to) { return removeChannel(name_from, devFPath(dev_to)); }
|
||||
|
||||
//! Remove from connection channel from "dev_from" to "name_to"
|
||||
//! \~english Removes routing channel from device "dev_from" to "name_to".
|
||||
//! \~russian Удаляет канал маршрутизации от устройства "dev_from" к "name_to".
|
||||
bool removeChannel(const PIIODevice * dev_from, const PIString & name_to) { return removeChannel(devFPath(dev_from), name_to); }
|
||||
|
||||
//! Remove from connection channel from "dev_from" to "dev_to"
|
||||
//! \~english Removes routing channel from device "dev_from" to device "dev_to".
|
||||
//! \~russian Удаляет канал маршрутизации от устройства "dev_from" к устройству "dev_to".
|
||||
bool removeChannel(const PIIODevice * dev_from, const PIIODevice * dev_to) {
|
||||
return removeChannel(devFPath(dev_from), devFPath(dev_to));
|
||||
}
|
||||
|
||||
/*! \brief Remove from connection all channels from "name_from"
|
||||
* \details "name_from" can be full path of device or filter name.
|
||||
* Returns \b false if there if no such device or filter, else remove channels and returns \b true */
|
||||
//! \~english Removes all outgoing channels starting from "name_from".
|
||||
//! \~russian Удаляет все исходящие каналы, начинающиеся в "name_from".
|
||||
bool removeChannel(const PIString & name_from);
|
||||
|
||||
//! Remove from connection all channels from "dev_from"
|
||||
//! \~english Removes all outgoing channels starting from device "dev_from".
|
||||
//! \~russian Удаляет все исходящие каналы, начинающиеся от устройства "dev_from".
|
||||
bool removeChannel(const PIIODevice * dev_from) { return removeChannel(devFPath(dev_from)); }
|
||||
|
||||
//! Remove from connection all channels
|
||||
//! \~english Removes all routing channels from this connection.
|
||||
//! \~russian Удаляет все каналы маршрутизации из этого соединения.
|
||||
void removeAllChannels();
|
||||
|
||||
//! Returns all channels of this connection as full pathes or filter names pair array (from, to)
|
||||
//! \~english Returns all routing channels as source and destination pairs.
|
||||
//! \~russian Возвращает все каналы маршрутизации как пары источника и назначения.
|
||||
PIVector<PIPair<PIString, PIString>> channels() const;
|
||||
|
||||
/*! \brief Add to connection sender with name "name" device with full path "full_path"
|
||||
* \details If there is no sender with name "name", connection create new, bound
|
||||
* to it device "full_path_name" and start sender timer with frequency "frequency".
|
||||
* If sender with name "name" already exists, device "full_path_name" add to this sender
|
||||
* If "start" is true, sender is started immediately. Else, you can start sender with
|
||||
* functions \a startSender()
|
||||
* \n \b Attention! "frequency" is actual olny if new sender was created! */
|
||||
//! \~english Creates or reuses sender "name" and binds device "full_path_name" to it.
|
||||
//! \~russian Создает или повторно использует отправитель "name" и привязывает к нему устройство "full_path_name".
|
||||
//! \~\details
|
||||
//! \~english If there is no sender with name "name", connection create new, bound
|
||||
//! to it device "full_path_name" and start sender timer with frequency "frequency".
|
||||
//! If sender with name "name" already exists, device "full_path_name" add to this sender
|
||||
//! If "start" is true, sender is started immediately. Else, you can start sender with
|
||||
//! functions \a startSender().
|
||||
//! \~russian Если отправителя с именем "name" не существует, соединение создаст новый отправитель, привяжет
|
||||
//! к нему устройство "full_path_name" и запускает таймер отправителя с частотой "frequency".
|
||||
//! Если отправитель с именем "name" уже существует, устройство "full_path_name" добавляется к этому отправителю
|
||||
//! Если "start" равно true, отправитель запускается немедленно. В противном случае можно запустить отправителя с помощью
|
||||
//! функций \a startSender().
|
||||
//! \~\note
|
||||
//! \~english \b Attention! "frequency" is actual olny if new sender was created!
|
||||
//! \~russian \b Внимание! "frequency" актуален только если был создан новый отправитель!
|
||||
//! \~\sa startSender()
|
||||
void addSender(const PIString & name, const PIString & full_path_name, float frequency, bool start = false);
|
||||
|
||||
//! Add to connection sender with name "name" device "dev"
|
||||
//! \~english Creates or reuses sender "name" and binds device "dev" to it.
|
||||
//! \~russian Создает или повторно использует отправитель "name" и привязывает к нему устройство "dev".
|
||||
void addSender(const PIString & name, const PIIODevice * dev, float frequency, bool start = false) {
|
||||
addSender(name, devFPath(dev), frequency, start);
|
||||
}
|
||||
|
||||
/*! \brief Remove from sender with name "name" device with full path "full_path_name"
|
||||
* \details If there is no devices bounded to this sender, it will be removed. Returns if sender was removed */
|
||||
//! \~english Unbinds device "full_path_name" from sender "name".
|
||||
//! \~russian Отвязывает устройство "full_path_name" от отправителя "name".
|
||||
//! \~\details
|
||||
//! \~english If there is no devices bounded to this sender, it will be removed. Returns if sender was removed.
|
||||
//! \~russian Если к этому отправителю не привязано устройств, он будет удален. Возвращает успешность удаления отправителя.
|
||||
bool removeSender(const PIString & name, const PIString & full_path_name);
|
||||
|
||||
//! Remove from sender with name "name" device "dev"
|
||||
//! \~english Unbinds device "dev" from sender "name".
|
||||
//! \~russian Отвязывает устройство "dev" от отправителя "name".
|
||||
bool removeSender(const PIString & name, const PIIODevice * dev) { return removeSender(name, devFPath(dev)); }
|
||||
|
||||
//! Remove sender with name "name", returns if sender was removed
|
||||
//! \~english Removes sender "name" together with its timer state.
|
||||
//! \~russian Удаляет отправитель "name" вместе с состоянием его таймера.
|
||||
bool removeSender(const PIString & name);
|
||||
|
||||
//! Set sender "name" fixed send data "data", returns if sender exists
|
||||
//! \~english Assigns fixed payload "data" to sender "name".
|
||||
//! \~russian Назначает фиксированную нагрузку "data" отправителю "name".
|
||||
bool setSenderFixedData(const PIString & name, const PIByteArray & data);
|
||||
|
||||
//! Remove sender "name" fixed send data, returns if sender exists
|
||||
//! \~english Clears fixed payload for sender "name".
|
||||
//! \~russian Очищает фиксированную нагрузку отправителя "name".
|
||||
bool clearSenderFixedData(const PIString & name);
|
||||
|
||||
//! Returns sender "name" fixed send data
|
||||
//! \~english Returns fixed payload configured for sender "name".
|
||||
//! \~russian Возвращает фиксированную нагрузку, настроенную для отправителя "name".
|
||||
PIByteArray senderFixedData(const PIString & name) const;
|
||||
|
||||
//! Returns sender "name" timer frequency, -1 if there is no such sender, or 0 if sender is not started yet
|
||||
//! \~english Returns sender timer frequency.
|
||||
//! \~russian Возвращает частоту таймера отправителя.
|
||||
//! \~\details
|
||||
//! \~english Returns -1 when the sender does not exist and 0 when it exists but is not running.
|
||||
//! \~russian Возвращает -1, если отправителя не существует, и 0, если он существует, но не запущен.
|
||||
float senderFrequency(const PIString & name) const;
|
||||
|
||||
//! Remove from connection all senders
|
||||
//! \~english Removes all senders from this connection.
|
||||
//! \~russian Удаляет все отправители из этого соединения.
|
||||
void removeAllSenders();
|
||||
|
||||
//! Start read thread of device with full path "full_path"
|
||||
//! \~english Starts threaded read for source "full_path_name".
|
||||
//! \~russian Запускает потоковое чтение для источника "full_path_name".
|
||||
void startThreadedRead(const PIString & full_path_name);
|
||||
|
||||
//! Start read thread of device "dev"
|
||||
//! \~english Starts threaded read for device "dev".
|
||||
//! \~russian Запускает потоковое чтение для устройства "dev".
|
||||
void startThreadedRead(const PIIODevice * dev) { startThreadedRead(devFPath(dev)); }
|
||||
|
||||
//! Start read threads of all Device pool device
|
||||
//! \~english Starts threaded read for all devices bound to the shared pool.
|
||||
//! \~russian Запускает потоковое чтение для всех устройств, привязанных к общему пулу.
|
||||
void startAllThreadedReads();
|
||||
|
||||
//! Start sender "name" timer
|
||||
//! \~english Starts sender timer "name".
|
||||
//! \~russian Запускает таймер отправителя "name".
|
||||
void startSender(const PIString & name);
|
||||
|
||||
//! Start all senders timers
|
||||
//! \~english Starts all sender timers.
|
||||
//! \~russian Запускает таймеры всех отправителей.
|
||||
void startAllSenders();
|
||||
|
||||
//! Start all read threads and senders
|
||||
//! \~english Starts all threaded reads and all senders.
|
||||
//! \~russian Запускает все потоковые чтения и все отправители.
|
||||
void start() {
|
||||
startAllThreadedReads();
|
||||
startAllSenders();
|
||||
}
|
||||
|
||||
//! Stop read thread of device with full path "full_path"
|
||||
//! \~english Stops threaded read for source "full_path_name".
|
||||
//! \~russian Останавливает потоковое чтение для источника "full_path_name".
|
||||
void stopThreadedRead(const PIString & full_path_name);
|
||||
|
||||
//! Stop read thread of device "dev"
|
||||
//! \~english Stops threaded read for device "dev".
|
||||
//! \~russian Останавливает потоковое чтение для устройства "dev".
|
||||
void stopThreadedRead(const PIIODevice * dev) { stopThreadedRead(devFPath(dev)); }
|
||||
|
||||
//! Stop read threads of all Device pool device
|
||||
//! \~english Stops threaded read for all bound devices.
|
||||
//! \~russian Останавливает потоковое чтение для всех привязанных устройств.
|
||||
void stopAllThreadedReads();
|
||||
|
||||
//! Stop sender "name" timer
|
||||
//! \~english Stops sender timer "name".
|
||||
//! \~russian Останавливает таймер отправителя "name".
|
||||
void stopSender(const PIString & name);
|
||||
|
||||
//! Stop all senders timers
|
||||
//! \~english Stops all sender timers.
|
||||
//! \~russian Останавливает таймеры всех отправителей.
|
||||
void stopAllSenders();
|
||||
|
||||
//! Stop all read threads and senders
|
||||
//! \~english Stops all threaded reads and all senders.
|
||||
//! \~russian Останавливает все потоковые чтения и все отправители.
|
||||
void stop() {
|
||||
stopAllThreadedReads();
|
||||
stopAllSenders();
|
||||
}
|
||||
|
||||
//! Stop connection and remove all devices
|
||||
//! \~english Stops the connection and removes all bound devices.
|
||||
//! \~russian Останавливает соединение и удаляет все привязанные устройства.
|
||||
void destroy() {
|
||||
stop();
|
||||
removeAllDevices();
|
||||
}
|
||||
|
||||
//! Returns if there are no devices in this connection
|
||||
//! \~english Returns whether the connection currently has no bound devices.
|
||||
//! \~russian Возвращает, нет ли сейчас у соединения привязанных устройств.
|
||||
bool isEmpty() const { return device_modes.isEmpty(); }
|
||||
|
||||
|
||||
//! Returns PIDiagnostics * assosiated with device with full path "full_path_name", name "full_path_name" or filter "full_path_name"
|
||||
//! \~english Returns diagnostics object for device or filter "full_path_name".
|
||||
//! \~russian Возвращает объект диагностики для устройства или фильтра "full_path_name".
|
||||
PIDiagnostics * diagnostic(const PIString & full_path_name) const;
|
||||
|
||||
//! Returns PIDiagnostics * assosiated with device or filter "dev"
|
||||
//! \~english Returns diagnostics object associated with device or filter "dev".
|
||||
//! \~russian Возвращает объект диагностики, связанный с устройством или фильтром "dev".
|
||||
PIDiagnostics * diagnostic(const PIIODevice * dev) const { return diags_.value(const_cast<PIIODevice *>(dev), 0); }
|
||||
|
||||
//! Write data "data" to device with full path "full_path" and returns result of \a write() function of device
|
||||
//! \~english Writes "data" to device resolved by full path "full_path".
|
||||
//! \~russian Записывает "data" в устройство, найденное по полному пути "full_path".
|
||||
int writeByFullPath(const PIString & full_path, const PIByteArray & data);
|
||||
|
||||
//! Write data "data" to device with name "name" and returns result of \a write() function of device
|
||||
//! \~english Writes "data" to device resolved by alias "name".
|
||||
//! \~russian Записывает "data" в устройство, найденное по псевдониму "name".
|
||||
int writeByName(const PIString & name, const PIByteArray & data);
|
||||
|
||||
//! Write data "data" to device "dev" and returns result of \a write() function of device
|
||||
//! \~english Writes "data" directly to device "dev".
|
||||
//! \~russian Записывает "data" непосредственно в устройство "dev".
|
||||
int write(PIIODevice * dev, const PIByteArray & data);
|
||||
|
||||
//! Returns all connections in application
|
||||
//! \~english Returns all currently alive %PIConnection objects.
|
||||
//! \~russian Возвращает все существующие в приложении объекты %PIConnection.
|
||||
static PIVector<PIConnection *> allConnections();
|
||||
|
||||
//! Returns all devices in Device pool
|
||||
//! \~english Returns all devices currently stored in the shared device pool.
|
||||
//! \~russian Возвращает все устройства, которые сейчас хранятся в общем пуле устройств.
|
||||
static PIVector<PIIODevice *> allDevices();
|
||||
|
||||
//! Set Device pool fake mode to \"yes\" and returns previous mode
|
||||
//! \~english Enables or disables shared device-pool fake mode and returns previous state.
|
||||
//! \~russian Включает или выключает режим имитации общего пула устройств и возвращает предыдущее состояние.
|
||||
static bool setFakeMode(bool yes);
|
||||
|
||||
//! Returns if Device pool works in fake mode
|
||||
//! \~english Returns whether the shared device pool works in fake mode.
|
||||
//! \~russian Возвращает, работает ли общий пул устройств в режиме имитации.
|
||||
static bool isFakeMode();
|
||||
|
||||
class PIP_EXPORT DevicePool: public PIThread {
|
||||
@@ -310,6 +430,7 @@ public:
|
||||
void init();
|
||||
PIIODevice *
|
||||
addDevice(PIConnection * parent, const PIString & fp, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite, bool start = true);
|
||||
|
||||
bool removeDevice(PIConnection * parent, const PIString & fp);
|
||||
void unboundConnection(PIConnection * parent);
|
||||
PIIODevice * device(const PIString & fp) const;
|
||||
@@ -336,32 +457,38 @@ public:
|
||||
bool fake;
|
||||
};
|
||||
|
||||
EVENT2(dataReceivedEvent, const PIString &, from, const PIByteArray &, data);
|
||||
EVENT2(packetReceivedEvent, const PIString &, from, const PIByteArray &, data);
|
||||
EVENT3(qualityChanged, const PIIODevice *, dev, PIDiagnostics::Quality, new_quality, PIDiagnostics::Quality, old_quality);
|
||||
|
||||
//! \events
|
||||
//! \{
|
||||
|
||||
//! \fn void dataReceivedEvent(const PIString & from, const PIByteArray & data)
|
||||
//! \brief Raise on data received from device with full path "from"
|
||||
//! \~english Emitted when raw data is received from source "from".
|
||||
//! \~russian Генерируется при получении сырых данных от источника "from".
|
||||
EVENT2(dataReceivedEvent, const PIString &, from, const PIByteArray &, data);
|
||||
|
||||
//! \fn void packetReceivedEvent(const PIString & from, const PIByteArray & data)
|
||||
//! \brief Raise on packet received from filter with name "from"
|
||||
//! \~english Emitted when filter "from" produces a packet.
|
||||
//! \~russian Генерируется, когда фильтр "from" выдает пакет.
|
||||
EVENT2(packetReceivedEvent, const PIString &, from, const PIByteArray &, data);
|
||||
|
||||
//! \fn void qualityChanged(const PIIODevice * device, PIDiagnostics::Quality new_quality, PIDiagnostics::Quality old_quality)
|
||||
//! \brief Raise on diagnostic quality of device "device" changed from "old_quality" to "new_quality"
|
||||
//! \~english Emitted when diagnostics quality of "device" changes.
|
||||
//! \~russian Генерируется при изменении качества диагностики устройства "device".
|
||||
EVENT3(qualityChanged, const PIIODevice *, dev, PIDiagnostics::Quality, new_quality, PIDiagnostics::Quality, old_quality);
|
||||
|
||||
//! \}
|
||||
|
||||
protected:
|
||||
//! Executes on data received from device with full path "from"
|
||||
//! \~english Called after raw data is received from source "from".
|
||||
//! \~russian Вызывается после получения сырых данных от источника "from".
|
||||
virtual void dataReceived(const PIString & from, const PIByteArray & data) {}
|
||||
|
||||
//! Executes on packet received from filter with name "from"
|
||||
//! \~english Called after filter "from" produces a packet.
|
||||
//! \~russian Вызывается после того, как фильтр "from" выдает пакет.
|
||||
virtual void packetReceived(const PIString & from, const PIByteArray & data) {}
|
||||
|
||||
//! You should returns data for sender "sender_name"
|
||||
//! \~english Returns dynamic payload for sender "sender_name".
|
||||
//! \~russian Возвращает динамическую нагрузку для отправителя "sender_name".
|
||||
virtual PIByteArray senderData(const PIString & sender_name);
|
||||
|
||||
private:
|
||||
@@ -408,7 +535,6 @@ private:
|
||||
|
||||
void __DevicePool_threadReadDP(void * ddp);
|
||||
|
||||
|
||||
extern PIP_EXPORT PIConnection::DevicePool * __device_pool__;
|
||||
|
||||
class PIP_EXPORT __DevicePoolContainer__ {
|
||||
|
||||
Reference in New Issue
Block a user