sim-modem


Namesim-modem JSON
Version 1.0.3 PyPI version JSON
download
home_page
SummaryEasy library for interfacing with mobile modems
upload_time2022-12-27 22:10:14
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT
keywords modem sms gsm sim atcommands
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sim-modem

Easy library for interfacing with mobile modems. Tested with Simcom SIM7600G-H on Raspberry PI Zero W. The commands could be different for other modems.

## Installation

```bash
pip install sim-modem
```

## Usage
    
```python
from sim_modem import Modem

modem = Modem('/dev/ttyUSB2')

signal_quality = modem.get_signal_quality()
print(signal_quality)

modem.send_sms('+393383928434', 'Hello World!')

```


## API

### Modem (Class)

Main class for interfacing with the modem. Each method raise an exception if the modem returns an error. If the command is successful, the function returns the response from the modem.


```python
Modem(        
    address, # Address of the device tty (e.g. "/dev/ttyUSB2")
    baudrate=460800, # Baudrate of the device. Default: 460800
    timeout=5, # Timeout for the serial connection. Default: 5
    at_cmd_delay=0.1, # Delay between AT commands. Default: 0.1
    debug=False # Log commands and responses from modem, test command support before executing them. Default: False
)
```


| Method                                        | Description                                                             |
| --------------------------------------------- | ----------------------------------------------------------------------- |
| reconnect() -> str                          | Reconnect to serial                                                     |
| close() -> str                              | Close the serial connection                                             |
| ***Hardware related methods***                    |                                                                         |
| get_model_identification() -> str           | Get the model identification                                            |
| get_manufacturer_identification() -> str    | Get the manufacturer identification                                     |
| get_serial_number() -> str                  | Get the serial number                                                   |
| get_firmware_version() -> str               | Get the firmware version                                                |
| get_volume() -> str                         | Get the volume. The volume range is between 0 and 5                     |
| set_volume(index: int) # 0-5                | Set the volume. The volume must be between 0 and 5                      |
| improve_tdd() -> str                        | Decrease TDD Noise effect                                               |
| enable_echo_suppression() -> str            | Enable echo suppression                                                 |
| disable_echo_suppression() -> str           | Disable echo suppression                                                |
| ***Network related methods***                     |                                                                         |
| get_network_registration_status() -> str    | Get the network registration status                                     |
| get_network_mode() -> NetworkMode           | Get the network mode                                                    |
| get_network_name() -> str                   | Get the network name                                                    |
| get_network_operator() -> str               | Get the network operator                                                |
| get_signal_quality() -> str                 | Get the signal quality                                                  |
| get_signal_quality_db() -> int              | Get the signal quality in dB                                            |
| get_signal_quality_range() -> SignalQuality | Get the signal quality as a range (see [SignalQuality](#SignalQuality)) |
| get_phone_number() -> str                   | Get the phone number                                                    |
| get_sim_status() -> str                     | Get the SIM status                                                      |
| set_network_mode(mode: NetworkMode) -> str  | Set the network mode                                                    |
| ***Calls related methods***                       |                                                                         |
| call(number: str) -> str                    | Call a number                                                           |
| answer() -> str                             | Answer a call                                                           |
| hangup() -> str                             | Hangup a call                                                           |
| ***SMS related methods***                         |                                                                         |
| get_sms_list() -> list                      | Get the list of SMS                                                     |
| empty_sms() -> str                          | Empty the SMS storage                                                   |
| send_sms(number: str, message: str) -> str  | Send an SMS                                                             |
| get_sms(index: int) -> dict                 | Get an SMS by ID                                                        |
| delete_sms(index: int) -> str               | Delete an SMS by ID                                                     |
| ***GPS related methods***                         |                                                                         |
| get_gps_status() -> str                     | Get the GPS status                                                      |
| start_gps() -> str                          | Start the GPS                                                           |
| stop_gps() -> str                           | Stop the GPS                                                            |
| get_gps_coordinates() -> dict               | Get the GPS coordinates                                                 |


### SignalQuality (enum)

Signal quality expressed as ranges 

| Key                       | Description                 |
| ------------------------- | --------------------------- |
| `SignalQuality.LOW`       | Signal is under 7           |
| `SignalQuality.FAIR`      | Signal is between 7 and 15  |
| `SignalQuality.GOOD`      | Signal is between 15 and 20 |
| `SignalQuality.EXCELLENT` | Signal is over 20           |

### NetworkMode (enum)

Network mode of the modem (get/set)

| Key                       | Description |
| ------------------------- | ----------- |
| `NetworkMode.AUTOMATIC`   | Automatic   |
| `NetworkMode.GSM_ONLY`    | GSM only    |
| `NetworkMode.LTE_ONLY`    | LTE only    |
| `NetworkMode.ANY_BUT_LTE` | Any but LTE |


## License

[MIT](https://choosealicense.com/licenses/mit/)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "sim-modem",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "modem,sms,gsm,sim,atcommands",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/ea/a8/a5a2cc543a88679a61ef44a2052e79def06fdf5e00e584e47b2ea8796c6c/sim-modem-1.0.3.tar.gz",
    "platform": null,
    "description": "# sim-modem\n\nEasy library for interfacing with mobile modems. Tested with Simcom SIM7600G-H on Raspberry PI Zero W. The commands could be different for other modems.\n\n## Installation\n\n```bash\npip install sim-modem\n```\n\n## Usage\n    \n```python\nfrom sim_modem import Modem\n\nmodem = Modem('/dev/ttyUSB2')\n\nsignal_quality = modem.get_signal_quality()\nprint(signal_quality)\n\nmodem.send_sms('+393383928434', 'Hello World!')\n\n```\n\n\n## API\n\n### Modem (Class)\n\nMain class for interfacing with the modem. Each method raise an exception if the modem returns an error. If the command is successful, the function returns the response from the modem.\n\n\n```python\nModem(        \n    address, # Address of the device tty (e.g. \"/dev/ttyUSB2\")\n    baudrate=460800, # Baudrate of the device. Default: 460800\n    timeout=5, # Timeout for the serial connection. Default: 5\n    at_cmd_delay=0.1, # Delay between AT commands. Default: 0.1\n    debug=False # Log commands and responses from modem, test command support before executing them. Default: False\n)\n```\n\n\n| Method                                        | Description                                                             |\n| --------------------------------------------- | ----------------------------------------------------------------------- |\n| reconnect() -> str                          | Reconnect to serial                                                     |\n| close() -> str                              | Close the serial connection                                             |\n| ***Hardware related methods***                    |                                                                         |\n| get_model_identification() -> str           | Get the model identification                                            |\n| get_manufacturer_identification() -> str    | Get the manufacturer identification                                     |\n| get_serial_number() -> str                  | Get the serial number                                                   |\n| get_firmware_version() -> str               | Get the firmware version                                                |\n| get_volume() -> str                         | Get the volume. The volume range is between 0 and 5                     |\n| set_volume(index: int) # 0-5                | Set the volume. The volume must be between 0 and 5                      |\n| improve_tdd() -> str                        | Decrease TDD Noise effect                                               |\n| enable_echo_suppression() -> str            | Enable echo suppression                                                 |\n| disable_echo_suppression() -> str           | Disable echo suppression                                                |\n| ***Network related methods***                     |                                                                         |\n| get_network_registration_status() -> str    | Get the network registration status                                     |\n| get_network_mode() -> NetworkMode           | Get the network mode                                                    |\n| get_network_name() -> str                   | Get the network name                                                    |\n| get_network_operator() -> str               | Get the network operator                                                |\n| get_signal_quality() -> str                 | Get the signal quality                                                  |\n| get_signal_quality_db() -> int              | Get the signal quality in dB                                            |\n| get_signal_quality_range() -> SignalQuality | Get the signal quality as a range (see [SignalQuality](#SignalQuality)) |\n| get_phone_number() -> str                   | Get the phone number                                                    |\n| get_sim_status() -> str                     | Get the SIM status                                                      |\n| set_network_mode(mode: NetworkMode) -> str  | Set the network mode                                                    |\n| ***Calls related methods***                       |                                                                         |\n| call(number: str) -> str                    | Call a number                                                           |\n| answer() -> str                             | Answer a call                                                           |\n| hangup() -> str                             | Hangup a call                                                           |\n| ***SMS related methods***                         |                                                                         |\n| get_sms_list() -> list                      | Get the list of SMS                                                     |\n| empty_sms() -> str                          | Empty the SMS storage                                                   |\n| send_sms(number: str, message: str) -> str  | Send an SMS                                                             |\n| get_sms(index: int) -> dict                 | Get an SMS by ID                                                        |\n| delete_sms(index: int) -> str               | Delete an SMS by ID                                                     |\n| ***GPS related methods***                         |                                                                         |\n| get_gps_status() -> str                     | Get the GPS status                                                      |\n| start_gps() -> str                          | Start the GPS                                                           |\n| stop_gps() -> str                           | Stop the GPS                                                            |\n| get_gps_coordinates() -> dict               | Get the GPS coordinates                                                 |\n\n\n### SignalQuality (enum)\n\nSignal quality expressed as ranges \n\n| Key                       | Description                 |\n| ------------------------- | --------------------------- |\n| `SignalQuality.LOW`       | Signal is under 7           |\n| `SignalQuality.FAIR`      | Signal is between 7 and 15  |\n| `SignalQuality.GOOD`      | Signal is between 15 and 20 |\n| `SignalQuality.EXCELLENT` | Signal is over 20           |\n\n### NetworkMode (enum)\n\nNetwork mode of the modem (get/set)\n\n| Key                       | Description |\n| ------------------------- | ----------- |\n| `NetworkMode.AUTOMATIC`   | Automatic   |\n| `NetworkMode.GSM_ONLY`    | GSM only    |\n| `NetworkMode.LTE_ONLY`    | LTE only    |\n| `NetworkMode.ANY_BUT_LTE` | Any but LTE |\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Easy library for interfacing with mobile modems",
    "version": "1.0.3",
    "split_keywords": [
        "modem",
        "sms",
        "gsm",
        "sim",
        "atcommands"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "073308262c65d5b4e9636e3d95236b61",
                "sha256": "54f989ce56a21bda7ff5c5f427be6693c89a1298e4b778198f4e70d9b80fb7a2"
            },
            "downloads": -1,
            "filename": "sim_modem-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "073308262c65d5b4e9636e3d95236b61",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7149,
            "upload_time": "2022-12-27T22:10:12",
            "upload_time_iso_8601": "2022-12-27T22:10:12.791217Z",
            "url": "https://files.pythonhosted.org/packages/6c/95/e464685c00c2144f03df00d146784e0bbe53619dcafce02e88cb546955dd/sim_modem-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "f004a89227bf1e18bd4e07416c22375f",
                "sha256": "7099ca4c860be756096db17248803a7b07ef587dfc6521084a16828a4fc9c3e1"
            },
            "downloads": -1,
            "filename": "sim-modem-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f004a89227bf1e18bd4e07416c22375f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6498,
            "upload_time": "2022-12-27T22:10:14",
            "upload_time_iso_8601": "2022-12-27T22:10:14.739709Z",
            "url": "https://files.pythonhosted.org/packages/ea/a8/a5a2cc543a88679a61ef44a2052e79def06fdf5e00e584e47b2ea8796c6c/sim-modem-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-27 22:10:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "sim-modem"
}
        
Elapsed time: 0.02196s