ForestHub SDK 0.1.0
C++14 LLM SDK for PC and embedded platforms
Loading...
Searching...
No Matches
platform.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (c) 2026 ForestHub. All rights reserved.
3// For commercial licensing, visit https://github.com/ForestHubAI/fh-sdk
4
5#ifndef FORESTHUB_PLATFORM_PLATFORM_HPP
6#define FORESTHUB_PLATFORM_PLATFORM_HPP
7
10
11#include <cstdint>
12#include <memory>
13
20
21namespace foresthub {
22namespace platform {
23
30 unsigned long baud_rate = 115200;
31};
32
38 const char* host = nullptr;
39 uint16_t port = 443;
40 bool use_tls = true;
41 unsigned long timeout_ms = 30000;
42};
43
48public:
49 std::shared_ptr<NetworkInterface> network;
50 std::shared_ptr<ConsoleInterface> console;
51 std::shared_ptr<TimeInterface> time;
52 std::shared_ptr<CryptoInterface> crypto;
53 std::shared_ptr<GpioInterface> gpio;
54
58 virtual std::shared_ptr<core::HttpClient> CreateHttpClient(const HttpClientConfig& config) = 0;
59
60 virtual ~PlatformContext() = default;
61};
62
66std::shared_ptr<PlatformContext> CreatePlatform(const PlatformConfig& config = {});
67
68} // namespace platform
69} // namespace foresthub
70
71#endif // FORESTHUB_PLATFORM_PLATFORM_HPP
Holds all platform subsystems and provides a factory for HTTP clients.
Definition platform.hpp:47
virtual std::shared_ptr< core::HttpClient > CreateHttpClient(const HttpClientConfig &config)=0
Create a platform-specific HTTP client.
std::shared_ptr< ConsoleInterface > console
Console I/O subsystem.
Definition platform.hpp:50
std::shared_ptr< TimeInterface > time
Time and delay subsystem.
Definition platform.hpp:51
std::shared_ptr< NetworkInterface > network
Network connectivity subsystem.
Definition platform.hpp:49
std::shared_ptr< CryptoInterface > crypto
TLS/crypto subsystem.
Definition platform.hpp:52
std::shared_ptr< GpioInterface > gpio
GPIO pin I/O subsystem (nullptr if FORESTHUB_ENABLE_GPIO not defined).
Definition platform.hpp:53
Abstract interface for console I/O.
Abstract interfaces for TLS/crypto operations.
Abstract interface for general-purpose pin I/O and PWM.
Abstract HTTP client interface and response type.
Client and provider configuration types.
Hardware abstraction layer: network, console, time, crypto, and GPIO interfaces.
std::shared_ptr< PlatformContext > CreatePlatform(const PlatformConfig &config={})
Factory function.
Top-level namespace for the ForestHub SDK.
Abstract interface for network connectivity.
Call-time configuration for HTTP client creation.
Definition platform.hpp:37
uint16_t port
Target port number.
Definition platform.hpp:39
bool use_tls
Whether to use TLS encryption.
Definition platform.hpp:40
const char * host
Target hostname (required).
Definition platform.hpp:38
unsigned long timeout_ms
Request timeout in milliseconds.
Definition platform.hpp:41
Construction-time configuration for the network subsystem.
Definition network.hpp:30
Construction-time configuration passed to CreatePlatform().
Definition platform.hpp:28
NetworkConfig network
Network credentials and options.
Definition platform.hpp:29
unsigned long baud_rate
Console communication speed in bits per second.
Definition platform.hpp:30
Abstract interface for time operations and synchronization.