1. boring ole modem stuff
- Posted by Some Slacker <some_slacker at yahoo.com> Feb 02, 2006
- 400 views
As a neophyte programmer and as one who hasn't programmed anything since the late 80's Euphoria is a slackers dream come true for a programming languange. To say that my understanding is limited would not be a stretch, on to my problem... I'm tryin to get the caller id info from the modem I don't seem to understand how information is xmitted seems to be long streams of the same data, is this the baud rate? or something else causing a whole stream of bytes to be reproduced? I wrote some junk code to find out whats happening but there are serious flaws with the code that cause the same character sent to be ignored this sort of works but of course fails if the same byte is actually sent twice in a row... grr. (I think it was Rob that mentioned prostitute code, whats lower? lol) I'm sorry for my following creepy code: but if someone can at least point me in the right direction, I can continue... heh --dial.ex Example program --Sample program to dial a pager --Change all 5555555 numbers to real phone numbers before running!!! --delay might need to be changed for different services. this works --for me Use at own risk. Not responsible for any damage caused by this --program --Greg Harris 1997 sequence s, word, pn integer x ,ox, y, RING x=10 ox=x y=0 RING=0 s={} word={} pn={} include serial.e COMPORT=COM3 --Init the modem -- init_ports(38400, W_8BIT, P_NONE, S_1BIT) enable_ports() --Turn on caller ID -- StringToPort("AT+VCID=2",1) delay(3) while get_key()=-1 do --while ox=x do x=GetSerialByte(3) if x != -1 then s=append(s,x) end if if RING=1 then position(3,1) puts(1,"Ringing...\n") pn={} RING=0 end if if length(s)>10 then for i = 1 to length(s)-10 do if s[i]=10 and s[i+1]=13 and s[i+2]=10 and s[i+3]=82 and s[i+4]=73 and s[i+5]=78 and s[i+6]=71 and s[i+7]=13 and s[i+8]=10 and s[i+9]=13 and s[i+10]=10 then RING=1 s=s[i+11..$] end if end for end if if length(s)>9 then for i = 1 to length(s)-9 do if s[i]=13 and s[i+1]=10 and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 and s[i+8]=13 and s[i+9]=10 then RING=1 s=s[i+10..$] end if end for end if if length(s)>7 then for i = 1 to length(s)-7 do if s[i]=13 and s[i+1]=10 and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 then RING=1 s=s[i+8..$] end if end for end if if length(s) >=50 and length(pn)<10 then for i= 18 to 0 by -2 do pn &= s[$-i] end for s={} position(4,1) puts(1,pn) end if position(6,1) ?s end while --Tell pager who called-- --StringToPort("ATDT5555555;",1) --delay(3) --Hang up the modem -- StringToPort("+++ATH0",1) delay(3) --Disable the modem disable_ports() while get_key() = -1 do end while
2. Re: boring ole modem stuff
- Posted by Kenneth Rhodes <ken_rhodes30436 at yahoo.com> Feb 02, 2006
- 405 views
Some Slacker wrote: Sorry I can't help you with your real problem, but you can get Syntax Coloring for your code posted to the EuForum. Instructions are at the bottom of the "Send a Message to EUforum" web interface page. Good luck!
--dial.ex Example program --Sample program to dial a pager --Change all 5555555 numbers to real phone numbers before running!!! --delay might need to be changed for different services. this works --for me Use at own risk. Not responsible for any damage caused by this --program --Greg Harris 1997 sequence s, word, pn integer x ,ox, y, RING x=10 ox=x y=0 RING=0 s={} word={} pn={} include serial.e COMPORT=COM3 --Init the modem -- init_ports(38400, W_8BIT, P_NONE, S_1BIT) enable_ports() --Turn on caller ID -- StringToPort("AT+VCID=2",1) delay(3) while get_key()=-1 do --while ox=x do x=GetSerialByte(3) if x != -1 then s=append(s,x) end if if RING=1 then position(3,1) puts(1,"Ringing...\n") pn={} RING=0 end if if length(s)>10 then for i = 1 to length(s)-10 do if s[i]=10 and s[i+1]=13 and s[i+2]=10 and s[i+3]=82 and s[i+4]=73 and s[i+5]=78 and s[i+6]=71 and s[i+7]=13 and s[i+8]=10 and s[i+9]=13 and s[i+10]=10 then RING=1 s=s[i+11..$] end if end for end if if length(s)>9 then for i = 1 to length(s)-9 do if s[i]=13 and s[i+1]=10 and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 and s[i+8]=13 and s[i+9]=10 then RING=1 s=s[i+10..$] end if end for end if if length(s)>7 then for i = 1 to length(s)-7 do if s[i]=13 and s[i+1]=10 and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 then RING=1 s=s[i+8..$] end if end for end if if length(s) >=50 and length(pn)<10 then for i= 18 to 0 by -2 do pn &= s[$-i] end for s={} position(4,1) puts(1,pn) end if position(6,1) ?s end while --Tell pager who called-- --StringToPort("ATDT5555555;",1) --delay(3) --Hang up the modem -- StringToPort("+++ATH0",1) delay(3) --Disable the modem disable_ports() while get_key() = -1 do end while
Ken Rhodes 100% MicroSoft Free SuSE Linux 10.0 No AddWare, SpyWare, or Viruses! Life is Good :)
3. Re: boring ole modem stuff
- Posted by Some Slacker <some_slacker at yahoo.com> Feb 02, 2006
- 418 views
Ok, I see that now, and all colored blue and everything... talk about tunnel vision... Guess I'm getting old...
4. Re: boring ole modem stuff
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Feb 02, 2006
- 426 views
On Wed, 01 Feb 2006 18:42:21 -0800, Some Slacker <guest at RapidEuphoria.com> wrote: >I'm tryin to get the caller id info from the modem I don't know anything about modems, but...
> if length(s)>10 then > for i = 1 to length(s)-10 do > if s[i]=10 and s[i+1]=13 and s[i+2]=10 > and s[i+3]=82 and s[i+4]=73 and s[i+5]=78 > and s[i+6]=71 and s[i+7]=13 and s[i+8]=10 > and s[i+9]=13 and s[i+10]=10 then > RING=1 > s=s[i+11..$] > end if > end for > end if
I think can be replaced by:
integer k k = match("\n\r\nRING\r\n\r\n",s) if k then RING = 1 s = s[k+11..$] end if
Regards, Pete
5. Re: boring ole modem stuff
- Posted by Some Slacker <some_slacker at yahoo.com> Feb 02, 2006
- 414 views
Pete Lomax wrote: > }}} <eucode> > integer k > k = match("\n\r\nRING\r\n\r\n",s) > if k then > RING = 1 > s = s[k+11..$] > end if > </eucode> {{{ > > Regards, > Pete > > COOL, thanks! This is what I mean, I knew there was a shorter way to do it, I just couldn't figure it out, so I took the long way, which at least I was sure would work... heh... now if I could just figure out what the stream of bytes is all about I'll be happy! Happy Codin' Some (Serious) Slacker
6. Re: boring ole modem stuff
- Posted by don cole <doncole at pacbell.net> Feb 02, 2006
- 420 views
Kenneth Rhodes wrote: > > Some Slacker wrote: > > Sorry I can't help you with your real problem, but you can get > Syntax Coloring for your code posted to the EuForum. Instructions > are at the bottom of the "Send a Message to EUforum" web interface page. > > Good luck! > > }}} <eucode> > --dial.ex Example program > > --Sample program to dial a pager > --Change all 5555555 numbers to real phone numbers before running!!! > --delay might need to be changed for different services. this works > --for me Use at own risk. Not responsible for any damage caused by this > --program > --Greg Harris 1997 > sequence s, word, pn > integer x ,ox, y, RING > x=10 ox=x y=0 RING=0 > s={} word={} pn={} > include serial.e > > COMPORT=COM3 > --Init the modem -- > init_ports(38400, W_8BIT, P_NONE, S_1BIT) > enable_ports() > --Turn on caller ID -- > StringToPort("AT+VCID=2",1) > delay(3) > while get_key()=-1 do > --while ox=x do > x=GetSerialByte(3) > if x != -1 then s=append(s,x) > end if > if RING=1 then > position(3,1) > puts(1,"Ringing...\n") > pn={} > RING=0 > end if > if length(s)>10 then > for i = 1 to length(s)-10 do > if s[i]=10 and s[i+1]=13 and s[i+2]=10 > and s[i+3]=82 and s[i+4]=73 and s[i+5]=78 > and s[i+6]=71 and s[i+7]=13 and s[i+8]=10 > and s[i+9]=13 and s[i+10]=10 then > RING=1 > s=s[i+11..$] > end if > end for > end if > if length(s)>9 then > for i = 1 to length(s)-9 do > if s[i]=13 and s[i+1]=10 > and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 > and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 > and s[i+8]=13 and s[i+9]=10 then > RING=1 > s=s[i+10..$] > end if > end for > end if > if length(s)>7 then > for i = 1 to length(s)-7 do > if s[i]=13 and s[i+1]=10 > and s[i+2]=82 and s[i+3]=73 and s[i+4]=78 > and s[i+5]=71 and s[i+6]=13 and s[i+7]=10 then > RING=1 > s=s[i+8..$] > end if > end for > end if > if length(s) >=50 and length(pn)<10 then > for i= 18 to 0 by -2 do > pn &= s[$-i] > end for > s={} > position(4,1) > puts(1,pn) > end if > position(6,1) > ?s > > end while > > --Tell pager who called-- > --StringToPort("ATDT5555555;",1) > --delay(3) > --Hang up the modem -- > StringToPort("+++ATH0",1) > delay(3) > --Disable the modem > disable_ports() > while get_key() = -1 do > end while > </eucode> {{{ > This is very interesting to me. I have a couple of questions. Will this program get you on line then show who's calling if you are interupted? Is Call Waiting required for it to work? Is Caller ID required? Thanks for any response, Don Cole
7. Re: boring ole modem stuff
- Posted by Some Slacker <some_slacker at yahoo.com> Feb 02, 2006
- 405 views
> This is very interesting to me. > > I have a couple of questions. > > Will this program get you on line then show who's calling if you are > interupted? > > Is Call Waiting required for it to work? > > Is Caller ID required? > > Thanks for any response, > > Don Cole this program doesn't actually connect you to anything or even dial it simply listens to the data stream coming from the modem it is merely my attempt to learn what is going on as the modem recieves caller id data (yes your modem needs caller id and you need to subscribe to caller id at the phone company)