wasm-demo/demo/ermis-f/python_m/cur/1726

75 lines
2.7 KiB
Plaintext

From: pete-python at kazmier.com (Peter Kazmier)
Date: 19 May 1999 23:36:44 GMT
Subject: Python/beeper connectivity
References: <Pine.GSO.3.95q.990519123238.6983A-100000@rac7.wam.umd.edu> <y0jzp30lo8d.fsf@vier.idi.ntnu.no>
Message-ID: <slrn7k6iob.2vl.pete-python@view.kazmier.com>
Content-Length: 2433
X-UID: 1726
On 19 May 1999 23:54:26 +0200, Magnus L. Hetland <mlh at idt.ntnu.no> wrote:
>Sarino Suon <pioneer at wam.umd.edu> writes:
>
>> Hi there:
>>
>> In one of the Python books, the author refers to an anecdote in ANOTHER
>> Python book about a guy who created a Python program to beep him whenever
>> an exception occurred. I thought that was neat when I first read about it.
>> Has anyone done anything like this? I would like to explore using my
>> computer to talk to household appliances and other electronic
>> devices, which I assume are especially designed to interface with a PC.
>>
>> Since I now trust Python to take over my computer, I wouldn't mind letting
>> it run my house. :-)
>>
>> Is anyone into this sort of thing? Would love to hear from you.
>
>Well... there are services where you can send mail to your cellphone
>etc. This could easily be done by a Python program. There might be a
>way to do something timilar with a beeper too, although I don't know
>much about that... :)
As far as the pager goes, I've written a small generic Pager class
with a few sub-classes that are designed to send pages to different
types of pagers. You can find it at:
http://www.kazmier.com/computer/#python
Please keep in mind, I just started learning Python about a week ago,
and this is my first attempt at a class so be gentle (suggestions are
definitely welcome). I haven't even gotten to the chapter on Classes
yet in the Learning Python book (which btw is a great book).
The sub-classes defined so far are:
SkyWordPager Supports SkyTel SkyWord pager customers
SkyWordPlusPager Supports SkyTel SkyWordPlus pager customers
ATTPager Supports ATT Digital One Rate Cell Phone pagers
MailPager Supports any email based pager
Here's an example of use:
p = SkyWordPager()
p.addr = 1234567 # Not my pin for obvious reasons
p.mesg = "This is a test"
p.send()
or simply:
SkyWordPager(1031080, "This is a test").send()
The base Pager class must be sub-classed. Its supposed to provide
some general functions like the send() function which checks the
maximum message length for the given pager sub-class (each one is
different), and then breaks the mesg into multiple pages if
neccessary. The doc string has more info on extending the class.
--
Peter Kazmier http://www.kazmier.com
PGP Fingerprint 4FE7 8DA3 D0B5 9CAA 69DC 7243 1855 BC2E 4B43 5654