Motorola extended AT commands for calendar and phone book

Most Motorola GSM phones support an extended AT command set for accessing their calendar and phonebook data.

This page is incomplete.

General

general:
AT+CSCS=? (show possible encodings)
+CSCS: ("8859-1","ASCII","GSM","UCS2","UTF8")
AT+CSCS="ASCII" (set encoding to ascii)

AT+CSCA? (read SMS service centre number)
AT+CGMI;+CGMM;+CGMR;+CGSN (read OS, caps, version, IMEI)
AT+CSQ;+CBC (read signal level, read battery level)
reply:
+CSQ: 21,99 (signal level, max level)
+CBC: 1,90 (charging/not charging, battery level/100)

Calendar

Simple Format

reading events:
AT+MDBL=1     -- required, blocks access to calendar in phone
AT+MDBR=0,14  -- read events 0-14 in calendar
AT+MDBL=0     -- unblock calendar access

output:
+MDBR: 0,"Meeting",1,0,"17:00","02-24-2006",60,"00:00","00-00-2000",0
+MDBR: 1,"Breakfast",1,1,"10:00","02-25-2006",60,"09:30","02-25-2006",2
event num, description, time flag (if 0, start time is meaningless), alarm enabl
ed flag (if 0, alarm time is meaningless), time, date, duration (mins), alarm ti
me, alarm date, repeat type

repeat type:
1 = daily
2 = weekly
3 = monthly on date
4 = monthly on day
5 = yearly


reading events "mobile parameters"
AT+MDBR=?
+MDBR: 500,1,64,8,2
(max events that can be stored, number of stored events, ?, ?, ?)


writing events:
AT+MDBL=1 (as above)
AT+MDBWE=1,0,0 (write enable entry 1?)
AT+MDBW=1,"Test Entry",1,1,"10:00","02-28-2006",60,"09:30","02-28-2006",2
AT+MDBWE=2,0,0
AT+MDBW=2,"Foo",1,0,"10:00","02-26-2006",60,"00:00","00-00-2000",0
AT+MDBWE=3,0,0
AT+MDBW=3,"Bar",1,0,"10:00","02-26-2006",60,"00:00","00-00-2000",0
AT+MDBL=0 (as above)


how to delete?
just do +MDBWE=n,0,0 (as above) but don't follow with a write

on positions:
events don't seem to change position once stored (even when modified)
however, a new event will get the lowest available position
so it's hard to tell between a delete-and-add and a big modify

Extended Format

The source for this information.

21 comma sperated fields, value types are integer, string (WITH QUOTES), and empty (really empty, as in nothing in there, NOT like empty strings)
Field#  Meaning                            Value type
1  ID of the Entry                         integer
2  Subject                                 string
3  Whole Day Event (see below)             integer (0 or 1)
4  Alarm                                   integer (0 or 1)
5  Start time                              string (format HH:MM)
6  Start date                              string (format MM-DD-YYYY)
7  Unused                                  always empty
8  Alarm time (see below)                  string
9  Alarm date (see below)                  string
10 Repeat (see below)                      integer
11 End time                                string
12 End date                                string
13 Alarm sound (see below)                 string
14 Type of Entry (see below)               integer
15 Location of Event                       string
16 Note                                    string
17 Unused (propably max ID for events???)  integer (always 501)
18 Repeat every X                          integer
19 Repeat on day X                         integer
20 Unused                                  always empty
21 End date of Repetition                  string

Explanation of Field sets:
_________________________
------------------------------

Field 3 = Whole Day Event
---------------------------------
Beware of the semantics off this field:
Value = Meaning
0 = whole day event
1  = NO whole day event!!!


Field 14 = Type of Event
-------------------------------
Value = Meaning
0 = None
1 = Private
2 = Discussion
3 = Meeting
4 = Birthday
5 = Anniversary
6 = Telephone Call
7 = Vacation
8 = Holyday
9 = Entertainment
10 = Breakfast
11 = Lunch
12 = Dinner
13 = education
14 = Travel
15 = Party

Fields 4,8,9,13 = Alarm related
--------------------------------------
Field 4 is the Alarm master switch:
Value = Meaning
0 = Alarm off
1 = Alarm on

If Alarm is off fields 8,9,13 contain their default values:
field 8 = "06:28"
field 9 = "02-06-2088"
field 13 = ""
Beware of the quotes, they belog to the value!!!
But those fields can savely be ignred if alarm is off

if Alarm is on field 8 and 9 are self explaining, field 13 can contain 2 different kinds of values:
a) either "" , which means that the default alarm sound for the current sound theme will be chosen, or
b) a path to a music file, which will then be chosen as alarm sound.

Fields 10, 18, 19, 21 = Event Repetition
-------------------------------------------------
This one is a little complicated.
Field 10 is the repetition master switch it has the following value - meaning pairs:
0 = no repeating
1 = daily repeat
2 = weekly repeat
3 = monthly repeat based on the weekday, e.g. Event is on 04-12-2007, which is also the second thursday in april we want to repeat the event on every second thursday of every month
4 = monthly repeat based on the correct date, e.g. Event is on 04-12-2007, we want to repeat the event on every 12. day of every month
5 = yearly repeat based on the weekday, e.g. Event is on 04-12-2007, which is also the second thursday in april we want to repeat the event on every second thursday of april of every year
6 = yearly repeat based on the correct date, e.g. Event is on 04-12-2007, we want to repeat the event on every 12. april of every year

field 21 always contains the end date of the repetition. If the repetition is endless field 21 contains the value "00-00-2000" (with quotes). The date format is as always: MM-DD-YYYY.

field 18 is only relevant if field 10 contains one of the following values : 1, 2, 3, 4. It is therefore not used for yearly repetition., only for daily weekly and monthly repetition. Field 18 contains an integer value. Its defauls value is 0 and indicates that the field is unset. For all other values its semantic can be interpreted as "repeat every VALUE day/week/month", e.g.:
Event date 1-1-2007, field 10=1, field 18=3
Repetetion on 1-4-2007, 1-7-2007, ...


The meaning off field 19 is dependant on the value of field 10.
Its default value is 0, and indicates that the field is unused, which is the case if field 10 contains one of the following values: 0, 1, 4, 6

For weekly repeat (field 10= 2) follows the following binary encoding of weekdays:
The weekday of the event (the one that gets repeated of course) gets the value 2^6 = 64,
the following weekday gets the value 2^5, the after that one gets 2^4, etc.
Field 19 contains the sum of the binary encoded weekdays.
For example:
lets assume we have an event on Thursday, 04-12-2007
As the starting weekday is the day of the first event (Thursday), this day gets encoded with 2^6, so the encoding for the whole week is as follows:
thursday 2^6 (1000000) - friday 2^5 (0100000) - saturday 2^4 (0010000) - sunday 2^3 (0001000) - monday 2^2 (0000100) - tuesday 2^1 (0000010) - wednesday 2^0 (0000001)
lets say we want to repeat that event every thursday and monday on a weekly basis.
Field 19 would then contain 2^6 + 2^2 = 68 or in binary form 1000100
As one can see it is quite easy to resolve this field using binary shifting operations.

for monthly repeat on weekday basis and yearly repeat on wekkday basis (field 10 = 3 or 5) the following holds:
The weekdays get the following basis encodings :
sunday = 0
monday = 8
tuesday = 16
wednesday = 24
thursday = 32
friday = 40
saturday = 48
Again it is quite easy to see the binary encodings.
The above values are NEVER the value of field 19. Instead the field contains a value computed as follows:
WEEKDAYCODE + 1 = first WEEKDAY of month
WEEKDAYCODE + 2 = second WEEKDAY of month
WEEKDAYCODE + 3 = third WEEKDAY of month
WEEKDAYCODE + 4 = fourth WEEKDAY of month
WEEKDAYCODE + 5 = last WEEKDAY of month

Phone Book

reading group IDs:
AT+MPGR=?
+MPGR: (1-30),24,(0-2,4-55,255),(0),(0),0
AT+MPGR=1,15 (read IDs 1-15)
+MPGR: 1,"General",255,0,0,""
+MPGR: 2,"Business",255,0,0,""
+MPGR: 3,"Personal",255,0,0,""
+MPGR: 4,"VIPs",255,0,0,""

field 7's purpose is unknown. one document says it is a "backlight flag" I've had reports of one device where some entries had it set to 1, however trying to write a 1 there always failed