Ticket #425 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 months ago

support for extended calendar format on new models

Reported by: qratz Assigned to: andrewb
Priority: high Milestone: 0.40
Component: Plugin: moto Version: 0.20
Severity: major Keywords: V3xx calendar moto motorola moto-plugin
Cc:

Description

The methods open_calendar and close_calendar in motosync.py send the at commands

AT+MDBL=1

and

AT+MDBL=0

to the phone. Those commands are unavailable on the V3xx and propably others too. As far as i know those commands are used to lock and unlock the calendar database. It seems to me that on the V3xx it is not necessary to use these commands before accessing the calendar database. I can still call the "AT+MDBR" command. Using this command, another problem appears: The phone answers a

AT+MDBR=?

with this:

+MDBR: 500,3,128,8,3,(0-6),264,(0-16),64,256
                                                                                
OK

Unfortunately motosync.py doesn't expect the command to return 10 parameters. Therefore it fails in line 433:

(maxevs, numevs, namelen, max_except, _) = self.read_event_params()

I tried skipping the opening and and closing function and filling line 433 with some dummy variables. but the program than faulted at line 701:

if part[0] == '"':

Now i don't have a clue about python, so'll leave it to someone else to correct it. I think this might be usefull:

at+mdbr=0}}}
returns this:

{{{
+MDBR: 0,"Al Capone",0,0,"00:00","01-24-2007",,"06:28","02-06-2088",6,"00:00","01-25-2007","",4,"","",501,0,0,,"00-00-2000"
}}}
which is a birthday entry.

Thx in advance

Change History

02/14/07 03:25:19 changed by andrewb

  • owner changed from abauer to andrewb.
  • status changed from new to assigned.
  • milestone changed from 0.21 to 0.30.

Thanks. I'm aware of the problem, but so far haven't been able to get more info about it, your data definitely gets us closer.

The problem with MDBL and MDBR=? are fairly easily worked around, but from your data it seems that calendar entries now store a lot more data than they used to. This is probably good (the old calendar format makes the calendar almost useless), but I'm going to need you to do a bit more work figuring out what all the fields mean. The way I did this on my phone was a process of deduction, creating lots of different calendar entries, reading them out, and then figuring out what the fields in the MDBR output meant. Can you do something like this? At the moment we have:

+MDBR: 0,"Al Capone",0,0,"00:00","01-24-2007",,"06:28","02-06-2088",6,"00:00","01-25-2007","",4,"","",501,0,0,,"00-00-2000"

Now, based on previous versions I know that the first few fields are probably: 1. event num 0 2. description 3. time flag (if 0, start time is meaningless) 4. alarm enabled flag (if 0, alarm time is meaningless) 5. start time 6. date 7. duration (mins)??

However the rest is a mystery. Especially the dates in 2088 (which are probably unset for this event), the other text fields, the 501, and the time of 06:28.

04/12/07 15:53:27 changed by qratz

Sorry it took me so long to answer. I was busy with my diplome thesis. Last night a had a little time off so i did a little reasearch on the event format of my v3xx. Here's what i've come up with: the mdbr output looks like this:

+MDBR: 0,"Al Capone",0,0,"00:00","01-24-2007",,"06:28","02-06-2088",6,"00:00","01-25-2007","",4,"","",501,0,0,,"00-00-2000"

My results are these:

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

That's it. I hope this helps. Tell me if can help some more. Under better circumstances i could have helped with the development, too, but i'm still busy finishing my diploma thesis.

06/02/07 08:06:00 changed by andrewb

  • summary changed from Motorola RAZR V3xx and propably others - calendar bug to support for extended calendar format on new models.
  • type changed from defect to enhancement.
  • severity changed from critical to major.
  • milestone changed from 0.30 to 0.31.

Sorry for the delay responding to this, I was busy with my own thesis :) Thanks for all your work gathering that data, it will definitely help.

I've just committed r2086, which should fix the problems with MDBL and MDBR=?. I've started working on refactoring the code to try to support the different levels of data on different models, but it's going to be a fairly major change.

06/14/07 03:21:29 changed by andrewb

Hi,

can you please double check these values:

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

The reason I ask, is my phone has monthly by day and monthly by date swapped around, and number 5 is yearly by date not yearly by day. So if your data is correct, we have the rather confusing situation that:

   my phone:     your phone:
-----------------------------
0  no repeat     no repeat
1  daily         daily
2  weekly        weekly
3  monthly date  monthly day
4  monthly day   monthly date
5  yearly date   yearly day
6  (unsupported) yearly date

... I can implement this, but it seems bizarre that they've not made the extended format backward compatible with the older format, and have actually swapped around the meaning of some types. So, can you please double check your data for me? I've just checked again on my phone, and it is definitely different.

Thanks.

06/15/07 06:55:00 changed by andrewb

  • status changed from assigned to closed.
  • resolution set to fixed.

Committed r2167 which adds support for the extended calendar format. This will need a lot of testing (as I don't have the hardware). Also, I still need you to check on the repeat type values in the previous comment.

06/21/07 02:48:15 changed by qratz

Hi, i just double checked the repeat values. Unfortunatly my previous observations are true. So Motorola did in fact change the semantics of this field in their new phones. BTW, I'll gladly test r2167. Just a quick question though: Which opensync version is required for the current svn version of motosync?

06/21/07 18:07:01 changed by andrewb

  • status changed from closed to reopened.
  • resolution deleted.

Sigh. Ok, I'll let you know when I've fixed the mapping of date/day for the repeat types.

The current svn motosync also requires svn opensync and other plugins. It might be easier to wait until 0.31 is out to test it.

07/01/07 12:39:55 changed by andrewb

  • status changed from reopened to closed.
  • resolution set to fixed.

Ok, r2232 fixes the mapping of repeat types in the extended-format calendar as discussed. Please test 0.31 when it is released and let me know how it goes (but please open new tickets for any bugs you find). Thanks.

08/07/07 17:25:58 changed by cstender

  • milestone changed from 0.31 to OpenSync 0.40.

Milestone 0.31 deleted

09/16/08 05:36:06 changed by add

about their apps in the first place. Both annotations and contributions will only clutter the interface by default as a design pattern rather than trying to put it all together. That way you can never create offline or print docs of high quality without again having the devs or current admins maintain the comments and annotations. Hopefully a small Wiki quality team will evolve (i am against ops or admins) to review and summarize the contributions. I hope this gives us more users as contributors than having the docs focused on the devs. Cheers, duns china tour Apparel shoes bags Kitchen Food and Wine Furniture) Flowers and Gifts Wall Art Computer Components I still prefer a wiki like approach since the php (or mysql) docs are very cluttered when you have to take their comments in account. On the other hand they are professionally maintained imho, since they are *much* better than KDE documentation.