Signaling (previously RTM) SDK v1.5.0 API Reference for Linux (C++)
Public Member Functions | List of all members
agora::rtm::IImageMessage Class Referenceabstract

#include <IAgoraRtmService.h>

Inherits agora::rtm::IMessage.

Public Member Functions

virtual long long  getSize () const =0
 
virtual const char *  getMediaId () const =0
 
virtual void  setThumbnail (const uint8_t *thumbnail, long long length)=0
 
virtual const char *  getThumbnailData () const =0
 
virtual const long long  getThumbnailLength () const =0
 
virtual void  setFileName (const char *fileName)=0
 
virtual const char *  getFileName () const =0
 
virtual void  setWidth (int width)=0
 
virtual int  getWidth () const =0
 
virtual void  setHeight (int height)=0
 
virtual int  getHeight () const =0
 
virtual void  setThumbnailWidth (int width)=0
 
virtual int  getThumbnailWidth () const =0
 
virtual void  setThumbnailHeight (int height)=0
 
virtual int  getThumbnailHeight () const =0
 
virtual long long  getMessageId () const =0
 
virtual MESSAGE_TYPE  getMessageType () const =0
 
virtual void  setText (const char *str)=0
 
virtual const char *  getText () const =0
 
virtual const char *  getRawMessageData () const =0
 
virtual int  getRawMessageLength () const =0
 
virtual long long  getServerReceivedTs () const =0
 
virtual bool  isOfflineMessage () const =0
 
virtual void  release ()=0
 

Member Function Documentation

◆ getSize()

virtual long long agora::rtm::IImageMessage::getSize ( ) const
pure virtual

Gets the size of the uploaded image.

Returns
The size of the uploaded image in bytes.

◆ getMediaId()

virtual const char * agora::rtm::IImageMessage::getMediaId ( ) const
pure virtual

Gets the media ID of the uploaded image.

Note
  • The media ID is automatically populated once the image is uploaded to the file server.
  • The media ID is valid for 7 days because the file server keeps all uploaded files for 7 days only.
Returns
The media ID of the uploaded image.

◆ setThumbnail()

virtual void agora::rtm::IImageMessage::setThumbnail ( const uint8_t *  thumbnail,
long long  length 
)
pure virtual

Sets the thumbnail of the uploaded image.

Parameters
thumbnail The thumbnail of the uploaded image.
length The length of the thumbnail in bytes. The size of thumbnail and fileName combined must not exceed 32 KB.

◆ getThumbnailData()

virtual const char * agora::rtm::IImageMessage::getThumbnailData ( ) const
pure virtual

Gets the thumbnail data of the uploaded image.

Returns
The thumbnail data of the uploaded image.

◆ getThumbnailLength()

virtual const long long agora::rtm::IImageMessage::getThumbnailLength ( ) const
pure virtual

Gets the length of the thumbnail data.

Returns
The length of the thumbnail data.

◆ setFileName()

virtual void agora::rtm::IImageMessage::setFileName ( const char *  fileName )
pure virtual

Sets the file name of the uploaded image.

Parameters
fileName The file name of the uploaded image. The size of thumbnail and fileName combined must not exceed 32 KB.

◆ getFileName()

virtual const char * agora::rtm::IImageMessage::getFileName ( ) const
pure virtual

Gets the file name of the uploaded image.

Returns
The file name of the uploaded image.

◆ setWidth()

virtual void agora::rtm::IImageMessage::setWidth ( int  width )
pure virtual

Sets the width of the uploaded image.

Note
  • If the uploaded image is in JPG, JPEG, BMP, or PNG format, the SDK automatically calculates the width and height of the image. You can call getWidth directly to get the width of the image.
  • Image width that is set by calling this method overrides the width calculated by the SDK.
Parameters
width The width of the uploaded image.

◆ getWidth()

virtual int agora::rtm::IImageMessage::getWidth ( ) const
pure virtual

Gets the width of the uploaded image.

Note
  • If the uploaded image is in JPG, JPEG, BMP, or PNG format, the SDK automatically calculates the width and height of the image. You can call this method directly to get the width of the image.
  • Image width that is set by calling setWidth overrides the width calculated by the SDK.
Returns
The width of the uploaded image. Is 0 if the SDK does not support the format of the uploaded image.

◆ setHeight()

virtual void agora::rtm::IImageMessage::setHeight ( int  height )
pure virtual

Sets the height of the uploaded image.

Note
  • If the uploaded image is in JPG, JPEG, BMP, or PNG format, the SDK automatically calculates the width and height of the image. You can call getHeight directly to get the height of the image.
  • Image height that is set by calling this method overrides the height calculated by the SDK.
Parameters
height The height of the uploaded image. Is 0 if the SDK does not support the format of the uploaded image.

◆ getHeight()

virtual int agora::rtm::IImageMessage::getHeight ( ) const
pure virtual

Gets the height of the uploaded image.

Note
  • If the uploaded image is in JPG, JPEG, BMP, or PNG format, the SDK automatically calculates the width and height of the image. You can call this method directly to get the height of the image.
  • Image height that is set by calling setHeight overrides the height calculated by the SDK.
Returns
The height of the uploaded image.

◆ setThumbnailWidth()

virtual void agora::rtm::IImageMessage::setThumbnailWidth ( int  width )
pure virtual

Sets the width of the thumbnail.

Note
You need to work out the width of the thumbnail by yourself, because the SDK does not work out the value for you.
Parameters
width The width of the thumbnail.

◆ getThumbnailWidth()

virtual int agora::rtm::IImageMessage::getThumbnailWidth ( ) const
pure virtual

Gets the width of the thumbnail.

Returns
The width of the thumbnail.

◆ setThumbnailHeight()

virtual void agora::rtm::IImageMessage::setThumbnailHeight ( int  height )
pure virtual

Sets the height of the thumbnail.

Note
You need to work out the height of the thumbnail by yourself, because the SDK does not work out the value for you.
Parameters
height The height of the thumbnail.

◆ getThumbnailHeight()

virtual int agora::rtm::IImageMessage::getThumbnailHeight ( ) const
pure virtual

Gets the height of the thumbnail.

Returns
The height of the thumbnail.

◆ getMessageId()

virtual long long agora::rtm::IMessage::getMessageId ( ) const
pure virtualinherited

Retrieves the unique ID of the message.

Returns
The message ID.

◆ getMessageType()

virtual MESSAGE_TYPE agora::rtm::IMessage::getMessageType ( ) const
pure virtualinherited

Retrieves the message type.

Returns
The message type. See MESSAGE_TYPE.

◆ setText()

virtual void agora::rtm::IMessage::setText ( const char *  str )
pure virtualinherited

Sets the content of a text message, or the text description of a raw message.

Parameters
str The text message to be set. Must not exceed 32 KB in length. If the message is a raw message, ensure that the overall size of the text description and the raw message data does not exceed 32 KB.

◆ getText()

virtual const char * agora::rtm::IMessage::getText ( ) const
pure virtualinherited

Retrieves the content of a text message, or the text description of a raw message.

Returns
The content of the received text message, or the text description of the received raw message.

◆ getRawMessageData()

virtual const char * agora::rtm::IMessage::getRawMessageData ( ) const
pure virtualinherited

Retrieves the starting address of the raw message in the memory.

Returns
The starting address of the raw message in the memory.

◆ getRawMessageLength()

virtual int agora::rtm::IMessage::getRawMessageLength ( ) const
pure virtualinherited

Retrieves the length of the raw message.

Returns
The length of the raw message in Bytes.

◆ getServerReceivedTs()

virtual long long agora::rtm::IMessage::getServerReceivedTs ( ) const
pure virtualinherited

Allows the receiver to retrieve the timestamp of when the messaging server receives this message.

Note
  • You can infer from the returned timestamp the approximate time as to when this message was sent.
  • The returned timestamp is on a millisecond time-scale. It is for demonstration purposes only, not for strict ordering of messages.
Returns
The timestamp (ms) of when the messaging server receives this message.

◆ isOfflineMessage()

virtual bool agora::rtm::IMessage::isOfflineMessage ( ) const
pure virtualinherited

Allows the receiver to check whether this message has been cached on the server (Applies to peer-to-peer message only).

Note
  • This method returns false if a message is not cached by the server. Only if the sender sends the message as an offline message (sets enableOfflineMessaging as true) when the specified user is offline, does the method return true when the user is back online.
  • For now we only cache 200 offline messages for up to seven days for each message receiver. When the number of the cached messages reaches this limit, the newest message overrides the oldest one.
Returns
  • true: This message has been cached on the server (the server caches this message and re-sends it to the receiver when he/she is back online).
  • false: This message has not been cached on the server.

◆ release()

virtual void agora::rtm::IMessage::release ( )
pure virtualinherited

Releases all resources used by the IMessage instance.

Note
For the message receiver: please access and save the content of the IMessage instance when receiving the onMessageReceived or the onMessageReceivedFromPeer callback. The SDK will release the IMessage instance when the callback ends.