Ringbeller IoT - Cellular library Python bindings
Project description
Ringbeller IoT Python API
1. Solution
The package builds a Python wrapper around the C++ Modem Library. The native C++ library is built with make to produce a shared library (.so) The shared library is loaded in Python with ctypes.
2. Sources
The original C++ Modem Library is copied in ringbellerpythonapi/src/modem. Main package file ringbellerpythonapi.py exports all functions supported by the C++ Modem Library.
3. Prerequisite: WiringPi
The WiringPi library is required by the C++ Modem Library for low-level hardware communication. To install the library:
- Go to https://github.com/WiringPi/WiringPi
- Download ZIP archive
- Unzip archive: unzip WiringPi-final_official_2.50.zip
- Compile and install library: cd WiringPi-final_official_2.50 ./build
4. Build C++ Modem Shared Library
cd ringbellerpythonapi cd src make
5. Testing
Test scripts are placed in folder /tests The following script attempts to turn ON and OFF the modem (debugging logs enabled):
cd tests python3 testpower.py
where: = 1 for SIMULATED mode or = 0 for HARDWARE mode (e.g. 1)
6. API Functions
initialize(verbose, debug, serial_port, audio_device): Initialize modem. on(): Turn on the modem off(): Turn off the modem restart(): Restart the modem connect(): Connect to modem disconnect(): Disconnect from modem configure(): Configure modem send_sms(number, message): Send SMS message receive_sms(): Receive SMS message place_voice_call(number): Place call receive_voice_call(): Receive call get_call_status(): Get call status end_call(): Hang up active voice call begin_audio_playback(playback_file): Begin playing audio to voice call wait_for_audio_playback(): Wait for voice-call audio-playback to end end_audio_playback(): End playing audio to voice call begin_audio_recording(record_file): Begin recording audio from voice call end_audio_recording(): End recording audio from voice call send_mms(recipient, cc, bcc, title, attachment, protocol, apn, username, password, authentication, mmsc, proxy, port): Send MMS message get_keypad_input(length, audio_file): Get keypad input (IVR)
7. Logging
The logging options are provided when calling the "initialize" API function. The package supports following logging options:
- verbose: log level from 0 to 4 0 - no logging 1 - errors displayed 2 - info and errors displayed 3 - info, errors and warnings displayed 4 - all messages displayed (info, errors, warnings and debug messages)
- debug: specify 1 to enable debug simulation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ringbellerpythonapi-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45505decb74085741f57e4f0ebdcfa9406d46c9a2f0f59fae67854d3d90dfe33 |
|
MD5 | 0e9bde1df84119ff686d44965080fdbe |
|
BLAKE2b-256 | 4d18e669d627f9214ffd2047314139f48e72a2f9764916a6b1ba2a69385ea2ff |
Hashes for ringbellerpythonapi-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6fc1fdbd2fd1b36a0d89920b0d77d99c131cde979840b24d6acdb22598592ea |
|
MD5 | 12ba4db20c3eefc1c71c3543e9c7f895 |
|
BLAKE2b-256 | 84d15f1a47f5b835aead1c66908edb6091c7f87f57bc60ee41dcd2dd0e661b50 |