From 0c36565aecc0630730225d9ce55186c3117914b8 Mon Sep 17 00:00:00 2001 From: peri4 Date: Tue, 22 Oct 2024 09:59:56 +0300 Subject: [PATCH] migrate to PIP v4.1 --- libs/core/cdutils_core.cpp | 3 ++- libs/core/cdutils_core.h | 3 +++ libs/core/cdutils_m.cpp | 2 +- libs/core/cdutils_types.h | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/core/cdutils_core.cpp b/libs/core/cdutils_core.cpp index 4dfbe9c..66261d6 100644 --- a/libs/core/cdutils_core.cpp +++ b/libs/core/cdutils_core.cpp @@ -58,6 +58,7 @@ CDCore::CDCore() { setName("CDCore"); x_timer.setName("_S.CDCore.x_timer"); datatr.setPacketSize(960); + cout_buffer_id = PICout::registerExternalBufferID(); CONNECTU(&connection, dataReceivedEvent, this, dataReceived); CONNECTU(PICout::Notifier::object(), finished, this, piCoutFinished); /*PIString s(app_config); @@ -387,7 +388,7 @@ void CDCore::xTimerTick() { void CDCore::piCoutFinished(int id, PIString * buffer) { - if (!buffer || !(id == 1)) return; + if ((id != cout_buffer_id) || !buffer) return; PIString sp = buffer->takeRange('[', ']'); PIDeque p = CDCore::stringToPath(sp); sendMessage(m_[p], Log, *buffer); diff --git a/libs/core/cdutils_core.h b/libs/core/cdutils_core.h index ef7e249..6f1f982 100644 --- a/libs/core/cdutils_core.h +++ b/libs/core/cdutils_core.h @@ -48,6 +48,7 @@ class CD_CORE_EXPORT CDCore: public PIObject { friend class CDSection; friend class Interface; friend class XInterface; + friend class MInterface; public: static CDCore * instance(); @@ -111,6 +112,7 @@ public: private: CDCore(); ~CDCore(); + EVENT_HANDLER2(void, dataReceived, const PIString &, from, const PIByteArray &, data); EVENT_HANDLER1(void, dtSendRequest, PIByteArray &, data); EVENT_HANDLER1(void, dtReceiveFinished, bool, ok); @@ -136,6 +138,7 @@ private: PIMutex x_mutex; PIVector> x_selected; PIMap c_handlers; + int cout_buffer_id = 0; bool need_rebuild_x, x_pult_side; }; diff --git a/libs/core/cdutils_m.cpp b/libs/core/cdutils_m.cpp index 6e33b35..d353b63 100644 --- a/libs/core/cdutils_m.cpp +++ b/libs/core/cdutils_m.cpp @@ -19,5 +19,5 @@ void MInterface::messageBox(const CDType & m, const PIString & msg) { PICout MInterface::createPICout(const CDType & m) const { PIString * buff = new PIString("[" + CDCore::pathToString(m.path()) + "]"); - return PICout::withExternalBuffer(buff, 1); + return PICout::withExternalBuffer(buff, core->cout_buffer_id); } diff --git a/libs/core/cdutils_types.h b/libs/core/cdutils_types.h index 12bd917..6850e5d 100644 --- a/libs/core/cdutils_types.h +++ b/libs/core/cdutils_types.h @@ -34,6 +34,12 @@ class CDItemModel; namespace CDUtils { class CDSection; +class CDCore; +class Interface; +class KInterface; +class XInterface; +class CInterface; +class MInterface; enum UpdateMode { SaveByIndex = 0x01,