Re: SMS pm-8200

Stephen Wood <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
On 12/13/05, Jordan Foley <[email protected]> wrote:
>
> I modified the code from samsung_prototype to what should be very simple
> sms code where it just grabs the first message and puts their callback #
> in the database but it will not work for some reason. I just wish I
> could at least get something in the database then it would be a lot
> easier from there.


You have to put "import sms" some where at the top fo the file (like
com_samsung_packet has "import memo".)


    def getsms(self, result):
>         sms = {}


This is the array that the sms entries will go in.  It can't be called sms
because that is the module you imported.  For purposes of discussion, I
assum that you call this variable mysms.


        self.log("Getting sms entries")
>         slot=1
>         req=self.protocolclass.messagerequest()
>         req.slot=slot
>         res=self.sendpbcommand(req, self.protocolclass.messageresponse)
>         entry=sms.SMSEntry()

This will work if you do the "import sms" at the top.


        entry.callback=callback


There is no variable callback.  You probably mean something like "
res.entry.callback" which gets the callback field from the packet you read
in sendpbcommand.  Actually, if you are using the packet definition you last
posted, you probably really want res.entry.phonenum, since you don't have a
callback field in your packet definition.

You  need to put your entry into the mysms array.  Add the following

mysms[entry.id]=entry

        result['sms']=sms

Insted say result['sms']=mysms


Before trying to get the data pushed into BitPim, it might be good to put
some print statements after the sendpbcommand.  Examples are
print res.entry.message
print res.entry.year, res.entry.month, res.entry.day

This will check that your packet definition really works and that you know
how to extract the fields of your result.


Stephen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.