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 |
|
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 #597130 is a reply to message #597114] |
Tue, 01 October 2013 04:42 |
|
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 #597213 is a reply to message #597168] |
Tue, 01 October 2013 10:58 |
|
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 |
|
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 #597351 is a reply to message #597314] |
Thu, 03 October 2013 10:08 |
|
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 |
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 #597552 is a reply to message #597541] |
Sun, 06 October 2013 04:30 |
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:31I 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 #602188 is a reply to message #598919] |
Sun, 01 December 2013 01:33 |
|
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
|
|
|
Goto Forum:
Current Time: Fri Sep 13 08:48:28 CDT 2024
|