Skip to content

Commit a5fd070

Browse files
committed
cm: communication: add communication interface
This patch adds a new communication interface to the cm module with API needed for storage state module. Signed-off-by: Mykhailo Lohvynenko <[email protected]> Reviewed-by: Mykola Kobets <[email protected]> Reviewed-by: Mykola Solianko <[email protected]> Reviewed-by: Oleksandr Grytsov <[email protected]>
1 parent b4eb07c commit a5fd070

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2025 EPAM Systems, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef AOS_CM_COMMUNICATION_HPP_
8+
#define AOS_CM_COMMUNICATION_HPP_
9+
10+
#include "aos/common/cloudprotocol/state.hpp"
11+
#include "aos/common/types.hpp"
12+
13+
namespace aos::cm::communication {
14+
15+
/** @addtogroup cm Communication Manager
16+
* @{
17+
*/
18+
19+
/**
20+
* Communication interface.
21+
*/
22+
class CommunicationItf {
23+
public:
24+
/**
25+
* Sends instances new state.
26+
*
27+
* @param newState new state to send.
28+
* @return Error.
29+
*/
30+
virtual Error SendInstanceNewState(const cloudprotocol::NewState& newState) = 0;
31+
32+
/**
33+
* Sends instances update state.
34+
*
35+
* @param updateState update state to send.
36+
* @return Error.
37+
*/
38+
virtual Error SendInstanceStateRequest(const cloudprotocol::StateRequest& stateRequest) = 0;
39+
40+
/**
41+
* Destructor.
42+
*/
43+
virtual ~CommunicationItf() = default;
44+
};
45+
46+
} // namespace aos::cm::communication
47+
48+
#endif
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (C) 2025 EPAM Systems, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef AOS_COMMUNICATION_MOCK_HPP_
8+
#define AOS_COMMUNICATION_MOCK_HPP_
9+
10+
#include <gmock/gmock.h>
11+
12+
#include "aos/cm/communication/communication.hpp"
13+
14+
namespace aos::cm::communication {
15+
16+
/**
17+
* Communication interface mock.
18+
*/
19+
class CommunicationMock : public CommunicationItf {
20+
public:
21+
MOCK_METHOD(Error, SendInstanceNewState, (const cloudprotocol::NewState& newState), (override));
22+
MOCK_METHOD(Error, SendInstanceStateRequest, (const cloudprotocol::StateRequest& stateRequest), (override));
23+
};
24+
25+
} // namespace aos::cm::communication
26+
27+
#endif

0 commit comments

Comments
 (0)