3. IMPLEMENTING QR CODE
OVERVIEW
3
"show me the money"
|
+---------------------+
| QR Code Encoder |
+---------------------+
|
v
|
+---------------------+
| QR Code Decoder |
+---------------------+
|
v
"show me the money"
53. IMPLEMENTING QR CODE
IMPLEMENTATION NOTES
▸ Pattern matching
▸ Bitstring manipulation <<>>
▸ Recursion
▸ High order functions: Stream/Enum
▸ Meta programming
53
total loc 670
loc w/o comments 420
54. IMPLEMENTING QR CODE
IMMUTABLE DATA
54
def encode(binary) do
data = QRCode.Encode.encode(binary)
|> QRCode.ReedSolomon.encode()
QRCode.Encode.version(binary)
|> QRCode.Matrix.new()
|> QRCode.Matrix.draw_finder_patterns()
|> QRCode.Matrix.draw_seperators()
|> QRCode.Matrix.draw_alignment_patterns()
|> QRCode.Matrix.draw_timing_patterns()
|> QRCode.Matrix.draw_dark_module()
|> QRCode.Matrix.draw_reserved_format_areas()
|> QRCode.Matrix.draw_reserved_version_areas()
|> QRCode.Matrix.draw_data_with_mask(data)
|> QRCode.Matrix.draw_format_areas()
|> QRCode.Matrix.draw_version_areas()
|> QRCode.Matrix.draw_quite_zone()
end
‣ Encode data
‣ Draw the QR code