Created
May 22, 2018 05:16
-
-
Save scalone/ede8234a657467f052c03f0664826308 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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