# Sending and receiving PCS information elements

An application using the ISDN Messaging API interface can send and receive user-to-PCS and PCS-to-user information elements, for the VN6 variant only, in the following primitives:

- ACU_ALERT_IN

- ACU_ALERT_RQ

- ACU_CLEAR_IN

- ACU_CLEAR_CO

- ACU_CLEAR_RQ

- ACU_CLEAR_RS

- ACU_CONN_CO

- ACU_CONN_IN

- ACU_CONN_RQ

- ACU_CONN_RS

- ACU_FACILITY_IN

- ACU_FACILITY_RQ

- ACU_PROGRESS_IN

The NMS ISDN stack provides three macros for each primitive, for accessing these information elements. (xxx represents the primitive name, such as conn_rq):

Macro | Description
Acu_xxx_pcs_user_size | Size of the pcs_user information.
Acu_xxx_pcs_user_protocol | Protocol discriminator for the pcs_user information element (can assume the values: ACUPCS_USER_TRANSGROUP, ACUPCS_USER_PUBLIPHONE, ACUPCS_USER_CALL_ROUTING, ACUPCS_USER_DIALOGUE).
Acu_xxx_a_pcs_user | Address of the pcs_user information.

The application can send pcs_user macros in the connected state, using the ACU_FACILITY_RQ primitive. In this case, in addition to the pcs_user macros previously described, the following macros must be set:

Macro | Must be set to...
--- | ---
Acu_facility_code | ACU_FAC_PCS_USER_ONLY
Acu_facility_action | ACU_RQ_ACTIVATE

The user-to-PCS information element can be sent only in the user-to-network direction. The PCS-to-user information element can be sent only in the network-to-user direction. Therefore, the two information elements are never present at the same time in an ISDN message. For this reason, the same macros are used for both information elements.

There are no restrictions on the contents of the information area in the user-to-PCS or PCS-to-user information elements. Non-printable characters, including \0, can be sent and received. However, for consistency with other macros and for ease of use, the stack automatically adds a \0 character at the end of any incoming pcs_user information. For example, if the incoming pcs_user information is 0x31 0x32 0x33 (representing the number 123), the stack sets the Acu_xxx_pcs_user_size macro to 4 and adds a 0x00 byte.

For outbound pcs_user information elements, the stack sends the exact number of octets specified by the application in Acu_xxx_pcs_user_size. For example, to send 0x31 0x32 0x33, the application sets Acu_xxx_pcs_user_size to 3.

## Example code

The following sample code illustrates how to build a structure containing PCS information, prior to sending it:

void build_facility_with_pcs(char *buffer, int *len)
{
struct acu_facility *p_data;
/* For simplicity let's use a string. We could also have used non-printable
characters here and used memcpy instead of strcpy */
char pcs_string[] = "pcs_string";
p_data = (struct acu_facility *)buffer;
memset(p_data, OFF, ISDN_BUFFER_DATA_LGTH);
Acu_facility_code = ACU_FAC_PCS_USER_ONLY;
Acu_facility_action = ACU_RQ_ACTIVATE;
Acu_facility_pcs_user_protocol = ACUPCS_USER_TRANSGROUP;
strcpy(Acu_facility_a_pcs_user,pcs_string);
Acu_facility_pcs_user_size = strlen(pcs_string);
*len = Acu_facility_total_size;
return;
}