From 8e4d9ad7b0e1afb4499b567d4e7cb32cda99eb89 Mon Sep 17 00:00:00 2001 From: druid <> Date: Sun, 11 Jan 2009 06:30:56 +0000 Subject: [PATCH] Updated to use generic method_missing def for pass-through methods to SerialPort git-svn-id: file:///home/svn/framework3/trunk@6121 4d416f70-5f16-0410-b530-b9f4589650da --- lib/telephony/modem.rb | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/lib/telephony/modem.rb b/lib/telephony/modem.rb index 2090e3dce5..ac4993e578 100644 --- a/lib/telephony/modem.rb +++ b/lib/telephony/modem.rb @@ -47,6 +47,9 @@ class Modem end end + # This provides pass-through support for the SerialPort + def method_missing(meth, *args); self.sp(meth, *args); end + def put_command(command, timeout) switchback = false if ! @commandstate @@ -163,36 +166,16 @@ class Modem return false end + # flush any stale data in the read buffer def flush - # flush any stale data in the read buffer @sp.read_timeout = -1 while @sp.getc; end end - # - # Pass-through methods to SerialPort Object - # - def close - @sp.close - end - def getc - @sp.getc - end - def gets - @sp.gets - end - def puts(s) - @sp.puts(s) - end + # TODO: confert all calls to Modem.params to Modem.modem_params and remove this def def params=(params) @sp.modem_params = params end - def dcd - @sp.dcd - end - def read_timeout (timeout) - @sp.read_timeout timeout - end end