# swiSampleInput

Retrieves the current data values present on specified switch block
inputs.

#### Prototype

DWORD swiSampleInput ( SWIHD swihd, SWI_TERMINUS input[], BYTE data[], unsigned count)

Argument | Description
swihd | Switch handle .
input | Array of terminus structures for the input of the switch block: typedef struct { DWORD bus; DWORD stream; DWORD timeslot; } SWI_TERMINUS; Refer to swiMakeConnection for a description of these fields.
data | Array that receives values present on the specified switch block inputs.
count | Number of elements in the input and data arrays.

#### Return values

Return value | Description
SUCCESS |
CTAERR_DRIVER_ERROR | Underlying driver retrieved an unrecognized error. Call swiGetLastError to retrieve the MVIP device error code.
CTAERR_INVALID_HANDLE | swihd is not a valid switch handle.
CTAERR_SVR_COMM | Communication error in the server environment.
SWIERR_INVALID_STREAM | One or more of the specified streams is invalid.
SWIERR_INVALID_TIMESLOT | One or more of the specified timeslots is invalid.

#### Details

swiSampleInput reads the data available on one or more inputs of a switch block. Calling this function does not affect the switch block inputs or connections.

Note: Under Solaris, the upper limit for the number of terminuses
that can be batched in one call is 32.

Refer to Sampling data for more information.

If CTAERR_DRIVER_ERROR is returned, call swiGetLastError to retrieve the MVIP device error code.

#### See also

swiGetOutputState, swiMakeFramedConnection, swiOpenSwitch, swiSendPattern

#### Example

void myPrintInput(SWIHD hd, SWI_TERMINUS input)
{
BYTE data;
swiSampleInput(hd, &input, &data, 1);
switch (input.bus)
{
case MVIP95_MVIP_BUS:
printf(" %s", " mvip");
break;
case MVIP95_LOCAL_BUS:
printf(" %s", "local");
break;
}
printf(":%2d:%02d=%02X\n", input.stream, input.timeslot, data);
}