Zao SDK for Jetson / libzep API Reference
Loading...
Searching...
No Matches
TunnelInterface.hpp
1/*
2 * Copyright (c) 2022-2023, Soliton Systems K.K. All rights reserved.
3 * Use in source and binary forms, with or without modification,
4 * is permitted provided that the following a condition is met:
5 *
6 * Use is permitted only in accordance with the terms and
7 * conditions set forth in the Software License Agreement available
8 * at https://zao-sdk.org/license-agreement/.
9 */
10#ifndef ZEP_SERIAL_TUNNEL_INTERFACE_HPP_
11#define ZEP_SERIAL_TUNNEL_INTERFACE_HPP_
12
13#include <cstdint>
14#include <future>
15#include <memory>
16#include <string>
17#include <vector>
18
19#include "../StreamInterface.hpp"
20#include "../TimestampInterface.hpp"
21#include "TunnelConfig.hpp"
22
23namespace zep {
24namespace serial {
25
26class TunnelCallbackInterface;
27
32 public:
40 virtual bool GetRequestedConfig(TunnelConfig& config) const noexcept = 0;
41
50 virtual std::shared_future<TunnelConfig> GetConfigRequestStatus()
51 const noexcept = 0;
52
64 virtual void SetAvailable(bool new_value) noexcept = 0;
65
72 virtual void SetMaxPacketLength(std::size_t length) = 0;
73
79 virtual void ResetQueue() = 0;
80
90 virtual void Queue(TimestampInterface::Rep timestamp, const void* bytes,
91 std::size_t length) = 0;
92
102 virtual void RegisterCallback(
103 const std::shared_ptr<TunnelCallbackInterface>& listener,
104 bool use_weak_ptr = false) = 0;
105
114 virtual void RegisterCallback(
115 std::unique_ptr<TunnelCallbackInterface>&& listener) = 0;
116
117 virtual ~TunnelInterface() noexcept = default;
118};
119
124 public:
128 enum class EventType {
130 kUnknown = 0,
131
133 kDisconnected,
134
136 kUnlinked,
137
139 kDepacketizeError,
140
142 kDeactivated,
143
145 kActivated,
146 };
147
155 virtual void OnRequestConfig(const TunnelConfig& config) = 0;
156
163 virtual void OnNotifyTunnelEvent(EventType type, const std::string& message) {
164 }
165
173 virtual void OnReceivePacket(std::vector<std::uint8_t>&& bytes) = 0;
174
175 virtual ~TunnelCallbackInterface() noexcept = default;
176};
177
178} // namespace serial
179} // namespace zep
180
181#endif // ZEP_SERIAL_TUNNEL_INTERFACE_HPP_
Stream function interface on the endpoint side.
Definition StreamInterface.hpp:22
Interface to timestamp management functions.
Definition TimestampInterface.hpp:20
シリアル通信トンネリング機能のコールバックインターフェース
Definition TunnelInterface.hpp:123
virtual void OnRequestConfig(const TunnelConfig &config)=0
設定要求時に呼び出されるコールバック。
EventType
イベントの種類
Definition TunnelInterface.hpp:128
virtual void OnNotifyTunnelEvent(EventType type, const std::string &message)
エラーなどのイベントが発生した時に呼び出されるコールバック。
Definition TunnelInterface.hpp:163
virtual void OnReceivePacket(std::vector< std::uint8_t > &&bytes)=0
パケット受信時に呼び出されるコールバック。
Class to store tunneling configuration.
Definition TunnelConfig.hpp:21
シリアル通信トンネリング機能のインターフェース
Definition TunnelInterface.hpp:31
virtual bool GetRequestedConfig(TunnelConfig &config) const noexcept=0
要求されたシリアルトンネリング設定を取得する。
virtual void SetMaxPacketLength(std::size_t length)=0
最大パケット長を設定する。
virtual void SetAvailable(bool new_value) noexcept=0
アクティブ状態にできるか否かを設定する。
virtual std::shared_future< TunnelConfig > GetConfigRequestStatus() const noexcept=0
設定要求状態を取得するshared_futureを取得する。
virtual void Queue(TimestampInterface::Rep timestamp, const void *bytes, std::size_t length)=0
送信データをキューする。
virtual void ResetQueue()=0
キューされているデータを削除する。
Namespace for ZEP SDK.
Definition FactoryInterface.hpp:19