faucamp / python-gsmmodem

Python module to control a GSM modem attached to the system: send/receive SMS messages, handle calls, etc
GNU Lesser General Public License v3.0
384 stars 302 forks source link

Arduino, sim900 fixes #67

Open alejandroMA opened 8 years ago

alejandroMA commented 8 years ago

So i´m using a sim900 modem with Arduino as a serial interface. While trying to connect to it, i would always get a timeOutException, turns out that Arduino reboots it-self every time a new serial connection starts so, when the first AT command get send, Arduino isn’t on yet, so it never reaches the sim900 modem, modem doesn’t respond, timeOutException. waiting for 2-3 sec does the trick.

Also i needed a way to set a custom CNMI, since the default one doesn’t work with the sim900 modem.

added "waittingForModemToStartInSeconds" argument to GsmModem.conect(), added AT_CNMI property to GsmModem.

The waittingForModemToStartInSeconds arg allows to wait after the serial connection has started, and before sending the AT commands.

The AT_CNMI proprety of the GsmModem class allow to specify the CNMI parameter of the gsm modem, this helps to set up the incoming sms notifications.

babca commented 8 years ago

@alejandroMA merged here https://github.com/babca/python-gsmmodem

please check it out and do a pull request there if you found any bugs.

alejandroMA commented 7 years ago

hey @babca, so sorry to be so late to respond, i just though this repo was really death. o first thank you so much for merging, ~~how ever i made another simple commit to my fork. it only touches the code i introduced. (sorry for the typo in my commit message). https://github.com/alejandroMA/python-gsmmodem/commit/0010fbdbbdb75533bc6acc4864965a05bc073b48 So i guest i make a pull request to your fork?~~ Sorry you already merged that.

also i think i would be great if your fork could be up in pip as another package (python-gsmmodem-new maybe, or gsmmodem-new).

babca commented 7 years ago

Thanks for suggestions, I tried to add it: https://github.com/babca/python-gsmmodem/issues/5 I hope it is done right, if not, let me know.

babca commented 7 years ago

@alejandroMA Are you able to help me fix broken unit tests? https://github.com/babca/python-gsmmodem/issues/6 :-)

alejandroMA commented 7 years ago

unfortunately this week i'm a little busy, and i have one modem available right now and it on production-ish, so i cant tinker with it or change to the python-gmsmodem-new right now.

but i would love to help, if you have something in mind for next week i can help :). Or i'll do the test new week.

babca commented 7 years ago

I'm putting all my ideas into my Issues tab https://github.com/babca/python-gsmmodem/issues Main three things I'd like to currently see checked and resolved are:

  1. test if it is a working replacement for original v0.9 / if it introduces any new bugs
  2. check unit tests. "Are they outdated or there are bug in the code?" https://github.com/babca/python-gsmmodem/issues/6
  3. replace serial.Serial() with serial.serial_for_url() in serial_comms.py for a native remote modem support. https://github.com/babca/python-gsmmodem/issues/2