Interface QrCodeGenerator

All Known Implementing Classes:
ZxingGenerator

@API(status=STABLE, since="1.0", consumers="ZxingGenerator") @Component public interface QrCodeGenerator
Generates Quick Response Codes (QR Codes). The generator provides DataStructures like calendar entry or contact information (PIM). It's implemented an encoder and also an decoder.
Since:
1.0
Version:
1.2
Author:
elmar.dott@gmail.com
  • Field Details

    • FEATURE_ID

      @API(status=STABLE, since="1.2") static final String FEATURE_ID
      Identifier for the given feature.
      See Also:
  • Method Details

    • setup

      @API(status=STABLE, since="1.0") void setup(String fileOutputPath, int dimensions)
      Configure the generator with the dimension (height and width) of the QR Code Image. Height = Weight; the produced image will be always an square. It also define where the file will be stored.
      Parameters:
      dimensions - as int
      fileOutputPath - s String
    • encode

      @API(status=STABLE, since="1.0") boolean encode(String data)
      Encode from a given String the image and store it on the configured path.
      Parameters:
      data - as String
      Returns:
      true on success
    • decode

      @API(status=STABLE, since="1.0") String decode(File qrCode)
      Extract (decode) from a image file the information as String.
      Parameters:
      qrCode - as File
      Returns:
      the content as String
    • generateDataForvCard

      @API(status=STABLE, since="1.0") String generateDataForvCard(Map<String,String> contact)
      Create a vCard (Version 3.0) data structure. URL: https://en.wikipedia.org/wiki/VCard

      Property Set:
      gender: Mr.
      name: Doe
      surname: John
      title:
      organization:
      role
      home-street:
      home-city:
      home-zipcode:
      home-state:
      home-country:
      home-phone:
      home-mobile:
      work-street:
      work-city:
      work-zipcode:
      work-state:
      work-country:
      work-phone:
      work-mobile:
      e-mail: john.doe@sample.org
      homepage:
      Parameters:
      contact - as Map
      Returns:
      dataStructure as String
    • generateDataForCalendarEvent

      @API(status=STABLE, since="2.1") String generateDataForCalendarEvent(String event, ZonedDateTime start, ZonedDateTime end)
      Encode an calender event.
      Parameters:
      event - as String
      start - as ZonedDateTime
      end - as ZonedDateTime
      Returns:
      dataStructure as String
    • generateDataForUrl

      @API(status=STABLE, since="1.0") String generateDataForUrl(String url)
      Encode an URL which will opened in a web browser.
      Parameters:
      url - as String
      Returns:
      dataStructure as String
    • generateDataForGeoLocation

      @API(status=STABLE, since="1.0") String generateDataForGeoLocation(String latitude, String longitude)
      A geo URI may be used to encode a point on the earth, including altitude. For example, to encode the Google's New York office, which is at 40.71872 deg N latitude, 73.98905 deg W longitude, at a point 100 meters above the office, one would encode "geo:40.71872,-73.98905,100".
      A reader might open a local mapping application like Google Maps to this location and zoom accordingly, or could open a link to this location on a mapping web site like Google Maps in the device's web browser.
      Parameters:
      longitude - as String
      latitude - as String
      Returns:
      dataStructure as String