summaryrefslogtreecommitdiff
path: root/docs/manual/python/index.rst
blob: 1c326165719e16b7a61fb9ed0f5c2d264ab061b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.. _python:

python-gammu API
================

A taste of python-gammu
-----------------------

Python-gammu allows you to easily access the phone. Following code will connect
to phone based on your Gammu configuration (usually stored in
:file:`~/.gammurc`) and gets network information from it::

    import gammu
    import sys

    # Create state machine object
    sm = gammu.StateMachine()

    # Read ~/.gammurc
    sm.ReadConfig()

    # Connect to phone
    sm.Init()

    # Reads network information from phone
    netinfo = sm.GetNetworkInfo()

    # Print information
    print 'Network name: %s' % netinfo['NetworkName']
    print 'Network code: %s' % netinfo['NetworkCode']
    print 'LAC: %s' % netinfo['LAC']
    print 'CID: %s' % netinfo['CID']

.. toctree::
    :maxdepth: 3

    examples

API documentation
-----------------

.. toctree::
    :maxdepth: 3

    gammu
    smsd
    data
    worker
    exceptions
    objects