Example: Send When Buffer Filled

This example shows coding necessary to add alarm generation/update requests to the IPC message buffer until the buffer is full. When the buffer is full, a message is sent.

        ... get parameters ... (load msg_fields)

     while (not_finished)

     {

        /* first call */

        amaru_add_gen (msg_wbody, MAX_MSG_SIZE, TRUE, ... );

        /* repeat */

        repeat

        {

           ... get parameters ...

        }

        until ( amaru_add_gen (msg_wbody,     , FALSE, ...) !=

                                               COR_SUCCESS);

        if (ret_stat.err_code == MF_INSUF_SPACE)

        {

           /* send message */

           amaru_send_msg (port_id, ... );

           /* unload returned message */

           ...

        }

     } /* end while */

Note: The alarm generation/update requests are added to the IPC message buffer. The most recent alarm segment is not added to the message buffer if there is not sufficient space for it. Therefore it must be kept and loaded into the next datagram as the first segment.

More information

Alarm Management API getting started.