Jump to main content

# 1.2.6.4.7 SRV_USI_Send_Message Function

## C

    size_t SRV_USI_Send_Message( SRV_USI_HANDLE handle,
            SRV_USI_PROTOCOL_ID protocol, uint8_t *data, size_t length )

## Summary

Sends a message through serial interface (USI).

## Description

This function is used to send a message through USI. The message will be formatted depending on the specified Protocol and will be sent using the serial interface associated to the corresponding USI instance.

## Precondition

SRV_USI_Open must have been called to obtain a valid opened service handle.

## Parameters

Param | Description
--- | ---
handle | A valid open-instance handle, returned from SRV_USI_Open.
protocol | Identifier of the protocol for the message to send (SRV_USI_PROTOCOL_ID Enum).
data | Pointer to the data to send.
length | Length of the data to send in bytes.

## Returns

Number of bytes sent.

## Example

    uint8_t pData[] = "Message to send through USI";

    // 'handle', returned from SRV_USI_Open previously called
    SRV_USI_Send_Message(handle, SRV_USI_PROT_ID_PHY, pData, sizeof(pData));

## Remarks

None.

Rev: G