not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

  1. /*
  2. Ported to JavaScript by Lazar Laszlo 2011
  3. lazarsoft@gmail.com, www.lazarsoft.info
  4. */
  5. /*
  6. *
  7. * Copyright 2007 ZXing authors
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License");
  10. * you may not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS,
  17. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. */
  21. function ErrorCorrectionLevel(ordinal, bits, name)
  22. {
  23. this.ordinal_Renamed_Field = ordinal;
  24. this.bits = bits;
  25. this.name = name;
  26. this.__defineGetter__("Bits", function()
  27. {
  28. return this.bits;
  29. });
  30. this.__defineGetter__("Name", function()
  31. {
  32. return this.name;
  33. });
  34. this.ordinal=function()
  35. {
  36. return this.ordinal_Renamed_Field;
  37. }
  38. }
  39. ErrorCorrectionLevel.forBits=function( bits)
  40. {
  41. if (bits < 0 || bits >= FOR_BITS.length)
  42. {
  43. throw "ArgumentException";
  44. }
  45. return FOR_BITS[bits];
  46. }
  47. var L = new ErrorCorrectionLevel(0, 0x01, "L");
  48. var M = new ErrorCorrectionLevel(1, 0x00, "M");
  49. var Q = new ErrorCorrectionLevel(2, 0x03, "Q");
  50. var H = new ErrorCorrectionLevel(3, 0x02, "H");
  51. var FOR_BITS = new Array( M, L, H, Q);