Skip to content

Commit 7c45b17

Browse files
include support for Huawei Modem E372 (#21)
* include support for Huawei Modem E372 and actually works with Ubuntu and Raspbian10 * add support in class for E372 modem Co-authored-by: Hector Mendez <[email protected]>
1 parent 0566314 commit 7c45b17

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

Hologram/Network/Cellular.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from Hologram.Event import Event
1212
from Exceptions.HologramError import NetworkError
1313
from Hologram.Network.Route import Route
14-
from Hologram.Network.Modem import Modem, E303, MS2131, Nova_U201, NovaM, DriverLoader
14+
from Hologram.Network.Modem import Modem, E303, MS2131, E372, Nova_U201, NovaM, DriverLoader
1515
from Hologram.Network import Network, NetworkScope
1616
import time
1717
from serial.tools import list_ports
@@ -30,6 +30,7 @@ class Cellular(Network):
3030
_modemHandlers = {
3131
'e303': E303.E303,
3232
'ms2131': MS2131.MS2131,
33+
'e372': E372.E372,
3334
'nova': Nova_U201.Nova_U201,
3435
'novam': NovaM.NovaM,
3536
'': Modem

Hologram/Network/Modem/E372.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# E372.py - Based on Hologram Python SDK Huawei MS2131 modem interface
2+
#
3+
#
4+
#
5+
#
6+
#
7+
# LICENSE: Distributed under the terms of the MIT License
8+
#
9+
10+
from Hologram.Network.Modem import Modem
11+
from Hologram.Event import Event
12+
13+
DEFAULT_E372_TIMEOUT = 200
14+
15+
class E372(Modem):
16+
17+
usb_ids = [('12d1', '14c6')]
18+
19+
def __init__(self, device_name=None, baud_rate='9600',
20+
chatscript_file=None, event=Event()):
21+
22+
super().__init__(device_name=device_name, baud_rate=baud_rate,
23+
chatscript_file=chatscript_file, event=event)
24+
25+
def connect(self, timeout = DEFAULT_E372_TIMEOUT):
26+
return super().connect(timeout)
27+
28+
def init_serial_commands(self):
29+
self.command("E0") #echo off
30+
self.command("+CMEE", "2") #set verbose error codes
31+
self.command("+CPIN?")
32+
self.command("+CTZU", "1") #time/zone sync
33+
self.command("+CTZR", "1") #time/zone URC
34+
#self.command("+CPIN", "") #set SIM PIN
35+
self.command("+CPMS", "\"ME\",\"ME\",\"ME\"")
36+
self.set_sms_configs()
37+
self.command("+CREG", "2")
38+
self.command("+CGREG", "2")
39+
40+
def disable_at_sockets_mode(self):
41+
pass
42+
43+
@property
44+
def iccid(self):
45+
return self._basic_command('^ICCID?').lstrip('^ICCID: ')[:-1]

Hologram/Network/Modem/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__all__ = ['Modem', 'MockModem', 'MS2131', 'Nova', 'E303']
1+
__all__ = ['Modem', 'MockModem', 'MS2131', 'Nova', 'E303', 'E372']
22

33
from .IModem import IModem
44
from .Modem import Modem

0 commit comments

Comments
 (0)