Updated on 2023-06-15 GMT+08:00

Sending Messages

SendMessage()

This section describes how to send messages synchronously. During the message sending process, other threads are blocked (in the waiting state). They are unblocked until the messages are sent successfully. You need to configure message subscription on the console first. For details, see the "Subscribing to Messages" section in HiLens User Guide. Only 1.0.7 to 1.2.2 versions are supported.

  • API calling

    HiLensEC hilens::UploadBuffer(const std::string & subject, const std::string & message)

  • Parameter description
    Table 1 Parameters

    Parameter

    Description

    subject

    Email subject. This parameter is valid only when Email is set. The value can contain up to 170 characters.

    message

    Message content, which contains up to 85 characters.

  • Return values

    If the return value is 0, the operation is successful. Otherwise, the operation fails. For details about the failure response parameters, see Error Codes.

SendMessageAsync()

This section describes how to send messages asynchronously. You need to configure message subscription on the console first. For details, see the "Subscribing to Messages" section in HiLens User Guide. Only 1.0.7 to 1.2.2 versions are supported.

  • API calling

    HiLensEC hilens::UploadBuffer(const std::string & subject, const std::string & message, void (*callback)(int) = NULL)

  • Parameter description
    Table 2 Parameters

    Parameter

    Description

    subject

    Email subject. This parameter is valid only when Email is set. The value can contain up to 170 characters.

    message

    Message content, which contains up to 85 characters

    callback

    Callback function

  • Return values

    If the return value is 0, the operation is successful. Otherwise, the operation fails. For details about the failure response parameters, see Error Codes.