Discussion:
[BitPim-devel] PM-8200 Todo Support Added
Jordan Foley
2005-12-14 11:11:08 UTC
Permalink
com_sanyonewer.py
import todo

def gettodo(self, result):
gtodo = {}
self.log("Getting todo entries")
req=self.protocolclass.todorequest()
for slot in range(20):
req.slot=slot
res=self.sendpbcommand(req, self.protocolclass.todoresponse)
entry=todo.TodoEntry()
entry.summary=res.entry.todo
if res.entry.priority==2:
entry.status=4
if res.entry.priority==0:
entry.priority=5
if res.entry.priority==1:
entry.priority=1
gtodo[entry.id]=entry
result['todo']=gtodo
return result


p_sanyonewer.p
PACKET todorequest:
* sanyoheader {'packettype': 0x0c,
'command': 0x25} +header
1 UINT slot
501 UNKNOWN +pad

PACKET todoentry:
1 UINT slot
1 UINT flag "0: Not used, 1: Used"
14 STRING {'raiseonunterminatedread': False} todo
7 UNKNOWN +pad1
1 UINT todo_len
1 UINT priority "0: Normal, 1: Urgent, 2: Done"
1 UINT +dunno "Maybe always zero"
1 UINT order "Gets sorted on screen in this order"

PACKET todoresponse:
* sanyoheader header
* todoentry entry
472 UNKNOWN pad


I did not make a diff for this one since it is a simple copy and paste
but this grabs the todo list off of the pm-8200. The phone only has two
fields, the name of the item and its priority so this was very easy to
implement. You can also mark a task completed so I added that also. I
did not add support to write back to the phone as i dont know how to do
that yet. Also I hardcoded the value of 20 into my subroutine because
that is the max on my phone. Is this different on different phones and
does this need to be a variable that is defined for each phone?

Question time. What are the commands to access different parts of the
phone, most importantly I am looking for a command that will allow me to
access the other sms folders since the command i have (0xe1) only gets
the inboxs and I have tried ones around it without success. Is there a
way to find them or is it trial and error? And if anyone would like to
give me a tutorial on writing write support to the phone that would be
great.
Stephen Wood
2005-12-14 15:11:09 UTC
Permalink
Jordan:

I'll check in your changes after we announce 8.04.

Let me know if your name added to the copyright line or if you want to
transfer the copyright.
.... I
did not add support to write back to the phone as i dont know how to do
that yet.
Look at savecalendar or savephonebook in com_sanyo.py for guidance on how to
write to sanyo phones. I'll try to explain a bit when I am not at work.


Also I hardcoded the value of 20 into my subroutine because
that is the max on my phone. Is this different on different phones and
does this need to be a variable that is defined for each phone?
These numbers seem to be pretty constant across a wide range of Sanyo
phones. In any case, I'll turn these constants into variables when I check
your code in.

Question time. What are the commands to access different parts of the
phone, most importantly I am looking for a command that will allow me to
access the other sms folders since the command i have (0xe1) only gets
the inboxs and I have tried ones around it without success. Is there a
way to find them or is it trial and error?
I think the what you wrote reads all messages in every folder. What it
looked like on the 4900 was that each message had a folder id/index. Have
you tried using the folderrequest/folderresponse packets to get the folder
names? For the 4900, the command was 0xef, and the packettype was 0x0b
instead of 0x0c. (The words "command" and "packettype" are not necessarily
meaningful. They are just soft of descriptive guesses of the functions of
these bytes.)

Stephen
Jordan Foley
2005-12-14 17:41:36 UTC
Permalink
You can just transfer the copyright over since you did most of the work
haha, I just troubleshooted the code, being in the credits is enough for
me. :)

The problem with the sms function is that for some reason it will only
grab the messages out of my inbox so I hardcoded the folder to Inbox. On
my phone I have the folders Inbox, Sent, Outbox, Drafts. The Outbox isnt
used and the Drafts would be the same as Saved in BitPim. I ran your
foldernamerequest and it did not return anything useful, but I will look
at it again. Just wondering what does the packettype mean? I noticed
that in the packet it returns one of the values is 0B instead of 0C. Did
you just find all of this by guessing or was it an educated guess.

Also do the newer sanyos support memos because I can not find this
function on my phone. All I have is voice memos.
Stephen Wood
2005-12-14 18:29:42 UTC
Permalink
Post by Jordan Foley
You can just transfer the copyright over since you did most of the work
haha, I just troubleshooted the code, being in the credits is enough for
me. :)
OK. I'll make sure you are on the credits page.

The problem with the sms function is that for some reason it will only
Post by Jordan Foley
grab the messages out of my inbox so I hardcoded the folder to Inbox. On
my phone I have the folders Inbox, Sent, Outbox, Drafts. The Outbox isnt
used and the Drafts would be the same as Saved in BitPim. I ran your
foldernamerequest and it did not return anything useful, but I will look
at it again. Just wondering what does the packettype mean? I noticed
that in the packet it returns one of the values is 0B instead of 0C. Did
you just find all of this by guessing or was it an educated guess.
It was a long time ago that I investigated all this, and only with the
4900. These SMS packet definitions were found by trial and error. I tried
all possible combinations of packettype (actually just 0x0 to 0x0f) and
command (0x0 to 0xff) and looked for interesting stuff coming back. I have
only repeated this in limited ways for phones newer than the 4900. I have a
couple of donated 8200's, so if you would like I could try to do a command
scan in the next few days and send you the results. My experience is that
it is safe to send random packets to sanyo phones, as long as you don't put
the phone into update mode (with the beginupdaterequest packet). But it is
probably better to do such a scan with a discarded phone if possible.

Also do the newer sanyos support memos because I can not find this
Post by Jordan Foley
function on my phone. All I have is voice memos.
I don't recall that the older Sanyo phones had memos either.

Now retrieving voice memo's might be another interesting project!

Stephen
Jordan Foley
2005-12-14 21:32:39 UTC
Permalink
If you have time to run the packet tests on the pm-8200 that would be
great, I have ran a scan on my phone with the packettype 0x0c from d0-ff
and didnt find much except that 2 of the commands restarted and i pulled
up my username. So as long as there are text messages on the phone it
should find it, but those would be easy to create.
Stephen Wood
2005-12-15 05:25:01 UTC
Permalink
Jordan:

I have checked in your changes. I put the code into com_sanyo.py because it
will probably work for the older phones too. I put variables for the number
of todo and sms slots into p_sanyo. I put in 200 for the max number of
messages, but it should probably be 128. Can you confirm?

I'll try some scaning of different packets tomorrow night.

Stephen

Loading...