jff-bohdan / sim-module Goto Github PK
View Code? Open in Web Editor NEWPython 3 classes for SIM 900 GSM module
License: MIT License
Python 3 classes for SIM 900 GSM module
License: MIT License
$: python test_basic_class.py
Traceback (most recent call last):
File "test_basic_class.py", line 3, in
from test_shared import *
File "/root/istp_prototype/sim-module/test_shared.py", line 4, in
from lib.sim900.gsm import SimGsm, SimGsmPinRequestState
File "/root/istp_prototype/sim-module/lib/sim900/gsm.py", line 114
def print(self, commandString, encoding = "ascii"):
^
SyntaxError: invalid syntax
Why is this error coming?
Is there a specific reason to return twice the amount of time (return secs*1000 + msecs)?
def timeDelta(timeBegin):
end = time.time()
secs = end - timeBegin
msecs = (end - timeBegin) * 1000.0
return secs*1000 + msecs
Would be nice to be able to pip install
this library.
hello when i lunch the script e say this :
[2016-07-14 16:11:01,374] INFO: opening port
[2016-07-14 16:11:01,376] ERROR: exception till port openning: could not open port com22: [Errno 2] No such file or directory: 'com22'
[2016-07-14 16:11:01,377] ERROR: error opening port: exception till port openning: could not open port com22: [Errno 2] No such file or directory: 'com22'
DONE
Hello,
I have problem with install on Raspbeerry Pi:
root@raspberrypi:~# pip install https://github.com/JFF-Bohdan/sim-module/archive/master.zip
Downloading/unpacking https://github.com/JFF-Bohdan/sim-module/archive/master.zip
Downloading master.zip
Running setup.py egg_info for package from https://github.com/JFF-Bohdan/sim-module/archive/master.zip
Traceback (most recent call last):
File "", line 14, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-fQkan7-build/setup.py'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 14, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-fQkan7-build/setup.py'
Command python setup.py egg_info failed with error code 1 in /tmp/pip-fQkan7-build
Storing complete log in /root/.pip/pip.log
Please tell me how install this library correctly ?
Thank you and Best regards
Hi
Every class i try to use it keeps kicking out this "ERROR: error initializing session:"
Using Raspberry pi 3 and very confused. Can you help me out?
Did you write some documentation of this module?
I want to use this in my project, but I have no idea how to use this.
Thanks
Hi,
I have problem after first boot or reboot rasperry, log:
root@raspberrypi:/sim-module# ./test_imei_retrieving.py/sim-module# ./test_imei_retrieving.py
[2015-08-24 02:04:06,054] INFO: opening port
[2015-08-24 02:04:06,059] INFO: initializing SIM900 session
[2015-08-24 02:04:06,236] ERROR: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
[2015-08-24 02:04:06,452] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
[2015-08-24 02:04:06,667] ERROR: 'ascii' codec can't decode byte 0x98 in position 0: ordinal not in range(128)
[2015-08-24 02:04:06,882] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
[2015-08-24 02:04:07,097] ERROR: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128)
[2015-08-24 02:04:07,300] ERROR: error initializing session: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128)
DONE
root@raspberrypi:
[2015-08-24 02:04:10,274] INFO: opening port
[2015-08-24 02:04:10,278] INFO: initializing SIM900 session
[2015-08-24 02:04:10,531] INFO: Disabling echo, calling 'ATE0'
[2015-08-24 02:04:11,365] INFO: retrieving IMEI
[2015-08-24 02:04:11,454] INFO: IMEI = xxxxxxxxxxxxxxxx
DONE
root@raspberrypi:~/sim-module# ./test_imei_retrieving.py
[2015-08-24 02:04:16,471] INFO: opening port
[2015-08-24 02:04:16,475] INFO: initializing SIM900 session
[2015-08-24 02:04:16,937] INFO: retrieving IMEI
[2015-08-24 02:04:17,006] INFO: IMEI = xxxxxxxxxxxxxxxx
DONE
[now still all right]
Second reboot, log:
root@raspberrypi:/sim-module# ./test_imei_retrieving.py/sim-module# ./test_imei_retrieving.py
[2015-08-24 01:57:32,008] INFO: opening port
[2015-08-24 01:57:32,013] INFO: initializing SIM900 session
[2015-08-24 01:57:32,195] ERROR: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)
[2015-08-24 01:57:32,411] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
[2015-08-24 01:57:32,626] ERROR: 'ascii' codec can't decode byte 0x98 in position 0: ordinal not in range(128)
[2015-08-24 01:57:32,842] ERROR: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
[2015-08-24 01:57:33,057] ERROR: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128)
[2015-08-24 01:57:33,261] ERROR: error initializing session: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128)
DONE
root@raspberrypi:
[2015-08-24 01:57:48,549] INFO: opening port
[2015-08-24 01:57:48,554] INFO: initializing SIM900 session
[2015-08-24 01:57:48,751] INFO: Disabling echo, calling 'ATE0'
[2015-08-24 01:57:49,422] ERROR: Wrong response for PIN state request
[2015-08-24 01:57:49,425] ERROR: error initializing session: Wrong response for PIN state request
DONE
root@raspberrypi:~/sim-module# ./test_imei_retrieving.py
[2015-08-24 01:57:56,339] INFO: opening port
[2015-08-24 01:57:56,343] INFO: initializing SIM900 session
[2015-08-24 01:57:56,810] INFO: retrieving IMEI
[2015-08-24 01:57:56,882] INFO: IMEI = xxxxxxxxxxxxxxxx
DONE
[now still all right]
Configuration:
Raspberry Pi A version with SIM900 GSM/GPRS Add-On v1.0,
/boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
/etc/inittab
Thank you and best regards.
I have a mobile subscription with slow data rate (cheap and enough for the task at hand)
Otherwise worked well but I had to do a bit of tinkering with the library because of some timeout issues.
gsm.py
__sendRawBytes timed out. I had to increase the maxWaitTime in __sendRawBytes since write functions don't have time out parametes. Only read functions have time out parameters. Sorry I can't remember exactly why it timed out...
Also added a delay to while loop in __sendRawBytes every 500 bytes to keep send buffer from filling up.
I also made slower functions for data transfer related functions to increase timeout time and ease load on raspberry by not constantly checking read buffer.
readLnSlow()
readDataLineSlow()
These are with timout * 10 and a 0.5 sec delay before checking serial input
inetgsm.py
bug
def __parseHttpResult(self, httpResult, bearerChannel = None):
...
if response[0] != str(bearerChannel):
I don't think the first parameter after +HTTPACTION: is bearerChannel.
SIM900_AT commands manual_V1.11 page 225.
It works only if you happen to have the right bearerChannel.
httpPOST() had the worst timeout problems for me.
After sending data the OK takes a while to come back.
Worst was after sending POST data and AT+HTTPACTION=1. The HTTP request result takes an even longer while to come back.
I had to change
dataLine = self.readDataLine(15000)
to 25000 timeout and also used my readDataLineSlow() with even more delay built in.
But like I said otherwise worked well. Good job and thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.