TcrSdk-Windows V1.0
custom_data_channel.h
Go to the documentation of this file.
1#ifndef TCRSDK_CUSTOM_DATA_CHANNEL_H_
2#define TCRSDK_CUSTOM_DATA_CHANNEL_H_
3
4#include <string>
5#include <stdint.h>
6#include "tcr_code.h"
7
23{
24public:
28 class Observer {
29 public:
30
36 virtual void OnConnected(const int32_t port) = 0;
37
45 virtual void OnError(const int32_t port, const TcrCode& code, const std::string& msg) = 0;
46
56 virtual void OnMessage(const int32_t port, const char* buffer) = 0;
57 };
58
65 virtual bool Send(const char* data) = 0;
66
70 virtual void Close() = 0;
71
72
73};
74
75#endif // TCRSDK_CUSTOM_DATA_CHANNEL_H_
76
A class can implement the Observer interface when it wants to be informed of events in CustomDataChan...
Definition custom_data_channel.h:28
virtual void OnMessage(const int32_t port, const char *buffer)=0
This method is called whenever the listened 'CustomDataChannel' receives cloud message.
virtual void OnError(const int32_t port, const TcrCode &code, const std::string &msg)=0
This method is called whenever some error is happened in the listened 'CustomDataChannel'.
virtual void OnConnected(const int32_t port)=0
This method is called when the listened 'CustomDataChannel' is connected successfully.
This interface represents a data channel between the client and the cloud application.
Definition custom_data_channel.h:23
virtual bool Send(const char *data)=0
Send data to the cloud Application.
virtual void Close()=0
Close this data channel.
TcrCode
This interface defines common codes of TcrSdk.
Definition tcr_code.h:9