This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

How to generate QR code by self programming
#2
Wow, that would probably be helpful for others, too. Especially because the editor generates rather large files that make offline QR codes impractical as they need to be split into multiple codes. When doing it manually, you can usually fit most things into a single QR code. (BTW: You can strip all the editor:... attributes to save on file size as they are not interpreted by phyphox, but only by the editor when loading the file again, which will most likely never happen from the QR code.)

I did not have the chance to read and try your entire code, but at a first glance, I have the following remarks:
  • Unless there is a problem in phyphox, the error should say something about CRC if that is the problem. I think, you are stuck one step before the CRC is checked. I think that phyphox does not even see the characters "phyphox" at the beginning. (See next item.) What is the exact error message?
  • You encode the entire thing as base64 and store it in a text-based QR code. It needs to be a binary QR code and as far as I know, QR codes have a dedicated encoding mode for binary data. Unless this is done via base64 (which I doubt as it would be very inefficient for how QR codes work and for the already small capacity they provide), this is not the same and you should check the QR code library you use for a method to store binary data instead of a string.
  • Phyphox only accepts zipped data in offline QR codes, so you need to compress it first. (Sorry, the documentation can be read as if this was a suggestion, but it is a requirement.)
  • Endianess can be quite annoying here. I cannot tell from your code without testing, but this has tripped me several times, so you might try switching bytesfor the CRC32 when you get to the point where this just does not want to match.

You can also see the receiving end here, if that helps: https://github.com/phyphox/phyphox-andro...java#L2130

Also, as you might try to compare your results to the one from the editor, be aware that phyphox allows you to strip the header of the zip file. You can only include the binary data, followed by a data descriptor, which is what the editor does. However, this is just a warning that the editor goes one step further - you can include a full zip file and should probably try this first.
Reply


Messages In This Thread
RE: How to generate QR code by self programming - by Sebastian Staacks - 07-15-2021, 11:31 AM

Forum Jump: