Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to renable at sockets #36

Merged
merged 1 commit into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Hologram/Network/Cellular.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def disconnect(self):
success = self.modem.disconnect()
if success:
self.logger.info('Successfully disconnected from cell network')
self.enable_at_sockets_mode()
self._connection_status = CLOUD_DISCONNECTED
self.event.broadcast('cellular.disconnected')
super().disconnect()
Expand Down Expand Up @@ -140,6 +141,9 @@ def pop_received_message(self):
def disable_at_sockets_mode(self):
self.modem.disable_at_sockets_mode()

def enable_at_sockets_mode(self):
self.modem.enable_at_sockets_mode()

def enableSMS(self):
return self.modem.enableSMS()

Expand Down
4 changes: 0 additions & 4 deletions Hologram/Network/Modem/E303.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ def init_serial_commands(self):
self.command("+CREG", "2")
self.command("+CGREG", "2")

# AT sockets mode is always disabled for E303.
def disable_at_sockets_mode(self):
pass

@property
def iccid(self):
return self._basic_command('^ICCID?').lstrip('^ICCID: ')[:-1]
4 changes: 0 additions & 4 deletions Hologram/Network/Modem/MS2131.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ def init_serial_commands(self):
self.command("+CREG", "2")
self.command("+CGREG", "2")

# AT sockets mode is always disabled for MS2131.
def disable_at_sockets_mode(self):
pass

@property
def iccid(self):
return self._basic_command('^ICCID?').lstrip('^ICCID: ')[:-1]
5 changes: 4 additions & 1 deletion Hologram/Network/Modem/Modem.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,10 @@ def _read_from_serial_port(self, timeout=None, size=DEFAULT_SERIAL_READ_SIZE):
return r

def disable_at_sockets_mode(self):
raise HologramError('Cannot disable AT command sockets on this Modem type')
pass

def enable_at_sockets_mode(self):
pass

def enable_hex_mode(self):
self.__set_hex_mode(1)
Expand Down
3 changes: 3 additions & 0 deletions Hologram/Network/Modem/Nova.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def __init__(self, device_name=None, baud_rate='9600',
def disable_at_sockets_mode(self):
self._at_sockets_available = False

def enable_at_sockets_mode(self):
self._at_sockets_available = True

@property
def version(self):
return self._basic_command('I9')
Expand Down