Disconnects an existing simplex, duplex, or quad connection.
DWORD ppxDisconnect ( CTAHD ctahd, PPX_MVIP_ADDR *talker, PPX_MVIP_ADDR *listener, PPX_CX_MODE mode )
|
Argument |
Description |
|
ctahd |
Context handle returned by ctaCreateContext or ctaAttachContext. |
|
talker |
Pointer to a PPX_MVIP_ADDR structure. The structure is defined as follows: typedef struct Refer to the Details section for a description of these fields. |
|
listener |
Pointer to a PPX_MVIP_ADDR structure. |
|
mode |
Connection mode: PPX_SIMPLEX, PPX_DUPLEX, or PPX_QUAD. |
|
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 |
ctahd is not a valid context handle. |
|
CTAERR_NOT_FOUND |
talker or listener is not defined in the PPX configuration file. |
|
CTAERR_OUT_OF_MEMORY |
Unable to allocate memory. |
|
CTAERR_SVR_COMM |
Natural Access server communication error. |
|
PPXERR_COMM_FAILURE |
Problems were encountered when communicating with the PPX server. |
|
PPXERR_CONN_OWNERSHIP |
listener is in a connection not owned by the calling connection or the initial connection was nailed up. |
|
PPXERR_DRIVER_OPEN_FAILED |
Driver open failed, or the driver DLL or device was not found. |
|
PPXERR_INVALID_SWITCH |
Switch number specified is inaccessible from the specified bus:stream:timeslot. |
|
PPXERR_NOT_CONNECTED |
listener is not receiving output from the talker. |
|
PPXERR_NOT_LISTENER |
listener is incapable of receiving output from the connection. |
|
SWIERR_INVALID_STREAM |
One or more of the specified streams is invalid. |
|
SWIERR_INVALID_TIMESLOT |
One or more of the specified timeslots is invalid. |
ppxDisconnect disconnects a talker from a listener that was previously connected through ppxConnect. All intervening timeslots are freed.
The context must own the connection in order to disconnect.
If talker = NULL, the listener is disconnected (output disabled).
ppxDisconnect can also be used to disconnect any nailed up connections specified in the PPX configuration file as long as the connections were not specified with the NAILED keyword. Verify that no application is using the connection before disconnecting.
The PPX_MVIP_ADDR structure contains the following fields:
|
Field |
Description |
|---|---|
|
switch_number |
Switch number of the board as defined in ppx.cfg. |
|
bus |
Acceptable values are: MVIP95_MVIP_BUS MVIP95_LOCAL_BUS |
|
stream |
Stream number of the listener/talker. |
|
timeslot |
Timeslot of the listener/talker. |
Refer to Making one-talker, one-listener connections for more information.
DWORD MyConnectDisconnect( CTAHD ctahd, PPX_CX_MODE mode, BOOL MakeConn )
{
PPX_MVIP_ADDR listener, talker;
DWORD ret ;
talkers.switch_number = 0;
talker.bus = MVIP95_LOCAL_BUS;
talker.stream = 0;
talker.timeslot = 4;
listener.switch_number = 1 ;
listener.bus = MVIP95_LOCAL_BUS;
listener.stream = 5;
listener.timeslot = 4;
/*
* The passed-in "mode" has one of the following
* values:
* PPX_SIMPLEX, PPX_DUPLEX, PPX_QUAD
*/
if ( MakeConn == TRUE )
ret = ppxConnect( ctahd, &talker, &listener, mode );
else
ret = ppxDisconnect( ctahd, &listener, &talker, mode );
return ( ret ) ;
}