PDA

View Full Version : Payload data support question



Ron
October 13th, 2002, 12:55 PM
I now see what you mean.

Okay, that is an nasty error in Girder. Fixing now! The GetPayload should return 1 in your example but you should pass the size of the complete buffer.

-Ron

Ron
October 13th, 2002, 12:55 PM
I've updated Girder (3.1.2d), could you please check if this works correctly now ? ( I'm half a sleep already I might have missed something crucial ;-) )

Ron
October 13th, 2002, 12:55 PM
I'm gonna be real brief, its 8 am, and classes start shortly, the payload data stuff is fixed in 3.1.2e.

When sending an event the length parameter should include the evenstring.

When requesting the payload data _only_ the payload data length is returned.

I think this is as documented, Girder should now also work that way.


Example

eventstring "1234567890123456" ( 16 chars) (17bytes)
1 byte string count ( 1byte )
1 string : "ee" ( 2 chars) ( 3 bytes )
10byte payload ( 10 bytes )

total length for Event: 31
length returned by GetPayload(NULL, -1) : 14

-Gotta run!

Mark F
October 13th, 2002, 12:55 PM
When I pass an event to Girder, the last parameter in the PostMessage call is the size of all data in the shared memory area. This includes the size of the event string and null terminator. When this event is processed by an action, the payload data size is reported as this same size BUT the event string has been striped from the front.

What value should be passed to Girder in the event PostMessage call? The size of the payload data or the size of payload data plus event string and NULL?

The current API document uses this example:


max-=strlen(irstr)+1;
if &#40;max <= 0 &#41;
&#123;
return;
&#125;

strncpy&#40;tempbuf, irstr, strlen&#40;irstr&#41; + 1&#41;;
cnt=strlen&#40;irstr&#41;+1;


and cnt is passed as the last parameter of the message. This is what I've followed.

A concrete example: :)

The event string is "Hello" and no payload data is passed. The shared memory buffer contains Hello/0/0 and the PostMessage call has 7 as the last parameter. The size returned by GetPayload for this event is 7, not 1.

Should I pass the value 1 as the last parameter to PostMessage? Is the example in the API document wrong?

Mark F
October 13th, 2002, 12:55 PM
It looks like the very last byte of binary data is being set to 0 between the time I give it to Girder (PostMessage) and when I get it back (GetPayload). :( The size is now correct. :)

Mark F
October 13th, 2002, 12:55 PM
Does DVDSpy include any binary data in the payload? Does it get passed all the way through?

Mark F
October 13th, 2002, 12:55 PM
Thanks for the confirmation.

I like the new Logger. :) Thanks for updating it.

Mark F
October 13th, 2002, 12:55 PM
Thanks, Ron. 3.1.2e works as advertized.

MMcM
October 13th, 2002, 12:55 PM
DVDSpy assumes that the parameter is the total payload length (one byte number for of strings, each string with its null, and binary bytes), not the including the event string length. I must have read earlier documentation or based it on what caused the "right" count to be returned before this fix. I take it I should now update it to be the grand total length, right?

MMcM
October 13th, 2002, 12:55 PM
None of the events has any binary data, no. I did patch some in while testing Logger's display of binary data. I tried that again just now in 3.1.2d and am seeing the last byte always reported as zero just as you are.