TcrSdk-Windows V1.0
Public Member Functions | List of all members
CustomDataChannel::Observer Class Referenceabstract

A class can implement the Observer interface when it wants to be informed of events in CustomDataChannel objects. More...

#include <custom_data_channel.h>

Public Member Functions

virtual void OnConnected (const int32_t port)=0
 This method is called when the listened 'CustomDataChannel' is connected successfully.
 
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 OnMessage (const int32_t port, const char *buffer)=0
 This method is called whenever the listened 'CustomDataChannel' receives cloud message.
 

Detailed Description

A class can implement the Observer interface when it wants to be informed of events in CustomDataChannel objects.

Member Function Documentation

◆ OnConnected()

virtual void OnConnected ( const int32_t  port)
pure virtual

This method is called when the listened 'CustomDataChannel' is connected successfully.

Parameters
portThe identify of the listened 'CustomDataChannel'.

◆ OnError()

virtual void OnError ( const int32_t  port,
const TcrCode code,
const std::string &  msg 
)
pure virtual

This method is called whenever some error is happened in the listened 'CustomDataChannel'.

Parameters
portThe identify of the listened 'CustomDataChannel'.
codeThe error code.
msgThe error message.

◆ OnMessage()

virtual void OnMessage ( const int32_t  port,
const char *  buffer 
)
pure virtual

This method is called whenever the listened 'CustomDataChannel' receives cloud message.

NOTE: |buffer| will be freed once this function returns so callers who want to use the data asynchronously must make sure to copy it first.

Parameters
portThe identify of the listened 'CustomDataChannel'.
bufferThe message sent from the cloud.

The documentation for this class was generated from the following file: