#include "ltbar.h"
L_LTBAR_API L_INT L_BarCodeAAMVAIDBuilderInit(pBuilder)
Pointer to an AAMVAIDBUILDER object.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function initializes the AAMVAIDBUILDER structure at pBuilder
. This process allocates the initial memory for the AAMVAID object AAMVAIDBUILDER.OutputID inside pBuilder
.
AAMVAIDBUILDER.OutputID should be freed by the user after it is no longer needed using L_BarCodeFreeAAMVAID.
L_BarCodeAAMVAIDBuilderInit must be called before calling any of L_BarCodeAAMVAIDBuilderSetXXX functions.
Required DLLs and Libraries
Win32, x64, Linux.
AAMVAIDBUILDER* pBuilder;
L_INT nRet = L_BarCodeAAMVAIDBuilderInit(pBuilder);
if(nRet != SUCCESS) return;
nRet = L_BarCodeAAMVAIDBuilderSetJurisdiction(pBuilder, L_AAMVA_JURISDICTION_NORTH_CAROLINA, NULL);
if(nRet != SUCCESS) return;
nRet = L_BarCodeAAMVAIDBuilderSetJurisdictionVersion(pBuilder, &"00");
if(nRet != SUCCESS) return;
nRet = L_BarCodeAAMVAIDBuilderSetVersion(pBuilder, L_AAMVA_VERSION_2016);
if(nRet != SUCCESS) return;
nRet = L_BarCodeAAMVAIDBuilderNumberOfEntries(pBuilder, 1);
if(nRet != SUCCESS) return;
nRet = L_BarCodeAAMVAIDBuilderSetSubfileType(pBuilder, 0, L_AAMVA_SUBFILE_TYPE_DL, NULL);
if(nRet != SUCCESS) return;
//Add all required data elements per AAMVA CDS
//Use L_BarCodeAAMVAIDLookup* functions for data element values of enumerated D20 types
nRet = L_BarCodeAAMVAIDBuilderAddDataElementToSubfile(pBuilder, 0, &"DAC", &"MICHAEL", 7);
if(nRet != SUCCESS) return;
L_CHAR* pszRaceEthnicityCode = NULL;
nRet = L_BarCodeAAMVAIDLookupRaceEthnicity(L_AAMVA_RACE_ETHNICITY_WHITE, &pszRaceEthnicityCode);
if(nRet != SUCCESS) return;
nRet = L_BarCodeAAMVAIDBuilderAddDataElementToSubfile(pBuilder, 0, &"DCL", pszRaceEthnicityCode, strlen(pszRaceEthnicityCode));
if(nRet != SUCCESS) return;
//...
//...
//...
nRet = L_BarCodeAAMVAIDBuilderBuild(pBuilder);
if(nRet != SUCCESS) return;
//Valid AAMVAID is now in pBuilder->OutputID
L_CHAR* data = NULL;
L_INT dataLength;
nRet = L_BarCodeWriteAAMVAData(pBuilder->OutputID, &data, &dataLength);
//Valid AAMVA ID data is now in data variable
//Free resources...