ezbroken
Posts: 2
Joined: Fri Jun 21, 2019 9:17 am

change data type using C/C++

Fri Jun 21, 2019 9:27 am

hI , I am recently using 3B+ developing connection between 3B+ and zigbee, zigbee require a certain hex communication type frame. I am wondering how to transform a file (txt, jpg) into hex datatype so that it can be sent and received sequentially by frame and frame.
Does anyone have experience on it or similar example. I am a little bit confused at all.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23334
Joined: Sat Jul 30, 2011 7:41 pm

Re: change data type using C/C++

Fri Jun 21, 2019 9:49 am

What is the specific format required? Depending on that you may need to write something, or there maybe a standard linux command line app that can do what you want.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

jahboater
Posts: 4598
Joined: Wed Feb 04, 2015 6:38 pm

Re: change data type using C/C++

Fri Jun 21, 2019 10:41 am

Yes,

Perhaps see the "od" command (type "man od" for details).

Or, as you are using C/C++, this may be trivial to code by hand.
That is, as you read in the file, hexify the text and split it into frames

User avatar
topguy
Posts: 5674
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: change data type using C/C++

Tue Jun 25, 2019 3:48 pm

I find it unlikely that a system like ZigBee would use such an inefficient method for sending data. Sending "7e" instead of one byte of value 0x7e just wastes half the bandwidth,

Return to “C/C++”