# mspEnableChannel

Enables the MSPP channel to begin processing data.

#### Prototype

DWORD mspEnableChannel ( MSPHD chnhd )

Argument | Description
chnhd | MSPP channel handle.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | Function argument includes an invalid value or a required pointer argument is NULL.
CTAERR_INVALID_CTAHD | Handle is invalid.
CTAERR_INVALID_HANDLE | Invalid handle was passed as an argument to this function.
MSPERR_CHANNEL_NOT_CONNECTED | Specified MSPP channel is not connected to any endpoints.
MSPERR_DRIVER_COMMAND_FAILED | SPI command failed.
MSPERR_INTERNAL_HANDLE | Specified MSPP channel is not valid.
MSPERR_INVALID_HANDLE | Specified MSPP channel is not valid.

#### Events

Event | Description
MSPEVN_ENABLE_CHANNEL_DONE | Generated when the data flow through an MSPP channel is enabled or resumed in response to an mspEnableChannel function call. The event.value field can contain the following: CTA_REASON_FINISHED MSPRSN_FAILED_TO_START MSPP service is unable to start the on-board resource. The event.objhd indicates the chnhd of the enabled channel.

#### Details

Created MSPP channels are disabled, by default, and must be enabled before data is sent or received. When invoking mspEnableChannel, specify the channel handle (chnhd) of the connected channel. As soon as data is transferred, the connection channel processes the data and passes it on to the endpoint at the opposite end of the connection.

mspEnableChannel can also be used to re-establish data flow through a channel that had previously been disabled.

#### See also

mspCreateChannel, mspDisableChannel

#### Example

ret = mspEnableChannel( hChan);
if (ret != SUCCESS)
return FAILURE;
// Wait for event
ctaWaitEvent( hCtaQueHd, &Event, CTA_WAIT_FOREVER );
// Check the reason code
if ( Event.id != MSPEVN_ENABLE_CHANNEL_DONE ||
Event.value != CTA_REASON_FINISHED )
return FAILURE;