-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0e530c0
Showing
8 changed files
with
1,099 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.pyc | ||
build/ | ||
dist/ | ||
gsmmodem_manager.egg-info/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
gsmmodem-manager (0.1) | ||
|
||
* Initial release | ||
|
||
-- J. Félix Ontañón <[email protected]> Tue, 20 Nov 2018 18:00:00 +0100 |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# python-gsmmodem-manager | ||
|
||
Framework for communicating and interacting with 2G/3G/4G usb modems | ||
|
||
## Table of Contents | ||
|
||
- [Description](#description) | ||
- [Hardware supported](#hardware) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Contributing](#contributing) | ||
- [To Do](#todo) | ||
- [Standards](#standards) | ||
|
||
|
||
## Description | ||
|
||
Modems usually offer an interface via AT commands. A serial protocol originally developed by [Dennis Hayes](https://en.wikipedia.org/wiki/Hayes_command_set). There's a basic set of AT commands almost all modems support, and an extended set only some support. Every single manufacturer adds their extended set of commands to provide with vendor specific functionallity. | ||
|
||
This python library is aimed to encapsulate all complicated vendor specific logic of USB modems and serving a common library to perform typical operations like: | ||
|
||
- Selecting a network operator. | ||
- Choosing an access technology (2G/3G/4G). | ||
- Registering in the network. | ||
- Activating/deactivating a PDP context. | ||
- Get IMEI from device. Get IMSI from SIM card. | ||
- etc. | ||
|
||
## Hardware | ||
|
||
So far, the list of supported modems are: | ||
|
||
- Huawei MS2131 | ||
- Huawei MS2372h | ||
- Huawei E3372 | ||
|
||
Plese have a look the [Contributing](#contributing) section to extend support for other modems. | ||
Let's join efforts! | ||
|
||
## Installation | ||
|
||
You can install via pip from our Github repository directly (pending to submit to [pypi](https://pypi.org)) | ||
|
||
```shell | ||
pip install https://github.com/PodgroupConnectivity/python-gsmmodem-manager | ||
``` | ||
|
||
## Usage | ||
|
||
```python | ||
# Lets use a generic modem and test some basic AT commands | ||
from gsmmodem_manager import GSMModem, signal_quality | ||
|
||
# The USB modem is attached to /dev/ttyUSB0. Let's communicate with 9600 baud. | ||
modem = GSMModem("/dev/ttyUSB0", "9600") | ||
|
||
modem.get_imei() # (True, 'AT+GSN', '{IMEI CODE GOES HERE}') | ||
modem.get_imsi() # (True, 'AT+CIMI', '{IMSI CODE GOES HERE}') | ||
modem.set_operator('21401') # (True, 'AT+COPS=1,2,"21401"', None) | ||
sq = modem.get_signal_quality() # (True, 'AT+CSQ', '11,99') | ||
signal_quality(sq[2]) # 'Excellent' | ||
|
||
# Let's use a specific Huawei MS2131 modem now | ||
from gsmmodem_manager import HuaweiMS2131 | ||
modem = GSMModem("/dev/ttyUSB0", "9600") | ||
|
||
# The following snipped selects Spain Vodafone 4G, registers and acquire data. | ||
# Please note this does not generate a PPP interface, but establish the session. | ||
modem.set_operator('21401') # Selects Spain Vodafone | ||
modem.set_access_technology(HuaweiMS2131.ACT_UMTS) # Choses 4G. Each modem has its own codes. | ||
modem.register() # Registers in the network | ||
modem.activate_pdp_context() # Acquires PDP Context (data session) | ||
modem.deactivate_pdp_context() # Closes PDP Context (data session) | ||
``` | ||
|
||
## Contributing | ||
|
||
Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/fraction/readme-boilerplate/compare/). | ||
|
||
Please note this source code has been released under the GPLv3 terms and all contributions will be considered under the same license. Have a look at the LICENSE file distributed with this code. | ||
|
||
## TODO | ||
|
||
The following is a non-comprehensive list of pending developments to add. | ||
We're happy to accept any contribution :) | ||
|
||
- Hot-detecting the USB modem and determine whether it is compatible or not. Via UDEV. | ||
- Listen to udev events when USB modem is available or not to pause/resume any activity. | ||
- Finish compatibility with K3765 HSPA | ||
|
||
## Standards | ||
|
||
[AT command set for User Equipment](https://www.etsi.org/deliver/etsi_ts/127000_127099/127007/10.03.00_60/ts_127007v100300p.pdf) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# vim: ts=4 | ||
### | ||
# | ||
# Copyright (c) 2016-2018 Pod Group Ltd | ||
# Authors : J. Félix Ontañón <[email protected]> | ||
|
||
from lib import signal_quality, GSMModem, HuaweiModem, HuaweiMS2131, HuaweiMS2372h, HuaweiE3372 |
Oops, something went wrong.