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
unstable
druid 2009-01-11 06:30:56 +00:00
parent 0d1ca42ed6
commit 8e4d9ad7b0
1 changed files with 5 additions and 22 deletions

View File

@ -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
def flush
# flush any stale data in the read buffer
def flush
@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