Changeset 2086
- Timestamp:
- 06/02/07 08:03:47 (1 year ago)
- Files:
-
- plugins/moto-sync/motosync.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/moto-sync/motosync.py
r2059 r2086 434 434 self.devstr = device 435 435 self.__calendar_open = False 436 self.__calendar_locking_required = True 436 437 self.__fd = self.__btsock = None 437 438 self.max_events = None … … 476 477 self.__do_cmd('ATE0Q0V1') # echo off, result codes off, verbose results 477 478 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 478 485 # use UCS2 encoding for data values 479 486 # this is an older version of UTF16 where every char is two bytes long … … 481 488 self.__do_cmd('AT+CSCS="UCS2"') 482 489 483 (maxevs, numevs, namelen, max_except , _) = self.read_event_params()490 (maxevs, numevs, namelen, max_except) = self.read_event_params() 484 491 self.max_events = maxevs 485 492 self.num_events = numevs … … 538 545 This "locks" out the phone's own UI from accessing the data. 539 546 """ 540 if not self.__calendar_open:547 if self.__calendar_locking_required and not self.__calendar_open: 541 548 self.__do_cmd('AT+MDBL=1') 542 self.__calendar_open = True549 self.__calendar_open = True 543 550 544 551 def close_calendar(self): 545 552 """Close the calendar.""" 546 if self.__calendar_ open:553 if self.__calendar_locking_required and self.__calendar_open: 547 554 self.__do_cmd('AT+MDBL=0') 548 self.__calendar_open = False555 self.__calendar_open = False 549 556 550 557 def read_event_params(self): … … 555 562 length of title/name field, 556 563 maximum number of event exceptions 557 maximum number of event exception types (?)558 564 """ 559 565 self.open_calendar() 560 566 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] 562 568 563 569 def read_events(self):
