diff --git a/cpp/example_usage.cpp b/cpp/example_usage.cpp deleted file mode 100644 index cf3d205..0000000 --- a/cpp/example_usage.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file example_usage.cpp - * @brief Example showing how to use the LogosAPI SDK - * - * This example demonstrates how to use the LogosAPI to connect - * to the Logos Core registry and request remote objects. - */ - -#include "logos_api_client.h" -#include "token_manager.h" -#include -#include -#include - -void exampleUsage() -{ - // Create a client instance (uses default registry URL) - LogosAPIClient client("core_manager", "example"); - - // Check if connected - if (!client.isConnected()) { - qWarning() << "Failed to connect to Logos Core registry"; - return; - } - - // Request the Core Manager object - QRemoteObjectReplica* coreManager = client.requestObject("Core Manager"); - if (!coreManager) { - qWarning() << "Failed to acquire Core Manager replica"; - return; - } - - // Use the replica to call methods - QString pluginName; - bool success = QMetaObject::invokeMethod( - coreManager, - "processPlugin", - Qt::DirectConnection, - Q_RETURN_ARG(QString, pluginName), - Q_ARG(QString, "/path/to/plugin.dylib") - ); - - if (success && !pluginName.isEmpty()) { - qDebug() << "Successfully processed plugin:" << pluginName; - } else { - qWarning() << "Failed to process plugin"; - } - - // Clean up the replica when done - delete coreManager; -} - -// Alternative usage with custom registry URL and timeout -void exampleCustomUsage() -{ - // Create client with custom registry URL - LogosAPI client("custom_registry"); - - if (!client.isConnected()) { - // Try to reconnect - if (!client.reconnect()) { - qWarning() << "Failed to connect to custom registry"; - return; - } - } - - // Request object with custom timeout (10 seconds) - QRemoteObjectReplica* someObject = client.requestObject("Some Object", 10000); - if (someObject) { - // Use the object... - - // Clean up - delete someObject; - } - - // Example TokenManager usage - TokenManager& tokenManager = TokenManager::instance(); - - // Save some tokens - tokenManager.saveToken("auth_token", "abc123xyz"); - tokenManager.saveToken("refresh_token", "def456uvw"); - tokenManager.saveToken("session_token", "ghi789rst"); - - // Retrieve tokens - QString authToken = tokenManager.getToken("auth_token"); - qDebug() << "Auth token:" << authToken; - - // Check if token exists - if (tokenManager.hasToken("refresh_token")) { - qDebug() << "Refresh token exists"; - } - - // Get all token keys - QList keys = tokenManager.getTokenKeys(); - qDebug() << "Token keys:" << keys; - qDebug() << "Total tokens:" << tokenManager.tokenCount(); - - // Remove a token - if (tokenManager.removeToken("session_token")) { - qDebug() << "Session token removed"; - } - - // Clear all tokens when done - // tokenManager.clearAllTokens(); -} \ No newline at end of file diff --git a/cpp/simple_example.cpp b/cpp/simple_example.cpp deleted file mode 100644 index e039760..0000000 --- a/cpp/simple_example.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file simple_example.cpp - * @brief Simple example showing how to use the LogosAPI class - */ - -#include "logos_api.h" -#include "logos_api_client.h" -#include "logos_api_provider.h" -#include "token_manager.h" -#include - -void simpleExample() -{ - // Create a LogosAPI instance for our module - LogosAPI api("core"); - - // Get the provider and register an object - LogosAPIProvider* provider = api.getProvider(); - QObject* myService = new QObject(); - provider->registerObject("my_service", myService); - - // Get the client to communicate with other modules - LogosAPIClient* client = api.getClient("core_manager"); - // Use client to call remote methods... - - // Get the token manager and save tokens - TokenManager* tokenManager = api.getTokenManager(); - tokenManager->saveToken("auth_token", "abc123"); - - qDebug() << "LogosAPI initialized successfully!"; - - delete myService; -} \ No newline at end of file