1.2.6.4.2 SRV_USI_Open Function
C
SRV_USI_HANDLE SRV_USI_Open( const SYS_MODULE_INDEX index )
Summary
Opens the specified USI service instance and returns a handle to it.
Description
This routine opens the specified USI service instance and provides a handle that must be provided to all other client-level operations to identify the caller and the instance of the service.
Precondition
Function SRV_USI_Initialize must have been called before calling this function.
Parameters
Param | Description |
---|---|
index | Index for the instance to be opened |
Returns
If successful, the routine returns a valid open-instance handle (SRV_USI_HANDLE Typedef).
If an error occurs, the return value is SRV_USI_HANDLE_INVALID. Error can occur
- if the specified instance has been already opened.
- if the instance being opened is not initialized or is invalid.
- if there is an error opening the serial interface (USB CDC instances only)
Example
SRV_USI_HANDLE handle;
handle = SRV_USI_Open(SRV_USI_INDEX_0);
if (handle == SRV_USI_HANDLE_INVALID)
{
// Unable to open USI instance. Maybe it is not initialized
}
Remarks
The handle returned is valid until SRV_USI_Close is called.