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

include support for Huawei Modem E372 #21

Merged
merged 2 commits into from
Jul 10, 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
3 changes: 2 additions & 1 deletion Hologram/Network/Cellular.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from Hologram.Event import Event
from Exceptions.HologramError import NetworkError
from Hologram.Network.Route import Route
from Hologram.Network.Modem import Modem, E303, MS2131, Nova_U201, NovaM, DriverLoader
from Hologram.Network.Modem import Modem, E303, MS2131, E372, Nova_U201, NovaM, DriverLoader
from Hologram.Network import Network, NetworkScope
import time
from serial.tools import list_ports
Expand All @@ -30,6 +30,7 @@ class Cellular(Network):
_modemHandlers = {
'e303': E303.E303,
'ms2131': MS2131.MS2131,
'e372': E372.E372,
'nova': Nova_U201.Nova_U201,
'novam': NovaM.NovaM,
'': Modem
Expand Down
45 changes: 45 additions & 0 deletions Hologram/Network/Modem/E372.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# E372.py - Based on Hologram Python SDK Huawei MS2131 modem interface
#
#
#
#
#
# LICENSE: Distributed under the terms of the MIT License
#

from Hologram.Network.Modem import Modem
from Hologram.Event import Event

DEFAULT_E372_TIMEOUT = 200

class E372(Modem):

usb_ids = [('12d1', '14c6')]

def __init__(self, device_name=None, baud_rate='9600',
chatscript_file=None, event=Event()):

super().__init__(device_name=device_name, baud_rate=baud_rate,
chatscript_file=chatscript_file, event=event)

def connect(self, timeout = DEFAULT_E372_TIMEOUT):
return super().connect(timeout)

def init_serial_commands(self):
self.command("E0") #echo off
self.command("+CMEE", "2") #set verbose error codes
self.command("+CPIN?")
self.command("+CTZU", "1") #time/zone sync
self.command("+CTZR", "1") #time/zone URC
#self.command("+CPIN", "") #set SIM PIN
self.command("+CPMS", "\"ME\",\"ME\",\"ME\"")
self.set_sms_configs()
self.command("+CREG", "2")
self.command("+CGREG", "2")

def disable_at_sockets_mode(self):
pass

@property
def iccid(self):
return self._basic_command('^ICCID?').lstrip('^ICCID: ')[:-1]
2 changes: 1 addition & 1 deletion Hologram/Network/Modem/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__all__ = ['Modem', 'MockModem', 'MS2131', 'Nova', 'E303']
__all__ = ['Modem', 'MockModem', 'MS2131', 'Nova', 'E303', 'E372']

from .IModem import IModem
from .Modem import Modem