Discussion:
[BitPim-devel] Making memo length a phone specific item
John O'Shaughnessy
2005-02-05 23:11:10 UTC
Permalink
A user recently pointed out that while the LG VX6100 can support memo
lengths of 64 in the phonebook, BitPim writes out the entry with a max of 31
characters.

In class Profile(com_phone.Profile) in com_lgvx4400.py there is the
following code:

# memo
e['memo']=helper.makeone(helper.getmemos(entry.get('memos',
[]), 0, 1, 32), "")


Changing that 32 to 64 properly writes out the max memo length on the
VX6100.

So -- what are the steps to do this the right way so that it can modified
with something simple such as MAX_MEMO_LENGTH=xx in each phone's source?

Any pointers would be appreciated.

Thanks,

John
Roger Binns
2005-02-07 05:47:14 UTC
Permalink
Post by John O'Shaughnessy
So -- what are the steps to do this the right way so that it can modified
with something simple such as MAX_MEMO_LENGTH=xx in each phone's source?
Any pointers would be appreciated.
Yes, the first thing you do is point it out to whoever looks after
that manufacturer :-)

You can see what I did in the commit.

The value becomes a module level parameter:

MEMOLENGTH=65

Then the specific field is altered to use this:

* STRING {'raiseonunterminatedread': False, 'sizeinbytes': MEMOLENGTH} memo

That step wasn't totally necessary (I could leave the 65 hard coded on
the above line), but it is generally a bad idea to duplicate information
(it would be quite hard to tell if they are out of sync, and things could
get very wierd if some of the code was cut and pasted for a new phone module).

This had to be done for all modules for the manufacturer. Finally the piece
of code that was doing the truncation was altered to look at self.protocolclass
which points to the p_ module for the actual selected phone model.

# memo (-1 is to leave space for null terminator - not all software puts it
# in, but we do)
e['memo']=helper.makeone(helper.getmemos(entry.get('memos', []), 0, 1,
self.protocolclass.MEMOLENGTH-1), "")

Roger
John O'Shaughnessy
2005-02-08 03:47:18 UTC
Permalink
Post by Roger Binns
Post by John O'Shaughnessy
So -- what are the steps to do this the right way so that it can modified
with something simple such as MAX_MEMO_LENGTH=xx in each phone's source?
Any pointers would be appreciated.
Yes, the first thing you do is point it out to whoever looks after
that manufacturer :-)
You can see what I did in the commit.
MEMOLENGTH=65
Wow. Thanks Roger!

I tested it on the LG VX6100, and it works as expected, up to MEMOLENGTH-1,
as documented.

John

Loading...