# swiGetSwitchCaps

Returns information about the capabilities of the device driver and the switch controlled by it.

#### Prototype

DWORD swiGetSwitchCaps ( SWIHD swihd, SWI_SWITCHCAPS_ARGS *args, SWI_LOCALDEVICE_DESC localdevs[], unsigned maxcount)

Argument | Description
swihd | Switch handle .
args | Pointer to a switch capabilities parameter structure for the device driver information: typedef struct { DWORD dvrrevision; DWORD domain; DWORD routing; DWORD blocking; DWORD swstandard; DWORD swstdrevision; DWORD hwstandard; DWORD hwstandardrevision; DWORD numlocalstreams; } SWI_SWITCHCAPS_ARGS; Refer to the Details section for a description of these fields.
localdevs | Array that receives the number of timeslots and the device type of each local stream. The SWI_LOCALDEVICE_DESC structure is: typedef struct { DWORD timeslots; DWORD deviceid; } SWI_LOCALDEVICE_DESC; Refer to the Details section for a description of these fields.
maxcount | Maximum number of elements in the localdevs array.

#### 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.

#### Details

swiGetSwitchCaps queries the device driver and returns the capabilities of the device driver and the switch block
. Use this function any time after opening a switch block.

The SWI_SWITCHCAPS_ARGS structure contains the following fields:

Field | Description
--- | ---
dvrrevision | Revision level of the device driver multiplied by 100 (decimal).
domain | Domain of a switch block. A switch block's domain indicates which MVIP streams have full-duplex connections to the switch block. The representation of these streams is a bit field. If a full-duplex connection to the switch block is supported, the corresponding bit in the domain parameter is set to one. Bit 0 indicates whether the switch block supports a full-duplex connection to HDS0 (MVIP-95). In the context of MVIP-95 hardware implementations, bits 0 through 23 indicate the switch block's support for full-duplex connections with HDS0 through HDS23. A full-duplex connection means that an MVIP HDS stream can provide both input to the switch block and output from the switch block. The domain of all MVIP-95 standard-compliant switches is 1111 1111 1111 1111 (0xFFFF).
routing | Switch block's half-duplex routing capabilities. The representation of these capabilities is a bit field. When the switch block has a routing capability, the bit is set to 1. Refer to the next table for more information on bits and routing capabilities.
blocking | Switch block's possible blocking. Blocking means that a switch block is unable to provide all possible connections. A bit field represents where blocking is possible; a value of 1 signifies this possible restriction. The bit field for the blocking parameter has the same meaning as the bit field for the routing parameter.
swstandard | MVIP software standard to which the device driver conforms. The acceptable value is MVIP95_STANDARD_MVIP95.
swstdrevision | Revision of the software standard to which the device driver conforms multiplied by 100 (decimal).
hwstandard | NMS boards return MVIP95_STANDARD_HMVIP.
hwstandardrevision | Revision of the hardware standard controlled by the device driver multiplied by 100 (decimal).
numlocalstreams | Number of streams on the local bus side of the switch block. This number includes both the data and signaling streams for network devices such as T1 framers.

The following table presents the correspondence of bits in the bit field to the switch block's half-duplex routing capabilities:

Bit | Half-duplex routing capability
--- | ---
0 | Even-numbered CT_D stream to odd-numbered CT_D stream.
1 | Odd-numbered CT_D stream to even-numbered CT_D stream.
2 | Even-numbered CT_D stream to even-numbered CT_D stream.
3 | Odd-numbered CT_D stream to odd-numbered CT_D stream.
4 | Even-numbered CT_D stream to local.
5 | Local to odd-numbered CT_D stream.
6 | Odd-numbered CT_D stream to local.
7 | Local to even-numbered CT_D stream.
8 | Local to local.

The SWI_LOCALDEVICE_DESC structure contains the following fields:

Field | Description
--- | ---
timeslots | Number of timeslots on the local stream.
deviceid | Device identifier of the local stream.

Refer to Querying switch capabilities for more information.

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

#### See also

swiDisableOutput, swiGetLocalStreamInfo, swiGetLocalTimeslotInfo, swiGetOutputState, swiMakeConnection, swiMakeFramedConnection, swiResetSwitch, swiSampleInput, swiSendPattern

#### Example

void myPrintSwitchCaps(SWIHD hd)
{
SWI_SWITCHCAPS_ARGS cp;
SWI_LOCALDEV_DESC *localdevs;
swiGetSwitchCaps(hd, &cp, NULL, 0);
localdevs = (SWI_LOCALDEV_DESC *)malloc(
sizeof(SWI_LOCALDEV_DESC)*cp.numlocalstreams);
swiGetSwitchCaps(hd, &cp, localdevs, cp.numlocalstreams);
printf("Driver Software Std. %s Rev. %2.f\n",
((cp.swstandard == MVIP95_STANDARD_MVIP95)? "MVIP-95" :
"other"),
(float)cp.swstdrevision/100.0);
printf("Hardware Std. %s Rev. %2.f.\n",
((cp.hwstandard == MVIP95_STANDARD_HMVIP)? "HMVIP" :
"other"),
(float)cp.hwstdrevision/100.0);
printf("Driver Rev. %.2f\n", (float)cp.dvrrevision/100.0);
printf(" Domain %04X, Routing %04X, Blocking %04X.\n",
cp.domain, cp.routing, cp.blocking );
if( cp.numlocalstreams > 0 )
{
DWORD i;
printf("Supports %d local streams:\n\t",
cp.numlocalstreams );
for( i=0; i<cp.numlocalstreams; i++ )
printf( "%2d ", i+16 );
printf("with\n\t");
for( i=0; i<cp.numlocalstreams; i++ )
printf( "%2d ", localdevs[i].timeslots );
printf("timeslots respectively.\n");
}
free(localdevs);
}

#### Sample Run

The output would be:

Driver Software Std. MVIP-95 Rev. 0.00, Hardware Std. H.110 Rev. 0.
Driver Rev. 17.00, Domain FFFF, Routing 01FF, Blocking 00FF.
Supports 4 local streams:
16 17 18 19 with
24 24 32 32 timeslots respectively.