Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOL flow chart!

Status
Not open for further replies.

Bamben

Programmer
Jul 22, 2009
70
IT
Thanks to roo for being a real good influence on me and recommending me to try this (although I don't think this is 'exactly' what he meant).
I have made a flow chart of part of my application and It has made me realise some thing; I have a BUG!!!

when ever my application Auto drops a call I've accidental told it to do two completely conflicting things at once so it get really confused.

I will post the flow chart showing what happens, then the code, then the new flow chart with my plan on how it should be...
 
procedure TMainForm.xCall0;
var
InDevice, OutDevice: Cardinal;
begin
Stage := 0;
Repeat
//1
Stage := Stage +1;
CC := 0;
//xCheckIfAccountIsExausted;
//J := J +1;
InDevice := AudioInDeviceNameToDeviceID(waveInDevice.Items[waveInDevice.ItemIndex]);
OutDevice := AudioInDeviceNameToDeviceID(waveOutDevice.Items[waveOutDevice.ItemIndex]);
CallPack[0] := SimpleSip1.AddCall(CurrentAccount, PhoneEdit.Text, InDevice, OutDevice);
CallPack[0]._AddRef;
ListCalls.items[0]:='CALLING : '+PhoneEdit.Text+'...';
xConnecting0;
Delay(9000);
//2
Stage := Stage +1;
ListCalls.items[0]:= 'Sending Pin';
SimpleSip1.PlayWavFile(CallPack[0], ExtractFilePath(ParamStr(0))+'ben pin.wav');
Memo1.Lines.Add('PIN: ******');
Delay(6000);
//3..........................................CHECK
Stage := Stage +1;
xCheck0;
Delay(2000);
//------------------------------------------------------------------------------
until Stage = 3;
end;
//------------------------------------------------------------------------------
procedure TMainForm.xConnecting0;
begin
CC := 0;
repeat
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call.';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call..';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call...';
Delay(300);
until (CallPack[0].State = csActive) or (CallPack[0].active = false);
if not (CallPack[0].State = csActive) then xCall0;
end;
procedure TMainForm.xConnectionCount0;
begin
CC := CC +1;
if CC = 100 then
begin
CC := 0;
SimpleSip1.EndCall(CallPack[0]);
ListCalls.items[0]:='AUTO DROPPED CALL';
Delay(2000);
xManagerBAD;
Delay(3000);
xCall0;
end;
end;
procedure TMainForm.xCheck0;
Begin
if (CallPack[0].State = csActive) then
begin
N := N +1;//------------------------------------(N)
ListCalls.Items[0]:='ACTIVE';
Delay(3000);
end
else
//if (CallPack[0].active = False) then
if not (CallPack[0].State = csActive) then
begin
ListCalls.Items[0]:='X';
xCall0;
end;
end;
 
yeah!! it works now... in just under an hours worth of work thanks to the flow chart (I am star-ing you roo on the suggestion you gave me to do this THANKS I cant believe how helpful this flow chart idea is, Its the BEST way to do it!!!)
 
here's the new working code I am pleased!

procedure TMainForm.xCall0;
var
InDevice, OutDevice: Cardinal;
begin
Stage := 0;
Repeat
//1
Stage := Stage +1;
CC := 0;
//xCheckIfAccountIsExausted;
//J := J +1;
InDevice := AudioInDeviceNameToDeviceID(waveInDevice.Items[waveInDevice.ItemIndex]);
OutDevice := AudioInDeviceNameToDeviceID(waveOutDevice.Items[waveOutDevice.ItemIndex]);
CallPack[0] := SimpleSip1.AddCall(CurrentAccount, PhoneEdit.Text, InDevice, OutDevice);
CallPack[0]._AddRef;
ListCalls.items[0]:='CALLING : '+PhoneEdit.Text+'...';
xConnecting0;
Delay(9000);
//2
Stage := Stage +1;
xPinSend0;
//3..........................................CHECK
Stage := Stage +1;
xCheck0;
Delay(2000);
//------------------------------------------------------------------------------
until Stage = 3;
end;
//------------------------------------------------------------------------------
procedure TMainForm.xConnecting0;
begin
CC := 0;
repeat
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call.';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call..';
Delay(300);
xConnectionCount0;
ListCalls.items[0]:= 'Connecting Call...';
Delay(300);
until (CallPack[0].State = csActive) or (CallPack[0].active = false);
end;
procedure TMainForm.xConnectionCount0;
begin
CC := CC +1;
if CC = 100 then
begin
CC := 0;
SimpleSip1.EndCall(CallPack[0]);
ListCalls.items[0]:='AUTO DROPPED CALL';
Delay(2000);
xManagerBAD;
Delay(3000);
xCall0;
end;
end;
procedure TMainForm.xPinSend0;
begin if (CallPack[0].State = csActive) then begin
ListCalls.items[0]:= 'Sending Pin';
SimpleSip1.PlayWavFile(CallPack[0], ExtractFilePath(ParamStr(0))+'ben pin.wav');
Memo1.Lines.Add('PIN: ******');
Delay(6000);
end;end;
procedure TMainForm.xCheck0;
Begin
if (CallPack[0].State = csActive) then
begin
N := N +1;//------------------------------------(N)
ListCalls.Items[0]:='ACTIVE';
Delay(3000);
end
else
if not (CallPack[0].State = csActive) then
begin
ListCalls.Items[0]:='X';
xManagerBAD;
Delay(3000);
xCall0;
end;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top