(Page 6 of 11 in this chapter)


4.5 MVIP Switching

The CT Access Switching service provides functions to allow you to control the underlying MVIP switching device. It provides functions for

The following table lists when to use the switching functions available in the CT Access Switching service.

If you want to...

Then use this function...

Reset specified switch block outputs to their idle state

swiDisableOutput

Retrieve the state of specified switch block outputs

swiGetOutputState

Query the device driver and return information about the capabilities of the device driver and the switch controlled by it

swiGetSwitchCaps

Connect inputs to outputs

swiMakeConnection

Connect inputs to outputs with identical throughput delay for all connections

swiMakeFramedConnection

Reset the entire switch block to the idle state

swiResetSwitch

Retrieve the current datum values present on specified switch block inputs

swiSampleInput

Assert fixed patterns on specified switch block outputs

swiSendPattern

Refer to Appendix D for an example of using the switching functions to develop a Call Center application.

4.5.1 Making Connections

The Switching service makes a connection between an input terminus and an output terminus with swiMakeConnection or swiMakeFramedConnection.

swiMakeFramedConnection is identical to swiMakeConnection except that all connections ever made on the same switch device with this function have the same constant throughput delay. swiMakeFramedConnection can be used to make a single high band-width connection using multiple timeslots where the data is synchronized across the timeslots.

swiMakeConnection connects inputs to the switch block to the outputs from the switch block. For example, it can be used to connect the voice paths of an incoming digital line and an operator station so that the caller and the operator can carry on a conversation.

The demonstration program prt2prt demonstrates how to make connections. Refer to Section 13.2.5, Port to Port Program: prt2prt.

The operator station is on the local bus at streams 0 and 1. As shown in Figure 30, it is connected to the MVIP bus on MVIP streams 0 and 1. To connect the voice streams on the incoming digital line to the operator station's voice streams, connect the incoming digital line's voice streams to MVIP bus streams 0 and 1.

Figure 30. State of the MVIP Switches Before the Connections Have Been Made


The following example code connects the incoming digital line's voice streams to the operator station's voice streams via the MVIP bus.

/* Connect Voice paths of AG S-Connect operator and incoming call on the T1 */
void myConnectVoice(SWIHD t1hd, DWORD timeslot)
{
SWI_TERMINUS output, input;

/* Connect T1 local:0:timeslot to mvip:0:timeslot */
output.bus = MVIP95_MVIP_BUS;
output.stream = 0;
output.timeslot = timeslot;

input.bus = MVIP95_LOCAL_BUS;
input.stream = 0;
input.timeslot = timeslot;

swiMakeConnection(t1hd, &input, &output, 1);

/*
* Make a DUPLEX connection by also connecting
* mvip:1:timeslot to local:1:timeslot
*/
output.bus = MVIP95_LOCAL_BUS;
output.stream = 1;
output.timeslot = timeslot;

input.bus = MVIP95_MVIP_BUS;
input.stream = 1;
input.timeslot = timeslot;

swiMakeConnection(t1hd, &input, &output, 1);
}

Figure 31 illustrates the state of the switch blocks after the connections have been made.

Figure 31. State of the MVIP Switches after the Connections Have Been Made

4.5.2 Sending a Pattern

swiSendPattern allows you to send a fixed eight bit pattern out of an output terminus of the switch block.

For example, to provide battery to the operator stations on an Alliance Generation S-Connect board, you would send the pattern SWI_A_BIT_ON to the operator stations on local bus stream 3.

Figure 32 illustrates the state of the switch block before the pattern is sent.

Figure 32. State of the MVIP Switches Before the Pattern is Sent


The following example code provides battery to the operator stations on an
S-Connect board by sending the pattern SWI_A_BIT_ON to the operator stations on local bus stream 3.

/* Provide battery to the AG S-Connect operator stations */
void mySendOffhook(SWIHD cxhd)
{
SWI_TERMINUS outputs[24];
BYTE patterns[24];
unsigned count;

/* SendPattern out to operator interfaces via local:3:timeslot */
for (count = 0; count < 24; count++)
{
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 3;
outputs[count].timeslot = (DWORD)count;
patterns[count] = SWI_A_BIT_ON;
}
swiSendPattern(cxhd, patterns, outputs, count);
}

Figure 33 illustrates the state of the switch block after the pattern is sent.

Figure 33. State of the MVIP Switches After the Pattern is Sent


The demonstration program prt2prt demonstrates sending patterns. Refer to Section 13.2.5, Port to Port Program: prt2prt.

4.5.3 Disabling Output

If an output terminus is connected to an input terminus or if there is a pattern being sent out of the output terminus, swiDisableOutput breaks the connection or stops sending the pattern.

For example, to break the connection from the incoming digital line's voice streams to the operator station's voice streams via the MVIP bus, you would disable the outputs from the incoming digital line's switch block.

It is very important to break switch connections or to stop sending a pattern when they are no longer required. Leftover connections can cause unpredictable behavior and hard to find problems for the application.

Figure 34 illustrates the state of the MVIP switches before the output is disabled from the incoming digital line's switch block.

Figure 34. State of the MVIP Switches Before Output is Disabled


The following example code breaks the connection.

void myReconfigureT1Line(SWIHD t1hd, DWORD timeslot)
{
SWI_TERMINUS output;

/* Disable outputs of switch to mvip:0:timeslot */
output.bus = MVIP95_MVIP_BUS;
output.stream = 0;
output.timeslot = timeslot;

swiDisableOutput(t1hd, &output, 1);

/* Disable outputs of switch to local:1:timeslot */
output.bus = MVIP95_LOCAL_BUS;
output.stream = 1;
output.timeslot = timeslot;

swiDisableOutput(t1hd, &output, 1);
}

Figure 35 illustrates the state of the MVIP switches after the output is disabled from the incoming digital line's switch block.

Figure 35. State of the MVIP Switches After the Output Has Been Disabled

4.5.4 Sampling Data

If you want to know what data is present on a switch block input terminus, use swiSampleInput.

For example, if you wanted to read the bits on an incoming analog line on an
AG-8 board, you would sample the data on the AG-8's incoming line's timeslot.

The following example code reads the bits on an incoming analog line on an
AG-8 board.

void myPrintInput(SWIHD hd, DWORD stream, DWORD timeslot)
{
BYTE data;
SWI_TERMINUS input;

input.bus = MVIP95_MVIP_BUS;
input.stream = stream;
input.timeslot = timeslot;

swiSampleInput(hd, &input, &data, 1);

switch (input.bus)
{
case MVIP95_MVIP_BUS:
printf(" %s", " mvip");
break;
case MVIP95_LOCAL_BUS:
printf(" %s", "local");
break;
case MVIP95_MC1_BUS:
printf(" %s", " mc1");
break;
}

printf(":%2d:%02d=%02X\n", input.stream, input.timeslot, data);
}

4.5.5 Querying Switch Capabilities

If you want to query the device driver and return information about the capabilities of the device driver and the switch block, use swiGetSwitchCaps.

The following example code queries the capabilities of the device driver and the switch controlled by it.

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" :
"MVIP-90"),
(float)cp.swstdrevision/100.0);

printf("Hardware Std. %s Rev. %2.f.\n",
((cp.hwstandard == MVIP95_STANDARD_HMVIP)? "HMVIP" :
"MVIP-90"),
(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);
}



(Page 6 of 11 in this chapter)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.