Class: Utel::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/utel/device.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.pin(*args) ⇒ Object



7
8
9
# File 'lib/utel/device.rb', line 7

def self.pin(*args)
  new.pin(*args)
end

.send_atObject



3
4
5
# File 'lib/utel/device.rb', line 3

def self.send_at
  new.send_at
end

Instance Method Details

#pin(code = PIN_CODE) ⇒ Object



11
12
13
# File 'lib/utel/device.rb', line 11

def pin(code=PIN_CODE)
  puts code
end

#send_atObject



15
16
17
18
19
20
21
22
# File 'lib/utel/device.rb', line 15

def send_at
  File.open(Utel::DEVICE, 'w+') do |f|
    f.write("AT\r\n")
    while (s = f.gets) do
      break if s.slice(0,2) == "OK"
    end
  end
end