rhodes 2.4.1 → 3.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. data/CHANGELOG +7 -0
  2. data/Rakefile +7 -36
  3. data/doc/build.txt +48 -22
  4. data/doc/device-caps.txt +130 -1
  5. data/doc/rhom.txt +9 -3
  6. data/doc/test-log-debug.txt +5 -2
  7. data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +40 -20
  8. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/AUTHORS +58 -0
  9. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/CHANGES +266 -0
  10. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/COPYING +201 -0
  11. data/lib/extensions/barcode/ext/barcode/platform/android/ZXing_Info/README +11 -0
  12. data/lib/extensions/barcode/ext/barcode/platform/android/ext_build.files +173 -0
  13. data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +34 -0
  14. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/BarcodeFormat.java +103 -0
  15. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Binarizer.java +80 -0
  16. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/BinaryBitmap.java +128 -0
  17. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ChecksumException.java +37 -0
  18. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/DecodeHintType.java +79 -0
  19. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/EncodeHintType.java +39 -0
  20. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/FormatException.java +38 -0
  21. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/LuminanceSource.java +113 -0
  22. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/MultiFormatReader.java +166 -0
  23. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/MultiFormatWriter.java +65 -0
  24. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/NotFoundException.java +37 -0
  25. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Reader.java +64 -0
  26. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ReaderException.java +98 -0
  27. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Result.java +143 -0
  28. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultMetadataType.java +109 -0
  29. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultPoint.java +127 -0
  30. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/ResultPointCallback.java +29 -0
  31. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/Writer.java +54 -0
  32. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/WriterException.java +35 -0
  33. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AbstractDoCoMoResultParser.java +39 -0
  34. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookAUResultParser.java +73 -0
  35. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookDoCoMoResultParser.java +85 -0
  36. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/AddressBookParsedResult.java +122 -0
  37. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/BizcardResultParser.java +94 -0
  38. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/BookmarkDoCoMoResultParser.java +46 -0
  39. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/CalendarParsedResult.java +134 -0
  40. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailAddressParsedResult.java +61 -0
  41. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailAddressResultParser.java +64 -0
  42. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/EmailDoCoMoResultParser.java +87 -0
  43. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ExpandedProductParsedResult.java +195 -0
  44. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ExpandedProductResultParser.java +199 -0
  45. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/GeoParsedResult.java +132 -0
  46. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/GeoResultParser.java +77 -0
  47. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ISBNParsedResult.java +39 -0
  48. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ISBNResultParser.java +54 -0
  49. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ParsedResult.java +73 -0
  50. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ParsedResultType.java +53 -0
  51. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ProductParsedResult.java +49 -0
  52. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ProductResultParser.java +66 -0
  53. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/ResultParser.java +319 -0
  54. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSMMSResultParser.java +107 -0
  55. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSParsedResult.java +104 -0
  56. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/SMSTOMMSTOResultParser.java +57 -0
  57. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TelParsedResult.java +54 -0
  58. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TelResultParser.java +44 -0
  59. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/TextParsedResult.java +48 -0
  60. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URIParsedResult.java +113 -0
  61. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URIResultParser.java +87 -0
  62. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/URLTOResultParser.java +47 -0
  63. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/VCardResultParser.java +346 -0
  64. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/VEventResultParser.java +54 -0
  65. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/WifiParsedResult.java +53 -0
  66. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/WifiResultParser.java +50 -0
  67. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/AbstractNDEFResultParser.java +45 -0
  68. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFRecord.java +87 -0
  69. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFSmartPosterParsedResult.java +63 -0
  70. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFSmartPosterResultParser.java +81 -0
  71. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFTextResultParser.java +57 -0
  72. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/result/optional/NDEFURIResultParser.java +95 -0
  73. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitArray.java +247 -0
  74. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitMatrix.java +226 -0
  75. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/BitSource.java +97 -0
  76. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/CharacterSetECI.java +110 -0
  77. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/Collections.java +53 -0
  78. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/Comparator.java +27 -0
  79. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DecoderResult.java +63 -0
  80. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DefaultGridSampler.java +81 -0
  81. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/DetectorResult.java +46 -0
  82. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/ECI.java +52 -0
  83. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/GlobalHistogramBinarizer.java +196 -0
  84. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/GridSampler.java +171 -0
  85. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/HybridBinarizer.java +185 -0
  86. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/PerspectiveTransform.java +148 -0
  87. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/StringUtils.java +191 -0
  88. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/detector/MonochromeRectangleDetector.java +209 -0
  89. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/detector/WhiteRectangleDetector.java +316 -0
  90. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/GF256.java +139 -0
  91. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/GF256Poly.java +263 -0
  92. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonDecoder.java +194 -0
  93. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonEncoder.java +75 -0
  94. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/common/reedsolomon/ReedSolomonException.java +31 -0
  95. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/DataMatrixReader.java +161 -0
  96. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java +446 -0
  97. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/DataBlock.java +118 -0
  98. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java +462 -0
  99. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/Decoder.java +134 -0
  100. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/decoder/Version.java +242 -0
  101. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/datamatrix/detector/Detector.java +348 -0
  102. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/ByQuadrantReader.java +96 -0
  103. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/GenericMultipleBarcodeReader.java +156 -0
  104. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/MultipleBarcodeReader.java +37 -0
  105. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/QRCodeMultiReader.java +80 -0
  106. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/detector/MultiDetector.java +72 -0
  107. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/multi/qrcode/detector/MultiFinderPatternFinder.java +324 -0
  108. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/CodaBarReader.java +263 -0
  109. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code128Reader.java +473 -0
  110. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code128Writer.java +73 -0
  111. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code39Reader.java +333 -0
  112. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code39Writer.java +82 -0
  113. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/Code93Reader.java +273 -0
  114. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN13Reader.java +135 -0
  115. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN13Writer.java +81 -0
  116. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Reader.java +72 -0
  117. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EAN8Writer.java +76 -0
  118. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/EANManufacturerOrgSupport.java +170 -0
  119. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/ITFReader.java +348 -0
  120. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/ITFWriter.java +68 -0
  121. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/MultiFormatOneDReader.java +109 -0
  122. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/MultiFormatUPCEANReader.java +113 -0
  123. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/OneDReader.java +297 -0
  124. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCAReader.java +75 -0
  125. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANExtensionSupport.java +186 -0
  126. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANReader.java +355 -0
  127. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEANWriter.java +104 -0
  128. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/UPCEReader.java +153 -0
  129. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/AbstractRSSReader.java +110 -0
  130. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/DataCharacter.java +37 -0
  131. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/FinderPattern.java +48 -0
  132. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/Pair.java +41 -0
  133. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/RSS14Reader.java +494 -0
  134. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/RSSUtils.java +155 -0
  135. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/BitArrayBuilder.java +85 -0
  136. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/ExpandedPair.java +68 -0
  137. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java +578 -0
  138. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013103decoder.java +47 -0
  139. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01320xDecoder.java +55 -0
  140. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01392xDecoder.java +66 -0
  141. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01393xDecoder.java +76 -0
  142. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0x1xDecoder.java +106 -0
  143. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI013x0xDecoder.java +56 -0
  144. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01AndOtherAIs.java +56 -0
  145. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01decoder.java +81 -0
  146. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AI01weightDecoder.java +58 -0
  147. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AbstractExpandedDecoder.java +85 -0
  148. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoder.java +48 -0
  149. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/BlockParsedResult.java +60 -0
  150. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/CurrentParsingState.java +69 -0
  151. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedChar.java +52 -0
  152. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedInformation.java +63 -0
  153. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedNumeric.java +79 -0
  154. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/DecodedObject.java +44 -0
  155. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/FieldParser.java +285 -0
  156. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/oned/rss/expanded/decoders/GeneralAppIdDecoder.java +414 -0
  157. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/PDF417Reader.java +79 -0
  158. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/BitMatrixParser.java +1163 -0
  159. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java +629 -0
  160. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/decoder/Decoder.java +150 -0
  161. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/pdf417/detector/Detector.java +498 -0
  162. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/QRCodeReader.java +166 -0
  163. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/QRCodeWriter.java +108 -0
  164. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java +203 -0
  165. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DataBlock.java +123 -0
  166. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DataMask.java +155 -0
  167. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/DecodedBitStreamParser.java +261 -0
  168. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Decoder.java +148 -0
  169. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/ErrorCorrectionLevel.java +86 -0
  170. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/FormatInformation.java +171 -0
  171. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Mode.java +112 -0
  172. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/decoder/Version.java +586 -0
  173. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/AlignmentPattern.java +48 -0
  174. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/AlignmentPatternFinder.java +279 -0
  175. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/Detector.java +400 -0
  176. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPattern.java +63 -0
  177. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java +585 -0
  178. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/detector/FinderPatternInfo.java +49 -0
  179. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/BlockPair.java +37 -0
  180. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/ByteMatrix.java +97 -0
  181. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/Encoder.java +557 -0
  182. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/MaskUtil.java +217 -0
  183. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/MatrixUtil.java +524 -0
  184. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/qrcode/encoder/QRCode.java +239 -0
  185. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +63 -0
  186. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/RhoLuminanceSource.java +75 -0
  187. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +74 -318
  188. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +70 -0
  189. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/COPYING +27 -0
  190. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +105 -0
  191. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarHelpController.h +60 -0
  192. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImage.h +69 -0
  193. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImageScanner.h +51 -0
  194. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderController.h +142 -0
  195. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +118 -0
  196. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +100 -0
  197. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +33 -0
  198. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSymbol.h +71 -0
  199. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +1476 -0
  200. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +201 -0
  201. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Exception.h +187 -0
  202. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Image.h +321 -0
  203. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/ImageScanner.h +130 -0
  204. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Processor.h +223 -0
  205. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Scanner.h +162 -0
  206. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +529 -0
  207. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Video.h +170 -0
  208. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Window.h +136 -0
  209. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/LICENSE +504 -0
  210. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/README +59 -0
  211. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-back.png +0 -0
  212. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-help.html +88 -0
  213. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-helpicons.png +0 -0
  214. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Resources/zbar-samples.png +0 -0
  215. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/libzbar.a +0 -0
  216. data/lib/extensions/debugger/debugger.rb +215 -67
  217. data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +1 -1
  218. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +14 -2
  219. data/lib/extensions/timeout/timeout.rb +114 -0
  220. data/lib/framework/rho/render.rb +14 -16
  221. data/lib/framework/rho/rho.rb +38 -14
  222. data/lib/framework/rho/rhoapplication.rb +1 -1
  223. data/lib/framework/rho/rhocontroller.rb +3 -3
  224. data/lib/framework/rho/rhofsconnector.rb +18 -6
  225. data/lib/framework/rho/rhoviewhelpers.rb +1 -1
  226. data/lib/framework/rhoappmanifest.rb +44 -0
  227. data/lib/framework/rhodes.rb +1 -1
  228. data/lib/framework/rhoframework.rb +31 -11
  229. data/lib/framework/rholang/localization_simplified.rb +10 -6
  230. data/lib/framework/rhom/rhom_object_factory.rb +3 -3
  231. data/lib/framework/version.rb +1 -1
  232. data/lib/rhodes.rb +1 -1
  233. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  234. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +32 -8
  235. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +21 -21
  236. data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +1 -0
  237. data/platform/android/Rhodes/jni/src/rhodes.cpp +21 -9
  238. data/platform/android/Rhodes/jni/src/sslimpl.cpp +1 -0
  239. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +7 -6
  240. data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +19 -1
  241. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +2 -2
  242. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +24 -15
  243. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +39 -47
  244. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +113 -106
  245. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +11 -0
  246. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/StatusNotification.java +49 -0
  247. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +1 -1
  248. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +5 -1
  249. data/platform/android/build/RhodesSRC_build.files +1 -0
  250. data/platform/android/build/android.rake +93 -6
  251. data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -4
  252. data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +10 -0
  253. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -15
  254. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
  255. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +21 -19
  256. data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +2 -2
  257. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +6 -1
  258. data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +10 -3
  259. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -1
  260. data/platform/iphone/Classes/SimpleMainView.m +5 -5
  261. data/platform/iphone/Info.plist +1 -1
  262. data/platform/iphone/rbuild/iphone.rake +30 -1
  263. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
  264. data/platform/shared/SyncClient/SyncClient.cpp +136 -20
  265. data/platform/shared/SyncClient/SyncClient.h +17 -0
  266. data/platform/shared/common/AppMenu.cpp +6 -1
  267. data/platform/shared/common/RhoConf.cpp +13 -1
  268. data/platform/shared/common/RhoConf.h +3 -1
  269. data/platform/shared/common/RhoDefs.h +10 -0
  270. data/platform/shared/common/RhoFile.cpp +15 -0
  271. data/platform/shared/common/RhoFile.h +1 -0
  272. data/platform/shared/common/RhodesApp.cpp +16 -3
  273. data/platform/shared/common/RhodesApp.h +1 -0
  274. data/platform/shared/common/RhodesAppBase.cpp +102 -62
  275. data/platform/shared/common/RhodesAppBase.h +7 -1
  276. data/platform/shared/curl/lib/rhossl.c +1 -0
  277. data/platform/shared/db/DBAdapter.cpp +14 -2
  278. data/platform/shared/logging/RhoLogConf.cpp +21 -0
  279. data/platform/shared/logging/RhoLogConf.h +11 -0
  280. data/platform/shared/logging/RhoLogSink.cpp +24 -0
  281. data/platform/shared/logging/RhoLogSink.h +20 -1
  282. data/platform/shared/net/HttpServer.cpp +8 -6
  283. data/platform/shared/net/RawSocket.cpp +130 -0
  284. data/platform/shared/net/RawSocket.h +74 -0
  285. data/platform/shared/ruby/ext/rho/rhoruby.c +37 -1
  286. data/platform/shared/ruby/ext/rho/rhosupport.c +74 -21
  287. data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +9 -1
  288. data/platform/shared/ruby/vm_eval.c +4 -3
  289. data/platform/shared/sync/SyncEngine.cpp +11 -12
  290. data/platform/shared/sync/SyncEngine.h +2 -2
  291. data/platform/shared/sync/SyncNotify.cpp +41 -13
  292. data/platform/shared/sync/SyncNotify.h +20 -3
  293. data/platform/shared/sync/SyncSource.cpp +21 -19
  294. data/platform/shared/sync/SyncThread.cpp +11 -1
  295. data/platform/shared/sync/SyncThread.h +3 -0
  296. data/platform/shared/test/test_helper.cpp +7 -0
  297. data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
  298. data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
  299. data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
  300. data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
  301. data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
  302. data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
  303. data/platform/win32/RhoSimulator/rhosimulator.exe +0 -0
  304. data/platform/wm/RhoLib/RhoLib.vcproj +762 -14
  305. data/platform/wm/build/wm.rake +87 -10
  306. data/platform/wm/rhodes.sln +155 -72
  307. data/platform/wm/rhodes/MainWindow.cpp +5 -2
  308. data/platform/wm/rhodes/MainWindow.h +9 -1
  309. data/platform/wm/rhodes/RhoNativeViewManager.cpp +4 -0
  310. data/platform/wm/rhodes/Rhodes.cpp +60 -6
  311. data/platform/wm/rhodes/emulator/ExternalWebView.cpp +20 -0
  312. data/platform/wm/rhodes/emulator/ExternalWebView.h +23 -0
  313. data/platform/wm/rhodes/emulator/ExternalWebView.ui +46 -0
  314. data/platform/wm/rhodes/emulator/MainWindowCallback.h +18 -0
  315. data/platform/wm/rhodes/emulator/MainWindowProxy.cpp +268 -0
  316. data/platform/wm/rhodes/emulator/MainWindowProxy.h +34 -0
  317. data/platform/wm/rhodes/emulator/MainWindowQt.cpp +345 -0
  318. data/platform/wm/rhodes/emulator/MainWindowQt.h +118 -0
  319. data/platform/wm/rhodes/emulator/NativeToolbarQt.cpp +57 -0
  320. data/platform/wm/rhodes/emulator/NativeToolbarQt.h +52 -0
  321. data/platform/wm/rhodes/emulator/QtMainWindow.cpp +219 -0
  322. data/platform/wm/rhodes/emulator/QtMainWindow.h +62 -0
  323. data/platform/wm/rhodes/emulator/QtMainWindow.ui +122 -0
  324. data/platform/wm/rhodes/{RhoCryptImpl.cpp → rho/common/RhoCryptImpl.cpp} +0 -0
  325. data/platform/wm/rhodes/{RhoCryptImpl.h → rho/common/RhoCryptImpl.h} +0 -0
  326. data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +2 -86
  327. data/platform/wm/rhodes/rho/rubyext/NativeToolbarExt.cpp +87 -0
  328. data/platform/wm/rhodes/rho/rubyext/NativeToolbarExt.h +6 -0
  329. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +60 -0
  330. data/platform/wm/rhodes/rhodes.vcproj +4025 -365
  331. data/platform/wm/rhodes/signature/Signature.cpp +29 -13
  332. data/platform/wm/rubylib/rubylib.vcproj +1167 -195
  333. data/platform/wm/shttpd/shttpd.vcproj +4 -4
  334. data/platform/wm/sqlite3/sqlite3.vcproj +441 -13
  335. data/platform/wm/syncengine/syncengine.vcproj +443 -15
  336. data/platform/wm/tcmalloc/tcmalloc.vcproj +0 -154
  337. data/platform/wm/tools/detool/LogServer.cpp +150 -0
  338. data/platform/wm/tools/detool/LogServer.h +23 -0
  339. data/platform/wm/tools/detool/detool.cpp +42 -4
  340. data/platform/wm/tools/detool/detool.vcproj +10 -1
  341. data/platform/wp7/IronRuby/Bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
  342. data/platform/wp7/IronRuby/Bin/Silverlight3Release/IronRuby.dll +0 -0
  343. data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
  344. data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
  345. data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Scripting.dll +0 -0
  346. data/platform/wp7/RhoAppRunner/Program.cs +20 -3
  347. data/platform/wp7/RhoLogServer/Program.cs +22 -0
  348. data/platform/wp7/RhoLogServer/Properties/AssemblyInfo.cs +36 -0
  349. data/platform/wp7/RhoLogServer/RhoLogServer.csproj +65 -0
  350. data/platform/wp7/RhoLogServer/SocketServer.cs +210 -0
  351. data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +6 -0
  352. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +3 -2
  353. data/platform/wp7/RhoRubyLib/RhoRuby.cs +82 -0
  354. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +7 -5
  355. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +1 -1
  356. data/platform/wp7/RhoRubyLib/common/RhoParams.cs +1 -1
  357. data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +4 -1
  358. data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +2 -2
  359. data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +1 -1
  360. data/platform/wp7/RhoRubyLib/logging/RhoEmptyLogger.cs +30 -0
  361. data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +10 -0
  362. data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +6 -1
  363. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +56 -0
  364. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +24 -11
  365. data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +57 -14
  366. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +32 -9
  367. data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +7 -0
  368. data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +6 -0
  369. data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +20 -16
  370. data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +2 -2
  371. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +138 -40
  372. data/platform/wp7/WPApplication/rho/apps/app/layout.erb +3 -1
  373. data/platform/wp7/build/wp.rake +151 -12
  374. data/platform/wp7/rhodes.sln +10 -0
  375. data/platform/wp7/rhodes/App.xaml.cs +6 -0
  376. data/platform/wp7/rhodes/MainPage.xaml +3 -0
  377. data/platform/wp7/rhodes/MainPage.xaml.cs +19 -0
  378. data/platform/wp7/rhodes/Rhodes.csproj +4 -2
  379. data/rakefile.rb +7 -36
  380. data/res/build-tools/RhoAppRunner.exe +0 -0
  381. data/res/build-tools/RhoLogServer.exe +0 -0
  382. data/res/build-tools/detool.exe +0 -0
  383. data/res/build-tools/wp7explorer.exe +0 -0
  384. data/res/generators/templates/application/app/layout.erb +3 -1
  385. data/res/generators/templates/application/public/jqtouch/jqtouch.js +1 -1
  386. data/rhodes.gemspec +1 -1
  387. data/spec/framework_spec/app/layout.erb +1 -1
  388. data/spec/framework_spec/build.yml +1 -0
  389. data/spec/perfomance_spec/app/layout.erb +3 -0
  390. data/spec/phone_spec/app/Account_s/account_s.rb +4 -1
  391. data/spec/phone_spec/app/spec/rhom_object_spec.rb +30 -1
  392. data/spec/phone_spec/app/spec_runner.rb +1 -1
  393. data/spec/phone_spec/build.yml +4 -1
  394. metadata +262 -10
  395. data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/ConsoleStream.cs +0 -107
@@ -0,0 +1,118 @@
1
+ //------------------------------------------------------------------------
2
+ // Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
3
+ //
4
+ // This file is part of the ZBar Bar Code Reader.
5
+ //
6
+ // The ZBar Bar Code Reader is free software; you can redistribute it
7
+ // and/or modify it under the terms of the GNU Lesser Public License as
8
+ // published by the Free Software Foundation; either version 2.1 of
9
+ // the License, or (at your option) any later version.
10
+ //
11
+ // The ZBar Bar Code Reader is distributed in the hope that it will be
12
+ // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13
+ // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU Lesser Public License for more details.
15
+ //
16
+ // You should have received a copy of the GNU Lesser Public License
17
+ // along with the ZBar Bar Code Reader; if not, write to the Free
18
+ // Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19
+ // Boston, MA 02110-1301 USA
20
+ //
21
+ // http://sourceforge.net/projects/zbar
22
+ //------------------------------------------------------------------------
23
+
24
+ #import <UIKit/UIKit.h>
25
+ #import "ZBarImageScanner.h"
26
+
27
+ @class AVCaptureSession, AVCaptureDevice;
28
+ @class CALayer;
29
+ @class ZBarImageScanner, ZBarCaptureReader, ZBarReaderView;
30
+
31
+ // delegate is notified of decode results.
32
+
33
+ @protocol ZBarReaderViewDelegate < NSObject >
34
+
35
+ - (void) readerView: (ZBarReaderView*) readerView
36
+ didReadSymbols: (ZBarSymbolSet*) symbols
37
+ fromImage: (UIImage*) image;
38
+
39
+ @end
40
+
41
+ // read barcodes from the displayed video preview. the view maintains
42
+ // a complete video capture session feeding a ZBarCaptureReader and
43
+ // presents the associated preview with symbol tracking annotations.
44
+
45
+ @interface ZBarReaderView
46
+ : UIView
47
+ {
48
+ id<ZBarReaderViewDelegate> readerDelegate;
49
+ CGRect scanCrop, zoomCrop;
50
+ CGAffineTransform previewTransform;
51
+ CGFloat zoom, zoom0;
52
+ BOOL tracksSymbols, showsFPS;
53
+ NSInteger torchMode;
54
+
55
+ CALayer *preview, *overlay, *tracking;
56
+ UIView *fpsView;
57
+ UILabel *fpsLabel;
58
+ UIPinchGestureRecognizer *pinch;
59
+ CGFloat imageScale;
60
+ BOOL started, running;
61
+ }
62
+
63
+ // supply a pre-configured image scanner.
64
+ - (id) initWithImageScanner: (ZBarImageScanner*) imageScanner;
65
+
66
+ // start the video stream and barcode reader.
67
+ - (void) start;
68
+
69
+ // stop the video stream and barcode reader.
70
+ - (void) stop;
71
+
72
+ // clear the internal result cache
73
+ - (void) flushCache;
74
+
75
+ // delegate is notified of decode results.
76
+ @property (nonatomic, assign) id<ZBarReaderViewDelegate> readerDelegate;
77
+
78
+ // access to image scanner for configuration.
79
+ @property (nonatomic, readonly) ZBarImageScanner *scanner;
80
+
81
+ // whether to display the tracking annotation for uncertain barcodes
82
+ // (default YES).
83
+ @property (nonatomic) BOOL tracksSymbols;
84
+
85
+ // enable pinch gesture recognition for zooming the preview/decode
86
+ // (default YES).
87
+ @property (nonatomic) BOOL allowsPinchZoom;
88
+
89
+ // torch mode to set automatically (default Auto).
90
+ @property (nonatomic) NSInteger torchMode;
91
+
92
+ // whether to display the frame rate for debug/configuration
93
+ // (default NO).
94
+ @property (nonatomic) BOOL showsFPS;
95
+
96
+ // zoom scale factor applied to video preview *and* scanCrop.
97
+ // also updated by pinch-zoom gesture. clipped to range [1,2],
98
+ // defaults to 1.25
99
+ @property (nonatomic) CGFloat zoom;
100
+
101
+ // the region of the image that will be scanned. normalized coordinates.
102
+ @property (nonatomic) CGRect scanCrop;
103
+
104
+ // additional transform applied to video preview.
105
+ // (NB *not* applied to scan crop)
106
+ @property (nonatomic) CGAffineTransform previewTransform;
107
+
108
+ // specify an alternate capture device.
109
+ @property (nonatomic, retain) AVCaptureDevice *device;
110
+
111
+ // direct access to the capture session. warranty void if opened...
112
+ @property (nonatomic, readonly) AVCaptureSession *session;
113
+ @property (nonatomic, readonly) ZBarCaptureReader *captureReader;
114
+
115
+ // this flag still works, but its use is deprecated
116
+ @property (nonatomic) BOOL enableCache;
117
+
118
+ @end
@@ -0,0 +1,100 @@
1
+ //------------------------------------------------------------------------
2
+ // Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
3
+ //
4
+ // This file is part of the ZBar Bar Code Reader.
5
+ //
6
+ // The ZBar Bar Code Reader is free software; you can redistribute it
7
+ // and/or modify it under the terms of the GNU Lesser Public License as
8
+ // published by the Free Software Foundation; either version 2.1 of
9
+ // the License, or (at your option) any later version.
10
+ //
11
+ // The ZBar Bar Code Reader is distributed in the hope that it will be
12
+ // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13
+ // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU Lesser Public License for more details.
15
+ //
16
+ // You should have received a copy of the GNU Lesser Public License
17
+ // along with the ZBar Bar Code Reader; if not, write to the Free
18
+ // Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19
+ // Boston, MA 02110-1301 USA
20
+ //
21
+ // http://sourceforge.net/projects/zbar
22
+ //------------------------------------------------------------------------
23
+
24
+ #import <UIKit/UIKit.h>
25
+ #import "ZBarReaderController.h"
26
+
27
+ @class ZBarReaderView;
28
+
29
+ // drop in video scanning replacement for ZBarReaderController.
30
+ // this is a thin controller around a ZBarReaderView that adds the UI
31
+ // controls and select functionality offered by ZBarReaderController.
32
+ // Automatically falls back to a ZBarReaderController if video APIs
33
+ // are unavailable (eg for OS < 4.0)
34
+
35
+ @interface ZBarReaderViewController
36
+ : UIViewController
37
+ {
38
+ ZBarImageScanner *scanner;
39
+ id <ZBarReaderDelegate> readerDelegate;
40
+ ZBarReaderView *readerView;
41
+ UIView *cameraOverlayView;
42
+ CGAffineTransform cameraViewTransform;
43
+ CGRect scanCrop;
44
+ BOOL showsZBarControls, tracksSymbols, enableCache;
45
+
46
+ UIView *controls;
47
+ BOOL didHideStatusBar;
48
+ }
49
+
50
+ // access to configure image scanner
51
+ @property (nonatomic, readonly) ZBarImageScanner *scanner;
52
+
53
+ // barcode result recipient
54
+ @property (nonatomic, assign) id <ZBarReaderDelegate> readerDelegate;
55
+
56
+ // whether to use alternate control set
57
+ @property (nonatomic) BOOL showsZBarControls;
58
+
59
+ // whether to show the green tracking box. note that, even when
60
+ // enabled, the box will only be visible when scanning EAN and I2/5.
61
+ @property (nonatomic) BOOL tracksSymbols;
62
+
63
+ // crop images for scanning. the image will be cropped to this
64
+ // rectangle before scanning. the rectangle is normalized to the
65
+ // image size and aspect ratio; useful values will place the rectangle
66
+ // between 0 and 1 on each axis, where the x-axis corresponds to the
67
+ // image major axis. defaults to the full image (0, 0, 1, 1).
68
+ @property (nonatomic) CGRect scanCrop;
69
+
70
+ // provide a custom overlay. note that this can be used with
71
+ // showsZBarControls enabled (but not if you want backward compatibility)
72
+ @property (nonatomic, retain) UIView *cameraOverlayView;
73
+
74
+ // transform applied to the preview image.
75
+ @property (nonatomic) CGAffineTransform cameraViewTransform;
76
+
77
+ // display the built-in help browser. the argument will be passed to
78
+ // the onZBarHelp() javascript function.
79
+ - (void) showHelpWithReason: (NSString*) reason;
80
+
81
+ // direct access to the ZBarReaderView
82
+ @property (nonatomic, readonly) ZBarReaderView *readerView;
83
+
84
+ // this flag still works, but its use is deprecated
85
+ @property (nonatomic) BOOL enableCache;
86
+
87
+ // these are present only for backward compatibility.
88
+ // they will error if inappropriate/unsupported values are set
89
+ @property (nonatomic) UIImagePickerControllerSourceType sourceType; // Camera
90
+ @property (nonatomic) BOOL allowsEditing; // NO
91
+ @property (nonatomic) BOOL allowsImageEditing; // NO
92
+ @property (nonatomic) BOOL showsCameraControls; // NO
93
+ @property (nonatomic) BOOL showsHelpOnFail; // ignored
94
+ @property (nonatomic) ZBarReaderControllerCameraMode cameraMode; // Sampling
95
+ @property (nonatomic) BOOL takesPicture; // NO
96
+ @property (nonatomic) NSInteger maxScanDimension; // ignored
97
+
98
+ + (BOOL) isSourceTypeAvailable: (UIImagePickerControllerSourceType) sourceType;
99
+
100
+ @end
@@ -0,0 +1,33 @@
1
+ /*------------------------------------------------------------------------
2
+ * Copyright 2010 (c) Jeff Brown <spadix@users.sourceforge.net>
3
+ *
4
+ * This file is part of the ZBar Bar Code Reader.
5
+ *
6
+ * The ZBar Bar Code Reader is free software; you can redistribute it
7
+ * and/or modify it under the terms of the GNU Lesser Public License as
8
+ * published by the Free Software Foundation; either version 2.1 of
9
+ * the License, or (at your option) any later version.
10
+ *
11
+ * The ZBar Bar Code Reader is distributed in the hope that it will be
12
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU Lesser Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser Public License
17
+ * along with the ZBar Bar Code Reader; if not, write to the Free
18
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19
+ * Boston, MA 02110-1301 USA
20
+ *
21
+ * http://sourceforge.net/projects/zbar
22
+ *------------------------------------------------------------------------*/
23
+
24
+ #import "zbar.h"
25
+
26
+ #import "ZBarSymbol.h"
27
+ #import "ZBarImage.h"
28
+ #import "ZBarImageScanner.h"
29
+ #import "ZBarReaderView.h"
30
+ #import "ZBarReaderViewController.h"
31
+ #import "ZBarReaderController.h"
32
+ #import "ZBarCaptureReader.h"
33
+ #import "ZBarHelpController.h"
@@ -0,0 +1,71 @@
1
+ //------------------------------------------------------------------------
2
+ // Copyright 2009-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
3
+ //
4
+ // This file is part of the ZBar Bar Code Reader.
5
+ //
6
+ // The ZBar Bar Code Reader is free software; you can redistribute it
7
+ // and/or modify it under the terms of the GNU Lesser Public License as
8
+ // published by the Free Software Foundation; either version 2.1 of
9
+ // the License, or (at your option) any later version.
10
+ //
11
+ // The ZBar Bar Code Reader is distributed in the hope that it will be
12
+ // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13
+ // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU Lesser Public License for more details.
15
+ //
16
+ // You should have received a copy of the GNU Lesser Public License
17
+ // along with the ZBar Bar Code Reader; if not, write to the Free
18
+ // Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19
+ // Boston, MA 02110-1301 USA
20
+ //
21
+ // http://sourceforge.net/projects/zbar
22
+ //------------------------------------------------------------------------
23
+
24
+ #import <Foundation/Foundation.h>
25
+ #import <CoreGraphics/CoreGraphics.h>
26
+ #import "zbar.h"
27
+
28
+ #ifdef __cplusplus
29
+ using namespace zbar;
30
+ #endif
31
+
32
+ // Obj-C wrapper for ZBar result types
33
+
34
+ @interface ZBarSymbolSet
35
+ : NSObject <NSFastEnumeration>
36
+ {
37
+ const zbar_symbol_set_t *set;
38
+ BOOL filterSymbols;
39
+ }
40
+
41
+ @property (readonly, nonatomic) int count;
42
+ @property (readonly, nonatomic) const zbar_symbol_set_t *zbarSymbolSet;
43
+ @property (nonatomic) BOOL filterSymbols;
44
+
45
+ - (id) initWithSymbolSet: (const zbar_symbol_set_t*) set;
46
+
47
+ @end
48
+
49
+
50
+ @interface ZBarSymbol : NSObject
51
+ {
52
+ const zbar_symbol_t *symbol;
53
+ }
54
+
55
+ @property (readonly, nonatomic) zbar_symbol_type_t type;
56
+ @property (readonly, nonatomic) NSString *typeName;
57
+ @property (readonly, nonatomic) NSUInteger configMask;
58
+ @property (readonly, nonatomic) NSUInteger modifierMask;
59
+ @property (readonly, nonatomic) NSString *data;
60
+ @property (readonly, nonatomic) int quality;
61
+ @property (readonly, nonatomic) int count;
62
+ @property (readonly, nonatomic) zbar_orientation_t orientation;
63
+ @property (readonly, nonatomic) ZBarSymbolSet *components;
64
+ @property (readonly, nonatomic) const zbar_symbol_t *zbarSymbol;
65
+ @property (readonly, nonatomic) CGRect bounds;
66
+
67
+ - (id) initWithSymbol: (const zbar_symbol_t*) symbol;
68
+
69
+ + (NSString*) nameForType: (zbar_symbol_type_t) type;
70
+
71
+ @end
@@ -0,0 +1,1476 @@
1
+ /*------------------------------------------------------------------------
2
+ * Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
3
+ *
4
+ * This file is part of the ZBar Bar Code Reader.
5
+ *
6
+ * The ZBar Bar Code Reader is free software; you can redistribute it
7
+ * and/or modify it under the terms of the GNU Lesser Public License as
8
+ * published by the Free Software Foundation; either version 2.1 of
9
+ * the License, or (at your option) any later version.
10
+ *
11
+ * The ZBar Bar Code Reader is distributed in the hope that it will be
12
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU Lesser Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser Public License
17
+ * along with the ZBar Bar Code Reader; if not, write to the Free
18
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19
+ * Boston, MA 02110-1301 USA
20
+ *
21
+ * http://sourceforge.net/projects/zbar
22
+ *------------------------------------------------------------------------*/
23
+ #ifndef _ZBAR_H_
24
+ #define _ZBAR_H_
25
+
26
+ /** @file
27
+ * ZBar Barcode Reader C API definition
28
+ */
29
+
30
+ /** @mainpage
31
+ *
32
+ * interface to the barcode reader is available at several levels.
33
+ * most applications will want to use the high-level interfaces:
34
+ *
35
+ * @section high-level High-Level Interfaces
36
+ *
37
+ * these interfaces wrap all library functionality into an easy-to-use
38
+ * package for a specific toolkit:
39
+ * - the "GTK+ 2.x widget" may be used with GTK GUI applications. a
40
+ * Python wrapper is included for PyGtk
41
+ * - the @ref zbar::QZBar "Qt4 widget" may be used with Qt GUI
42
+ * applications
43
+ * - the Processor interface (in @ref c-processor "C" or @ref
44
+ * zbar::Processor "C++") adds a scanning window to an application
45
+ * with no GUI.
46
+ *
47
+ * @section mid-level Intermediate Interfaces
48
+ *
49
+ * building blocks used to construct high-level interfaces:
50
+ * - the ImageScanner (in @ref c-imagescanner "C" or @ref
51
+ * zbar::ImageScanner "C++") looks for barcodes in a library defined
52
+ * image object
53
+ * - the Window abstraction (in @ref c-window "C" or @ref
54
+ * zbar::Window "C++") sinks library images, displaying them on the
55
+ * platform display
56
+ * - the Video abstraction (in @ref c-video "C" or @ref zbar::Video
57
+ * "C++") sources library images from a video device
58
+ *
59
+ * @section low-level Low-Level Interfaces
60
+ *
61
+ * direct interaction with barcode scanning and decoding:
62
+ * - the Scanner (in @ref c-scanner "C" or @ref zbar::Scanner "C++")
63
+ * looks for barcodes in a linear intensity sample stream
64
+ * - the Decoder (in @ref c-decoder "C" or @ref zbar::Decoder "C++")
65
+ * extracts barcodes from a stream of bar and space widths
66
+ */
67
+
68
+ #ifdef __cplusplus
69
+
70
+ /** C++ namespace for library interfaces */
71
+ namespace zbar {
72
+ extern "C" {
73
+ #endif
74
+
75
+
76
+ /** @name Global library interfaces */
77
+ /*@{*/
78
+
79
+ /** "color" of element: bar or space. */
80
+ typedef enum zbar_color_e {
81
+ ZBAR_SPACE = 0, /**< light area or space between bars */
82
+ ZBAR_BAR = 1, /**< dark area or colored bar segment */
83
+ } zbar_color_t;
84
+
85
+ /** decoded symbol type. */
86
+ typedef enum zbar_symbol_type_e {
87
+ ZBAR_NONE = 0, /**< no symbol decoded */
88
+ ZBAR_PARTIAL = 1, /**< intermediate status */
89
+ ZBAR_EAN8 = 8, /**< EAN-8 */
90
+ ZBAR_UPCE = 9, /**< UPC-E */
91
+ ZBAR_ISBN10 = 10, /**< ISBN-10 (from EAN-13). @since 0.4 */
92
+ ZBAR_UPCA = 12, /**< UPC-A */
93
+ ZBAR_EAN13 = 13, /**< EAN-13 */
94
+ ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). @since 0.4 */
95
+ ZBAR_I25 = 25, /**< Interleaved 2 of 5. @since 0.4 */
96
+ ZBAR_DATABAR = 34, /**< GS1 DataBar (RSS). @since 0.11 */
97
+ ZBAR_DATABAR_EXP = 35, /**< GS1 DataBar Expanded. @since 0.11 */
98
+ ZBAR_CODE39 = 39, /**< Code 39. @since 0.4 */
99
+ ZBAR_PDF417 = 57, /**< PDF417. @since 0.6 */
100
+ ZBAR_QRCODE = 64, /**< QR Code. @since 0.10 */
101
+ ZBAR_CODE93 = 93, /**< Code 93. @since 0.11 */
102
+ ZBAR_CODE128 = 128, /**< Code 128 */
103
+ ZBAR_SYMBOL = 0x00ff, /**< mask for base symbol type */
104
+ ZBAR_ADDON2 = 0x0200, /**< 2-digit add-on flag */
105
+ ZBAR_ADDON5 = 0x0500, /**< 5-digit add-on flag */
106
+ ZBAR_ADDON = 0x0700, /**< add-on flag mask */
107
+ } zbar_symbol_type_t;
108
+
109
+ /** decoded symbol coarse orientation.
110
+ * @since 0.11
111
+ */
112
+ typedef enum zbar_orientation_e {
113
+ ZBAR_ORIENT_UNKNOWN = -1, /**< unable to determine orientation */
114
+ ZBAR_ORIENT_UP, /**< upright, read left to right */
115
+ ZBAR_ORIENT_RIGHT, /**< sideways, read top to bottom */
116
+ ZBAR_ORIENT_DOWN, /**< upside-down, read right to left */
117
+ ZBAR_ORIENT_LEFT, /**< sideways, read bottom to top */
118
+ } zbar_orientation_t;
119
+
120
+ /** error codes. */
121
+ typedef enum zbar_error_e {
122
+ ZBAR_OK = 0, /**< no error */
123
+ ZBAR_ERR_NOMEM, /**< out of memory */
124
+ ZBAR_ERR_INTERNAL, /**< internal library error */
125
+ ZBAR_ERR_UNSUPPORTED, /**< unsupported request */
126
+ ZBAR_ERR_INVALID, /**< invalid request */
127
+ ZBAR_ERR_SYSTEM, /**< system error */
128
+ ZBAR_ERR_LOCKING, /**< locking error */
129
+ ZBAR_ERR_BUSY, /**< all resources busy */
130
+ ZBAR_ERR_XDISPLAY, /**< X11 display error */
131
+ ZBAR_ERR_XPROTO, /**< X11 protocol error */
132
+ ZBAR_ERR_CLOSED, /**< output window is closed */
133
+ ZBAR_ERR_WINAPI, /**< windows system error */
134
+ ZBAR_ERR_NUM /**< number of error codes */
135
+ } zbar_error_t;
136
+
137
+ /** decoder configuration options.
138
+ * @since 0.4
139
+ */
140
+ typedef enum zbar_config_e {
141
+ ZBAR_CFG_ENABLE = 0, /**< enable symbology/feature */
142
+ ZBAR_CFG_ADD_CHECK, /**< enable check digit when optional */
143
+ ZBAR_CFG_EMIT_CHECK, /**< return check digit when present */
144
+ ZBAR_CFG_ASCII, /**< enable full ASCII character set */
145
+ ZBAR_CFG_NUM, /**< number of boolean decoder configs */
146
+
147
+ ZBAR_CFG_MIN_LEN = 0x20, /**< minimum data length for valid decode */
148
+ ZBAR_CFG_MAX_LEN, /**< maximum data length for valid decode */
149
+
150
+ ZBAR_CFG_UNCERTAINTY = 0x40,/**< required video consistency frames */
151
+
152
+ ZBAR_CFG_POSITION = 0x80, /**< enable scanner to collect position data */
153
+
154
+ ZBAR_CFG_X_DENSITY = 0x100, /**< image scanner vertical scan density */
155
+ ZBAR_CFG_Y_DENSITY, /**< image scanner horizontal scan density */
156
+ } zbar_config_t;
157
+
158
+ /** decoder symbology modifier flags.
159
+ * @since 0.11
160
+ */
161
+ typedef enum zbar_modifier_e {
162
+ /** barcode tagged as GS1 (EAN.UCC) reserved
163
+ * (eg, FNC1 before first data character).
164
+ * data may be parsed as a sequence of GS1 AIs
165
+ */
166
+ ZBAR_MOD_GS1 = 0,
167
+
168
+ /** barcode tagged as AIM reserved
169
+ * (eg, FNC1 after first character or digit pair)
170
+ */
171
+ ZBAR_MOD_AIM,
172
+
173
+ /** number of modifiers */
174
+ ZBAR_MOD_NUM,
175
+ } zbar_modifier_t;
176
+
177
+ /** retrieve runtime library version information.
178
+ * @param major set to the running major version (unless NULL)
179
+ * @param minor set to the running minor version (unless NULL)
180
+ * @returns 0
181
+ */
182
+ extern int zbar_version(unsigned *major,
183
+ unsigned *minor);
184
+
185
+ /** set global library debug level.
186
+ * @param verbosity desired debug level. higher values create more spew
187
+ */
188
+ extern void zbar_set_verbosity(int verbosity);
189
+
190
+ /** increase global library debug level.
191
+ * eg, for -vvvv
192
+ */
193
+ extern void zbar_increase_verbosity(void);
194
+
195
+ /** retrieve string name for symbol encoding.
196
+ * @param sym symbol type encoding
197
+ * @returns the static string name for the specified symbol type,
198
+ * or "UNKNOWN" if the encoding is not recognized
199
+ */
200
+ extern const char *zbar_get_symbol_name(zbar_symbol_type_t sym);
201
+
202
+ /** retrieve string name for addon encoding.
203
+ * @param sym symbol type encoding
204
+ * @returns static string name for any addon, or the empty string
205
+ * if no addons were decoded
206
+ */
207
+ extern const char *zbar_get_addon_name(zbar_symbol_type_t sym);
208
+
209
+ /** retrieve string name for configuration setting.
210
+ * @param config setting to name
211
+ * @returns static string name for config,
212
+ * or the empty string if value is not a known config
213
+ */
214
+ extern const char *zbar_get_config_name(zbar_config_t config);
215
+
216
+ /** retrieve string name for modifier.
217
+ * @param modifier flag to name
218
+ * @returns static string name for modifier,
219
+ * or the empty string if the value is not a known flag
220
+ */
221
+ extern const char *zbar_get_modifier_name(zbar_modifier_t modifier);
222
+
223
+ /** retrieve string name for orientation.
224
+ * @param orientation orientation encoding
225
+ * @returns the static string name for the specified orientation,
226
+ * or "UNKNOWN" if the orientation is not recognized
227
+ * @since 0.11
228
+ */
229
+ extern const char *zbar_get_orientation_name(zbar_orientation_t orientation);
230
+
231
+ /** parse a configuration string of the form "[symbology.]config[=value]".
232
+ * the config must match one of the recognized names.
233
+ * the symbology, if present, must match one of the recognized names.
234
+ * if symbology is unspecified, it will be set to 0.
235
+ * if value is unspecified it will be set to 1.
236
+ * @returns 0 if the config is parsed successfully, 1 otherwise
237
+ * @since 0.4
238
+ */
239
+ extern int zbar_parse_config(const char *config_string,
240
+ zbar_symbol_type_t *symbology,
241
+ zbar_config_t *config,
242
+ int *value);
243
+
244
+ /** consistently compute fourcc values across architectures
245
+ * (adapted from v4l2 specification)
246
+ * @since 0.11
247
+ */
248
+ #define zbar_fourcc(a, b, c, d) \
249
+ ((unsigned long)(a) | \
250
+ ((unsigned long)(b) << 8) | \
251
+ ((unsigned long)(c) << 16) | \
252
+ ((unsigned long)(d) << 24))
253
+
254
+ /** parse a fourcc string into its encoded integer value.
255
+ * @since 0.11
256
+ */
257
+ static inline unsigned long zbar_fourcc_parse (const char *format)
258
+ {
259
+ unsigned long fourcc = 0;
260
+ if(format) {
261
+ int i;
262
+ for(i = 0; i < 4 && format[i]; i++)
263
+ fourcc |= ((unsigned long)format[i]) << (i * 8);
264
+ }
265
+ return(fourcc);
266
+ }
267
+
268
+ /** @internal type unsafe error API (don't use) */
269
+ extern int _zbar_error_spew(const void *object,
270
+ int verbosity);
271
+ extern const char *_zbar_error_string(const void *object,
272
+ int verbosity);
273
+ extern zbar_error_t _zbar_get_error_code(const void *object);
274
+
275
+ /*@}*/
276
+
277
+ struct zbar_symbol_s;
278
+ typedef struct zbar_symbol_s zbar_symbol_t;
279
+
280
+ struct zbar_symbol_set_s;
281
+ typedef struct zbar_symbol_set_s zbar_symbol_set_t;
282
+
283
+
284
+ /*------------------------------------------------------------*/
285
+ /** @name Symbol interface
286
+ * decoded barcode symbol result object. stores type, data, and image
287
+ * location of decoded symbol. all memory is owned by the library
288
+ */
289
+ /*@{*/
290
+
291
+ /** @typedef zbar_symbol_t
292
+ * opaque decoded symbol object.
293
+ */
294
+
295
+ /** symbol reference count manipulation.
296
+ * increment the reference count when you store a new reference to the
297
+ * symbol. decrement when the reference is no longer used. do not
298
+ * refer to the symbol once the count is decremented and the
299
+ * containing image has been recycled or destroyed.
300
+ * @note the containing image holds a reference to the symbol, so you
301
+ * only need to use this if you keep a symbol after the image has been
302
+ * destroyed or reused.
303
+ * @since 0.9
304
+ */
305
+ extern void zbar_symbol_ref(const zbar_symbol_t *symbol,
306
+ int refs);
307
+
308
+ /** retrieve type of decoded symbol.
309
+ * @returns the symbol type
310
+ */
311
+ extern zbar_symbol_type_t zbar_symbol_get_type(const zbar_symbol_t *symbol);
312
+
313
+ /** retrieve symbology boolean config settings.
314
+ * @returns a bitmask indicating which configs were set for the detected
315
+ * symbology during decoding.
316
+ * @since 0.11
317
+ */
318
+ extern unsigned int zbar_symbol_get_configs(const zbar_symbol_t *symbol);
319
+
320
+ /** retrieve symbology modifier flag settings.
321
+ * @returns a bitmask indicating which characteristics were detected
322
+ * during decoding.
323
+ * @since 0.11
324
+ */
325
+ extern unsigned int zbar_symbol_get_modifiers(const zbar_symbol_t *symbol);
326
+
327
+ /** retrieve data decoded from symbol.
328
+ * @returns the data string
329
+ */
330
+ extern const char *zbar_symbol_get_data(const zbar_symbol_t *symbol);
331
+
332
+ /** retrieve length of binary data.
333
+ * @returns the length of the decoded data
334
+ */
335
+ extern unsigned int zbar_symbol_get_data_length(const zbar_symbol_t *symbol);
336
+
337
+ /** retrieve a symbol confidence metric.
338
+ * @returns an unscaled, relative quantity: larger values are better
339
+ * than smaller values, where "large" and "small" are application
340
+ * dependent.
341
+ * @note expect the exact definition of this quantity to change as the
342
+ * metric is refined. currently, only the ordered relationship
343
+ * between two values is defined and will remain stable in the future
344
+ * @since 0.9
345
+ */
346
+ extern int zbar_symbol_get_quality(const zbar_symbol_t *symbol);
347
+
348
+ /** retrieve current cache count. when the cache is enabled for the
349
+ * image_scanner this provides inter-frame reliability and redundancy
350
+ * information for video streams.
351
+ * @returns < 0 if symbol is still uncertain.
352
+ * @returns 0 if symbol is newly verified.
353
+ * @returns > 0 for duplicate symbols
354
+ */
355
+ extern int zbar_symbol_get_count(const zbar_symbol_t *symbol);
356
+
357
+ /** retrieve the number of points in the location polygon. the
358
+ * location polygon defines the image area that the symbol was
359
+ * extracted from.
360
+ * @returns the number of points in the location polygon
361
+ * @note this is currently not a polygon, but the scan locations
362
+ * where the symbol was decoded
363
+ */
364
+ extern unsigned zbar_symbol_get_loc_size(const zbar_symbol_t *symbol);
365
+
366
+ /** retrieve location polygon x-coordinates.
367
+ * points are specified by 0-based index.
368
+ * @returns the x-coordinate for a point in the location polygon.
369
+ * @returns -1 if index is out of range
370
+ */
371
+ extern int zbar_symbol_get_loc_x(const zbar_symbol_t *symbol,
372
+ unsigned index);
373
+
374
+ /** retrieve location polygon y-coordinates.
375
+ * points are specified by 0-based index.
376
+ * @returns the y-coordinate for a point in the location polygon.
377
+ * @returns -1 if index is out of range
378
+ */
379
+ extern int zbar_symbol_get_loc_y(const zbar_symbol_t *symbol,
380
+ unsigned index);
381
+
382
+ /** retrieve general orientation of decoded symbol.
383
+ * @returns a coarse, axis-aligned indication of symbol orientation or
384
+ * ZBAR_ORIENT_UNKNOWN if unknown
385
+ * @since 0.11
386
+ */
387
+ extern zbar_orientation_t
388
+ zbar_symbol_get_orientation(const zbar_symbol_t *symbol);
389
+
390
+ /** iterate the set to which this symbol belongs (there can be only one).
391
+ * @returns the next symbol in the set, or
392
+ * @returns NULL when no more results are available
393
+ */
394
+ extern const zbar_symbol_t *zbar_symbol_next(const zbar_symbol_t *symbol);
395
+
396
+ /** retrieve components of a composite result.
397
+ * @returns the symbol set containing the components
398
+ * @returns NULL if the symbol is already a physical symbol
399
+ * @since 0.10
400
+ */
401
+ extern const zbar_symbol_set_t*
402
+ zbar_symbol_get_components(const zbar_symbol_t *symbol);
403
+
404
+ /** iterate components of a composite result.
405
+ * @returns the first physical component symbol of a composite result
406
+ * @returns NULL if the symbol is already a physical symbol
407
+ * @since 0.10
408
+ */
409
+ extern const zbar_symbol_t*
410
+ zbar_symbol_first_component(const zbar_symbol_t *symbol);
411
+
412
+ /** print XML symbol element representation to user result buffer.
413
+ * @see http://zbar.sourceforge.net/2008/barcode.xsd for the schema.
414
+ * @param symbol is the symbol to print
415
+ * @param buffer is the inout result pointer, it will be reallocated
416
+ * with a larger size if necessary.
417
+ * @param buflen is inout length of the result buffer.
418
+ * @returns the buffer pointer
419
+ * @since 0.6
420
+ */
421
+ extern char *zbar_symbol_xml(const zbar_symbol_t *symbol,
422
+ char **buffer,
423
+ unsigned *buflen);
424
+
425
+ /*@}*/
426
+
427
+ /*------------------------------------------------------------*/
428
+ /** @name Symbol Set interface
429
+ * container for decoded result symbols associated with an image
430
+ * or a composite symbol.
431
+ * @since 0.10
432
+ */
433
+ /*@{*/
434
+
435
+ /** @typedef zbar_symbol_set_t
436
+ * opaque symbol iterator object.
437
+ * @since 0.10
438
+ */
439
+
440
+ /** reference count manipulation.
441
+ * increment the reference count when you store a new reference.
442
+ * decrement when the reference is no longer used. do not refer to
443
+ * the object any longer once references have been released.
444
+ * @since 0.10
445
+ */
446
+ extern void zbar_symbol_set_ref(const zbar_symbol_set_t *symbols,
447
+ int refs);
448
+
449
+ /** retrieve set size.
450
+ * @returns the number of symbols in the set.
451
+ * @since 0.10
452
+ */
453
+ extern int zbar_symbol_set_get_size(const zbar_symbol_set_t *symbols);
454
+
455
+ /** set iterator.
456
+ * @returns the first decoded symbol result in a set
457
+ * @returns NULL if the set is empty
458
+ * @since 0.10
459
+ */
460
+ extern const zbar_symbol_t*
461
+ zbar_symbol_set_first_symbol(const zbar_symbol_set_t *symbols);
462
+
463
+ /** raw result iterator.
464
+ * @returns the first decoded symbol result in a set, *before* filtering
465
+ * @returns NULL if the set is empty
466
+ * @since 0.11
467
+ */
468
+ extern const zbar_symbol_t*
469
+ zbar_symbol_set_first_unfiltered(const zbar_symbol_set_t *symbols);
470
+
471
+ /*@}*/
472
+
473
+ /*------------------------------------------------------------*/
474
+ /** @name Image interface
475
+ * stores image data samples along with associated format and size
476
+ * metadata
477
+ */
478
+ /*@{*/
479
+
480
+ struct zbar_image_s;
481
+ /** opaque image object. */
482
+ typedef struct zbar_image_s zbar_image_t;
483
+
484
+ /** cleanup handler callback function.
485
+ * called to free sample data when an image is destroyed.
486
+ */
487
+ typedef void (zbar_image_cleanup_handler_t)(zbar_image_t *image);
488
+
489
+ /** data handler callback function.
490
+ * called when decoded symbol results are available for an image
491
+ */
492
+ typedef void (zbar_image_data_handler_t)(zbar_image_t *image,
493
+ const void *userdata);
494
+
495
+ /** new image constructor.
496
+ * @returns a new image object with uninitialized data and format.
497
+ * this image should be destroyed (using zbar_image_destroy()) as
498
+ * soon as the application is finished with it
499
+ */
500
+ extern zbar_image_t *zbar_image_create(void);
501
+
502
+ /** image destructor. all images created by or returned to the
503
+ * application should be destroyed using this function. when an image
504
+ * is destroyed, the associated data cleanup handler will be invoked
505
+ * if available
506
+ * @note make no assumptions about the image or the data buffer.
507
+ * they may not be destroyed/cleaned immediately if the library
508
+ * is still using them. if necessary, use the cleanup handler hook
509
+ * to keep track of image data buffers
510
+ */
511
+ extern void zbar_image_destroy(zbar_image_t *image);
512
+
513
+ /** image reference count manipulation.
514
+ * increment the reference count when you store a new reference to the
515
+ * image. decrement when the reference is no longer used. do not
516
+ * refer to the image any longer once the count is decremented.
517
+ * zbar_image_ref(image, -1) is the same as zbar_image_destroy(image)
518
+ * @since 0.5
519
+ */
520
+ extern void zbar_image_ref(zbar_image_t *image,
521
+ int refs);
522
+
523
+ /** image format conversion. refer to the documentation for supported
524
+ * image formats
525
+ * @returns a @em new image with the sample data from the original image
526
+ * converted to the requested format. the original image is
527
+ * unaffected.
528
+ * @note the converted image size may be rounded (up) due to format
529
+ * constraints
530
+ */
531
+ extern zbar_image_t *zbar_image_convert(const zbar_image_t *image,
532
+ unsigned long format);
533
+
534
+ /** image format conversion with crop/pad.
535
+ * if the requested size is larger than the image, the last row/column
536
+ * are duplicated to cover the difference. if the requested size is
537
+ * smaller than the image, the extra rows/columns are dropped from the
538
+ * right/bottom.
539
+ * @returns a @em new image with the sample data from the original
540
+ * image converted to the requested format and size.
541
+ * @note the image is @em not scaled
542
+ * @see zbar_image_convert()
543
+ * @since 0.4
544
+ */
545
+ extern zbar_image_t *zbar_image_convert_resize(const zbar_image_t *image,
546
+ unsigned long format,
547
+ unsigned width,
548
+ unsigned height);
549
+
550
+ /** retrieve the image format.
551
+ * @returns the fourcc describing the format of the image sample data
552
+ */
553
+ extern unsigned long zbar_image_get_format(const zbar_image_t *image);
554
+
555
+ /** retrieve a "sequence" (page/frame) number associated with this image.
556
+ * @since 0.6
557
+ */
558
+ extern unsigned zbar_image_get_sequence(const zbar_image_t *image);
559
+
560
+ /** retrieve the width of the image.
561
+ * @returns the width in sample columns
562
+ */
563
+ extern unsigned zbar_image_get_width(const zbar_image_t *image);
564
+
565
+ /** retrieve the height of the image.
566
+ * @returns the height in sample rows
567
+ */
568
+ extern unsigned zbar_image_get_height(const zbar_image_t *image);
569
+
570
+ /** retrieve both dimensions of the image.
571
+ * fills in the width and height in samples
572
+ */
573
+ extern void zbar_image_get_size(const zbar_image_t *image,
574
+ unsigned *width,
575
+ unsigned *height);
576
+
577
+ /** retrieve the crop rectangle.
578
+ * fills in the image coordinates of the upper left corner and size
579
+ * of an axis-aligned rectangular area of the image that will be scanned.
580
+ * defaults to the full image
581
+ * @since 0.11
582
+ */
583
+ extern void zbar_image_get_crop(const zbar_image_t *image,
584
+ unsigned *x,
585
+ unsigned *y,
586
+ unsigned *width,
587
+ unsigned *height);
588
+
589
+ /** return the image sample data. the returned data buffer is only
590
+ * valid until zbar_image_destroy() is called
591
+ */
592
+ extern const void *zbar_image_get_data(const zbar_image_t *image);
593
+
594
+ /** return the size of image data.
595
+ * @since 0.6
596
+ */
597
+ extern unsigned long zbar_image_get_data_length(const zbar_image_t *img);
598
+
599
+ /** retrieve the decoded results.
600
+ * @returns the (possibly empty) set of decoded symbols
601
+ * @returns NULL if the image has not been scanned
602
+ * @since 0.10
603
+ */
604
+ extern const zbar_symbol_set_t*
605
+ zbar_image_get_symbols(const zbar_image_t *image);
606
+
607
+ /** associate the specified symbol set with the image, replacing any
608
+ * existing results. use NULL to release the current results from the
609
+ * image.
610
+ * @see zbar_image_scanner_recycle_image()
611
+ * @since 0.10
612
+ */
613
+ extern void zbar_image_set_symbols(zbar_image_t *image,
614
+ const zbar_symbol_set_t *symbols);
615
+
616
+ /** image_scanner decode result iterator.
617
+ * @returns the first decoded symbol result for an image
618
+ * or NULL if no results are available
619
+ */
620
+ extern const zbar_symbol_t*
621
+ zbar_image_first_symbol(const zbar_image_t *image);
622
+
623
+ /** specify the fourcc image format code for image sample data.
624
+ * refer to the documentation for supported formats.
625
+ * @note this does not convert the data!
626
+ * (see zbar_image_convert() for that)
627
+ */
628
+ extern void zbar_image_set_format(zbar_image_t *image,
629
+ unsigned long format);
630
+
631
+ /** associate a "sequence" (page/frame) number with this image.
632
+ * @since 0.6
633
+ */
634
+ extern void zbar_image_set_sequence(zbar_image_t *image,
635
+ unsigned sequence_num);
636
+
637
+ /** specify the pixel size of the image.
638
+ * @note this also resets the crop rectangle to the full image
639
+ * (0, 0, width, height)
640
+ * @note this does not affect the data!
641
+ */
642
+ extern void zbar_image_set_size(zbar_image_t *image,
643
+ unsigned width,
644
+ unsigned height);
645
+
646
+ /** specify a rectangular region of the image to scan.
647
+ * the rectangle will be clipped to the image boundaries.
648
+ * defaults to the full image specified by zbar_image_set_size()
649
+ */
650
+ extern void zbar_image_set_crop(zbar_image_t *image,
651
+ unsigned x,
652
+ unsigned y,
653
+ unsigned width,
654
+ unsigned height);
655
+
656
+ /** specify image sample data. when image data is no longer needed by
657
+ * the library the specific data cleanup handler will be called
658
+ * (unless NULL)
659
+ * @note application image data will not be modified by the library
660
+ */
661
+ extern void zbar_image_set_data(zbar_image_t *image,
662
+ const void *data,
663
+ unsigned long data_byte_length,
664
+ zbar_image_cleanup_handler_t *cleanup_hndlr);
665
+
666
+ /** built-in cleanup handler.
667
+ * passes the image data buffer to free()
668
+ */
669
+ extern void zbar_image_free_data(zbar_image_t *image);
670
+
671
+ /** associate user specified data value with an image.
672
+ * @since 0.5
673
+ */
674
+ extern void zbar_image_set_userdata(zbar_image_t *image,
675
+ void *userdata);
676
+
677
+ /** return user specified data value associated with the image.
678
+ * @since 0.5
679
+ */
680
+ extern void *zbar_image_get_userdata(const zbar_image_t *image);
681
+
682
+ /** dump raw image data to a file for debug.
683
+ * the data will be prefixed with a 16 byte header consisting of:
684
+ * - 4 bytes uint = 0x676d697a ("zimg")
685
+ * - 4 bytes format fourcc
686
+ * - 2 bytes width
687
+ * - 2 bytes height
688
+ * - 4 bytes size of following image data in bytes
689
+ * this header can be dumped w/eg:
690
+ * @verbatim
691
+ od -Ax -tx1z -N16 -w4 [file]
692
+ @endverbatim
693
+ * for some formats the image can be displayed/converted using
694
+ * ImageMagick, eg:
695
+ * @verbatim
696
+ display -size 640x480+16 [-depth ?] [-sampling-factor ?x?] \
697
+ {GRAY,RGB,UYVY,YUV}:[file]
698
+ @endverbatim
699
+ *
700
+ * @param image the image object to dump
701
+ * @param filebase base filename, appended with ".XXXX.zimg" where
702
+ * XXXX is the format fourcc
703
+ * @returns 0 on success or a system error code on failure
704
+ */
705
+ extern int zbar_image_write(const zbar_image_t *image,
706
+ const char *filebase);
707
+
708
+ /** read back an image in the format written by zbar_image_write()
709
+ * @note TBD
710
+ */
711
+ extern zbar_image_t *zbar_image_read(char *filename);
712
+
713
+ /*@}*/
714
+
715
+ /*------------------------------------------------------------*/
716
+ /** @name Processor interface
717
+ * @anchor c-processor
718
+ * high-level self-contained image processor.
719
+ * processes video and images for barcodes, optionally displaying
720
+ * images to a library owned output window
721
+ */
722
+ /*@{*/
723
+
724
+ struct zbar_processor_s;
725
+ /** opaque standalone processor object. */
726
+ typedef struct zbar_processor_s zbar_processor_t;
727
+
728
+ /** constructor.
729
+ * if threaded is set and threading is available the processor
730
+ * will spawn threads where appropriate to avoid blocking and
731
+ * improve responsiveness
732
+ */
733
+ extern zbar_processor_t *zbar_processor_create(int threaded);
734
+
735
+ /** destructor. cleans up all resources associated with the processor
736
+ */
737
+ extern void zbar_processor_destroy(zbar_processor_t *processor);
738
+
739
+ /** (re)initialization.
740
+ * opens a video input device and/or prepares to display output
741
+ */
742
+ extern int zbar_processor_init(zbar_processor_t *processor,
743
+ const char *video_device,
744
+ int enable_display);
745
+
746
+ /** request a preferred size for the video image from the device.
747
+ * the request may be adjusted or completely ignored by the driver.
748
+ * @note must be called before zbar_processor_init()
749
+ * @since 0.6
750
+ */
751
+ extern int zbar_processor_request_size(zbar_processor_t *processor,
752
+ unsigned width,
753
+ unsigned height);
754
+
755
+ /** request a preferred video driver interface version for
756
+ * debug/testing.
757
+ * @note must be called before zbar_processor_init()
758
+ * @since 0.6
759
+ */
760
+ extern int zbar_processor_request_interface(zbar_processor_t *processor,
761
+ int version);
762
+
763
+ /** request a preferred video I/O mode for debug/testing. You will
764
+ * get errors if the driver does not support the specified mode.
765
+ * @verbatim
766
+ 0 = auto-detect
767
+ 1 = force I/O using read()
768
+ 2 = force memory mapped I/O using mmap()
769
+ 3 = force USERPTR I/O (v4l2 only)
770
+ @endverbatim
771
+ * @note must be called before zbar_processor_init()
772
+ * @since 0.7
773
+ */
774
+ extern int zbar_processor_request_iomode(zbar_processor_t *video,
775
+ int iomode);
776
+
777
+ /** force specific input and output formats for debug/testing.
778
+ * @note must be called before zbar_processor_init()
779
+ */
780
+ extern int zbar_processor_force_format(zbar_processor_t *processor,
781
+ unsigned long input_format,
782
+ unsigned long output_format);
783
+
784
+ /** setup result handler callback.
785
+ * the specified function will be called by the processor whenever
786
+ * new results are available from the video stream or a static image.
787
+ * pass a NULL value to disable callbacks.
788
+ * @param processor the object on which to set the handler.
789
+ * @param handler the function to call when new results are available.
790
+ * @param userdata is set as with zbar_processor_set_userdata().
791
+ * @returns the previously registered handler
792
+ */
793
+ extern zbar_image_data_handler_t*
794
+ zbar_processor_set_data_handler(zbar_processor_t *processor,
795
+ zbar_image_data_handler_t *handler,
796
+ const void *userdata);
797
+
798
+ /** associate user specified data value with the processor.
799
+ * @since 0.6
800
+ */
801
+ extern void zbar_processor_set_userdata(zbar_processor_t *processor,
802
+ void *userdata);
803
+
804
+ /** return user specified data value associated with the processor.
805
+ * @since 0.6
806
+ */
807
+ extern void *zbar_processor_get_userdata(const zbar_processor_t *processor);
808
+
809
+ /** set config for indicated symbology (0 for all) to specified value.
810
+ * @returns 0 for success, non-0 for failure (config does not apply to
811
+ * specified symbology, or value out of range)
812
+ * @see zbar_decoder_set_config()
813
+ * @since 0.4
814
+ */
815
+ extern int zbar_processor_set_config(zbar_processor_t *processor,
816
+ zbar_symbol_type_t symbology,
817
+ zbar_config_t config,
818
+ int value);
819
+
820
+ /** parse configuration string using zbar_parse_config()
821
+ * and apply to processor using zbar_processor_set_config().
822
+ * @returns 0 for success, non-0 for failure
823
+ * @see zbar_parse_config()
824
+ * @see zbar_processor_set_config()
825
+ * @since 0.4
826
+ */
827
+ static inline int zbar_processor_parse_config (zbar_processor_t *processor,
828
+ const char *config_string)
829
+ {
830
+ zbar_symbol_type_t sym;
831
+ zbar_config_t cfg;
832
+ int val;
833
+ return(zbar_parse_config(config_string, &sym, &cfg, &val) ||
834
+ zbar_processor_set_config(processor, sym, cfg, val));
835
+ }
836
+
837
+ /** retrieve the current state of the ouput window.
838
+ * @returns 1 if the output window is currently displayed, 0 if not.
839
+ * @returns -1 if an error occurs
840
+ */
841
+ extern int zbar_processor_is_visible(zbar_processor_t *processor);
842
+
843
+ /** show or hide the display window owned by the library.
844
+ * the size will be adjusted to the input size
845
+ */
846
+ extern int zbar_processor_set_visible(zbar_processor_t *processor,
847
+ int visible);
848
+
849
+ /** control the processor in free running video mode.
850
+ * only works if video input is initialized. if threading is in use,
851
+ * scanning will occur in the background, otherwise this is only
852
+ * useful wrapping calls to zbar_processor_user_wait(). if the
853
+ * library output window is visible, video display will be enabled.
854
+ */
855
+ extern int zbar_processor_set_active(zbar_processor_t *processor,
856
+ int active);
857
+
858
+ /** retrieve decode results for last scanned image/frame.
859
+ * @returns the symbol set result container or NULL if no results are
860
+ * available
861
+ * @note the returned symbol set has its reference count incremented;
862
+ * ensure that the count is decremented after use
863
+ * @since 0.10
864
+ */
865
+ extern const zbar_symbol_set_t*
866
+ zbar_processor_get_results(const zbar_processor_t *processor);
867
+
868
+ /** wait for input to the display window from the user
869
+ * (via mouse or keyboard).
870
+ * @returns >0 when input is received, 0 if timeout ms expired
871
+ * with no input or -1 in case of an error
872
+ */
873
+ extern int zbar_processor_user_wait(zbar_processor_t *processor,
874
+ int timeout);
875
+
876
+ /** process from the video stream until a result is available,
877
+ * or the timeout (in milliseconds) expires.
878
+ * specify a timeout of -1 to scan indefinitely
879
+ * (zbar_processor_set_active() may still be used to abort the scan
880
+ * from another thread).
881
+ * if the library window is visible, video display will be enabled.
882
+ * @note that multiple results may still be returned (despite the
883
+ * name).
884
+ * @returns >0 if symbols were successfully decoded,
885
+ * 0 if no symbols were found (ie, the timeout expired)
886
+ * or -1 if an error occurs
887
+ */
888
+ extern int zbar_process_one(zbar_processor_t *processor,
889
+ int timeout);
890
+
891
+ /** process the provided image for barcodes.
892
+ * if the library window is visible, the image will be displayed.
893
+ * @returns >0 if symbols were successfully decoded,
894
+ * 0 if no symbols were found or -1 if an error occurs
895
+ */
896
+ extern int zbar_process_image(zbar_processor_t *processor,
897
+ zbar_image_t *image);
898
+
899
+ /** display detail for last processor error to stderr.
900
+ * @returns a non-zero value suitable for passing to exit()
901
+ */
902
+ static inline int
903
+ zbar_processor_error_spew (const zbar_processor_t *processor,
904
+ int verbosity)
905
+ {
906
+ return(_zbar_error_spew(processor, verbosity));
907
+ }
908
+
909
+ /** retrieve the detail string for the last processor error. */
910
+ static inline const char*
911
+ zbar_processor_error_string (const zbar_processor_t *processor,
912
+ int verbosity)
913
+ {
914
+ return(_zbar_error_string(processor, verbosity));
915
+ }
916
+
917
+ /** retrieve the type code for the last processor error. */
918
+ static inline zbar_error_t
919
+ zbar_processor_get_error_code (const zbar_processor_t *processor)
920
+ {
921
+ return(_zbar_get_error_code(processor));
922
+ }
923
+
924
+ /*@}*/
925
+
926
+ /*------------------------------------------------------------*/
927
+ /** @name Video interface
928
+ * @anchor c-video
929
+ * mid-level video source abstraction.
930
+ * captures images from a video device
931
+ */
932
+ /*@{*/
933
+
934
+ struct zbar_video_s;
935
+ /** opaque video object. */
936
+ typedef struct zbar_video_s zbar_video_t;
937
+
938
+ /** constructor. */
939
+ extern zbar_video_t *zbar_video_create(void);
940
+
941
+ /** destructor. */
942
+ extern void zbar_video_destroy(zbar_video_t *video);
943
+
944
+ /** open and probe a video device.
945
+ * the device specified by platform specific unique name
946
+ * (v4l device node path in *nix eg "/dev/video",
947
+ * DirectShow DevicePath property in windows).
948
+ * @returns 0 if successful or -1 if an error occurs
949
+ */
950
+ extern int zbar_video_open(zbar_video_t *video,
951
+ const char *device);
952
+
953
+ /** retrieve file descriptor associated with open *nix video device
954
+ * useful for using select()/poll() to tell when new images are
955
+ * available (NB v4l2 only!!).
956
+ * @returns the file descriptor or -1 if the video device is not open
957
+ * or the driver only supports v4l1
958
+ */
959
+ extern int zbar_video_get_fd(const zbar_video_t *video);
960
+
961
+ /** request a preferred size for the video image from the device.
962
+ * the request may be adjusted or completely ignored by the driver.
963
+ * @returns 0 if successful or -1 if the video device is already
964
+ * initialized
965
+ * @since 0.6
966
+ */
967
+ extern int zbar_video_request_size(zbar_video_t *video,
968
+ unsigned width,
969
+ unsigned height);
970
+
971
+ /** request a preferred driver interface version for debug/testing.
972
+ * @note must be called before zbar_video_open()
973
+ * @since 0.6
974
+ */
975
+ extern int zbar_video_request_interface(zbar_video_t *video,
976
+ int version);
977
+
978
+ /** request a preferred I/O mode for debug/testing. You will get
979
+ * errors if the driver does not support the specified mode.
980
+ * @verbatim
981
+ 0 = auto-detect
982
+ 1 = force I/O using read()
983
+ 2 = force memory mapped I/O using mmap()
984
+ 3 = force USERPTR I/O (v4l2 only)
985
+ @endverbatim
986
+ * @note must be called before zbar_video_open()
987
+ * @since 0.7
988
+ */
989
+ extern int zbar_video_request_iomode(zbar_video_t *video,
990
+ int iomode);
991
+
992
+ /** retrieve current output image width.
993
+ * @returns the width or 0 if the video device is not open
994
+ */
995
+ extern int zbar_video_get_width(const zbar_video_t *video);
996
+
997
+ /** retrieve current output image height.
998
+ * @returns the height or 0 if the video device is not open
999
+ */
1000
+ extern int zbar_video_get_height(const zbar_video_t *video);
1001
+
1002
+ /** initialize video using a specific format for debug.
1003
+ * use zbar_negotiate_format() to automatically select and initialize
1004
+ * the best available format
1005
+ */
1006
+ extern int zbar_video_init(zbar_video_t *video,
1007
+ unsigned long format);
1008
+
1009
+ /** start/stop video capture.
1010
+ * all buffered images are retired when capture is disabled.
1011
+ * @returns 0 if successful or -1 if an error occurs
1012
+ */
1013
+ extern int zbar_video_enable(zbar_video_t *video,
1014
+ int enable);
1015
+
1016
+ /** retrieve next captured image. blocks until an image is available.
1017
+ * @returns NULL if video is not enabled or an error occurs
1018
+ */
1019
+ extern zbar_image_t *zbar_video_next_image(zbar_video_t *video);
1020
+
1021
+ /** display detail for last video error to stderr.
1022
+ * @returns a non-zero value suitable for passing to exit()
1023
+ */
1024
+ static inline int zbar_video_error_spew (const zbar_video_t *video,
1025
+ int verbosity)
1026
+ {
1027
+ return(_zbar_error_spew(video, verbosity));
1028
+ }
1029
+
1030
+ /** retrieve the detail string for the last video error. */
1031
+ static inline const char *zbar_video_error_string (const zbar_video_t *video,
1032
+ int verbosity)
1033
+ {
1034
+ return(_zbar_error_string(video, verbosity));
1035
+ }
1036
+
1037
+ /** retrieve the type code for the last video error. */
1038
+ static inline zbar_error_t
1039
+ zbar_video_get_error_code (const zbar_video_t *video)
1040
+ {
1041
+ return(_zbar_get_error_code(video));
1042
+ }
1043
+
1044
+ /*@}*/
1045
+
1046
+ /*------------------------------------------------------------*/
1047
+ /** @name Window interface
1048
+ * @anchor c-window
1049
+ * mid-level output window abstraction.
1050
+ * displays images to user-specified platform specific output window
1051
+ */
1052
+ /*@{*/
1053
+
1054
+ struct zbar_window_s;
1055
+ /** opaque window object. */
1056
+ typedef struct zbar_window_s zbar_window_t;
1057
+
1058
+ /** constructor. */
1059
+ extern zbar_window_t *zbar_window_create(void);
1060
+
1061
+ /** destructor. */
1062
+ extern void zbar_window_destroy(zbar_window_t *window);
1063
+
1064
+ /** associate reader with an existing platform window.
1065
+ * This can be any "Drawable" for X Windows or a "HWND" for windows.
1066
+ * input images will be scaled into the output window.
1067
+ * pass NULL to detach from the resource, further input will be
1068
+ * ignored
1069
+ */
1070
+ extern int zbar_window_attach(zbar_window_t *window,
1071
+ void *x11_display_w32_hwnd,
1072
+ unsigned long x11_drawable);
1073
+
1074
+ /** control content level of the reader overlay.
1075
+ * the overlay displays graphical data for informational or debug
1076
+ * purposes. higher values increase the level of annotation (possibly
1077
+ * decreasing performance). @verbatim
1078
+ 0 = disable overlay
1079
+ 1 = outline decoded symbols (default)
1080
+ 2 = also track and display input frame rate
1081
+ @endverbatim
1082
+ */
1083
+ extern void zbar_window_set_overlay(zbar_window_t *window,
1084
+ int level);
1085
+
1086
+ /** retrieve current content level of reader overlay.
1087
+ * @see zbar_window_set_overlay()
1088
+ * @since 0.10
1089
+ */
1090
+ extern int zbar_window_get_overlay(const zbar_window_t *window);
1091
+
1092
+ /** draw a new image into the output window. */
1093
+ extern int zbar_window_draw(zbar_window_t *window,
1094
+ zbar_image_t *image);
1095
+
1096
+ /** redraw the last image (exposure handler). */
1097
+ extern int zbar_window_redraw(zbar_window_t *window);
1098
+
1099
+ /** resize the image window (reconfigure handler).
1100
+ * this does @em not update the contents of the window
1101
+ * @since 0.3, changed in 0.4 to not redraw window
1102
+ */
1103
+ extern int zbar_window_resize(zbar_window_t *window,
1104
+ unsigned width,
1105
+ unsigned height);
1106
+
1107
+ /** display detail for last window error to stderr.
1108
+ * @returns a non-zero value suitable for passing to exit()
1109
+ */
1110
+ static inline int zbar_window_error_spew (const zbar_window_t *window,
1111
+ int verbosity)
1112
+ {
1113
+ return(_zbar_error_spew(window, verbosity));
1114
+ }
1115
+
1116
+ /** retrieve the detail string for the last window error. */
1117
+ static inline const char*
1118
+ zbar_window_error_string (const zbar_window_t *window,
1119
+ int verbosity)
1120
+ {
1121
+ return(_zbar_error_string(window, verbosity));
1122
+ }
1123
+
1124
+ /** retrieve the type code for the last window error. */
1125
+ static inline zbar_error_t
1126
+ zbar_window_get_error_code (const zbar_window_t *window)
1127
+ {
1128
+ return(_zbar_get_error_code(window));
1129
+ }
1130
+
1131
+
1132
+ /** select a compatible format between video input and output window.
1133
+ * the selection algorithm attempts to use a format shared by
1134
+ * video input and window output which is also most useful for
1135
+ * barcode scanning. if a format conversion is necessary, it will
1136
+ * heuristically attempt to minimize the cost of the conversion
1137
+ */
1138
+ extern int zbar_negotiate_format(zbar_video_t *video,
1139
+ zbar_window_t *window);
1140
+
1141
+ /*@}*/
1142
+
1143
+ /*------------------------------------------------------------*/
1144
+ /** @name Image Scanner interface
1145
+ * @anchor c-imagescanner
1146
+ * mid-level image scanner interface.
1147
+ * reads barcodes from 2-D images
1148
+ */
1149
+ /*@{*/
1150
+
1151
+ struct zbar_image_scanner_s;
1152
+ /** opaque image scanner object. */
1153
+ typedef struct zbar_image_scanner_s zbar_image_scanner_t;
1154
+
1155
+ /** constructor. */
1156
+ extern zbar_image_scanner_t *zbar_image_scanner_create(void);
1157
+
1158
+ /** destructor. */
1159
+ extern void zbar_image_scanner_destroy(zbar_image_scanner_t *scanner);
1160
+
1161
+ /** setup result handler callback.
1162
+ * the specified function will be called by the scanner whenever
1163
+ * new results are available from a decoded image.
1164
+ * pass a NULL value to disable callbacks.
1165
+ * @returns the previously registered handler
1166
+ */
1167
+ extern zbar_image_data_handler_t*
1168
+ zbar_image_scanner_set_data_handler(zbar_image_scanner_t *scanner,
1169
+ zbar_image_data_handler_t *handler,
1170
+ const void *userdata);
1171
+
1172
+
1173
+ /** set config for indicated symbology (0 for all) to specified value.
1174
+ * @returns 0 for success, non-0 for failure (config does not apply to
1175
+ * specified symbology, or value out of range)
1176
+ * @see zbar_decoder_set_config()
1177
+ * @since 0.4
1178
+ */
1179
+ extern int zbar_image_scanner_set_config(zbar_image_scanner_t *scanner,
1180
+ zbar_symbol_type_t symbology,
1181
+ zbar_config_t config,
1182
+ int value);
1183
+
1184
+ /** parse configuration string using zbar_parse_config()
1185
+ * and apply to image scanner using zbar_image_scanner_set_config().
1186
+ * @returns 0 for success, non-0 for failure
1187
+ * @see zbar_parse_config()
1188
+ * @see zbar_image_scanner_set_config()
1189
+ * @since 0.4
1190
+ */
1191
+ static inline int
1192
+ zbar_image_scanner_parse_config (zbar_image_scanner_t *scanner,
1193
+ const char *config_string)
1194
+ {
1195
+ zbar_symbol_type_t sym;
1196
+ zbar_config_t cfg;
1197
+ int val;
1198
+ return(zbar_parse_config(config_string, &sym, &cfg, &val) ||
1199
+ zbar_image_scanner_set_config(scanner, sym, cfg, val));
1200
+ }
1201
+
1202
+ /** enable or disable the inter-image result cache (default disabled).
1203
+ * mostly useful for scanning video frames, the cache filters
1204
+ * duplicate results from consecutive images, while adding some
1205
+ * consistency checking and hysteresis to the results.
1206
+ * this interface also clears the cache
1207
+ */
1208
+ extern void zbar_image_scanner_enable_cache(zbar_image_scanner_t *scanner,
1209
+ int enable);
1210
+
1211
+ /** remove any previously decoded results from the image scanner and the
1212
+ * specified image. somewhat more efficient version of
1213
+ * zbar_image_set_symbols(image, NULL) which may retain memory for
1214
+ * subsequent decodes
1215
+ * @since 0.10
1216
+ */
1217
+ extern void zbar_image_scanner_recycle_image(zbar_image_scanner_t *scanner,
1218
+ zbar_image_t *image);
1219
+
1220
+ /** retrieve decode results for last scanned image.
1221
+ * @returns the symbol set result container or NULL if no results are
1222
+ * available
1223
+ * @note the symbol set does not have its reference count adjusted;
1224
+ * ensure that the count is incremented if the results may be kept
1225
+ * after the next image is scanned
1226
+ * @since 0.10
1227
+ */
1228
+ extern const zbar_symbol_set_t*
1229
+ zbar_image_scanner_get_results(const zbar_image_scanner_t *scanner);
1230
+
1231
+ /** scan for symbols in provided image. The image format must be
1232
+ * "Y800" or "GRAY".
1233
+ * @returns >0 if symbols were successfully decoded from the image,
1234
+ * 0 if no symbols were found or -1 if an error occurs
1235
+ * @see zbar_image_convert()
1236
+ * @since 0.9 - changed to only accept grayscale images
1237
+ */
1238
+ extern int zbar_scan_image(zbar_image_scanner_t *scanner,
1239
+ zbar_image_t *image);
1240
+
1241
+ /*@}*/
1242
+
1243
+ /*------------------------------------------------------------*/
1244
+ /** @name Decoder interface
1245
+ * @anchor c-decoder
1246
+ * low-level bar width stream decoder interface.
1247
+ * identifies symbols and extracts encoded data
1248
+ */
1249
+ /*@{*/
1250
+
1251
+ struct zbar_decoder_s;
1252
+ /** opaque decoder object. */
1253
+ typedef struct zbar_decoder_s zbar_decoder_t;
1254
+
1255
+ /** decoder data handler callback function.
1256
+ * called by decoder when new data has just been decoded
1257
+ */
1258
+ typedef void (zbar_decoder_handler_t)(zbar_decoder_t *decoder);
1259
+
1260
+ /** constructor. */
1261
+ extern zbar_decoder_t *zbar_decoder_create(void);
1262
+
1263
+ /** destructor. */
1264
+ extern void zbar_decoder_destroy(zbar_decoder_t *decoder);
1265
+
1266
+ /** set config for indicated symbology (0 for all) to specified value.
1267
+ * @returns 0 for success, non-0 for failure (config does not apply to
1268
+ * specified symbology, or value out of range)
1269
+ * @since 0.4
1270
+ */
1271
+ extern int zbar_decoder_set_config(zbar_decoder_t *decoder,
1272
+ zbar_symbol_type_t symbology,
1273
+ zbar_config_t config,
1274
+ int value);
1275
+
1276
+ /** parse configuration string using zbar_parse_config()
1277
+ * and apply to decoder using zbar_decoder_set_config().
1278
+ * @returns 0 for success, non-0 for failure
1279
+ * @see zbar_parse_config()
1280
+ * @see zbar_decoder_set_config()
1281
+ * @since 0.4
1282
+ */
1283
+ static inline int zbar_decoder_parse_config (zbar_decoder_t *decoder,
1284
+ const char *config_string)
1285
+ {
1286
+ zbar_symbol_type_t sym;
1287
+ zbar_config_t cfg;
1288
+ int val;
1289
+ return(zbar_parse_config(config_string, &sym, &cfg, &val) ||
1290
+ zbar_decoder_set_config(decoder, sym, cfg, val));
1291
+ }
1292
+
1293
+ /** retrieve symbology boolean config settings.
1294
+ * @returns a bitmask indicating which configs are currently set for the
1295
+ * specified symbology.
1296
+ * @since 0.11
1297
+ */
1298
+ extern unsigned int zbar_decoder_get_configs(const zbar_decoder_t *decoder,
1299
+ zbar_symbol_type_t symbology);
1300
+
1301
+ /** clear all decoder state.
1302
+ * any partial symbols are flushed
1303
+ */
1304
+ extern void zbar_decoder_reset(zbar_decoder_t *decoder);
1305
+
1306
+ /** mark start of a new scan pass.
1307
+ * clears any intra-symbol state and resets color to ::ZBAR_SPACE.
1308
+ * any partially decoded symbol state is retained
1309
+ */
1310
+ extern void zbar_decoder_new_scan(zbar_decoder_t *decoder);
1311
+
1312
+ /** process next bar/space width from input stream.
1313
+ * the width is in arbitrary relative units. first value of a scan
1314
+ * is ::ZBAR_SPACE width, alternating from there.
1315
+ * @returns appropriate symbol type if width completes
1316
+ * decode of a symbol (data is available for retrieval)
1317
+ * @returns ::ZBAR_PARTIAL as a hint if part of a symbol was decoded
1318
+ * @returns ::ZBAR_NONE (0) if no new symbol data is available
1319
+ */
1320
+ extern zbar_symbol_type_t zbar_decode_width(zbar_decoder_t *decoder,
1321
+ unsigned width);
1322
+
1323
+ /** retrieve color of @em next element passed to
1324
+ * zbar_decode_width(). */
1325
+ extern zbar_color_t zbar_decoder_get_color(const zbar_decoder_t *decoder);
1326
+
1327
+ /** retrieve last decoded data.
1328
+ * @returns the data string or NULL if no new data available.
1329
+ * the returned data buffer is owned by library, contents are only
1330
+ * valid between non-0 return from zbar_decode_width and next library
1331
+ * call
1332
+ */
1333
+ extern const char *zbar_decoder_get_data(const zbar_decoder_t *decoder);
1334
+
1335
+ /** retrieve length of binary data.
1336
+ * @returns the length of the decoded data or 0 if no new data
1337
+ * available.
1338
+ */
1339
+ extern unsigned int
1340
+ zbar_decoder_get_data_length(const zbar_decoder_t *decoder);
1341
+
1342
+ /** retrieve last decoded symbol type.
1343
+ * @returns the type or ::ZBAR_NONE if no new data available
1344
+ */
1345
+ extern zbar_symbol_type_t
1346
+ zbar_decoder_get_type(const zbar_decoder_t *decoder);
1347
+
1348
+ /** retrieve modifier flags for the last decoded symbol.
1349
+ * @returns a bitmask indicating which characteristics were detected
1350
+ * during decoding.
1351
+ * @since 0.11
1352
+ */
1353
+ extern unsigned int zbar_decoder_get_modifiers(const zbar_decoder_t *decoder);
1354
+
1355
+ /** retrieve last decode direction.
1356
+ * @returns 1 for forward and -1 for reverse
1357
+ * @returns 0 if the decode direction is unknown or does not apply
1358
+ * @since 0.11
1359
+ */
1360
+ extern int zbar_decoder_get_direction(const zbar_decoder_t *decoder);
1361
+
1362
+ /** setup data handler callback.
1363
+ * the registered function will be called by the decoder
1364
+ * just before zbar_decode_width() returns a non-zero value.
1365
+ * pass a NULL value to disable callbacks.
1366
+ * @returns the previously registered handler
1367
+ */
1368
+ extern zbar_decoder_handler_t*
1369
+ zbar_decoder_set_handler(zbar_decoder_t *decoder,
1370
+ zbar_decoder_handler_t *handler);
1371
+
1372
+ /** associate user specified data value with the decoder. */
1373
+ extern void zbar_decoder_set_userdata(zbar_decoder_t *decoder,
1374
+ void *userdata);
1375
+
1376
+ /** return user specified data value associated with the decoder. */
1377
+ extern void *zbar_decoder_get_userdata(const zbar_decoder_t *decoder);
1378
+
1379
+ /*@}*/
1380
+
1381
+ /*------------------------------------------------------------*/
1382
+ /** @name Scanner interface
1383
+ * @anchor c-scanner
1384
+ * low-level linear intensity sample stream scanner interface.
1385
+ * identifies "bar" edges and measures width between them.
1386
+ * optionally passes to bar width decoder
1387
+ */
1388
+ /*@{*/
1389
+
1390
+ struct zbar_scanner_s;
1391
+ /** opaque scanner object. */
1392
+ typedef struct zbar_scanner_s zbar_scanner_t;
1393
+
1394
+ /** constructor.
1395
+ * if decoder is non-NULL it will be attached to scanner
1396
+ * and called automatically at each new edge
1397
+ * current color is initialized to ::ZBAR_SPACE
1398
+ * (so an initial BAR->SPACE transition may be discarded)
1399
+ */
1400
+ extern zbar_scanner_t *zbar_scanner_create(zbar_decoder_t *decoder);
1401
+
1402
+ /** destructor. */
1403
+ extern void zbar_scanner_destroy(zbar_scanner_t *scanner);
1404
+
1405
+ /** clear all scanner state.
1406
+ * also resets an associated decoder
1407
+ */
1408
+ extern zbar_symbol_type_t zbar_scanner_reset(zbar_scanner_t *scanner);
1409
+
1410
+ /** mark start of a new scan pass. resets color to ::ZBAR_SPACE.
1411
+ * also updates an associated decoder.
1412
+ * @returns any decode results flushed from the pipeline
1413
+ * @note when not using callback handlers, the return value should
1414
+ * be checked the same as zbar_scan_y()
1415
+ * @note call zbar_scanner_flush() at least twice before calling this
1416
+ * method to ensure no decode results are lost
1417
+ */
1418
+ extern zbar_symbol_type_t zbar_scanner_new_scan(zbar_scanner_t *scanner);
1419
+
1420
+ /** flush scanner processing pipeline.
1421
+ * forces current scanner position to be a scan boundary.
1422
+ * call multiple times (max 3) to completely flush decoder.
1423
+ * @returns any decode/scan results flushed from the pipeline
1424
+ * @note when not using callback handlers, the return value should
1425
+ * be checked the same as zbar_scan_y()
1426
+ * @since 0.9
1427
+ */
1428
+ extern zbar_symbol_type_t zbar_scanner_flush(zbar_scanner_t *scanner);
1429
+
1430
+ /** process next sample intensity value.
1431
+ * intensity (y) is in arbitrary relative units.
1432
+ * @returns result of zbar_decode_width() if a decoder is attached,
1433
+ * otherwise @returns (::ZBAR_PARTIAL) when new edge is detected
1434
+ * or 0 (::ZBAR_NONE) if no new edge is detected
1435
+ */
1436
+ extern zbar_symbol_type_t zbar_scan_y(zbar_scanner_t *scanner,
1437
+ int y);
1438
+
1439
+ /** process next sample from RGB (or BGR) triple. */
1440
+ static inline zbar_symbol_type_t zbar_scan_rgb24 (zbar_scanner_t *scanner,
1441
+ unsigned char *rgb)
1442
+ {
1443
+ return(zbar_scan_y(scanner, rgb[0] + rgb[1] + rgb[2]));
1444
+ }
1445
+
1446
+ /** retrieve last scanned width. */
1447
+ extern unsigned zbar_scanner_get_width(const zbar_scanner_t *scanner);
1448
+
1449
+ /** retrieve sample position of last edge.
1450
+ * @since 0.10
1451
+ */
1452
+ extern unsigned zbar_scanner_get_edge(const zbar_scanner_t *scn,
1453
+ unsigned offset,
1454
+ int prec);
1455
+
1456
+ /** retrieve last scanned color. */
1457
+ extern zbar_color_t zbar_scanner_get_color(const zbar_scanner_t *scanner);
1458
+
1459
+ /*@}*/
1460
+
1461
+ #ifdef __cplusplus
1462
+ }
1463
+ }
1464
+
1465
+ # include "zbar/Exception.h"
1466
+ # include "zbar/Decoder.h"
1467
+ # include "zbar/Scanner.h"
1468
+ # include "zbar/Symbol.h"
1469
+ # include "zbar/Image.h"
1470
+ # include "zbar/ImageScanner.h"
1471
+ # include "zbar/Video.h"
1472
+ # include "zbar/Window.h"
1473
+ # include "zbar/Processor.h"
1474
+ #endif
1475
+
1476
+ #endif