-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathDataSenderManager.h
51 lines (41 loc) · 1.43 KB
/
DataSenderManager.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
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "DataSenderTypes.h"
#include "ISender.h"
#include "PayloadManager.h"
#include <memory>
#include <unordered_map>
namespace Aws
{
namespace IoTFleetWise
{
/**
* @brief Class that implements data sender logic: data preprocessing and upload
*
* This class is not thread-safe so the caller needs to ensure that the different functions
* are called only from one thread. This class will be instantiated and used from the Data Sender
* Manager Worker thread
*/
class DataSenderManager
{
public:
DataSenderManager( std::unordered_map<SenderDataType, std::shared_ptr<DataSender>> dataSenders,
std::shared_ptr<ISender> mqttSender,
std::shared_ptr<PayloadManager> payloadManager );
virtual ~DataSenderManager() = default;
/**
* @brief Process collection scheme parameters and prepare data for upload
*/
virtual void processData( std::shared_ptr<const DataToSend> data );
/**
* @brief Retrieve all the persisted data and hand it over to the correct sender
*/
virtual void checkAndSendRetrievedData();
private:
std::unordered_map<SenderDataType, std::shared_ptr<DataSender>> mDataSenders;
std::shared_ptr<ISender> mMQTTSender;
std::shared_ptr<PayloadManager> mPayloadManager;
};
} // namespace IoTFleetWise
} // namespace Aws