Prosody data communications: API: smdc_channel_config

Prototype Definition

int smdc_channel_config(struct smdc_channel_config_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct smdc_channel_config_parms {
	tSMChannelId channel;					/* in */
	tSM_INT protocol;					/* in */
	tSM_INT config_length;					/* in */
	void *config_data;					/* in */
	tSM_INT encoding;					/* in */
	tSM_INT encoding_config_length;				/* in */
	void *encoding_config_data;				/* in */
} SMDC_CHANNEL_CONFIG_PARMS;

Description

Configures a channel (or half a channel) for data communications using a specified protocol and preparing it to transfer data encoded according to the encoding type over that protocol.

For details of what protocols and encodings are available, and the format of their configuration data, see the document Prosody Data Communcations Protocols and Encodings.

Channels can have two halves: an input half and an output half. A protocol may occupy either or both of these. It is possible to configure a channel for two protocols if one is input-only and the other is output-only. In that case the channel operates as if it were two separate channels, one for each direction.

The input half of a channel is reserved for this data communications configuration until smdc_rx_status() returns the status kSMDCRxStatusFinished. No other activity can take place on the input half of the channel during this time.

The output half of a channel is reserved for this data communications configuration until smdc_tx_status() returns the status kSMDCTxStatusFinished. No other activity can take place on the output half of the channel during this time.

While the output half of a channel is configured for data communications, a write event associated with this channel using sm_channel_set_event() will be set while the channel is ready to accept more data or there may be a status change to report. See smdc_tx_control() for details of how this works. When an application discovers that this event is set, it may check the status using smdc_tx_status(). However, an application may simply try smdc_tx_data() immediately and check status when it refuses to accept data.

While the input half of a channel is configured for data communications, a read event associated with this channel using sm_channel_set_event() will be set while the channel is ready to allow data to be read or there may be a status change to report. See smdc_rx_control() for details of how this works. When an application discovers that this event is set, it should attempt to read data using smdc_rx_data(). See its description to see how this interacts with status changes.

Requires firmware modules applicable to protocol and encoding to have been downloaded. See Prosody Data Communcations Protocols and Encodings

Fields

channel
The channel to configure.
protocol
The desired data communications protocol. The value zero (kSMDCProtocolNone) is reserved and guaranteed never to select a valid protocol.
config_length
The length of the protocol-specific configuration data pointed to by config_data.
config_data
Protocol-specific configuration data.
encoding
The desired encoding for data transferred with the selected protocol.
encoding_config_length
The length of the encoding-specific configuration data pointed to by encoding_config_data
encoding_config_data
Encoding-specific configuration data.

Returns

0 if call completed successfully, otherwise a standard error such as:


This function is part of the Prosody data communications API.