1:mod:`gammu` -- Mobile phone access 2=================================== 3 4.. module:: gammu 5 :synopsis: Provides access to mobile phones. 6 7This module wraps all python-gammu functionality. 8 9:class:`gammu.StateMachine` 10--------------------------- 11 12.. class:: StateMachine(Locale) 13 14 StateMachine object, that is used for communication with phone. 15 16 :param Locale: What locales to use for gammu error messages, default is ``auto`` which does autodetection according to user locales 17 :type Locale: str 18 19 20 .. method:: AddCalendar(Value) 21 22 Adds calendar entry. 23 24 :param Value: Calendar entry data, see :ref:`cal_obj` 25 :type Value: dict 26 :return: Location of newly created entry 27 :rtype: int 28 29 30 .. method:: AddCategory(Type, Name) 31 32 Adds category to phone. 33 34 :param Type: Type of category to read, one of ``ToDo``, ``Phonebook`` 35 :type Type: str 36 :param Name: Category name 37 :type Name: str 38 :return: Location of created category 39 :rtype: int 40 41 42 .. method:: AddFilePart(File) 43 44 Adds file part to filesystem. 45 46 :param File: File data, see :ref:`file_obj` 47 :type File: dict 48 :return: File data for subsequent calls (Finished indicates transfer has been completed) 49 :rtype: dict 50 51 52 .. method:: AddFolder(ParentFolderID, Name) 53 54 Adds folder to filesystem. 55 56 :param ParentFolderID: Folder where to create subfolder 57 :type ParentFolderID: str 58 :param Name: New folder name 59 :type Name: str 60 :return: New folder ID. 61 :rtype: str 62 63 64 .. method:: AddMemory(Value) 65 66 Adds memory (phonebooks or calls) entry. 67 68 :param Value: Memory entry, see :ref:`pbk_obj` 69 :type Value: dict 70 :return: Location of created entry 71 :rtype: int 72 73 74 .. method:: AddSMS(Value) 75 76 Adds SMS to specified folder. 77 78 :param Value: SMS data, see :ref:`sms_obj` 79 :type Value: dict 80 :return: Tuple for location and folder. 81 :rtype: tuple 82 83 84 .. method:: AddSMSFolder(Name) 85 86 Creates SMS folder. 87 88 :param Name: Name of new folder 89 :type Name: str 90 :return: None 91 :rtype: None 92 93 94 .. method:: AddToDo(Value) 95 96 Adds ToDo in phone. 97 98 :param Value: ToDo data, see :ref:`todo_obj` 99 :type Value: dict 100 :return: Location of created entry 101 :rtype: int 102 103 104 .. method:: AnswerCall(ID, All) 105 106 Accept current incoming call. 107 108 :param ID: ID of call 109 :type ID: int 110 :param All: Answer all calls? Defaults to True 111 :type All: bool 112 :return: None 113 :rtype: None 114 115 .. method:: CancelAllDiverts() 116 117 .. versionadded:: 1.31.90 118 119 Cancels all call diverts. 120 121 :return: None 122 :rtype: None 123 124 125 .. method:: CancelCall(ID, All) 126 127 Deny current incoming call. 128 129 :param ID: ID of call 130 :type ID: int 131 :param All: Cancel all calls? Defaults to True 132 :type All: bool 133 :return: None 134 :rtype: None 135 136 137 .. method:: ConferenceCall(ID) 138 139 Initiates conference call. 140 141 :param ID: ID of call 142 :type ID: int 143 :return: None 144 :rtype: None 145 146 147 .. method:: DeleteAllCalendar() 148 149 Deletes all calendar entries. 150 151 :return: None 152 :rtype: None 153 154 155 .. method:: DeleteAllMemory(Type) 156 157 Deletes all memory (phonebooks or calls) entries of specified type. 158 159 :param Type: Memory type, one of ``ME``, ``SM``, ``ON``, ``DC``, ``RC``, ``MC``, ``MT``, ``FD``, ``VM`` 160 :type Type: str 161 :return: None 162 :rtype: None 163 164 165 .. method:: DeleteAllToDo() 166 167 Deletes all todo entries in phone. 168 169 :return: None 170 :rtype: None 171 172 173 .. method:: DeleteCalendar(Location) 174 175 Deletes calendar entry. 176 177 :param Location: Calendar entry to delete 178 :type Location: int 179 :return: None 180 :rtype: None 181 182 183 .. method:: DeleteFile(FileID) 184 185 Deletes file from filesystem. 186 187 :param FileID: File to delete 188 :type FileID: str 189 :return: None 190 :rtype: None 191 192 193 .. method:: DeleteFolder(FolderID) 194 195 Deletes folder on filesystem. 196 197 :param FolderID: Folder to delete 198 :type FolderID: str 199 :return: None 200 :rtype: None 201 202 203 .. method:: DeleteMemory(Type, Location) 204 205 Deletes memory (phonebooks or calls) entry. 206 207 :param Type: Memory type, one of ``ME``, ``SM``, ``ON``, ``DC``, ``RC``, ``MC``, ``MT``, ``FD``, ``VM`` 208 :type Type: str 209 :param Location: Location of entry to delete 210 :type Location: int 211 :return: None 212 :rtype: None 213 214 215 .. method:: DeleteSMS(Folder, Location) 216 217 Deletes SMS. 218 219 :param Folder: Folder where to read entry (0 is emulated flat memory) 220 :type Folder: int 221 :param Location: Location of entry to delete 222 :type Location: int 223 :return: None 224 :rtype: None 225 226 .. note:: 227 228 In most cases you want to use Folder=0 as in this mode it will accept locations 229 as GetNextSMS returns them. 230 231 232 .. method:: DeleteSMSFolder(ID) 233 234 Deletes SMS folder. 235 236 :param ID: Index of folder to delete 237 :type ID: int 238 :return: None 239 :rtype: None 240 241 242 .. method:: DeleteToDo(Location) 243 244 Deletes ToDo entry in phone. 245 246 :param Location: Location of entry to delete 247 :type Location: int 248 :return: None 249 :rtype: None 250 251 252 .. method:: DialService(Number) 253 254 Dials number and starts voice call. 255 256 :param Number: Number to dial 257 :type Number: str 258 :return: None 259 :rtype: None 260 261 262 .. method:: DialVoice(Number, ShowNumber) 263 264 Dials number and starts voice call. 265 266 :param Number: Number to dial 267 :type Number: str 268 :param ShowNumber: Identifies whether to enable CLIR (None = keep default phone settings). Default is None 269 :type ShowNumber: bool or None 270 :return: None 271 :rtype: None 272 273 274 .. method:: EnterSecurityCode(Type, Code, NewPIN) 275 276 Enters security code. 277 278 :param Type: What code to enter, one of ``PIN``, ``PUK``, ``PIN2``, ``PUK2``, ``Phone``. 279 :type Type: str 280 :param Code: Code value 281 :type Code: str 282 :param NewPIN: New PIN value in case entering PUK 283 :type NewPIN: str 284 :return: None 285 :rtype: None 286 287 288 .. method:: GetAlarm(Location) 289 290 Reads alarm set in phone. 291 292 :param Location: Which alarm to read. Many phone support only one alarm. Default is 1. 293 :type Location: int 294 :return: Alarm dict 295 :rtype: dict 296 297 298 .. method:: GetBatteryCharge() 299 300 Gets information about battery charge and phone charging state. 301 302 :return: Dictionary containing information about battery state (BatteryPercent and ChargeState) 303 :rtype: dict 304 305 306 .. method:: GetCalendar(Location) 307 308 Retrieves calendar entry. 309 310 :param Location: Calendar entry to read 311 :type Location: int 312 :return: Dictionary with calendar values, see :ref:`cal_obj` 313 :rtype: dict 314 315 316 .. method:: GetCalendarStatus() 317 318 Retrieves calendar status (number of used entries). 319 320 :return: Dictionary with calendar status (Used) 321 :rtype: dict 322 323 324 .. method:: GetCallDivert(Divert = 'AllTypes', Type = 'All') 325 326 .. versionadded:: 1.31.90 327 328 Gets call diverts. 329 330 :param Divert: When to do the divert. 331 :type Divert: :ref:`divert-type` 332 :param Type: What call types to divert. 333 :type Type: :ref:`divert-call` 334 :return: List of call diverts. 335 :rtype: :ref:`divert-entry` 336 337 .. method:: GetCategory(Type, Location) 338 339 Reads category from phone. 340 341 :param Type: Type of category to read, one of ``ToDo``, ``Phonebook`` 342 :type Type: str 343 :param Location: Location of category to read 344 :type Location: int 345 :return: Category name as str 346 :rtype: str 347 348 349 .. method:: GetCategoryStatus(Type) 350 351 Reads category status (number of used entries) from phone. 352 353 :param Type: Type of category to read, one of ``ToDo``, ``Phonebook`` 354 :type Type: str 355 :return: Dictionary containing information about category status (Used) 356 :rtype: dict 357 358 359 .. method:: GetConfig(Section) 360 361 Gets specified config section. Configuration consists of all params which can be defined in gammurc config file: 362 - Model 363 - DebugLevel 364 - Device 365 - Connection 366 - SyncTime 367 - LockDevice 368 - DebugFile 369 - StartInfo 370 - UseGlobalDebugFile 371 372 :param Section: Index of config section to read. Defaults to 0. 373 :type Section: int 374 :return: Dictionary containing configuration 375 :rtype: dict 376 377 378 .. method:: GetDateTime() 379 380 Reads date and time from phone. 381 382 :return: Date and time from phone as datetime.datetime object. 383 :rtype: datetime.datetime 384 385 386 .. method:: GetDisplayStatus() 387 388 Acquired display status. 389 :return: List of indicators displayed on display 390 :rtype: list 391 392 393 .. method:: GetFilePart(File) 394 395 Gets file part from filesystem. 396 397 :param File: File data, see :ref:`file_obj` 398 :type File: dict 399 :return: File data for subsequent calls (Finished indicates transfer has been completed), see :ref:`file_obj` 400 :rtype: dict 401 402 403 .. method:: GetFileSystemStatus() 404 405 Acquires filesystem status. 406 407 :return: Dictionary containing filesystem status (Used and Free) 408 :rtype: dict 409 410 411 .. method:: GetFirmware() 412 413 Reads firmware information from phone. 414 415 :return: Tuple from version, date and numeric version. 416 :rtype: tuple 417 418 419 .. method:: GetFolderListing(Folder, Start) 420 421 Gets next filename from filesystem folder. 422 423 :param Folder: Folder to list 424 :type Folder: str 425 :param Start: Whether we're starting listing. Defaults to False. 426 :type Start: bool 427 :return: File data as dict, see :ref:`file_obj` 428 :rtype: dict 429 430 431 .. method:: GetHardware() 432 433 Gets hardware information about device. 434 435 :return: Hardware information as str. 436 :rtype: str 437 438 439 .. method:: GetIMEI() 440 441 Reads IMEI/serial number from phone. 442 443 :return: IMEI of phone as str. 444 :rtype: str 445 446 447 .. method:: GetLocale() 448 449 Gets locale information from phone. 450 451 :return: Dictionary of locale settings. :meth:`SetLocale` lists them all. 452 :rtype: dict 453 454 455 .. method:: GetManufactureMonth() 456 457 Gets month when device was manufactured. 458 459 :return: Month of manufacture as str. 460 :rtype: str 461 462 463 .. method:: GetManufacturer() 464 465 Reads manufacturer from phone. 466 467 :return: String with manufacturer name 468 :rtype: str 469 470 471 .. method:: GetMemory(Type, Location) 472 473 Reads entry from memory (phonebooks or calls). Which entry should be read is defined in entry. 474 475 :param Type: Memory type, one of ``ME``, ``SM``, ``ON``, ``DC``, ``RC``, ``MC``, ``MT``, ``FD``, ``VM`` 476 :type Type: str 477 :return: Memory entry as dict, see :ref:`pbk_obj` 478 :rtype: dict 479 480 481 .. method:: GetMemoryStatus(Type) 482 483 Gets memory (phonebooks or calls) status (eg. number of used and free entries). 484 485 :param Type: Memory type, one of ``ME``, ``SM``, ``ON``, ``DC``, ``RC``, ``MC``, ``MT``, ``FD``, ``VM`` 486 :type Type: str 487 :return: Dictionary with information about memory (Used and Free) 488 :rtype: dict 489 490 491 .. method:: GetModel() 492 493 Reads model from phone. 494 495 :return: Tuple containing gammu identification and real model returned by phone. 496 :rtype: tuple 497 498 499 .. method:: GetNetworkInfo() 500 501 Gets network information. 502 503 :return: Dictionary with information about network (NetworkName, State, NetworkCode, CID and LAC) 504 :rtype: dict 505 506 507 .. method:: GetNextCalendar(Start, Location) 508 509 Retrieves calendar entry. This is useful for continuous reading of all calendar entries. 510 511 :param Start: Whether to start. This can not be used together with Location 512 :type Start: bool 513 :param Location: Last read location. This can not be used together with Start 514 :type Location: int 515 :return: Dictionary with calendar values, see :ref:`cal_obj` 516 :rtype: dict 517 518 519 .. method:: GetNextFileFolder(Start) 520 521 Gets next filename from filesystem. 522 523 :param Start: Whether we're starting listing. Defaults to False. 524 :type Start: bool 525 :return: File data as dict, see :ref:`file_obj` 526 :rtype: dict 527 528 529 .. method:: GetNextMemory(Type, Start, Location) 530 531 Reads entry from memory (phonebooks or calls). Which entry should be read is defined in entry. This can be easily used for reading all entries. 532 533 :param Type: Memory type, one of ``ME``, ``SM``, ``ON``, ``DC``, ``RC``, ``MC``, ``MT``, ``FD``, ``VM`` 534 :type Type: str 535 :param Start: Whether to start. This can not be used together with Location 536 :type Start: bool 537 :param Location: Last read location. This can not be used together with Start 538 :type Location: int 539 :return: Memory entry as dict, see :ref:`pbk_obj` 540 :rtype: dict 541 542 543 .. method:: GetNextRootFolder(Folder) 544 545 Gets next root folder from filesystem. Start with empty folder name. 546 547 :param Folder: Previous read folder. Start with empty folder name. 548 :type Folder: str 549 :return: Structure with folder information 550 551 552 .. method:: GetNextSMS(Folder, Start, Location) 553 554 Reads next (or first if start set) SMS message. This might be faster for some phones than using :meth:`GetSMS` for each message. 555 556 :param Folder: Folder where to read entry (0 is emulated flat memory) 557 :type Folder: int 558 :param Start: Whether to start. This can not be used together with Location 559 :type Start: bool 560 :param Location: Location last read entry. This can not be used together with Start 561 :type Location: int 562 :return: Dictionary with SMS data, see :ref:`sms_obj` 563 :rtype: dict 564 565 566 .. method:: GetNextToDo(Start, Location) 567 568 Reads ToDo from phone. 569 570 :param Start: Whether to start. This can not be used together with Location 571 :type Start: bool 572 :param Location: Last read location. This can not be used together with Start 573 :type Location: int 574 :return: Dictionary with ToDo values, see :ref:`todo_obj` 575 :rtype: dict 576 577 578 .. method:: GetOriginalIMEI() 579 580 Gets original IMEI from phone. 581 582 :return: Original IMEI of phone as string. 583 :rtype: str 584 585 586 .. method:: GetPPM() 587 588 Gets PPM (Post Programmable Memory) from phone. 589 590 :return: PPM as string 591 :rtype: str 592 593 594 .. method:: GetProductCode() 595 596 Gets product code of device. 597 :return: Product code as string. 598 :rtype: str 599 600 601 .. method:: GetSIMIMSI() 602 603 Gets SIM IMSI from phone. 604 605 :return: SIM IMSI as string 606 :rtype: str 607 608 609 .. method:: GetSMS(Folder, Location) 610 611 Reads SMS message. 612 613 :param Folder: Folder where to read entry (0 is emulated flat memory) 614 :type Folder: int 615 :param Location: Location of entry to read 616 :type Location: int 617 :return: Dictionary with SMS data, see :ref:`sms_obj` 618 :rtype: dict 619 620 621 .. method:: GetSMSC(Location) 622 623 Gets SMS Service Center number and SMS settings. 624 625 :param Location: Location of entry to read. Defaults to 1 626 :type Location: int 627 :return: Dictionary with SMSC information, see :ref:`smsc_obj` 628 :rtype: dict 629 630 631 .. method:: GetSMSFolders() 632 633 Returns SMS folders information. 634 635 :return: List of SMS folders. 636 :rtype: list 637 638 639 .. method:: GetSMSStatus() 640 641 Gets information about SMS memory (read/unread/size of memory for both SIM and phone). 642 643 :return: Dictionary with information about phone memory (SIMUnRead, SIMUsed, SIMSize, PhoneUnRead, PhoneUsed, PhoneSize and TemplatesUsed) 644 :rtype: dict 645 646 647 .. method:: GetSecurityStatus() 648 649 Queries whether some security code needs to be entered. 650 651 :return: String indicating which code needs to be entered or None if none is needed 652 :rtype: str 653 654 655 .. method:: GetSignalQuality() 656 657 Reads signal quality (strength and error rate). 658 659 :return: Dictionary containing information about signal state (SignalStrength, SignalPercent and BitErrorRate) 660 :rtype: dict 661 662 663 .. method:: GetSpeedDial(Location) 664 665 Gets speed dial. 666 667 :param Location: Location of entry to read 668 :type Location: int 669 :return: Dictionary with speed dial (Location, MemoryLocation, MemoryNumberID, MemoryType) 670 :rtype: dict 671 672 673 .. method:: GetToDo(Location) 674 675 Reads ToDo from phone. 676 677 :param Location: Location of entry to read 678 :type Location: int 679 :return: Dictionary with ToDo values, see :ref:`todo_obj` 680 :rtype: dict 681 682 683 .. method:: GetToDoStatus() 684 685 Gets status of ToDos (count of used entries). 686 687 :return: Dictionary of status (Used) 688 :rtype: dict 689 690 691 .. method:: HoldCall(ID) 692 693 Holds call. 694 695 :param ID: ID of call 696 :type ID: int 697 :return: None 698 :rtype: None 699 700 701 .. method:: Init(Replies) 702 703 Initialises the connection with phone. 704 705 :param Replies: Number of replies to wait for on each request. Defaults to 1. Higher value makes sense only on unreliable links. 706 :type Replies: int 707 :return: None 708 :rtype: None 709 710 711 .. method:: PressKey(Key, Press) 712 713 Emulates key press. 714 715 :param Key: What key to press 716 :type Key: str 717 :param Press: Whether to emulate press or release. 718 :type Press: bool 719 :return: None 720 :rtype: None 721 722 723 .. method:: ReadConfig(Section, Configuration, Filename) 724 725 Reads specified section of gammurc 726 727 :param Section: Index of config section to read. Defaults to 0. 728 :type Section: int 729 :param Configuration: Index where config section will be stored. Defaults to Section. 730 :type Configuration: int 731 :param Filename: Path to configuration file (otherwise it is autodetected). 732 :type Filename: str 733 :return: None 734 :rtype: None 735 736 737 .. method:: ReadDevice(Wait) 738 739 Reads data from device. This should be used in busy wait loop in case you 740 are waiting for incoming events on the device. 741 742 :param Wait: Whether to wait, default is not to wait. 743 :type Wait: bool 744 :return: Number of bytes read 745 :rtype: int 746 747 748 .. method:: Reset(Hard) 749 750 Performs phone reset. 751 752 :param Hard: Whether to make hard reset 753 :type Hard: bool 754 :return: None 755 :rtype: None 756 757 758 .. method:: ResetPhoneSettings(Type) 759 760 Resets phone settings. 761 762 :param Type: What to reset, one of ``PHONE``, ``UIF``, ``ALL``, ``DEV``, ``FACTORY`` 763 :type Type: str 764 :return: None 765 :rtype: None 766 767 768 .. method:: SendDTMF(Number) 769 770 Sends DTMF (Dual Tone Multi Frequency) tone. 771 772 :param Number: Number to dial 773 :type Number: str 774 :return: None 775 :rtype: None 776 777 778 .. method:: SendFilePart(File) 779 780 Sends file part to phone. 781 782 :param File: File data, see :ref:`file_obj` 783 :type File: dict 784 :return: File data for subsequent calls (Finished indicates transfer has been completed), see :ref:`file_obj` 785 :rtype: dict 786 787 788 .. method:: SendSMS(Value) 789 790 Sends SMS. 791 792 :param Value: SMS data, see :ref:`sms_obj` 793 :type Value: dict 794 :return: Message reference as int 795 :rtype: int 796 797 798 .. method:: SendSavedSMS(Folder, Location) 799 800 Sends SMS saved in phone. 801 802 :param Folder: Folder where to read entry (0 is emulated flat memory) 803 :type Folder: int 804 :param Location: Location of entry to send 805 :type Location: int 806 :return: Message reference as int 807 :rtype: int 808 809 810 .. method:: SetAlarm(DateTime, Location, Repeating, Text) 811 812 Sets alarm in phone. 813 814 :param DateTime: When should alarm happen. 815 :type DateTime: datetime.datetime 816 :param Location: Location of alarm to set. Defaults to 1. 817 :type Location: int 818 :param Repeating: Whether alarm should be repeating. Defaults to True. 819 :type Repeating: bool 820 :param Text: Text to be displayed on alarm. Defaults to empty. 821 :type Text: str 822 :return: None 823 :rtype: None 824 825 826 .. method:: SetAutoNetworkLogin() 827 828 Enables network auto login. 829 830 :return: None 831 :rtype: None 832 833 834 .. method:: SetCalendar(Value) 835 836 Sets calendar entry 837 838 :param Value: Calendar entry data, see :ref:`cal_obj` 839 :type Value: dict 840 :return: Location of set entry 841 :rtype: int 842 843 844 .. method:: SetConfig(Section, Values) 845 846 Sets specified config section. 847 848 :param Section: Index of config section to modify 849 :type Section: int 850 :param Values: Config values, see :meth:`GetConfig` for description of accepted 851 :type Values: dict 852 :return: None 853 :rtype: None 854 855 .. method:: SetCallDivert(Divert, Type, Number, Timeout=0) 856 857 .. versionadded:: 1.31.90 858 859 Sets call divert. 860 861 :param Divert: When to do the divert. 862 :type Divert: :ref:`divert-type` 863 :param Type: What call types to divert. 864 :type Type: :ref:`divert-call` 865 :param Number: Phone number where to divert. 866 :type Number: str 867 :param Timeout: Optional timeout when divert happens. 868 :type Timeout: int 869 :return: None 870 :rtype: None 871 872 .. method:: SetDateTime(Date) 873 874 Sets date and time in phone. 875 876 :param Date: Date to set 877 :type Date: datetime.datetime 878 :return: None 879 :rtype: None 880 881 882 .. method:: SetDebugFile(File, Global) 883 884 Sets state machine debug file. 885 886 :param File: File where to write debug stuff (as configured by :meth:`SetDebugLevel`). Can be either None for no file, Python file object or filename. 887 :type File: mixed 888 :param Global: Whether to use global debug structure (overrides File) 889 :type Global: bool 890 :return: None 891 :rtype: None 892 893 894 .. method:: SetDebugLevel(Level) 895 896 Sets state machine debug level accorting to passed string. You need to configure output file using :meth:`SetDebugFile` to activate it. 897 898 :type Level: str 899 :param Level: name of debug level to use, currently one of: 900 - nothing 901 - text 902 - textall 903 - binary 904 - errors 905 - textdate 906 - textalldate 907 - errorsdate 908 :return: None 909 :rtype: None 910 911 912 .. method:: SetFileAttributes(Filename, ReadOnly, Protected, System, Hidden) 913 914 Sets file attributes. 915 916 :param Filename: File to modify 917 :type Filename: str 918 :param ReadOnly: Whether file is read only. Default to False. 919 :type ReadOnly: bool 920 :param Protected: Whether file is protected. Default to False. 921 :type Protected: bool 922 :param System: Whether file is system. Default to False. 923 :type System: bool 924 :param Hidden: Whether file is hidden. Default to False. 925 :type Hidden: bool 926 :return: None 927 :rtype: None 928 929 930 .. method:: SetIncomingCB(Enable) 931 932 Gets network information from phone. 933 934 :type Enable: bool 935 :param Enable: Whether to enable notifications, default is True 936 :return: None 937 :rtype: None 938 939 940 .. method:: SetIncomingCall(Enable) 941 942 Activates/deactivates noticing about incoming calls. 943 944 :type Enable: bool 945 :param Enable: Whether to enable notifications, default is True 946 :return: None 947 :rtype: None 948 949 950 .. method:: SetIncomingCallback(Callback) 951 952 Sets callback function which is called whenever any (enabled) incoming event appears. Please note that you have to enable each event type by calling SetIncoming* functions. 953 954 The callback function needs to accept three parameters: StateMachine object, event type and it's data in dictionary. 955 956 :param Callback: callback function or None for disabling 957 :type Callback: function 958 :return: None 959 :rtype: None 960 961 962 .. method:: SetIncomingSMS(Enable) 963 964 Enable/disable notification on incoming SMS. 965 966 :type Enable: bool 967 :param Enable: Whether to enable notifications, default is True 968 :return: None 969 :rtype: None 970 971 972 .. method:: SetIncomingUSSD(Enable) 973 974 Activates/deactivates noticing about incoming USSDs (UnStructured Supplementary Services). 975 976 :type Enable: bool 977 :param Enable: Whether to enable notifications, default is True 978 :return: None 979 :rtype: None 980 981 982 .. method:: SetLocale(DateSeparator, DateFormat, AMPMTime) 983 984 Sets locale of phone. 985 986 :param DateSeparator: Date separator. 987 :type DateSeparator: str 988 :param DateFormat: Date format, one of ``DDMMYYYY``, ``MMDDYYYY``, ``YYYYMMDD`` 989 :type DateFormat: str 990 :param AMPMTime: Whether to use AM/PM time. 991 :type AMPMTime: bool 992 :return: None 993 :rtype: None 994 995 996 .. method:: SetMemory(Value) 997 998 Sets memory (phonebooks or calls) entry. 999 1000 :param Value: Memory entry, see :ref:`pbk_obj` 1001 :type Value: dict 1002 :return: Location of created entry 1003 :rtype: int 1004 1005 1006 .. method:: SetSMS(Value) 1007 1008 Sets SMS. 1009 1010 :param Value: SMS data, see :ref:`sms_obj` 1011 :type Value: dict 1012 :return: Tuple for location and folder. 1013 :rtype: tuple 1014 1015 1016 .. method:: SetSMSC(Value) 1017 1018 Sets SMS Service Center number and SMS settings. 1019 1020 :param Value: SMSC information, see :ref:`smsc_obj` 1021 :type Value: dict 1022 :return: None 1023 :rtype: None 1024 1025 1026 .. method:: SetSpeedDial(Value) 1027 1028 Sets speed dial. 1029 1030 :param Value: Speed dial data, see :meth:`GetSpeedDial` for listing. 1031 :type Value: dict 1032 :return: None 1033 :rtype: None 1034 1035 1036 .. method:: SetToDo(Value) 1037 1038 Sets ToDo in phone. 1039 1040 :param Value: ToDo data, see :ref:`todo_obj` 1041 :type Value: dict 1042 :return: Location of created entry 1043 :rtype: int 1044 1045 1046 .. method:: SplitCall(ID) 1047 1048 Splits call. 1049 1050 :param ID: ID of call 1051 :type ID: int 1052 :return: None 1053 :rtype: None 1054 1055 1056 .. method:: SwitchCall(ID, Next) 1057 1058 Switches call. 1059 1060 :param ID: ID of call 1061 :type ID: int 1062 :return: None 1063 :rtype: None 1064 1065 1066 .. method:: Terminate() 1067 1068 Terminates the connection with phone. 1069 1070 :return: None 1071 :rtype: None 1072 1073 .. method:: Abort() 1074 1075 Aborts current operation. 1076 1077 :return: None 1078 :rtype: None 1079 1080 .. method:: TransferCall(ID, Next) 1081 1082 Transfers call. 1083 1084 :param ID: ID of call 1085 :type ID: int 1086 :return: None 1087 :rtype: None 1088 1089 1090 .. method:: UnholdCall(ID) 1091 1092 Unholds call. 1093 1094 :param ID: ID of call 1095 :type ID: int 1096 :return: None 1097 :rtype: None 1098 1099 1100 1101Generic functions 1102----------------- 1103 1104.. function:: Version() 1105 1106 Get version information. 1107 1108 :return: Tuple of version information - Gammu runtime version, python-gammu version, build time Gammu version. 1109 :rtype: tuple 1110 1111Debugging configuration 1112----------------------- 1113 1114.. function:: SetDebugFile(File) 1115 1116 Sets global debug file. 1117 1118 :param File: File where to write debug stuff (as configured by :meth:`SetDebugLevel`). Can be either None for no file, Python file object or filename. 1119 :type File: mixed 1120 :return: None 1121 :rtype: None 1122 1123.. function:: SetDebugLevel(Level) 1124 1125 Sets global debug level accorting to passed string. You need to configure output file using :meth:`SetDebugFile` to activate it. 1126 1127 :type Level: str 1128 :param Level: name of debug level to use, currently one of: 1129 1130 * nothing 1131 * text 1132 * textall 1133 * binary 1134 * errors 1135 * textdate 1136 * textalldate 1137 * errorsdate 1138 :return: None 1139 :rtype: None 1140 1141Message processing 1142------------------ 1143 1144.. function:: LinkSMS(Messages, EMS) 1145 1146 Links multi part SMS messages. 1147 1148 :type Messages: list 1149 :type EMS: bool 1150 :param Messages: List of messages to link, see :ref:`sms_obj` 1151 :param EMS: Whether to detect ems, defauls to True 1152 :return: List of linked messages, see :ref:`sms_obj` 1153 :rtype: list 1154 1155.. function:: SMSCounter(Text, UDH = "NoUDH", Coding = "Default") 1156 1157 Calculates number of SMS and free chars in SMS. 1158 1159 :type Text: str 1160 :param Text: Message text 1161 :type UDH: str 1162 :param UDH: Message UDH 1163 :type Coding: str 1164 :param Coding: Message coding (eg. Unicode or Default) 1165 :return: Number of messages and number of free chars 1166 :rtype: tuple 1167 1168 .. versionadded:: 1.29.90 1169 1170.. function:: DecodeSMS(Messages, EMS) 1171 1172 Decodes multi part SMS message. 1173 1174 :param Messages: Nessages to decode, see :ref:`sms_obj` 1175 :type Messages: list 1176 :param EMS: Whether to use EMS, defalt to True 1177 :type EMS: bool 1178 :return: Multi part message information, see :ref:`sms_info_obj` 1179 :rtype: dict 1180 1181.. function:: EncodeSMS(MessageInfo) 1182 1183 Encodes multi part SMS message. 1184 1185 :param MessageInfo: Description of message, see :ref:`sms_info_obj` 1186 :type MessageInfo: dict 1187 :return: List of dictionaries with raw message, see :ref:`sms_obj` 1188 :rtype: dict 1189 1190.. function:: DecodePDU(Data, SMSC = False) 1191 1192 Parses PDU packet. 1193 1194 :param Data: PDU data, need to be binary not hex encoded 1195 :type Data: str 1196 :param SMSC: Whether PDU includes SMSC. 1197 :type SMSC: bool 1198 :return: Message data, see :ref:`sms_obj` 1199 :rtype: dict 1200 1201 **Example:** 1202 1203 .. code-block:: python 1204 1205 gammu.DecodePDU( 1206 '0681678968986811000a8152564557550010ff0d3bf67aed5ebbddeb1d7bed06'.decode('hex') 1207 ) 1208 1209.. function:: EncodePDU(SMS, Layout = Submit) 1210 1211 Creates PDU packet. 1212 1213 :param SMS: SMS dictionary, see :ref:`sms_obj` 1214 :type SMS: dict 1215 :param Layout: Layout (one of Submit, Deliver, StatusReport), Submit is default 1216 :type Layout: str 1217 :return: Message data 1218 :rtype: str 1219 1220 .. versionadded:: 1.27.93 1221 1222Encoding and decoding entries 1223----------------------------- 1224 1225.. function:: DecodeVCARD(Text) 1226 1227 Decodes memory entry v from a string. 1228 1229 :param Text: String to decode 1230 :type Text: str 1231 :return: Memory entry, see :ref:`pbk_obj` 1232 :rtype: dict 1233 1234.. function:: EncodeVCARD(Entry) 1235 1236 Encodes memory entry to a vCard. 1237 1238 :param Entry: Memory entry, see :ref:`pbk_obj` 1239 :type Entry: dict 1240 :return: String with vCard 1241 :rtype: str 1242 1243.. function:: DecodeVCS(Text) 1244 1245 Decodes todo/calendar entry v from a string. 1246 1247 :param Text: String to decode 1248 :type Text: str 1249 :return: Calendar or todo entry (whatever one was included in string), see :ref:`cal_obj`, :ref:`todo_obj` 1250 :rtype: dict 1251 1252.. function:: DecodeICS(Text) 1253 1254 Decodes todo/calendar entry v from a string. 1255 1256 :param Text: String to decode 1257 :type Text: str 1258 :return: Calendar or todo entry (whatever one was included in string), see :ref:`cal_obj`, :ref:`todo_obj` 1259 :rtype: dict 1260 1261.. function:: EncodeVCALENDAR(Entry) 1262 1263 Encodes calendar entry to a vCalendar. 1264 1265 :param Entry: Calendar entry, see :ref:`cal_obj` 1266 :type Entry: dict 1267 :return: String with vCalendar 1268 :rtype: str 1269 1270.. function:: EncodeICALENDAR(Entry) 1271 1272 Encodes calendar entry to a iCalendar. 1273 1274 :param Entry: Calendar entry, see :ref:`cal_obj` 1275 :type Entry: dict 1276 :return: String with iCalendar 1277 :rtype: str 1278 1279.. function:: EncodeVTODO(Entry) 1280 1281 Encodes todo entry to a vTodo. 1282 1283 :param Entry: Todo entry, see :ref:`todo_obj` 1284 :type Entry: dict 1285 :return: String with vTodo 1286 :rtype: str 1287 1288.. function:: EncodeITODO(Entry) 1289 1290 Encodes todo entry to a iTodo. 1291 1292 :param Entry: Todo entry, see :ref:`todo_obj` 1293 :type Entry: dict 1294 :return: String with vCard 1295 :rtype: str 1296 1297Backup reading and writing 1298-------------------------- 1299 1300.. function:: SaveRingtone(Filename, Ringtone, Format) 1301 1302 Saves ringtone into file. 1303 1304 :param Filename: Name of file where ringote will be saved 1305 :type Filename: str 1306 :param Ringtone: Ringtone to save 1307 :type Ringtone: dict 1308 :param Format: One of ``ott``, ``mid``, ``rng``, ``imy``, ``wav``, ``rttl`` 1309 :type Format: str 1310 :return: None 1311 :rtype: None 1312 1313.. function:: SaveBackup(Filename, Backup, Format) 1314 1315 Saves backup into file. 1316 1317 :param Filename: Name of file to read backup from 1318 :type Filename: str 1319 :param Backup: Backup data, see :func:`ReadBackup` for description 1320 :type Backup: dict 1321 :param Format: File format to use (``Auto``, ``AutoUnicode``, ``LMB``, ``VCalendar``, ``VCard``, ``LDIF``, ``ICS``, ``Gammu``, ``GammuUnicode``, the default is ``AutoUnicode``) 1322 :type Format: str 1323 :return: None 1324 :rtype: None 1325 1326.. function:: ReadBackup(Filename, Format) 1327 1328 Reads backup into file. 1329 1330 :param Filename: Name of file where backup is stored 1331 :type Filename: str 1332 :param Format: File format to use (``Auto``, ``AutoUnicode``, ``LMB``, ``VCalendar``, ``VCard``, ``LDIF``, ``ICS``, ``Gammu``, ``GammuUnicode``, the default is ``AutoUnicode``) 1333 :type Format: str 1334 :return: Dictionary of read entries, it contains following keys, each might be empty: 1335 1336 * IMEI 1337 * Model 1338 * Creator 1339 * PhonePhonebook 1340 * SIMPhonebook 1341 * Calendar 1342 * ToDo 1343 * DateTime 1344 :rtype: dict 1345 1346.. function:: SaveSMSBackup(Filename, Backup) 1347 1348 Saves SMS backup into file. 1349 1350 :param Filename: Name of file where to save SMS backup 1351 :type Filename: str 1352 :param Backup: List of messages to store 1353 :type Backup: list 1354 :return: None 1355 :rtype: None 1356 1357.. function:: ReadSMSBackup(Filename) 1358 1359 Reads SMS backup into file. 1360 1361 :param Filename: Name of file where SMS backup is stored 1362 :type Filename: str 1363 :return: List of messages read from file 1364 :rtype: list 1365 1366Various data 1367------------ 1368 1369.. data:: GSMNetworks 1370 1371 Dictionary with GSM network codes. 1372 1373.. data:: GSMCountries 1374 1375 Dictionary with GSM country codes. 1376