You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old inbox --> content cut after ~263 chars - 2007-08-27, 22:31

Join Date: Jul 2007
Posts: 43
Lukas Hetzenecker
Offline
Registered User
Hello,

If want to read the content of an message.
Code:
import inbox

box=inbox.Inbox(inbox.ESent)
messages=box.sms_messages()

print box.content(1051660)
But if the content is longer than 263 the message gets cut.
Is there a way to display messages, which are longer than 263 chars?
Reply With Quote

#2 Old Re: inbox --> content cut after ~263 chars - 2007-09-21, 14:23

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Hello Lukas Hetzenecker

Well Yeah there is a solution to this problem.

You can find the code at http://croozeus.googlepages.com/phase3

Hope it helps,
Reply With Quote

#3 Old Re: inbox --> content cut after ~263 chars - 2007-10-30, 10:50

Join Date: Mar 2003
Posts: 7
trapi
Offline
Registered User
I've got the same problem - the message get cut after ~256 characters.
I use:
Code:
i = inbox.Inbox()
mes = i.sms_messages()  # all message ID's
for m in mes:
	sms_text=i.content(m)
	req.write(sms_text)
req is http request handler and I think that the problem isn't there.

What I do wrong? I search http://croozeus.googlepages.com/phase3 and found nothing different from my code.
Reply With Quote

#4 Old Re: inbox --> content cut after ~263 chars - 2007-10-30, 16:35

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by trapi View Post
I've got the same problem - the message get cut after ~256 characters.
I use:
Code:
i = inbox.Inbox()
mes = i.sms_messages()  # all message ID's
for m in mes:
	sms_text=i.content(m)
	req.write(sms_text)
req is http request handler and I think that the problem isn't there.

What I do wrong? I search http://croozeus.googlepages.com/phase3 and found nothing different from my code.
Hello trapi and Welcome to the Forum

That link was meant to read contents of the inbox.That wont help you.
Have you tried to exploit the ctypes module? I think that may help you here.Try storing the text of a SMS (Longer then 263 characters in a long string or something like that.You can find other datatypes here http://docs.python.org/lib/node454.html

Hope that Helps

Regards
Reply With Quote

#5 Old Re: inbox --> content cut after ~263 chars - 2007-10-30, 21:55

Join Date: Mar 2003
Posts: 7
trapi
Offline
Registered User
Quote:
That link was meant to read contents of the inbox.That wont help you.
Have you tried to exploit the ctypes module? I think that may help you here.Try storing the text of a SMS (Longer then 263 characters in a long string or something like that.You can find other datatypes here http://docs.python.org/lib/node454.html
Could you gimme more detailed example?
I tried import ctypes but it's not a module of python for s60.

What's more - when I try sms_len=len(i.content(m)) it also shows no more than 256. So it's something wrong with inbox module I guess..
Reply With Quote

#6 Old Re: inbox --> content cut after ~263 chars - 2007-10-31, 11:59

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by trapi View Post
Could you gimme more detailed example?
I tried import ctypes but it's not a module of python for s60.

What's more - when I try sms_len=len(i.content(m)) it also shows no more than 256. So it's something wrong with inbox module I guess..
Hello trapi

Yes i came to know that ctypes wasnt available in S60 when i tried my code on the device.Also referred to jplauril's comments in a post

Quote:
Question:Jplauril, would it be possible to have something like ctypes on symbian as well?
Ctypes make calling native dll much easier, no need to create an extension for interface.

Answer:Unfortunately using ctypes would be quite problematic. All interesting Symbian API's are C++ and ctypes is built with C in mind. To create C++ objects to pass as parameters you would need to parse the headers with a real C++ compiler and this would be much more complicated than for C. An additional inconvenience is that Symbian DLL's don't include function names, just ordinals, so you would have to pregenerate the naming information for the SDK libraries beforehand.
Here is link to that thread http://discussion.forum.nokia.com/fo...ad.php?t=67187
So unfortunately we have to find an other alternative to your problem
Reply With Quote

#7 Old Re: inbox --> content cut after ~263 chars - 2007-11-01, 10:46

Join Date: Mar 2003
Posts: 7
trapi
Offline
Registered User
I looked into PyS60 source and in ext/inbox/inboxadapter.cpp is a function GetMessageL and there are these lines:
Code:
// Check length because message is read to limited size TBuf
if (length >= KMessageBodySize) 
{
  message.Append(richText->Read(0, KMessageBodySize -1));
}
else 
{
	message.Append(richText->Read(0, length));
}
And in ext/inbox/inbox.h the constant KMessageBodySize is set to 512.
I think that this is the problem, but I don't know why the size of const on my python i 256.I also don't know why it's 512, it's only about 3 smses which is not so many..
Reply With Quote

#8 Old Re: inbox --> content cut after ~263 chars - 2007-11-01, 14:55

Join Date: Oct 2007
Posts: 67
nlsp
Offline
Regular Contributor
Quote:
Originally Posted by trapi View Post
I don't know why the size of const on my python is 256..
Perhaps it *is* 512 and the data read there is unicode?
Reply With Quote

#9 Old Re: inbox --> content cut after ~263 chars - 2007-11-01, 20:31

Join Date: Mar 2003
Posts: 7
trapi
Offline
Registered User
Quote:
Perhaps it *is* 512 and the data read there is unicode?
You are probably right. Thanks for that idea. When I get to know how to compile the python for s60 source I will inform you about the results.
Reply With Quote

#10 Old Re: inbox --> content cut after ~263 chars - 2007-11-01, 21:38

Join Date: Oct 2007
Posts: 67
nlsp
Offline
Regular Contributor
You can do with the following installed (on windows):

- activeperl (from www.activestate.com)
- python (from www.python.org)
- S60 3rd Edition SDK for Symbian OS, Maintenance Release
- Sensor API Plugin for S60 3rd Ed. SDK for Symbian OS
- Extensions Plugin for 3rd Ed. SDK for Symbian OS
- CSL ARM Toolchain (arm-symbianelf) 2005-Q1C (bundled with S60 3rd Ed. SDK)

And finally you'll have to find some tool compatible with standard 'patch' to apply some diffs to the S60 include files needed to compile PyS60. Seems to exist for windows too but i've used a nearby BSD box for that :-/

With the above installed it gets as easy as
- cd to PyS60 source directory
- python setup.py configure <your config preferences given here>
- python setup.py build_device
- python setup.py bdist_sis SIGN_CERT=xxx.cer SIGN_KEY=xxx.key SIGN_PASS=whatever

You may want to create a batchfile to specify your options to the configure command.
If you want to create a package with the same uids as the nokia signed sis files, you need the following there (white space added for readability)

PYS60_UID_S60=0x2000b1a0
PYS60_UID_CORE=0x2000b1a1
PYS60_UID_APPMGR=0x2000b1a2
PYS60_UID_RECOG=0x2000b1a3
PYS60_UID_APPMGR_WRAPPER=0x2000b1a4
PYS60_UID_SCRIPTSHELL=0x2000b1a5
PYS60_UID_LAUNCHER=0x2000b1a6
PYS60_UID_PYREPL=0x2000b1a9

Best regards,

Niels

Oh yes there were two other do's:
- use the good old SUBST dos command to map a driveletter to the dir where the S60 SDK gets installed (that is, the one containing the EPOC directory)
- set EPOCROOT=\
- cd to your subst'ed drive to do the build

:-)
Last edited by nlsp : 2007-11-01 at 22:09. Reason: added notes about SUBST and EPOCROOT
Reply With Quote

#11 Old Re: inbox --> content cut after ~263 chars - 2007-11-02, 22:08

Join Date: Mar 2003
Posts: 7
trapi
Offline
Registered User
Thanks a lot. I've done all that stuff with compiling, patching, signing etc. and I faced with another problem - I'd selfsigned the file, installed it and then when I opened mymobileserver it couldn't load the module mod_python.
Do you think that when I signed the file with certificate and give the ID's that you wrote the python compiled by me will be a 100% substitute for Nokia's Python?
Integration with mymobileserver is very importat for me but I also want to have an ability of fetching long text messages..
Reply With Quote

#12 Old Re: inbox --> content cut after ~263 chars - 2007-11-02, 22:40

Join Date: Oct 2007
Posts: 67
nlsp
Offline
Regular Contributor
That's a tricky one. I didn't do anything with mobile webserver, so can only guess. General rule for capabilities on a dll is they should have the union of all capabilities assigned to all executables that load them. Some post mentioned the officially nokia signed python has more capabilites than a devcert is able to sign (i didn't check that). I guess mod_python depends on the python_222.dll and is loaded by the webserver executable, so if the error is -46 i would check capabilities down that chain.

Did you sign with a self-signed cert or with a devcert from symbiansigned?
Reply With Quote

#13 Old Re: inbox --> content cut after ~263 chars - 2007-11-02, 22:55

Join Date: Oct 2007
Posts: 67
nlsp
Offline
Regular Contributor
Update:

Quote:
Originally Posted by trapi View Post
Do you think that when I signed the file with certificate and give the ID's that you wrote the python compiled by me will be a 100% substitute for Nokia's Python?
No. In the Nokia package:

Capabilities 0xff7be (ALL-TCB-DRM-AllFiles)

In my devcert-signed GCCE compiled package:

Capabilities 0xff1b4 (ALL-TCB-CommDD-MultimediaDD-DRM-DiskAdmin-NetworkControl-AllFiles)
Reply With Quote

#14 Old Re: inbox --> content cut after ~263 chars - 2007-11-02, 23:37

Join Date: Mar 2003
Posts: 7
trapi
Offline
Registered User
Quote:
I guess mod_python depends on the python_222.dll and is loaded by the webserver executable, so if the error is -46 i would check capabilities down that chain
There is apache-like error (message from stdout: 'loading module mod_python failed' or sth like that).

So the solution is use nokia's python with cutted messages or self-compiled python without mobile webserver..
Reply With Quote

#15 Old Re: inbox --> content cut after ~263 chars - 2007-11-03, 00:04

Join Date: Oct 2007
Posts: 67
nlsp
Offline
Regular Contributor
Quote:
Originally Posted by trapi View Post
There is apache-like error (message from stdout: 'loading module mod_python failed' or sth like that).

So the solution is use nokia's python with cutted messages or self-compiled python without mobile webserver..
Or compile mobile webserver with a self-compiled python package?
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Input Stream on N80 tkaihock Symbian Media (Graphics & Sounds) 9 2006-06-30 10:15
Has Nokia broken 7650 J2ME in v4.39? LongSteve Mobile Java General 6 2003-06-03 18:05
7650 Bluetooth Modem with Toshiba Tecra 9000 Windows XP - RESOLVED Now! d0lph1n Bluetooth Technology 5 2003-02-07 12:25
Incorrect order parts of MMS (if parts qnty > 5) marianwitkowski General Messaging 1 2002-08-29 05:36
7650 and MS Bluetooth Transceiver damnedi Bluetooth Technology 1 1970-01-01 02:00

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia