Files
logos-cpp-sdk/cpp/logos_provider_object.cpp
T
Dario LipicarandClaude Opus 4.8 38bc77e127 Consume logos-protocol: the transport/token/IPC layer moves behind the lp_* C ABI (#82)
* Extract the protocol layer into logos-protocol; consume it as a flake input

The transport/token/IPC layer (transports incl. QRO + plain TCP/TLS,
consumer core LogosAPIClient/LogosAPIConsumer with the capability
auto-requestModule flow, ModuleProxy, token manager, QVariant<->JSON
conversion, the abstract LogosProviderObject interface) now lives in the
logos-protocol repo behind the versioned lp_* C ABI.

This SDK keeps the typed C++ developer layer (LogosAPI, provider base
classes + Qt provider glue, module context, code generator) and still
compiles the protocol sources INTO liblogos_sdk.a from the flake input,
so the installed artifact (archive symbols, include/ + include/cpp
layouts, cmake config) stays byte-compatible: existing consumers need
no changes. Public headers are unchanged; logos_provider_object.h keeps
its name and now re-exports the abstract interface from
logos_provider_interface.h.

Transport/protocol component tests moved to logos-protocol with the
code; the remaining sdk/generator/experimental suites are unchanged
(432/432 green against the local protocol checkout).

* lock: add logos-protocol input

* fix: accept the installed source-export layout in the protocol-root check

The fail-fast only tested <root>/cpp/logos_protocol.h, but the LP_SRC
selection right below (and the error message itself) support the
installed export layout <root>/include/cpp as well. Pointing
LOGOS_PROTOCOL_ROOT at an installed export tripped the FATAL_ERROR
before that fallback could apply.

Caught by Copilot review on #82.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* lock: protocol at the typed-requestModule P1 port (1e4bc72)

* lock: protocol at master (protocol#2 merged)

The extraction is on protocol master now (29afbac); the temporary branch
pin is dropped.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 19:21:00 -03:00

49 lines
1.7 KiB
C++

#include "logos_provider_object.h"
#include "logos_api.h"
#include "token_manager.h"
#include <QDebug>
// The LogosProviderObject universal-interface defaults and Std bridges moved
// to logos-protocol (logos_provider_interface.cpp) together with the abstract
// interface. What remains here is LogosProviderBase — the developer-facing
// base class — because it talks to LogosAPI, which layers above the protocol.
// ---------------------------------------------------------------------------
// LogosProviderBase
// ---------------------------------------------------------------------------
void LogosProviderBase::init(void* apiInstance)
{
m_logosAPI = static_cast<LogosAPI*>(apiInstance);
qDebug() << "[LogosProviderObject] LogosProviderBase::init called";
onInit(m_logosAPI);
}
bool LogosProviderBase::informModuleToken(const QString& moduleName, const QString& token)
{
if (!m_logosAPI) {
qWarning() << "[LogosProviderObject] informModuleToken: LogosAPI not available";
return false;
}
TokenManager* tokenManager = m_logosAPI->getTokenManager();
if (!tokenManager) {
qWarning() << "[LogosProviderObject] informModuleToken: TokenManager not available";
return false;
}
qDebug() << "[LogosProviderObject] Saving token for module:" << moduleName;
tokenManager->saveToken(moduleName, token);
return true;
}
void LogosProviderBase::emitEvent(const QString& eventName, const QVariantList& data)
{
if (m_eventCallback) {
qDebug() << "[LogosProviderObject] emitEvent:" << eventName;
m_eventCallback(eventName, data);
} else {
qWarning() << "[LogosProviderObject] emitEvent: no listener set for" << eventName;
}
}