-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathIConnectivityModule.h
61 lines (49 loc) · 1.6 KB
/
IConnectivityModule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "IReceiver.h"
#include "ISender.h"
#include <cstddef>
#include <memory>
#include <mutex>
#include <string>
namespace Aws
{
namespace IoTFleetWise
{
/**
* @brief called after the mqtt client is connected
*/
using OnConnectionEstablishedCallback = std::function<void()>;
class IConnectivityModule
{
public:
virtual ~IConnectivityModule() = default;
virtual bool isAlive() const = 0;
/**
* @brief create a new sender sharing the connection of this module
*
* @return a pointer to the newly created sender. A reference to the newly created sender is also hold inside this
* module.
*/
virtual std::shared_ptr<ISender> createSender() = 0;
/**
* @brief create a new receiver sharing the connection of this module
*
* @param topicName the topic which this receiver should subscribe to
*
* @return a pointer to the newly created receiver. A reference to the newly created receiver is also hold inside
* this module.
*/
virtual std::shared_ptr<IReceiver> createReceiver( const std::string &topicName ) = 0;
virtual bool disconnect() = 0;
virtual bool connect() = 0;
/**
* @brief Subscribe to the event that is triggered when the connection is established
*
* @param callback The callback to be called when the connection is established.
*/
virtual void subscribeToConnectionEstablished( OnConnectionEstablishedCallback callback ) = 0;
};
} // namespace IoTFleetWise
} // namespace Aws