Home » Developer & Programmer » Forms » Multiple Comm Port (Oracle 9i, forms 6i windows xp32 bit)
Multiple Comm Port [message #597107] Tue, 01 October 2013 02:24 Go to next message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
Gelo Gurus....


I am working on a School Management System....

I want to

1. get data from rf_id using comm port 1.
2. and send attendance time to a mobile number.

I have done both the task separate forms. but when i combined these two tsks,
i am able to read the data from rf_id but my sms sending procedure is not working
even not get interface property.

Any Idea,???

Muhammad Ibrar
Re: Multiple Comm Port [message #597114 is a reply to message #597107] Tue, 01 October 2013 03:30 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Since we have no idea what code you've used to do this, no.
Re: Multiple Comm Port [message #597129 is a reply to message #597114] Tue, 01 October 2013 04:42 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
until unless we shall not see your coding how can we try to provide solution its very easy both task i acomplished many time before but what you are doing in your code still no idea atleast upload your .fmb or coding where you are getting problem.
Re: Multiple Comm Port [message #597130 is a reply to message #597114] Tue, 01 October 2013 04:42 Go to previous messageGo to next message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
WHEN NEW FORM INSTANCE

Declare
CommHandle ole2.obj_type; -- to hold the interface pointer
hold number;

string1 Varchar2(2000);
tim timer;

Begin
CommHandle := forms_ole.get_interface_pointer('block3.ole_control4');

OLE2.SET_PROPERTY(CommHandle, 'CommPort', 1);
/* try to close COM2, in case it was open for some reason.
0 = FALSE, -1 = TRUE
*/

OLE2.SET_PROPERTY(CommHandle, 'PortOpen', 0);

-- Set device to 9600 baud, no parity, 8 data, and 1 stop bit.
OLE2.SET_PROPERTY(CommHandle, 'Settings', '9600,N,8,1');

-- Open the port. 0 = FALSE, -1 = TRUE
OLE2.SET_PROPERTY(CommHandle, 'PortOpen', -1);

:data2 := OLE2.GET_CHAR_PROPERTY(CommHandle, 'Input');


End;

<< i am using this code for get value from rf id >>
Re: Multiple Comm Port [message #597131 is a reply to message #597130] Tue, 01 October 2013 04:45 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
are you getting successfully your data from RFID?
Re: Multiple Comm Port [message #597132 is a reply to message #597131] Tue, 01 October 2013 04:56 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Dear recently @Spordic provided easy solution for sending sms here is a solution of Mr Spordic


SMS Caster free software to send sms from Oracle Forms and reports. The best thing in this software is that, I can accept arguments through command line, so by using Host function, you can send parameters to SMS caster, that will be attached with GSM Modem and will send sms anywhere, other feature is that, you can send sms of 10000 characters from it successfully.


hope u got something

Re: Multiple Comm Port [message #597145 is a reply to message #597132] Tue, 01 October 2013 05:58 Go to previous messageGo to next message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
Yes i am fetch data successfully from rf id

and form sending sms i am using it commands.

it is also working... but the issue is when i combine these two procedures

second communication port is not working..
Re: Multiple Comm Port [message #597168 is a reply to message #597145] Tue, 01 October 2013 07:52 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
And unless you show us the code you actually used we have no way of even guessing what went wrong.
Re: Multiple Comm Port [message #597213 is a reply to message #597168] Tue, 01 October 2013 10:58 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Yes @cookiemonster is right which 2 procedures atleast elaborate upload both procedures how you are trying to combine what you are trying to do exactly, are you trying to set com port 1, com port 2, one for getting data from RFID and other is for sending sms is that? if yes have you checked Control panel->system->hardware->device manager->ports(com)whether com port 1 & 2 sets for your purpose. please upload your .fmb or full details if you are feeling in-secure regarding your project so therefore send your .fmb into personal email @cookiemonster or other experts or into my email but without all these things no body can help you.



Regard
Mughal

[Updated on: Tue, 01 October 2013 14:21]

Report message to a moderator

Re: Multiple Comm Port [message #597313 is a reply to message #597213] Thu, 03 October 2013 01:52 Go to previous messageGo to next message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
Sure.... I will send u complete codes...


But i have completed the task successfully...

it was some logical problem. thats why...


Scenario :

I have places 2 OLE Object in the form and created object "MS Comm Control"
one is connected with Com Port 1 and other on Com Port 2

<< WHEN NEW FORM INSTANCE >>
NULL;



Declare
CommHandle ole2.obj_type; -- to hold the interface pointer
hold number; --to hold the value either open or close
tim timer;
errCode pls_integer;
errSrc varchar2(200);
errDescription varchar2(2000);
errHelpfile varchar2(200);
errHelpContext pls_integer;

begin
CommHandle := forms_ole.get_interface_pointer('block3.ole_control4');
--Message(CommHandle);pause;

OLE2.SET_PROPERTY(CommHandle, 'CommPort', 1);

-- Set device to 9600 baud, no parity, 8 data, and 1 stop bit.
OLE2.SET_PROPERTY(CommHandle, 'Settings', '9600,N,8,1');


--Close the port if it is open (0 for close and -1 for open)

if (OLE2.gET_num_PROPERTY(CommHandle, 'PortOpen') = 0 )then
null;
else
OLE2.SET_PROPERTY(CommHandle, 'PortOpen', 0);
end if;

-- now time to open the port
OLE2.SET_PROPERTY(CommHandle, 'PortOpen', -1);

:global.comhandle := CommHandle;


--message (OLE2.gET_num_PROPERTY(CommHandle, 'PortOpen'));--, -1);


tim := Find_Timer('MSG');
IF Id_Null(tim) THEN
tim := Create_Timer('MSG',500,REPEAT);
END IF;



Exception
when form_ole_failure then
errCode := last_ole_exception( errSrc,
errDescription,
errHelpfile,
errHelpContext);
message('ERR:'||errSrc||': '||errDescription);pause;
When Others Then
message('Error In Reading');pause;
Message('1'||SQlcode||sqlerrm);pause;

end;


<< WHEN TIMER EXPIRED >>

declare
AA VARCHAR2(200);
ab varchar2(100);
pno1 varchar2(40);

begin
AA := data_input;

IF AA IS NOT NULL THEN

:data2 := AA;

GO_BLOCK('TEST');
EXECUTE_QUERY(NO_VALIDATE);

begin
select rno into pno1 from att where trunc(date1) = trunc(sysdate)
and time_in is not null and time_out is null;

if sql%found then
update att set time_out = to_char(sysdate, 'hh:mi:ss')
where rno = :test.rno and time_in is not null and time_out is null;
commit;

:test.item11 := to_char(sysdate, 'hh:mi:ss');
sms;
end if;


exception
when no_data_found then
:system.message_level := 25;
insert into att (pno, date1, time_in)
values (:test.rno, sysdate, to_char(sysdate, 'hh:mi:ss'));
commit;

:test.item10 := to_char(sysdate, 'hh:mi:ss');
sms;
end ;




-- :test.issued_date := sysdate;
READ_IMAGE_FILE('C:\'||:test.rno||'.jpg','ANY', 'block3.image12');


END IF;

EXCEPTION
when no_data_found then
message('sdfdfd');


WHEN OTHERS THEN
null;


END;

<< FUNCTION >>
FUNCTION data_input RETURN char IS
val varchar2(2000);
BEGIN

-- val := OLE2.gET_num_PROPERTY(:global.ComHandle, 'PortOpen');
-- message (val);--, -1);


:data2 := OLE2.GET_CHAR_PROPERTY(:global.ComHandle, 'Input');

return :data2;
END;

>> PROCEDURE <<
PROCEDURE sms IS
BEGIN
Declare
CommHandle1 ole2.obj_type; -- to hold the interface pointer
hold number; --to hold the value either open or close
st varchar2(200);

TT varchar2(200);
ph varchar2(20);
errCode pls_integer;
errSrc varchar2(200);
errDescription varchar2(2000);
errHelpfile varchar2(200);
errHelpContext pls_integer;


begin
CommHandle1 := forms_ole.get_interface_pointer('block3.ole_control8');
--Message(CommHandle);pause;
OLE2.SET_PROPERTY(CommHandle1, 'CommPort', 3);

-- Set device to 9600 baud, no parity, 8 data, and 1 stop bit.
OLE2.SET_PROPERTY(CommHandle1, 'Settings', '9600,N,8,1');

--Close the port if it is open (0 for close and -1 for open)
if (OLE2.gET_num_PROPERTY(CommHandle1, 'PortOpen') = 0 )then
null;
else
OLE2.SET_PROPERTY(CommHandle1, 'PortOpen', 0);
end if;

-- now time to open the port
OLE2.SET_PROPERTY(CommHandle1, 'PortOpen', -1);

TT := 'AT+CMGF = '||1||CHR(13);
OLE2.SET_PROPERTY(CommHandle1, 'Output', tt);

for i in 1..9000 loop null; end loop;

begin
select phone_no into ph from test where rno = :test.rno;

exception
when no_data_found then null;
end;


TT := 'AT+CMGS = "'||ph||'"'||CHR(13);
OLE2.SET_PROPERTY(CommHandle1, 'Output', tt);

for i in 1..99000 loop null; end loop;

if :test.item10 is not null then
st := ''''||:test.name ||', R. No. '||:test.rno ||' entered at '||:test.item10 ||' on ' ||to_char(sysdate, 'dd-mm-yyyy')||'''';
elsif :test.item11 is not null then
st := ''''||:test.name ||', R. No. '||:test.rno ||' out at '||:test.item11 ||' on ' ||to_char(sysdate, 'dd-mm-yyyy')||'''';
end if;

TT := st ||' please acknowledge '||CHR(26);
OLE2.SET_PROPERTY(CommHandle1, 'Output', tt);
--message(st); pause;
/*
TT := 'this is a test sms'||CHR(26);
OLE2.SET_PROPERTY(CommHandle1, 'Output', tt);
*/
OLE2.SET_PROPERTY(CommHandle1, 'PortOpen', 0);
Exception
when form_ole_failure then
errCode := last_ole_exception( errSrc,
errDescription,
errHelpfile,
errHelpContext);
message('ERR: '||errSrc||': '||errDescription);pause;
When Others Then
message('Error In Reading');pause;
Message('1 '||SQlcode||' '||sqlerrm);pause;

end;

END;





Re: Multiple Comm Port [message #597314 is a reply to message #597313] Thu, 03 October 2013 01:56 Go to previous messageGo to next message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
This code will read the data from rf id tags. and identify the valid person
next automatically mark the attendance and further sent a message to a registered mobile number

Re: Multiple Comm Port [message #597351 is a reply to message #597314] Thu, 03 October 2013 10:08 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
great you have acomplished your task successfully and share this valuable information for more members who need this information, can you share are you using same RFID device for both purpose or for sending sms you were using kind of modem etc.?



Regard
Mughal

[Updated on: Thu, 03 October 2013 10:10]

Report message to a moderator

Re: Multiple Comm Port [message #597365 is a reply to message #597313] Thu, 03 October 2013 14:28 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
mohammad_ibrar wrote on Thu, 03 October 2013 12:22

When Others Then
message('Error In Reading');pause;
Message('1'||SQlcode||sqlerrm);pause;

end;

WHEN OTHERS THEN
null;


END;

When Others Then
message('Error In Reading');pause;
Message('1 '||SQlcode||' '||sqlerrm);pause;

end;



Did you test your code thoroughly? The exception block might turn into a bug. Read the forum wiki about EXCEPTION WHEN OTHERS.

Another thing, are you sure you want to use commit inside your code?

Regards,
Lalit
Re: Multiple Comm Port [message #597541 is a reply to message #597365] Sat, 05 October 2013 23:01 Go to previous messageGo to next message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
I have tested the code not yet received bug.... Please if you found some bugs, then please in torn me... Commit statement depend on your requirement...
Mughals......... You need gsm modem
Re: Multiple Comm Port [message #597552 is a reply to message #597541] Sun, 06 October 2013 04:30 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
mohammad_ibrar wrote on Sun, 06 October 2013 09:31
I have tested the code not yet received bug.... Please if you found some bugs, then please in torn me


You will not find any bugs until you remove WHEN OTHERS, and that's because it hides the errors. If you want to specify the EXCEPTION block then handle them meaningfully. Do something about the exceptions, not just print them or catch them.

Regards,
Lalit
Re: Multiple Comm Port [message #598497 is a reply to message #597552] Tue, 15 October 2013 06:11 Go to previous messageGo to next message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
Helo Gurus....

i am facing a problem....

i have written above Codes. it just working fine... but i have to deploy it on another computer..

here i have download mscomm32.ocx and registerd.

but in my forms, it does not work.
any one help me please

Regards
Ibrar
Re: Multiple Comm Port [message #598919 is a reply to message #598497] Sat, 19 October 2013 17:10 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
have you solved your problem if not register also these three files actually these are VB controls. if you will install full vb software in same machine it also will work.

MCI32.OCX----ole
MSCOMCT2.OCX
MSCOMCTL.OCX

Regard
Mughal





Re: Multiple Comm Port [message #602188 is a reply to message #598919] Sun, 01 December 2013 01:33 Go to previous message
mohammad_ibrar
Messages: 16
Registered: August 2013
Location: Pakistan
Junior Member
Dear Mughal....

i have attached my mobile (Samsung S2) with my computers...

Also i have read about analogue clock at forms.... Can you share Fmb with me.???

Secondly i want to know how to attach my mobile with oracle server and as data inserted in specific form from any client, it broadcast an sms.

Regards...

Mohammad_ibrar@yahoo.com
Previous Topic: insert previous balance into new record.
Next Topic: Data Not Showing
Goto Forum:
  


Current Time: Thu Apr 18 18:09:14 CDT 2024