Skip to content

Instantly share code, notes, and snippets.

@scalone
Created May 22, 2018 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scalone/ede8234a657467f052c03f0664826308 to your computer and use it in GitHub Desktop.
Save scalone/ede8234a657467f052c03f0664826308 to your computer and use it in GitHub Desktop.
def self.send_at_command(serial, command)
3.times do
result = serial.command("#{command}\r", 200)
if result.to_s.match(/\OK/)
break [true, ""]
else
[false, result]
end
end
end
def self.select_attach_network(imsi_id)
cmd_at("/dev/mux1", 115200, 8, "N", 1, 20000) do |serial|
result, reason = self.send_at_command(serial, "AT+CMEE=2") # Enable errors
return reason unless result
#...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment