Skip to content

Commit

Permalink
support for Huawei (and many other modem models) by configuring modem…
Browse files Browse the repository at this point in the history
… into text mode; bump version up to 0.4
  • Loading branch information
herval committed Apr 7, 2010
0 parents commit b8651c4
Show file tree
Hide file tree
Showing 14 changed files with 622 additions and 0 deletions.
89 changes: 89 additions & 0 deletions PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Metadata-Version: 1.0
Name: sms
Version: 0.3
Summary: SMS sending and receiving with enfora gsm modems
Home-page: http://pypi.python.org/pypi/sms
Author: Amos Latteier
Author-email: amos@latteier.com
License: MIT
Description: SMS
===

The sms package provides sms capabilities for Enfora gsm modems, and
probably others. I developed this package for my location-specific
nature haiku by sms project N8R TXT (http://n8rtxt.org/).

The sms package provides Modem and Message classes for sending and
receiving sms message.

The `sms.server` module provides two servers that allow you to
dispatch incoming sms messages. The `sms.echo` module is an example
that works with the `sms.server.subprocess_server`.

Usage
-----

Create a modem object passing it the serial device ID. On windows this
would be something like 'COM1'. The example below is for mac and
linux:

>>> import sms
>>> m = sms.Modem('/dev/ttyS0')

You can have use several modem objects concurrently if you have more
than one modem attached to different serial ports.

To send a sms message call the send method, passing a phone number
string and a message string.

>>> m.send('14161234567', 'This is a message')

If an error occurs a ModemError will be raised with the error message.

>>> m.send('14161234567', 'This is a message')
Traceback (most recent call last):
...
ModemError: ['ERROR']

You can retrieve sms messages with the messages() method. It returns a
sequence of message objects.

>>> m.messages()
[<sms.Message object at 0x...>]

Message objects have a couple attributes: number, date, and text.

>>> msgs = m.messages()
>>> msgs[0].number
'+16476186676'

>>> msgs[0].date
datetime.datetime(2008, 7, 11, 11, 2, 11)

>>> msgs[0].text
'Activation code 63966 Go 2 www.ipipi.com and signin with your username and pwd, enter 63966 to activate your mobile/account\n\nWelcome 2 ipipi.com'

After you receive messages you'll want to delete them from the SIM
card. This is done by calling the delete method on the messages.

>>> msgs[0].delete()

Rather than polling the modem to find messages you can call the wait()
method, which blocks until a message is received. The wait method
takes an optional timeout argument.

>>> m.wait(1) # waiting with 1 timeout

>>> m.wait() # waiting with no timeout

The wait message doesn't return anything. You should call the
messages() method after it returns to receive the messages. Note that
it's possible that there may in fact be no messages available after
the wait method returns.

Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Topic :: Communications :: Telephony
74 changes: 74 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
SMS
===

The sms package provides sms capabilities for Enfora gsm modems, and
probably others. I developed this package for my location-specific
nature haiku by sms project N8R TXT (http://n8rtxt.org/).

The sms package provides Modem and Message classes for sending and
receiving sms message.

The `sms.server` module provides two servers that allow you to
dispatch incoming sms messages. The `sms.echo` module is an example
that works with the `sms.server.subprocess_server`.

Usage
-----

Create a modem object passing it the serial device ID. On windows this
would be something like 'COM1'. The example below is for mac and
linux:

>>> import sms
>>> m = sms.Modem('/dev/ttyS0')

You can have use several modem objects concurrently if you have more
than one modem attached to different serial ports.

To send a sms message call the send method, passing a phone number
string and a message string.

>>> m.send('14161234567', 'This is a message')

If an error occurs a ModemError will be raised with the error message.

>>> m.send('14161234567', 'This is a message')
Traceback (most recent call last):
...
ModemError: ['ERROR']

You can retrieve sms messages with the messages() method. It returns a
sequence of message objects.

>>> m.messages()
[<sms.Message object at 0x...>]

Message objects have a couple attributes: number, date, and text.

>>> msgs = m.messages()
>>> msgs[0].number
'+16476186676'

>>> msgs[0].date
datetime.datetime(2008, 7, 11, 11, 2, 11)

>>> msgs[0].text
'Activation code 63966 Go 2 www.ipipi.com and signin with your username and pwd, enter 63966 to activate your mobile/account\n\nWelcome 2 ipipi.com'

After you receive messages you'll want to delete them from the SIM
card. This is done by calling the delete method on the messages.

>>> msgs[0].delete()

Rather than polling the modem to find messages you can call the wait()
method, which blocks until a message is received. The wait method
takes an optional timeout argument.

>>> m.wait(1) # waiting with 1 timeout

>>> m.wait() # waiting with no timeout

The wait message doesn't return anything. You should call the
messages() method after it returns to receive the messages. Note that
it's possible that there may in fact be no messages available after
the wait method returns.
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0

23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from setuptools import setup, find_packages

setup(name = 'sms',
description = 'SMS sending and receiving with enfora gsm modems',
long_description = open('README.txt').read(),
author = ['Amos Latteier', 'Herval Freire'],
author_email = 'amos@latteier.com',
url = 'http://pypi.python.org/pypi/sms',
license = 'MIT',
version = '0.4',
packages = find_packages('src'),
package_dir = {'':'src'},
package_data = {'sms': ['*.txt']},
zip_safe = False,
classifiers = [
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Topic :: Communications :: Telephony'
],
install_requires = ['pyserial', 'setuptools'],
)
89 changes: 89 additions & 0 deletions src/sms.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Metadata-Version: 1.0
Name: sms
Version: 0.4
Summary: SMS sending and receiving with enfora gsm modems
Home-page: http://pypi.python.org/pypi/sms
Author: ['Amos Latteier', 'Herval Freire']
Author-email: amos@latteier.com
License: MIT
Description: SMS
===

The sms package provides sms capabilities for Enfora gsm modems, and
probably others. I developed this package for my location-specific
nature haiku by sms project N8R TXT (http://n8rtxt.org/).

The sms package provides Modem and Message classes for sending and
receiving sms message.

The `sms.server` module provides two servers that allow you to
dispatch incoming sms messages. The `sms.echo` module is an example
that works with the `sms.server.subprocess_server`.

Usage
-----

Create a modem object passing it the serial device ID. On windows this
would be something like 'COM1'. The example below is for mac and
linux:

>>> import sms
>>> m = sms.Modem('/dev/ttyS0')

You can have use several modem objects concurrently if you have more
than one modem attached to different serial ports.

To send a sms message call the send method, passing a phone number
string and a message string.

>>> m.send('14161234567', 'This is a message')

If an error occurs a ModemError will be raised with the error message.

>>> m.send('14161234567', 'This is a message')
Traceback (most recent call last):
...
ModemError: ['ERROR']

You can retrieve sms messages with the messages() method. It returns a
sequence of message objects.

>>> m.messages()
[<sms.Message object at 0x...>]

Message objects have a couple attributes: number, date, and text.

>>> msgs = m.messages()
>>> msgs[0].number
'+16476186676'

>>> msgs[0].date
datetime.datetime(2008, 7, 11, 11, 2, 11)

>>> msgs[0].text
'Activation code 63966 Go 2 www.ipipi.com and signin with your username and pwd, enter 63966 to activate your mobile/account\n\nWelcome 2 ipipi.com'

After you receive messages you'll want to delete them from the SIM
card. This is done by calling the delete method on the messages.

>>> msgs[0].delete()

Rather than polling the modem to find messages you can call the wait()
method, which blocks until a message is received. The wait method
takes an optional timeout argument.

>>> m.wait(1) # waiting with 1 timeout

>>> m.wait() # waiting with no timeout

The wait message doesn't return anything. You should call the
messages() method after it returns to receive the messages. Note that
it's possible that there may in fact be no messages available after
the wait method returns.

Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Topic :: Communications :: Telephony
13 changes: 13 additions & 0 deletions src/sms.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
README.txt
setup.cfg
setup.py
src/sms/__init__.py
src/sms/echo.py
src/sms/server.py
src/sms/tests.py
src/sms.egg-info/PKG-INFO
src/sms.egg-info/SOURCES.txt
src/sms.egg-info/dependency_links.txt
src/sms.egg-info/not-zip-safe
src/sms.egg-info/requires.txt
src/sms.egg-info/top_level.txt
1 change: 1 addition & 0 deletions src/sms.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions src/sms.egg-info/not-zip-safe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions src/sms.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyserial
setuptools
1 change: 1 addition & 0 deletions src/sms.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sms
Loading

0 comments on commit b8651c4

Please sign in to comment.