blob: 87cb8cb8291dfbde997e06cd07faa904e8e6f77c (
plain)
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
|
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_LOCAL_SOCKET_RECEIVER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_LOCAL_SOCKET_RECEIVER_H_
#include "transport_manager/android/ipc_receiver.h"
namespace transport_manager {
namespace transport_adapter {
class LocalSocketReceiver: public IpcReceiver
{
public:
using MessageDelegate = std::function<void(const std::vector<uint8_t>&)>;
LocalSocketReceiver(MessageDelegate&& callback);
~LocalSocketReceiver();
void Init(const std::string& socket_name) override;
void Run() override;
void Stop() override;
private:
int server_sock_;
int client_sock_;
bool connected_;
std::atomic_bool stop_requested_;
MessageDelegate callback_;
};
} // namespace transport_adapter
} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_ANDROID_LOCAL_SOCKET_RECEIVER_H_
|