# swiGetOutputState

Retrieves the state of the specified switch bloc
k outputs.

#### Prototype

DWORD swiGetOutputState ( SWIHD swihd, SWI_TERMINUS output[], unsigned mode[], BYTE pattern[], SWI_TERMINUS input[], unsigned count)

Argument | Description
swihd | Switch handle .
output | Array of terminus structures for which to retrieve the state: typedef struct { DWORD bus; DWORD stream; DWORD timeslot; } SWI_TERMINUS; Refer to swiMakeConnection for a description of these fields.
mode | Array that receives the state of the switch block outputs. Possible mode values are: MVIP95_DISABLE_MODE MVIP95_PATTERN_MODE MVIP95_CONNECT_MODE MVIP95_FRAMED_CONNECT_MODE Refer to the Details section for more information about mode.
pattern | Array that receives the data values asserted at the switch block outputs if the corresponding mode is MVIP95_PATTERN_MODE.
input | Array that receives the switch block inputs connected to the switch block outputs if mode is MVIP95_CONNECT_MODE or MVIP95_FRAMED_CONNECT_MODE.
count | Number of elements in the output, mode, pattern, and input 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_MODE | mode value returned by the driver is unrecognized.
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

swiGetOutputState retrieves the state of the specified switch block outputs. The following table describes the mode values:

If mode is... | Then...
MVIP95_DISABLE_MODE | The switch block outputs on the MVIP bus are in their high impedance state. If a switch block output is on a local bus, the timeslots on the local bus are put into a known state. (The driver vendor must publish these states in customer documentation.)
MVIP95_PATTERN_MODE | A fixed pattern is being asserted on the switch block output.
MVIP95_CONNECT_MODE or MVIP95_FRAMED_CONNECT_MODE | There is a connection from the input terminus to the output terminus.

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

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

#### See also

swiDisableOutput, swiMakeFramedConnection, swiResetSwitch, swiSendPattern

####

#### Example

void myPrintOutputState(SWIHD hd, SWI_TERMINUS output)
{
unsigned mode;
BYTE pattern;
SWI_TERMINUS input;
swiGetOutputState(hd, &output, &mode, &pattern, &input, 1);
switch (output.bus)
{
case MVIP95_MVIP_BUS:
printf("STo(%s", "mvip");
break;
case MVIP95_LOCAL_BUS:
("STo(%s", "local");
break;
}
printf(":%2d:%02d) ", output.stream, output.timeslot);
switch( mode )
{
case MVIP95_CONNECT_MODE:
case MVIP95_FRAMED_CONNECT_MODE:
switch (input.bus)
{
case MVIP95_MVIP_BUS:
printf(" %s", " mvip");
break;
case MVIP95_LOCAL_BUS:
printf(" %s", "local");
break;
}
printf(":%2d:%02d", input.stream, input.timeslot);
break;
case MVIP95_PATTERN_MODE:
printf(" m_%02X", pattern );
break;
case MVIP95_DISABLE_MODE:
printf(" t_%02X", 0 );
break;
default:
printf(" %02X_%02X", 0, 0);
break;
}
printf("\n");
}