Skip to main content

Python lib for AT GSM commands

Project description

AT-GSM

Python lib for AT GSM commands

Install

pip install atgsm

Usage

from atgsm import AT

AT.get_ports_list()
# Ex result: ['/dev/ttyXX1', '/dev/ttyXX2']

# Create new device instance
device = AT('/dev/ttyACM0', baudrate=115200)


############################
# Device related functions #
############################

device.is_responding()
# return boolean (ex: True)

device.get_imei()
# return device IMEI (ex: '000000000000001')

device.get_imsi()
# return SIM IMSI (ex: '000000000000001')

device.get_iccid()
# return SIM ICCID (ex: '00000000000000000001')

device.get_signal_strength()
# return signal strength from 0 to 31 (ex: 12')

device.is_network_ready()
# return boolean (ex: True)


#########################
# SIM related functions #
#########################

device.is_sim_locked()
# return boolean (ex: True)

device.unlock_sim(pin)
# return boolean of success (ex: True)

device.change_sim_pin(actual_pin, new_pin)
# return boolean of success (ex: True)

device.disable_sim_pin(pin)
# return boolean of success (ex: True)

device.enable_sim_pin(pin)
# return boolean of success (ex: True)

device.reset_sim_pin(puk, new_pin)
# return boolean of success (ex: True)


#########################
# SMS related functions #
#########################

device.send_sms(phone_number, content)
# - phone_number = string (destination phone number)
# - content = string (sms content)
# return nothing

device.get_sms_list(include_read, keep_unread)
# - include_read = boolean (include already read messages only if True)
# - keep_unread = boolean (keep messages unread only if True)
# return list of messages dicts, ex :
# [{'index': '1', 'status': 'REC READ', 'readed': True, 'sender': '+33XXXXXXXXX', 'time': '2023/XX/XX XX:XX:XX+XX', 'content': 'This is text'}]

device.get_sms(message_index, keep_unread)
# - message_index = int (index of specific message to get)
# - keep_unread = boolean (keep messages unread only if True)
# return requested message as dict
# {'index': '1', 'status': 'REC READ', 'readed': True, 'sender': '+33XXXXXXXXX', 'time': '2023/XX/XX XX:XX:XX+XX', 'content': 'This is text'}

device.delete_sms(message_index)
# - message_index = int (index of specific message to delete)
# return boolean of success (ex: True)

device.delete_all_sms(include_unread)
# - include_read = boolean (delete also unread messages if True)
# return boolean of success (ex: True)


##############################
# Contacts related functions #
##############################

device.get_contact(contact_id)
# - contact_id = int (id of specific contact to get)
# return requested contact as dict
# {'id': 1, 'name': 'My phone number', 'number': '+33XXXXXXXXX'}

device.set_contact(contact_id, contact_name, contact_phone_number)
# - contact_id = int (id of specific contact to create)
# - contact_name = string (name of contact to create)
# - contact_phone_number = string (phone number of contact to create)
# return boolean of success (ex: True)


###########################
# Calls related functions #
###########################

device.dial(phone_number)
# - phone_number = string (phone number to dial)
# return boolean of success (ex: True)

device.answer()
# (answer to incomming call)
# return boolean of success (ex: True)

device.hang_up()
# (hang up actual call)
# return boolean of success (ex: True)

device.press_key(key)
# - key = string (key to press on keypad during call)
# return boolean of success (ex: True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atgsm-0.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

atgsm-0.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file atgsm-0.3.tar.gz.

File metadata

  • Download URL: atgsm-0.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for atgsm-0.3.tar.gz
Algorithm Hash digest
SHA256 5f6025a4b82c944cfc33c750e0e4a658601383a45746c97bdd42737cef979c45
MD5 07c95961133c2efbd2b22c6538ad4f39
BLAKE2b-256 a9376c22b93c9eb94a70d8f1c7b8279e32376b487aec2a8a5d3ad29080d5c0c0

See more details on using hashes here.

File details

Details for the file atgsm-0.3-py3-none-any.whl.

File metadata

  • Download URL: atgsm-0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for atgsm-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3811ad5d213766ac5024752ee71f4503383a3d91bfa69e6ca9d7f3a9edb5aff5
MD5 5f5708e18e033d36129aad8a0e830d81
BLAKE2b-256 c9624162982903db040146ba650443af4244d0a1391967f73fdd1073de7c6a77

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page