Skip to content

Commit 325303a

Browse files
committed
Add options to configure serial flow control
1 parent ea7db39 commit 325303a

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0
2323
- name: Set up Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
2525
with:
2626
python-version: "3.x"
2727
- name: Install pypa/build
@@ -32,7 +32,7 @@ jobs:
3232
run: |
3333
python -m build
3434
- name: Upload dist files
35-
uses: actions/upload-artifact@v2
35+
uses: actions/upload-artifact@v4
3636
with:
3737
name: dist-files
3838
path: dist/
@@ -44,7 +44,7 @@ jobs:
4444
runs-on: ubuntu-latest
4545
steps:
4646
- name: Download dist files
47-
uses: actions/download-artifact@v2
47+
uses: actions/download-artifact@v4
4848
with:
4949
name: dist-files
5050
path: dist/
@@ -61,7 +61,7 @@ jobs:
6161
runs-on: ubuntu-latest
6262
steps:
6363
- name: Download dist files
64-
uses: actions/download-artifact@v2
64+
uses: actions/download-artifact@v4
6565
with:
6666
name: dist-files
6767
path: dist/

gsmmodem/serial_comms.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class SerialComms(object):
2222
# Default timeout for serial port reads (in seconds)
2323
timeout = 1
2424

25-
def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCallbackFunc=None, *args, **kwargs):
25+
def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCallbackFunc=None,
26+
xonxoff=False, dsrdtr=True, rtscts=True, *args, **kwargs):
2627
""" Constructor
2728
2829
:param fatalErrorCallbackFunc: function to call if a fatal error occurs in the serial device reading thread
@@ -32,6 +33,10 @@ def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCal
3233
self.port = port
3334
self.baudrate = baudrate
3435

36+
self.xonxoff = xonxoff
37+
self.dsrdtr = dsrdtr
38+
self.rtscts = rtscts
39+
3540
self._responseEvent = None # threading.Event()
3641
self._expectResponseTermSeq = None # expected response terminator sequence
3742
self._response = None # Buffer containing response to a written command
@@ -47,7 +52,7 @@ def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCal
4752

4853
def connect(self):
4954
""" Connects to the device and starts the read thread """
50-
self.serial = serial.Serial(dsrdtr=True, rtscts=True, port=self.port, baudrate=self.baudrate,
55+
self.serial = serial.Serial(xonxoff=self.xonxoff, dsrdtr=self.dsrdtr, rtscts=self.rtscts, port=self.port, baudrate=self.baudrate,
5156
timeout=self.timeout,*self.com_args,**self.com_kwargs)
5257
# Start read thread
5358
self.alive = True

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[metadata]
2-
name = python-gsmmodem-new
2+
name = python-gsmmodem-2025
33
description = Control an attached GSM modem: send/receive SMS messages, handle calls, etc
44
license = LGPLv3+
55
author = Francois Aucamp
66
author_email = francois.aucamp@gmail.com
7-
url = https://github.com/babca/python-gsmmodem
7+
url = https://github.com/jaydenpung/python-gsmmodem
88
long_description = file: README.rst
99
long_description_content_type = text/x-rst
1010
classifiers =

0 commit comments

Comments
 (0)