P3 receiving and decoding
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
P3 receiving and decoding
Hello everybody!!!
I interested of some interaction with specific device using p3 protocol. I found out that device broadcasts UDP datagrams. But these datagrams are binary. How can I decode it in case I know what means each byte?
Of course I want to do it with LiveCode!!!
Thanks!
I interested of some interaction with specific device using p3 protocol. I found out that device broadcasts UDP datagrams. But these datagrams are binary. How can I decode it in case I know what means each byte?
Of course I want to do it with LiveCode!!!
Thanks!
Re: P3 receiving and decoding
It seems to me that i should use something like this:
Code: Select all
on openCard
open datagram socket "192.168.0.203:5403" --it's IP address and port of device
accept datagram connecitons on port 5403 with message "DataRecieved"
end openCard
on DataRecieved curIP,curData
put textDecode(curData,"???") into curData
--what kind of encoding should i use for curData if i know that UDP message is binary??? ASCII?
end DataRecieved
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: P3 receiving and decoding
The textDecode function is useful for coercing tet encoding schemes. For translating binary data to and from various formats see the binaryDecode function.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: P3 receiving and decoding
Thanks, I'll try it! And with receiving messages everything is ok? Can I use accept command?FourthWorld wrote:The textDecode function is useful for coercing tet encoding schemes. For translating binary data to and from various formats see the binaryDecode function.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: P3 receiving and decoding
I'm completely unfamiliar with P3, so that's where you'll be teaching me.
Give accept a try and report back what you find.

Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: P3 receiving and decoding
Richard, I have some problems: number of detected device is presented by 4 hex bytes. How to transform it to "normal" number? I saw that guys are taking hex bytes from last to first and do something with it. Can you say what exactly they does?
P.S. The same thing they does with received time that also is presented by four hex bytes
P.S. The same thing they does with received time that also is presented by four hex bytes
Re: P3 receiving and decoding
Gotcha!
I found how to parse messages. The only task now - is to recieve these messages from device)))))
I found how to parse messages. The only task now - is to recieve these messages from device)))))