←Select platform

AAMVAID Class

Summary

Provides information encoded in an AAMVA CDS related to ID card or driver's license, of the cardholder.

Syntax

C#
VB
Java
Objective-C
C++
public class AAMVAID : IDisposable 
Public Class AAMVAID  
   Implements System.IDisposable  
@interface AAMVAID : NSObject 
public class AAMVAID 
public ref class AAMVAID : public System.IDisposable   

Remarks

The class will be filled by calling BarcodeData.parseAAMVAData(byte[], bool) when reading PDF417 barcodes from North American ID cards and driver's licenses.

Example

C#
using Leadtools; 
using Leadtools.Barcode; 
using Leadtools.Codecs; 
 
public void AAMVAID_Example() 
{ 
   using (RasterCodecs codecs = new RasterCodecs()) 
   using (RasterImage inputImage = codecs.Load("drivers_license_barcode.png")) 
   { 
      BarcodeEngine engine = new BarcodeEngine(); 
      BarcodeData data = engine.Reader.ReadBarcode(inputImage, LeadRect.Empty, BarcodeSymbology.PDF417); 
      if (data != null) 
      { 
         using (AAMVAID id = BarcodeData.ParseAAMVAData(data.GetData(), false)) 
         { 
            if (id != null) 
            { 
               // Read was successful. Print AAMVAID properties 
 
               Console.WriteLine("Issuer Identification Number: " + id.IssuerIdentificationNumber); 
               Console.WriteLine("Jurisdiction: " + id.Jurisdiction.ToString()); 
               Console.WriteLine("AAMVA CDS Version: " + id.Version.ToString()); 
               Console.WriteLine("Jurisdiction Version: " + id.JurisdictionVersion); 
               Console.WriteLine("Number of Entries: " + id.NumberOfEntries.ToString()); 
 
               //Convenience functions for data elements across all subfiles 
 
               // NOTE: 
               // Some issuing authorities encode full names in a single data element ("DAA" tag). 
               // eg. LAST,FIRST,MIDDLE 
               //     FIRST MIDDLE LAST 
               //     LAST@FIRST@MIDDLEINITIAL 
               // 
               // Others use newer tags to encode first, middle and last names separately. 
               // The convenience functions below check for the preferable newer tags first, then 
               // attempt to parse out the requested name from the "DAA" tag if necessary. 
               // Since issuing authorities use different encodings for the 
               // "DAA" element, the name convenience functions below are not guaranteed 
               // to work in all cases. If a name has been inferred from the "DAA" data element, 
               // AAMVANameResult.InferredFromFullName will be TRUE. In such cases, it may be best to manually 
               // read the "DAA" tag as well. 
 
               AAMVANameResult firstNameResult = id.FirstName; 
               if (firstNameResult != null) 
               { 
                  Console.WriteLine("First Name: " + firstNameResult.Value + ", Inferred?: " + firstNameResult.InferredFromFullName); 
               } 
 
               AAMVANameResult lastNameResult = id.LastName; 
               if (lastNameResult != null) 
               { 
                  Console.WriteLine("Last Name: " + lastNameResult.Value + ", Inferred?: " + lastNameResult.InferredFromFullName); 
               } 
 
               string addressStreet1 = id.AddressStreet1; 
               if (addressStreet1 != null) 
                  Console.WriteLine("Address Street 1: " + addressStreet1); 
 
               string addressStreet2 = id.AddressStreet2; 
               if (addressStreet2 != null) 
                  Console.WriteLine("Address Street 2: " + addressStreet2); 
 
               string addressStateAbbreviation = id.AddressStateAbbreviation; 
               if (addressStateAbbreviation != null) 
                  Console.WriteLine("Address State Abbreviation: " + addressStateAbbreviation); 
 
               string addressCity = id.AddressCity; 
               if (addressCity != null) 
                  Console.WriteLine("Address City: " + addressCity); 
 
               string addressPostalCode = id.AddressPostalCode; 
               if (addressPostalCode != null) 
                  Console.WriteLine("Address Postal Code: " + addressPostalCode); 
 
               AAMVARegion addressRegion = id.AddressRegion; 
               Console.WriteLine("Address Region: " + addressRegion.ToString()); 
 
               string dateOfBirth = id.DateOfBirth; 
               if (dateOfBirth != null) 
                  Console.WriteLine("Date of Birth: " + dateOfBirth); 
 
               if (id.Over18Available) 
               { 
                  Console.WriteLine("Over 18?: " + id.Over18); 
               } 
 
               if (id.Over19Available) 
               { 
                  Console.WriteLine("Over 19?: " + id.Over19); 
               } 
 
               if (id.Over21Available) 
               { 
                  Console.WriteLine("Over 21?: " + id.Over21); 
               } 
 
               if (id.ExpirationAvailable) 
               { 
                  Console.WriteLine("Expired?: " + id.Expired); 
               } 
 
               string expirationDate = id.ExpirationDate; 
               if (expirationDate != null) 
                  Console.WriteLine("Expiration Date: " + expirationDate); 
 
               string issueDate = id.IssueDate; 
               if (issueDate != null) 
                  Console.WriteLine("Issue Date: " + issueDate); 
 
               string idNumber = id.Number; 
               if (idNumber != null) 
                  Console.WriteLine("ID Number: " + idNumber); 
 
               AAMVAEyeColor eyeColor = id.EyeColor; 
               Console.WriteLine("Eye Color: " + eyeColor.ToString()); 
 
               AAMVAHairColor hairColor = id.HairColor; 
               Console.WriteLine("Hair Color: " + hairColor.ToString()); 
 
               AAMVASex sex = id.Sex; 
               Console.WriteLine("Sex: " + sex.ToString()); 
 
               // We've exhausted all of our convenience functions. If we want to read data elements directly, 
               // we can search all data elements in all subfiles like so 
 
               // Use AAMVADataElementInfo.RetrieveAll to get dictionary 
               // of information about every data element for a given 
               // AAMVA CDS version 
 
               IDictionary<String, AAMVADataElementInfo> dataElementInfoDictionary = AAMVADataElementInfo.RetrieveAll(id.Version); 
 
               for (int i = 0; i < id.NumberOfEntries; i++) 
               { 
                  AAMVASubfile subfile = id.Subfiles[i]; 
                  IDictionary<String, AAMVADataElement> subfileDataElements = subfile.DataElements; 
 
                  if (subfileDataElements.ContainsKey("DDK")) 
                  { 
                     //Get the data element 
                     AAMVADataElement dataElement = subfileDataElements["DDK"]; 
 
                     //Get some information about the data element 
                     AAMVADataElementInfo info = dataElementInfoDictionary["DDK"]; 
                     //info.ElementID;         --> "DDK" 
                     //info.FriendlyName;      --> "Organ Donor Indicator" 
                     //info.Definition;        --> "Field that indicates that the cardholder is an organ donor = 1." 
                     //info.LengthType;        --> AAMVALengthType.Fixed (alternative is variable) 
                     //info.ValidMaxLength;    --> 1 
                     //info.ValidCharacters;   --> AAMVAValidCharacters.Numeric (can be bitwise OR'd with other AAMVAValidCharacter types -- Alphabetical, Special) 
                     //info.ValidSubfileTypes; --> AAMVASubfileType.DL | AAMVASubfileType.ID; 
 
                     if (dataElement.Value.Equals("1")) 
                     { 
                        Console.WriteLine("Cardholder is an organ donor!"); 
                     } 
                  } 
               } 
            } 
         } 
      } 
   } 
} 

Requirements

Target Platforms

Help Version 20.0.2018.1.19
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Barcode Assembly