CA_Send_CA_Msg()

Purpose

Send a message to another custom server.

Libraries

Blueworx Voice Response library (libvae.a)

Custom Server library (libca.a)

Syntax

#include "CA_header.h"
int CA_Send_CA_Msg (
 char    *appl_name,
 char    *function_name,
 size_t     Nbytes,
 unsigned char    *data
);

Description

This subroutine is used to send a message to another custom server specified by appl_name, via the function specified by function_name. A valid message must have a length in the range 0 to MAX_CA_MSG_DATA_LENGTH. The custom server for which the message is intended must be running.

The receiving user function should be defined to have two input parameters that correspond to the Nbytes and data parameters for CA_Send_CA_Msg(). In other words, the prototype for this function should be:

void function_name (long Nbytes, unsigned char *data);

where function_name is the name of the custom server user function.

Therefore given a WAITING custom server FVCN_CA_Send_CA with a System Generated main() having a user function:

void   FVCN_recMsg (
        long     FVCN_recMsg_nbytes,
        char    *FVCN_recMsg_recBuf)
{
  printf("Receive bytes=%li buf=%s\n",
         FVCN_recMsg_nbytes,
         FVCN_recMsg_recBuf);
}

which is defined with Input parameters:

long nbytes;
char recBuf[12];

the call CA_Send_CA_Msg( "FVCN_CA_Send_CA", "FVCN_recMsg", 12, "Hello World"); from another custom server will generate the output:

Receive bytes=12 buf=Hello World

Parameters

appl_name
Name of the custom server to which the message is to be sent. The maximum number of characters allowed in this string is MAX_CA_NAME_LENGTH.
function_name
Name of the custom server user function to which the message is to be sent. The maximum number of characters allowed in this string is MAX_FUNC_NAME_LENGTH.
Nbytes
Length of message.
data
Message.

Return codes

0
Successful
-1
Unsuccessful (global error number CA_errno is set to indicate the error)

Error names

CA_ACCESS_NOBUFS
CA_INV_ADDR
CA_INV_FUNC_ID
CA_NOT_INIT
CA_NOT_STARTED
CA_PARM_OVERFLOW
CA_REQ_FAILED
CA_TERMINATING

Related information

CA_Get_DT_Parameters(), CA_Put_DT_Parameters(), CA_Receive_DT_Msg(), CA_Send_DT_Msg(), CA_Send_DT_Error().