AWS IoT Device SDK C++ v2: discovery/include/aws/discovery/DiscoveryClient.h Source File

AWS IoT Device SDK C++ v2 1.14.0 AWS IoT Device SDK C++ v2

DiscoveryClient.h
Go to the documentation of this file.
1#pragma once
6#include <aws/discovery/DiscoverResponse.h>
7
8#include <aws/crt/http/HttpConnectionManager.h>
9
10namespace Aws
11{
12 namespace Discovery
13 {
14 using OnDiscoverResponse = std::function<void(DiscoverResponse *, int errorCode, int httpResponseCode)>;
15
16 class AWS_DISCOVERY_API DiscoveryClientConfig
17 {
18 public:
19 DiscoveryClientConfig() noexcept;
20 DiscoveryClientConfig(const DiscoveryClientConfig &rhs) = default;
21 DiscoveryClientConfig(DiscoveryClientConfig &&rhs) = default;
22
23 DiscoveryClientConfig &operator=(const DiscoveryClientConfig &rhs) = default;
24 DiscoveryClientConfig &operator=(DiscoveryClientConfig &&rhs) = default;
25
26 ~DiscoveryClientConfig() = default;
27
32 Crt::Io::ClientBootstrap *Bootstrap;
33
38 Crt::Optional<Crt::Io::TlsContext> TlsContext;
39
44 Crt::Io::SocketOptions SocketOptions;
45
50 Crt::String Region;
51
55 size_t MaxConnections;
56
61 Crt::Optional<Crt::Http::HttpClientConnectionProxyOptions> ProxyOptions;
62 };
63
64 class AWS_DISCOVERY_API DiscoveryClient final
65 {
66 public:
67 bool Discover(const Crt::String &thingName, const OnDiscoverResponse &onDiscoverResponse) noexcept;
68
69 static std::shared_ptr<DiscoveryClient> CreateClient(
70 const DiscoveryClientConfig &config,
71 Crt::Allocator *allocator = Crt::DefaultAllocator());
72
73 private:
74 DiscoveryClient(const DiscoveryClientConfig &config, Crt::Allocator *allocator) noexcept;
75
76 std::shared_ptr<Crt::Http::HttpClientConnectionManager> m_connectionManager;
77 Crt::String m_hostName;
78 Crt::Allocator *m_allocator;
79 };
80 } // namespace Discovery
81} // namespace Aws
DiscoverResponse.h
HttpConnectionManager.h
Aws::Crt::Io::ClientBootstrap
Definition: Bootstrap.h:35
Aws::Crt::Io::SocketOptions
Definition: SocketOptions.h:48
Aws::Crt::Optional
Definition: Optional.h:17
Aws::Discovery::DiscoverResponse
Definition: DiscoverResponse.h:13
Aws::Discovery::DiscoveryClientConfig
Definition: DiscoveryClient.h:17
Aws::Discovery::DiscoveryClientConfig::operator=
DiscoveryClientConfig & operator=(DiscoveryClientConfig &&rhs)=default
Aws::Discovery::DiscoveryClientConfig::TlsContext
Crt::Optional< Crt::Io::TlsContext > TlsContext
Definition: DiscoveryClient.h:38
Aws::Discovery::DiscoveryClientConfig::DiscoveryClientConfig
DiscoveryClientConfig(const DiscoveryClientConfig &rhs)=default
Aws::Discovery::DiscoveryClientConfig::SocketOptions
Crt::Io::SocketOptions SocketOptions
Definition: DiscoveryClient.h:44
Aws::Discovery::DiscoveryClientConfig::operator=
DiscoveryClientConfig & operator=(const DiscoveryClientConfig &rhs)=default
Aws::Discovery::DiscoveryClientConfig::~DiscoveryClientConfig
~DiscoveryClientConfig()=default
Aws::Discovery::DiscoveryClientConfig::Region
Crt::String Region
Definition: DiscoveryClient.h:50
Aws::Discovery::DiscoveryClientConfig::MaxConnections
size_t MaxConnections
Definition: DiscoveryClient.h:55
Aws::Discovery::DiscoveryClientConfig::ProxyOptions
Crt::Optional< Crt::Http::HttpClientConnectionProxyOptions > ProxyOptions
Definition: DiscoveryClient.h:61
Aws::Discovery::DiscoveryClientConfig::Bootstrap
Crt::Io::ClientBootstrap * Bootstrap
Definition: DiscoveryClient.h:32
Aws::Discovery::DiscoveryClientConfig::DiscoveryClientConfig
DiscoveryClientConfig(DiscoveryClientConfig &&rhs)=default
Aws::Discovery::DiscoveryClient
Definition: DiscoveryClient.h:65
AWS_DISCOVERY_API
#define AWS_DISCOVERY_API
Definition: Exports.h:19
Aws::Crt::Allocator
aws_allocator Allocator
Definition: StlAllocator.h:17
Aws::Crt::DefaultAllocator
AWS_CRT_CPP_API Allocator * DefaultAllocator() noexcept
Definition: Types.cpp:13
Aws::Crt::String
std::basic_string< char, std::char_traits< char >, StlAllocator< char > > String
Definition: Types.h:47
Aws::Discovery::OnDiscoverResponse
std::function< void(DiscoverResponse *, int errorCode, int httpResponseCode)> OnDiscoverResponse
Definition: DiscoveryClient.h:14
Aws
Definition: Api.h:17