📄 ac48drlo.c
字号:
/* Mute (0) to +31dB (63). Only the six LSBs of the */
/* assigned integer are affected. */
/* TDebugMode DebugMode */
/* Debug mode, to use (see: AC48xxDebugCommand). */
/* TWaitMode WaitMode: */
/* Wait / don't wait for the AC48 to be */
/* ready to deal with a new Command, */
/* which uses the 'AC48xxTransmitPacket' */
/* function. */
/* */
/* Output : int: */
/* ( 0) "AC_OK" for successful operation. */
/* (-1) "PACKET-FULL" detection in */
/* "DONT_WAIT_PACKET_EMPTY" mode. */
/* AC48 is not ready to transmit a new packet */
/* (suitable mode for polling). */
/* ( 2) "STATUS_ERROR" detected by the AC48. */
/*======================================================================*/
int Ac48xxInputGainCommand(int DeviceIndex, int ChannelIndex, int Gain,
TDebugingData DebugingData, TWaitMode WaitMode)
{
TInputGainCommand InputGainCommand;
InputGainCommand.Header.ConstAA = 0xAA;
InputGainCommand.Header.Id = ChannelIndex;
InputGainCommand.Header.Const_0_0_10 = 0;
InputGainCommand.Header.IdleCommandOpCode = INPUT_GAIN_COMMAND_OP_CODE;
InputGainCommand.Header.IdleCommandLength=0x06;
InputGainCommand.Gain = Gain;
InputGainCommand.Const_0_2_6 = 0;
InputGainCommand.Const_0_2_8 = 0;
return Ac48xxTransmitPacket(DeviceIndex, (char*)&InputGainCommand,
DebugingData, WaitMode);
}
/*======================================================================*/
/* Name : Ac48xxFaxCommand */
/*======================================================================*/
/* Purpose : Assigns Fax Parameters to a specific channel in the */
/* AC48 device by sending the AC48 FAX command to set its */
/* Attributes. */
/* */
/* Inputs : int DeviceIndex: */
/* An integer, performing the device index. */
/* int ChannelIndex: */
/* An integer, performing the channel index. */
/* TFaxAttributes *FaxAttributes: */
/* Fax attributes structure */
/* TDebugMode DebugMode */
/* Debug mode, to use (see: AC48xxDebugCommand). */
/* TWaitMode WaitMode: */
/* Wait / don't wait for the AC48 to be */
/* ready to deal with a new Command, */
/* which uses the 'AC48xxTransmitPacket' */
/* function. */
/* */
/* Output : int: */
/* ( 0) "AC_OK" for successful operation. */
/* (-1) "PACKET-FULL" detection in */
/* "DONT_WAIT_PACKET_EMPTY" mode. */
/* AC48 is not ready to transmit a new packet */
/* (suitable mode for polling). */
/* ( 2) "STATUS_ERROR" detected by the AC48. */
/*======================================================================*/
int Ac48xxFaxCommand(int DeviceIndex, int ChannelIndex,
const TFaxAttributes *FaxAttributes,
TDebugingData DebugingData, TWaitMode WaitMode
)
{
TFaxCommand FaxCommand;
FaxCommand.Header.ConstAA=0xAA;
FaxCommand.Header.Id=ChannelIndex;
FaxCommand.Header.Const_0_0_10=0;
FaxCommand.Header.IdleCommandOpCode = FAX_COMMAND_OP_CODE;
FaxCommand.BypassCoder = FaxAttributes->BypassCoder;
FaxCommand.NumberOfBlocks = FaxAttributes->NumberOfBlocks;
FaxCommand.FaxMaxRate = FaxAttributes->FaxMaxRate;
FaxCommand.Header.IdleCommandLength = sizeof(TFaxCommand);
#ifdef EXTENDED_FAX_COMMAND
FaxCommand.Volume = FaxAttributes->Volume;
FaxCommand.Fax = FaxAttributes->Fax;
FaxCommand.Bell = FaxAttributes->Bell;
FaxCommand.V21 = FaxAttributes->V21;
FaxCommand.V22 = FaxAttributes->V22;
FaxCommand.V23 = FaxAttributes->V23;
FaxCommand.V32 = FaxAttributes->V32;
FaxCommand.V34 = FaxAttributes->V34;
FaxCommand.CallerID = FaxAttributes->CallerID;
FaxCommand.EcmEnable = FaxAttributes->EcmEnable;
FaxCommand.HdlcEnable = FaxAttributes->HdlcEnable;
FaxCommand.V32MaxRate = FaxAttributes->V32MaxRate;
FaxCommand.ProtocolMode = FaxAttributes->ProtocolMode;
#ifndef OLD_VERSION_OF_EXTENDED_FAX_COMMAND
FaxCommand.JitterPeriodLSBits = (FaxAttributes->JitterPeriod & 0xFF);
FaxCommand.JitterPeriodMSBits = (FaxAttributes->JitterPeriod>>8);
FaxCommand.Const_0_5_11=0;
#endif //OLD_VERSION_OF_EXTENDED_FAX_COMMAND
FaxCommand.Const_0_2_4 =0;
FaxCommand.Const_0_2_15=0;
FaxCommand.Const_0_4_5 =0;
FaxCommand.Const_0_4_15=0;
#else
FaxCommand.FaxVolume = FaxAttributes->FaxVolume;
FaxCommand.FaxEnable = FaxAttributes->FaxEnable;
FaxCommand.BypassEnable = FaxAttributes->BypassEnable;
#endif /* EXTENDED_FAX_COMMAND */
return Ac48xxTransmitPacket(DeviceIndex, (char*)&FaxCommand,
DebugingData, WaitMode);
}
/*======================================================================*/
/* Name : Ac48xxDtmfCommand */
/*======================================================================*/
/* Purpose : Assign DTMF levels of low and high frequency groups */
/* generator and a mute option, of a specific channel in */
/* the AC48 device, by sending the AC48 DTMF command. */
/* */
/* Inputs : int DeviceIndex: */
/* An integer, performing the device index. */
/* int ChannelIndex: */
/* An integer, performing the channel index. */
/* TDtmf *Dtmf: */
/* A DTMF structure. Acceptable values for */
/* LowFrequencyLevel and HighFrequencyLevel fields */
/* are between 0 (mute) and 63 (+31dB). */
/* TDebugMode DebugMode */
/* Debug mode, to use (see: AC48xxDebugCommand). */
/* TWaitMode WaitMode: */
/* Wait / don't wait for the AC48 to be */
/* ready to deal with a new Command, */
/* which uses the 'AC48xxTransmitPacket' */
/* function. */
/* */
/* Output : int: */
/* ( 0) "AC_OK" for successful operation. */
/* (-1) "PACKET-FULL" detection in */
/* "DONT_WAIT_PACKET_EMPTY" mode. */
/* AC48 is not ready to transmit a new packet */
/* (suitable mode for polling). */
/* ( 2) "STATUS_ERROR" detected by the AC48. */
/*======================================================================*/
int Ac48xxDtmfCommand(int DeviceIndex, int ChannelIndex, const TDtmf *Dtmf,
TDebugingData DebugingData, TWaitMode WaitMode)
{
TDtmfCommand DtmfCommand;
DtmfCommand.Header.ConstAA=0xAA;
DtmfCommand.Header.Id=ChannelIndex;
DtmfCommand.Header.Const_0_0_10=0;
DtmfCommand.Header.IdleCommandOpCode = DTMF_COMMAND_OP_CODE;
DtmfCommand.Header.IdleCommandLength=0x06;
DtmfCommand.LowFrequencyLevel = Dtmf->LowFrequencyLevel; /*(0 - 63)*/
DtmfCommand.HighFrequencyLevel = Dtmf->HighFrequencyLevel; /*(0 - 63)*/
DtmfCommand.MuteEncoder = Dtmf->MuteEncoder;
DtmfCommand.Const_0_2_6=0;
DtmfCommand.Const_0_2_14=0;
return Ac48xxTransmitPacket(DeviceIndex, (char*)&DtmfCommand,
DebugingData, WaitMode);
}
/*======================================================================*/
/* Name : Ac48xxInitCommand */
/*======================================================================*/
/* Purpose : This function transfers the device from 'run' to 'init' */
/* mode, by sending the AC48 INIT command. */
/* */
/* Inputs : int DeviceIndex: */
/* An integer, performing the device index. */
/* int ChannelIndex: */
/* An integer, performing the channel index. */
/* This is an irrelevant field. */
/* TDebugMode DebugMode */
/* Debug mode, to use (see: AC48xxDebugCommand). */
/* TWaitMode WaitMode: */
/* Wait / don't wait for the AC48 to be */
/* ready to deal with a new Command, */
/* which uses the 'AC48xxTransmitPacket' */
/* function. */
/* */
/* Output : int: */
/* ( 0) "AC_OK" for successful operation. */
/* (-1) "PACKET-FULL" detection in */
/* "DONT_WAIT_PACKET_EMPTY" mode. */
/* AC48 is not ready to transmit a new packet */
/* (suitable mode for polling). */
/* ( 2) "STATUS_ERROR" detected by the AC48. */
/* */
/* Comment : There is no importance to which of the channels refer, */
/* as long as it is in "idle mode". */
/*======================================================================*/
int Ac48xxInitCommand(int DeviceIndex, int ChannelIndex,
TDebugingData DebugingData, TWaitMode WaitMode)
{
TInitCommand InitCommand;
InitCommand.Header.ConstAA=0xAA;
InitCommand.Header.Id=ChannelIndex; /* must be in idle mode */
InitCommand.Header.Const_0_0_10=0;
InitCommand.Header.IdleCommandOpCode = INIT_COMMAND_OP_CODE;
InitCommand.Header.IdleCommandLength=0x04;
return Ac48xxTransmitPacket(DeviceIndex, (char*)&InitCommand,
DebugingData, WaitMode);
}
/********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -