Arsip: Bahasa C++
more 16 years ago
fafa
bro semua ada yang ngerti dan bisa jelasin g ttg program c++ dibawah ini ke delphi!!
/-----------------------------------------------------------------------------
Function: ProcessDTMFDigits
Parameter: pServer Contains the common data for the server.
pInternalConn Pointer to internal connection structure
cDigit The received digit.
Returns: none
Description: Check if the received digit initiates an immediate action
or if we just have to collect the digits.
---------------------------------------------------------------------------- /
void ProcessDTMFDigits ( VoiceSystemCommon pServer, SingleConnection pInternalConn, char cDigit )
{
/
The '' ends the session after playing the good bye message.
/
if ( cDigit == '' )
{
DivaStopSendingVoiceFile ( pInternalConn->hDivaCall );
pInternalConn->dwState = ConnectionStatusPlayGoodBye;
if ( DivaSendVoiceFile ( pInternalConn->hDivaCall,
pServer->GoodByeMessageFile,
FALSE ) != DivaSuccess )
{
pInternalConn->dwResultCode = ResultCodeErrorStreamFile;
DivaDisconnect ( pInternalConn->hDivaCall );
}
}
else
{
if ( ( cDigit >= '0' ) && ( cDigit <= '9' ) )
{
int nDigits = 0;
if ( pInternalConn->dwState == ConnectionStatusPlayInitial )
{
/
First digit pressed. Change state to collecting and
init the timeouts. The message is stopped.
/
pInternalConn->dwState = ConnectionStatusCollectDigits;
DivaStopSendingVoiceFile ( pInternalConn->hDivaCall );
pInternalConn->DetectedDigits[0] = cDigit;
pInternalConn->DetectedDigits[1] = 0;
nDigits = 1;
pInternalConn->dwSecondsWithoutDigits = 0;
}
else if ( pInternalConn->dwState == ConnectionStatusCollectDigits )
{
nDigits = strlen ( pInternalConn->DetectedDigits );
pInternalConn->DetectedDigits[nDigits++] = cDigit;
pInternalConn->DetectedDigits[nDigits] = 0;
pInternalConn->dwSecondsWithoutDigits = 0;
}
/
Check if we have enough digits to initiate the transfer.
/
if ( ! pServer->bDetectEndByTimeout && ( nDigits >= (int) pServer->dwMinDigits ) )
{
pInternalConn->dwState = ConnectionStatusDoTransfer;
if ( DivaSendVoiceFile ( pInternalConn->hDivaCall,
pServer->TransferMessageFile,
FALSE ) != DivaSuccess )
{
pInternalConn->dwResultCode = ResultCodeErrorStreamFile;
DivaDisconnect ( pInternalConn->hDivaCall );
}
}
}
else if ( cDigit == '#' )
{
/
If we are playing the initial message the initiates the
transfer to the operator. Stream the 'please wait' message,
the transfer is triggered by the event DivaEventVoiceFileDone.
*/
if ( pInternalConn->dwState == ConnectionStatusPlayInitial )
{
strcpy ( pInternalConn->DetectedDigits, pServer->DefaultForwardNumber );
pInternalConn->dwState = ConnectionStatusDoOperatorTransfer;
if ( DivaSendVoiceFile ( pInternalConn->hDivaCall,
pServer->TransferMessageFile,
FALSE ) != DivaSuccess )
{
pInternalConn->dwResultCode = ResultCodeErrorStreamFile;
DivaDisconnect ( pInternalConn->hDivaCall );
}
}
}
}
}
gw dah coba beberapa kali ko tetep g bisa ya!! nih coding punya gw
procedure TFormIVR.DivaCall1ToneReceived(ASender: TObject; cTone: Byte);
var digit : char;
var result : integer;
begin
connected := True;
DivaCall1.SignalEvents := 1;
DivaCall1.AsyncMode := 1;
DivaCall1.EnableDigitDetection := 1;
DIvaCall1.EnableExtendedToneDetection := 1;
case digit of
'1' : begin
if Divacall1.DetectedDigits = digit then
DivaCall1.SendVoiceFile('MenuOpt2.wav',0);
end;
end
{
if cTOne = DivaResultSuccess then
begin
if digit = '1' then
begin
DivaCall1.SendVoiceFile('MenuOpt2.wav',0);
end
Else If digit = '2' then
begin
DivaCall1.SendVoiceFile('',0);
end
Else If digit = '3' then
begin
Divacall1.SendVoiceFile('',0);
end
Else if digit = '4' then
begin
DivaCall1.SendVoiceFile('',0);
End
end}
end;
nah kalo di delphi void main dari c++ itu sebagai apa y!yang gw tau void itu arti null jadi gimana y kalo diartiin kebahasa delphi secara garis besar....
more 16 years ago
cikumiyu
method void main() di C++ itu sama dengan begin .. end. yang ada di file project (.dpr) kalau di delphi. Jadi kalo di c++ itu sebagai main programnya.
Void itu ngga sama dengan NULL. Void ya void, NULL ya NULL. NULL adalah pointer bernilai integer 0. Sedangkan void adalah reserve word yang dipakai salah satunya untuk menyatakan suatu method/operation tidak memiliki nilai kembalian. Kalau di pascal, method yang sepert ini dikenal dengan procedure.
more 16 years ago
fafa
hmm,,barti kalo gihtu gw mesti buat funtion atau procedure sendiri ya dari contoh program c++ diatas!!soalnya dari component itu udah ada procedure!!apa gw ikutin dari procedure component tersebut!!
kalo void main () = begin ... else,,,,tapi kalo void ProcessDTMFDigits itu apa ya!!apa itu sebuah procedure atau sebuah function ya bro!!
more 16 years ago
mas_kofa
SETAU AKU VOID ITU MENANDAKAN BAHWA FUNGSI BERSANGKUTAN TDK MEMPUNYAI NILAI KEMBALIAN (return).....ATO DI DELPHI DISEBUT PROCEDURE
more 16 years ago
mas_kofa
heks................wah sudah di jawab ama cikumiyu...
void ProcessDTMFDigits berarti sebuah procedure..........
more 16 years ago
pebbie
(----------------------------------------------------------- ------------------
Function: ProcessDTMFDigits
Parameter: pServer Contains the common data for the server.
pInternalConn Pointer to internal connection structure
cDigit The received digit.
Returns: none
Description: Check if the received digit initiates an immediate action
or if we just have to collect the digits.
-------------------------------------------------------------------- -------- )
procedure ProcessDTMFDigits ( pServer : PVoiceSystemCommon; pInternalConn: PSingleConnection; cDigit:char );
var
nDigits : integer;
begin
/
The '' ends the session after playing the good bye message.
/
if ( cDigit = '' ) then
begin
DivaStopSendingVoiceFile ( pInternalConn^.hDivaCall );
pInternalConn^.dwState: = ConnectionStatusPlayGoodBye;
if ( DivaSendVoiceFile ( pInternalConn^.hDivaCall,
pServer^.GoodByeMessageFile,
FALSE ) <> DivaSuccess ) then
begin
pInternalConn^.dwResultCode := ResultCodeErrorStreamFile;
DivaDisconnect ( pInternalConn^.hDivaCall );
end;
end;
else
begin
if ( cDigit in ) then
begin
int nDigits := 0;
if ( pInternalConn^.dwState = ConnectionStatusPlayInitial ) then
begin
(
First digit pressed. Change state to collecting and
init the timeouts. The message is stopped.
)
pInternalConn^.dwState := ConnectionStatusCollectDigits;
DivaStopSendingVoiceFile ( pInternalConn^.hDivaCall );
pInternalConn^.DetectedDigits[0] := cDigit;
pInternalConn^.DetectedDigits[1] := 0;
nDigits := 1;
pInternalConn^.dwSecondsWithoutDigits := 0;
end
else if ( pInternalConn->dwState == ConnectionStatusCollectDigits ) then
begin
nDigits := length ( pInternalConn^.DetectedDigits );
inc(nDigits);
pInternalConn^.DetectedDigits[nDigits] := cDigit;
pInternalConn^.DetectedDigits[nDigits] := 0;
pInternalConn^.dwSecondsWithoutDigits := 0;
end;
(
Check if we have enough digits to initiate the transfer.
)
if (not pServer^.bDetectEndByTimeout) and ( nDigits >= Round(pServer->dwMinDigits ) ) then
begin
pInternalConn^.dwState := ConnectionStatusDoTransfer;
if ( DivaSendVoiceFile ( pInternalConn^.hDivaCall,
pServer^.TransferMessageFile,
FALSE ) <> DivaSuccess ) then
begin
pInternalConn^.dwResultCode := ResultCodeErrorStreamFile;
DivaDisconnect ( pInternalConn^.hDivaCall );
end;
end;
end
else if ( cDigit == '#' ) then
begin
(
If we are playing the initial message the initiates the
transfer to the operator. Stream the 'please wait' message,
the transfer is triggered by the event DivaEventVoiceFileDone.
*)
if ( pInternalConn^.dwState = ConnectionStatusPlayInitial ) then
begin
Copy ( pInternalConn^.DetectedDigits, 1, pServer^.DefaultForwardNumber );
pInternalConn^.dwState := ConnectionStatusDoOperatorTransfer;
if ( DivaSendVoiceFile ( pInternalConn^.hDivaCall,
pServer^.TransferMessageFile,
FALSE ) <> DivaSuccess ) then
begin
pInternalConn^.dwResultCode := ResultCodeErrorStreamFile;
DivaDisconnect ( pInternalConn^.hDivaCall );
end;
end;
end;
end;
end;
more 16 years ago
fafa
maap @ atas brati saya lupa posting structnya nih!!jadi structur didalam c++ dibuat juga ya dalam delphi
structur c++ nya
typedef struct _SingleConnection_
{
BOOL bInUse;
DWORD dwState;
char CalledNumber[MAX_ADDR_LEN];
char CallingNumber[MAX_ADDR_LEN];
char FileName[_MAX_PATH];
char PathFileName[_MAX_PATH];
BOOL bFileReceived;
char DetectedDigits[30];
DWORD dwSecondsWithoutDigits;
DWORD InitialFileCycles;
DWORD dwSecondsConnected;
DWORD dwSecondsRecording;
DWORD dwSecondsRinging;
DWORD dwDisconnectReason;
DWORD dwResultCode;
time_t lStartTime;
/
SDK specific parameter
/
DivaCallHandle hDivaCall;
} SingleConnection;
typedef struct
{
/
Operating system specific handles for events and threads.
/
HANDLE hEvent;
HANDLE hThread;
DWORD dwThreadId;
HANDLE hTimerThread;
HANDLE hTimerStopEvent;
/
Parameter for thread state and termination.
/
BOOL bThreadRunning;
BOOL bThreadTerminate;
/
Configuration parameter, application specific.
/
char SaveFilePath[_MAX_PATH];
char InitialMessageFile[_MAX_PATH];
char TransferMessageFile[_MAX_PATH];
char ErrorBusyMessageFile[_MAX_PATH];
char ErrorMiscMessageFile[_MAX_PATH];
char ErrorNoAnswerMessageFile[_MAX_PATH];
char GoodByeMessageFile[_MAX_PATH];
char BeepMessageFile[_MAX_PATH];
DWORD dwSecondsBeforeAnswer;
BOOL bDetectEndByTimeout;
DWORD dwDetectEndTimeout;
DWORD dwMinDigits;
char DefaultForwardNumber[20];
/
SDK specific parameter
/
DivaAppHandle hApp;
DWORD dwNumDevices;
DWORD dwNumChannels;
/
The memory for the connections will be dynamiclly calculated.
/
SingleConnection *pConnections;
} VoiceSystemCommon;
terus kalo didalam delphi apa struktur c++ itu sama dengan sebuah type atau apa ya...
more 16 years ago
fafa
maap @ atas brati saya lupa posting structnya nih!!jadi structur didalam c++ dibuat juga ya dalam delphi
structur c++ nya
typedef struct _SingleConnection_
{
BOOL bInUse;
DWORD dwState;
char CalledNumber[MAX_ADDR_LEN];
char CallingNumber[MAX_ADDR_LEN];
char FileName[_MAX_PATH];
char PathFileName[_MAX_PATH];
BOOL bFileReceived;
char DetectedDigits[30];
DWORD dwSecondsWithoutDigits;
DWORD InitialFileCycles;
DWORD dwSecondsConnected;
DWORD dwSecondsRecording;
DWORD dwSecondsRinging;
DWORD dwDisconnectReason;
DWORD dwResultCode;
time_t lStartTime;
/
SDK specific parameter
/
DivaCallHandle hDivaCall;
} SingleConnection;
typedef struct
{
/
Operating system specific handles for events and threads.
/
HANDLE hEvent;
HANDLE hThread;
DWORD dwThreadId;
HANDLE hTimerThread;
HANDLE hTimerStopEvent;
/
Parameter for thread state and termination.
/
BOOL bThreadRunning;
BOOL bThreadTerminate;
/
Configuration parameter, application specific.
/
char SaveFilePath[_MAX_PATH];
char InitialMessageFile[_MAX_PATH];
char TransferMessageFile[_MAX_PATH];
char ErrorBusyMessageFile[_MAX_PATH];
char ErrorMiscMessageFile[_MAX_PATH];
char ErrorNoAnswerMessageFile[_MAX_PATH];
char GoodByeMessageFile[_MAX_PATH];
char BeepMessageFile[_MAX_PATH];
DWORD dwSecondsBeforeAnswer;
BOOL bDetectEndByTimeout;
DWORD dwDetectEndTimeout;
DWORD dwMinDigits;
char DefaultForwardNumber[20];
/
SDK specific parameter
/
DivaAppHandle hApp;
DWORD dwNumDevices;
DWORD dwNumChannels;
/
The memory for the connections will be dynamiclly calculated.
/
SingleConnection *pConnections;
} VoiceSystemCommon;
terus kalo didalam delphi apa struktur c++ itu sama dengan sebuah type atau apa ya...atau structur itu biasanya terdapat pada sebuah componennya ya bro!!soalnya diva ini mempunyai componennya juga bro!!
more 16 years ago
pebbie
struct/typedef struct di delphi analog dengan record (packed record)
typedef struct { sometype bla_bla; } namatipe, *tipeptr;
jadi
type
tipeptr = ^namatipe
namatipe = record
bla_bla:sometype;
end;
biasanya record itu di-align ke nilai tertentu (4 byte ato 8 byte).. coba baca packed untuk alignment ke 1 byte
more ...
- Pages:
- 1
- 2
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 3 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 4 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 11 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 11 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 11 years ago
Random Topic
- Soal TAdoTable... share dikit....
by juan81 in Hal umum tentang Pascal Indonesia more 16 years ago - IndexFieldNames hilang ketika database connection di refresh
by bayzap in Hal umum tentang Pascal Indonesia more 16 years ago - Membuat No Urut otomatis pada tabel lain
by ayojoe in Hal umum tentang Pascal Indonesia more 18 years ago - Math Dalam QUERY MySQL
by delphicode in Network, Files, I/O & System more 14 years ago - Siapa yang gak pelit???
by n3o_cybertech in Tip n Trik Pemrograman more 16 years ago - RecordCount
by Yudho in Hal umum tentang Pascal Indonesia more 17 years ago - delete from DataArea ...
by asepolin in Hal umum tentang Pascal Indonesia more 15 years ago - Delphi ID ganti domain..??
by deLogic in Kritik & Saran more 18 years ago - VoIP rakyat....
by EkoIndri in OOT more 16 years ago - Tanggal terakhir
by fatahjunaidi in Hal umum tentang Pascal Indonesia more 18 years ago