Alphabetical Function Reference
(Page 58 of 80 in this chapter)
adiStartSignalDetector
Description
- Starts the detection of changes in incoming out-of-band signaling bits.
Prototype
- DWORD adiStartSignalDetector( CTAHD ctahd,
unsigned initial,
unsigned mask,
unsigned timeon,
unsigned timeoff )
- ctahd Context handle returned by adiOpenPort.
- initial A mask indicating the expected incoming line state (see mask below for possible values).
- mask A mask indicating which bits should be monitored (For example, by setting this mask to ADI_A_BIT, all transitions of the A bit will be reported and transitions of the other bits will be ignored. The following constants are in adidef.h and can be ORed to monitor any group of bits: ADI_A_BIT, ADI_B_BIT, ADI_C_BIT, and ADI_D_BIT).
- timeon Deglitching (debounce) time (in milliseconds) for the ON state of the masked bits (A bit transition to HIGH is not reported unless it exceeds timeon).
- timeoff Deglitching (debounce) time (in milliseconds) for the OFF state of the masked bits (A bit transition to LOW is not reported unless it exceeds timeoff).
Return Values
Events
DSP File Requirement
- This function requires that signal.dsp has been loaded by agmon.
Details
- This function enables the detection of incoming out-of-band signaling bits. After this function is called, transitions of masked bits are reported as events, along with the current state of all bits.
- If the line state does not match the value set in initial, then after qualification time, timeon, or timeoff, an event will be generated.
Note: This function is incompatible with standard call control. Contexts running a standard protocol are usually excluded from use of this function. Protocols usually use out-of-band signaling bits for call set-up (detection of incoming calls) and call teardown (detection of hang-up).
See Also
- adiStopSignalDetector, adiQuerySignalState
Example
#define ALL_BITS (ADI_A_BIT|ADI_B_BIT|ADI_C_BIT|ADI_D_BIT)
int myMonitorSignal( CTAHD ctahd )
{
ADI_EVENT event;
/* start function to monitor all bit changes of 100 ms */
if( adiStartSignalDetector( ctahd, 0, ALL_BITS, 100, 100 ) != SUCCESS )
return MYFAILURE;
while( 1 )
{
const char *pc;
myGetEvent( &event ); /* see adiFetchAndProcess example */
switch( event.id )
{
case ADIEVN_SIGNAL_DETECT_DONE:
if( event.value == CTA_REASON_STOPPED )
return SUCCESS;
else
return MYFAILURE;
case ADIEVN_SIGNALBIT_CHANGED:
switch( event.value ) /* value contains the change */
{ /* size contains current state */
case 0xA1: pc = "A ON"; break;
case 0xB1: pc = "B ON"; break;
case 0xC1: pc = "C ON"; break;
case 0xD1: pc = "D ON"; break;
case 0xA0: pc = "A OFF"; break;
case 0xB0: pc = "B OFF"; break;
case 0xC0: pc = "C OFF"; break;
case 0xD0: pc = "D OFF"; break;
}
printf( "MVIP bit change: %s\tsignalling bits = 0x%x (%c%c%c%c)\n",
pc, (event.value&0xf),
(event.size&0x8)?'A':'-', (event.size&0x4)?'B':'-',
(event.size&0x2)?'C':'-', (event.size&0x1)?'D':'-' );
break;
/* might include cases to handle disconnect event, DTMFs, etc. */
}
}
}
(Page 58 of 80 in this chapter)
Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights
reserved.