Skip to content

Commit e7e0187

Browse files
committed
cm: communication: update interface to have a single send method
This patch updates communication interface to have a single method for sending messages that will accept variant type of cloud message. Signed-off-by: Mykhailo Lohvynenko <[email protected]>
1 parent 158644f commit e7e0187

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

include/aos/cm/communication/communication.hpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#ifndef AOS_CM_COMMUNICATION_HPP_
88
#define AOS_CM_COMMUNICATION_HPP_
99

10-
#include "aos/common/cloudprotocol/state.hpp"
10+
#include "aos/common/cloudprotocol/cloudmessage.hpp"
1111
#include "aos/common/types.hpp"
1212

1313
namespace aos::cm::communication {
@@ -66,20 +66,12 @@ class ConnectionEventsSubscriberItf {
6666
class CommunicationItf {
6767
public:
6868
/**
69-
* Sends instances new state.
69+
* Sends cloud message.
7070
*
71-
* @param newState new state to send.
71+
* @param body cloud message body to send.
7272
* @return Error.
7373
*/
74-
virtual Error SendInstanceNewState(const cloudprotocol::NewState& newState) = 0;
75-
76-
/**
77-
* Sends instances update state.
78-
*
79-
* @param updateState update state to send.
80-
* @return Error.
81-
*/
82-
virtual Error SendInstanceStateRequest(const cloudprotocol::StateRequest& stateRequest) = 0;
74+
virtual Error SendMessage(const cloudprotocol::MessageVariant& body) = 0;
8375

8476
/**
8577
* Subscribes to connection events.

tests/include/mocks/communicationmock.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class ConnectionEventsSubscriberMock : public ConnectionEventsSubscriberItf {
2727
*/
2828
class CommunicationMock : public CommunicationItf {
2929
public:
30-
MOCK_METHOD(Error, SendInstanceNewState, (const cloudprotocol::NewState& newState), (override));
31-
MOCK_METHOD(Error, SendInstanceStateRequest, (const cloudprotocol::StateRequest& stateRequest), (override));
30+
MOCK_METHOD(Error, SendMessage, (const cloudprotocol::MessageVariant& body), (override));
3231
MOCK_METHOD(Error, Subscribe, (ConnectionEventsSubscriberItf & subscriber), (override));
3332
MOCK_METHOD(Error, Unsubscribe, (ConnectionEventsSubscriberItf & subscriber), (override));
3433
};

0 commit comments

Comments
 (0)