Class: Sim800c::Client
- Inherits:
-
Object
- Object
- Sim800c::Client
- Includes:
- Helpers
- Defined in:
- lib/sim800c/client.rb
Instance Method Summary collapse
-
#delete_message ⇒ Object
Methods: .by_index, .all_read, .all_read_and_sent, .all_read_sent_and_unsent.
-
#device ⇒ Object
Methods: .battery_info.
-
#initialize(port_path, baud: 9600) ⇒ Client
constructor
A new instance of Client.
-
#list_messages ⇒ Object
Methods: .all, .unread, .read, .unsent, .sent (Hash).
-
#save_and_send_message(phone_number, message) ⇒ Object
Store and send (AT+CMGW = store, AT+CMSS = send).
-
#send_message(phone_number, message) ⇒ Object
Sends message immediately (does not store sent messages).
-
#signal_quality ⇒ Object
Methods: .info (Hash), .rssi (Integer).
-
#storage_info ⇒ Object
Checks storage info.
Methods included from Helpers
#at_cmd, #parse_cmgl_response, #read_response, #return_or_raise_error!
Constructor Details
#initialize(port_path, baud: 9600) ⇒ Client
Returns a new instance of Client.
15 16 17 18 |
# File 'lib/sim800c/client.rb', line 15 def initialize(port_path, baud: 9600) require 'rubyserial' @serial = Serial.new(port_path, baud) end |
Instance Method Details
#delete_message ⇒ Object
Methods: .by_index, .all_read, .all_read_and_sent, .all_read_sent_and_unsent
41 42 43 |
# File 'lib/sim800c/client.rb', line 41 def Commands::DeleteMessage.new(@serial) end |
#device ⇒ Object
Methods: .battery_info
51 52 53 |
# File 'lib/sim800c/client.rb', line 51 def device Commands::Device.new(@serial) end |
#list_messages ⇒ Object
Methods: .all, .unread, .read, .unsent, .sent (Hash)
31 32 33 |
# File 'lib/sim800c/client.rb', line 31 def Commands::ListMessages.new(@serial) end |
#save_and_send_message(phone_number, message) ⇒ Object
Store and send (AT+CMGW = store, AT+CMSS = send)
26 27 28 |
# File 'lib/sim800c/client.rb', line 26 def (phone_number, ) Commands::SendMessage.new(@serial).save_and_send(phone_number, ) end |
#send_message(phone_number, message) ⇒ Object
Sends message immediately (does not store sent messages)
21 22 23 |
# File 'lib/sim800c/client.rb', line 21 def (phone_number, ) Commands::SendMessage.new(@serial).send_immediate(phone_number, ) end |
#signal_quality ⇒ Object
Methods: .info (Hash), .rssi (Integer)
36 37 38 |
# File 'lib/sim800c/client.rb', line 36 def signal_quality Commands::SignalQuality.new(@serial) end |
#storage_info ⇒ Object
Checks storage info
46 47 48 |
# File 'lib/sim800c/client.rb', line 46 def storage_info Commands::StorageInfo.new(@serial).call end |