Queries the current value in the energy detector.
CG
DWORD adiQueryEnergy ( CTAHD ctahd)
Argument |
Description |
ctahd |
Context handle returned by ctaCreateContext or ctaAttachContext. |
Return value |
Description |
SUCCESS |
|
CTAERR_FUNCTION_NOT_ACTIVE |
adiStartEnergyDetector was not called. |
CTAERR_INVALID_STATE |
Function not valid in the current port state. |
CTAERR_SVR_COMM |
Server communication error. |
Event |
Description |
ADIEVN_QUERY_ENERGY_DONE |
After the ADI service queries the board for the current energy level, the ADI service generates an event with the size field containing the current energy in dbm0. |
Use adiQueryEnergy to query the silence/energy signaling detector for the current energy value.
The energy detector reports a moving average of the energy over approximately the last 30 milliseconds. The energy is reported in dBm0 units, with a range of -72 to -7.
Note: This function can be called only if you started detection either by using adiStartEnergyDetector or by starting recording with silence detection enabled.
int myQueryEnergy( CTAHD ctahd )
{
CTA_EVENT event;
if( adiQueryEnergy( ctahd ) != SUCCESS )
{
return MYFAILURE;
}
while( 1 )
{
myGetEvent( ctahd, &event ); /* see ctaWaitEvent example */
switch( event.id )
{
case ADIEVN_QUERY_ENERGY_DONE:
printf( "Current energy = %d dbm0\n", event.size);
break;
/* ... */
}
}
}