trk / hfx.eastlink.caJUNK.invalid wrote:
(snip)
>And then the software needs to just sit & listen to /dev/modem for
>valid tone sequences (4 digits or so) and respond by playing the
>corresponding recorded messages out the voicemodem and soundcard.
(snip)
>Mainly what I'm looking for is code samples and advice on how to
>structure the prog so it's technically elegant & shows OO Ruby at
>its best, rather than looking like stuff perversely dragged over
>from BASIC.

I'm not sure how far we can go without getting 
into specifics and real code. Personally, I would 
take an XP (eXtreme Programming) approach, and 
come up with stories, then tasks, and then start 
writing tests. But we're not here to talk about 
XP.

I would guess that you would want a class that 
wraps the low-level /dev/modem stuff. Perhaps 
something like class Modem where you could pass 
in the port filespec (e.g. "/dev/modem"). This 
would do any configuring it might need to.

Then, you might have some kind of listener class 
that creates the Modem object and waits for good 
stuff to come pouring in. You could set up this 
listener as an Observer of the Modem, or you 
could create the modem with a block so you get 
called back any time something comes in. As I 
said, it's really hard to say.

If you're at all serious about Ruby, spend the 
money on the pickaxe book ("Programming Ruby"). 
It will pay for itself within a day.

Kevin