Changeset 2086

Show
Ignore:
Timestamp:
06/02/07 08:03:47 (1 year ago)
Author:
abaumann
Message:

initial support for newer models with extended calendar (bug #425)
this only fixes the problems with AT+MDBL and AT+MDBR=?
it's also untested, because I don't have the phone :)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/moto-sync/motosync.py

    r2059 r2086  
    434434        self.devstr = device 
    435435        self.__calendar_open = False 
     436        self.__calendar_locking_required = True 
    436437        self.__fd = self.__btsock = None 
    437438        self.max_events = None 
     
    476477        self.__do_cmd('ATE0Q0V1')  # echo off, result codes off, verbose results 
    477478 
     479        # find out if calendar locking is required/supported by this phone 
     480        try: 
     481            self.__do_cmd('AT+MDBL=0') 
     482        except opensync.Error: 
     483            self.__calendar_locking_required = False 
     484 
    478485        # use UCS2 encoding for data values 
    479486        # this is an older version of UTF16 where every char is two bytes long 
     
    481488        self.__do_cmd('AT+CSCS="UCS2"') 
    482489 
    483         (maxevs, numevs, namelen, max_except, _) = self.read_event_params() 
     490        (maxevs, numevs, namelen, max_except) = self.read_event_params() 
    484491        self.max_events = maxevs 
    485492        self.num_events = numevs 
     
    538545        This "locks" out the phone's own UI from accessing the data. 
    539546        """ 
    540         if not self.__calendar_open: 
     547        if self.__calendar_locking_required and not self.__calendar_open: 
    541548            self.__do_cmd('AT+MDBL=1') 
    542             self.__calendar_open = True 
     549        self.__calendar_open = True 
    543550 
    544551    def close_calendar(self): 
    545552        """Close the calendar.""" 
    546         if self.__calendar_open: 
     553        if self.__calendar_locking_required and self.__calendar_open: 
    547554            self.__do_cmd('AT+MDBL=0') 
    548             self.__calendar_open = False 
     555        self.__calendar_open = False 
    549556 
    550557    def read_event_params(self): 
     
    555562                 length of title/name field, 
    556563                 maximum number of event exceptions 
    557                  maximum number of event exception types (?) 
    558564        """ 
    559565        self.open_calendar() 
    560566        data = self.__do_cmd('AT+MDBR=?') # read event parameters 
    561         return self.__parse_results('MDBR', data)[0] 
     567        return self.__parse_results('MDBR', data)[0][:4] 
    562568 
    563569    def read_events(self):