IATA BCBP
Overview
The parser supports up to version 8 of the International Air Transport Association Bar Coded Boarding Pass (IATA-BCBP) standard. The latest IATA-BCBP specifications can be obtained from International Air Transport Association.
Sample usage for IATA-BCBP parser and Barcode Capture
First, you need to create a DataCaptureContext, access a Camera and create an IATA-BCBP parser:
DataCaptureContext context = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);
Camera camera = Camera.GetDefaultCamera();
camera?.ApplySettingsAsync(BarcodeCapture.RecommendedCameraSettings);
context.SetFrameSourceAsync(camera);
camera?.SwitchToDesiredStateAsync(FrameSourceState.On);
BarcodeCaptureSettings barcodeCaptureSettings = BarcodeCaptureSettings.Create();
BarcodeCapture barcodeCapture = BarcodeCapture.Create(context, barcodeCaptureSettings);
Parser parser = Parser.Create(this.dataCaptureContext, ParserDataFormat.IataBcbp);
Then, you need to implement IBarcodeCaptureListener:
public void OnBarcodeScanned(BarcodeCapture barcodeCapture, BarcodeCaptureSession session, IFrameData frameData)
{
var barcode = session?.NewlyRecognizedBarcode;
if (barcode == null)
{
return;
}
try
{
ParsedData parsedData = parser.parseString(barcode.Data);
/*
* Extract the fields relevant to your use case. Below, for example, we extract the passenger name,
* which is represented as a list of Strings (["FirstName", "LastName"]), seat number which is a string,
* and flightDate, which is represented as a map with keys "year", "month", "day".
*/
string passengerName = parsedData.FieldsByName["passengerName"].Parsed.ToString();
string seatNumber = parsedData.FieldsByName["seatNumber"].Parsed.ToString();
var hashMap = (Java.Util.HashMap)parsedData.FieldsByName["flightDate"].Parsed;
int year = ((Java.Lang.Integer)hashMap.Get("year")).IntValue();
int month = ((Java.Lang.Integer)hashMap.Get("month")).IntValue();
int day = ((Java.Lang.Integer)hashMap.Get("day")).IntValue();
// Do something with the extracted fields.
}
catch (ArgumentException e)
{
// Handle the parser errors
}
}
Finally, add the listener to the mode to receive scan results:
barcodeCapture.AddListener(this);
For details, go to the API docs.
Examples
Parsing the following code (without the quotes) given a reference year of 2024:
"M1DESMARAIS/LUC EABC123 YULFRAAC 0834 226F001A0025 100"
will result in the following JSON output:
[
{
"name": "formatCode",
"parsed": "M",
"rawString": "M"
},
{
"name": "numberOfLegsEncoded",
"parsed": 1,
"rawString": "1"
},
{
"name": "passengerName",
"parsed": [
"LUC",
"DESMARAIS"
],
"rawString": "DESMARAIS/LUC"
},
{
"name": "electronicTicketIndicator",
"parsed": "E",
"rawString": "E"
},
{
"name": "legs",
"parsed": [
{
"checkInSequenceNumber": "0025",
"compartmentCode": "F",
"flightDate": {
"day": 13,
"month": 8,
"year": 2024
},
"flightNumber": "0834",
"fromAirport": "YUL",
"operatingCarrierDesignator": "AC",
"operatingCarrierPNR": "ABC123",
"passengerStatus": "1",
"seatNumber": "001A",
"toAirport": "FRA"
}
],
"rawString": "ABC123 YULFRAAC 0834 226F001A0025 1"
}
]
Exposed Fields
The names of the fields correspond to their names from the IATA BCBP spec, written in lower came case. For further details about specific items, please refer to the IATA Resolution 792 BCBP specifications.
Fields can be Mandatory (M) or Conditional (C), and in either case, are either top-level or associated with Legs (L).
Element Name |
Meaning |
M, C, L |
Value Type |
Notes |
---|---|---|---|---|
formatCode |
Format code |
M |
string |
Always ‘M’ |
numberOfLegsEncoded |
Number of legs |
M |
integer |
1 or greater |
legs |
Details for each leg of the trip |
M |
array of json objects |
|
passengerName |
Passenger’s first name and last name |
M |
array of two strings |
Names are truncated as required to fit within the total 19 characters available. |
electronicTicketIndicator |
Electronic ticket indicator |
M |
string |
E if passenger is travelling on an electronic ticket. |
passengerDescription |
The type of passenger |
C |
string |
0 for adult, 1 for male, 2 for female, 3 for child, etc… |
sourceOfCheckin |
Where the passenger checked in |
C |
string |
W for web, K for airport kiosk, R for remote, etc… |
sourceofBoardingPassIssuance |
Where the boarding ass was issued |
C |
string |
W for web, K for airport kiosk, R for remote, etc… |
dateOfIssuance |
Date the boarding pass was issued |
C |
key/value pairs:
with YYYY, MM, DD integers |
|
versionNumber |
BCBP version number |
C |
string |
Current version is 8. |
documentType |
Document type |
C |
string |
B for boarding pass, I for itinerary receipt. |
airlineDesignatorOfIssuer |
Designator of the airline which issued the boarding pass |
C |
string |
|
baggageTagLicensePlateNumbers |
Baggage tag license plate numbers |
C |
array of strings |
Each string in the array represents the license plate number for a single item of baggage. |
securityDataType |
The type of security used to protect the BCBP. |
C |
string |
|
securityData |
The security data used to prevent tampering of the BCBP data. |
C |
string |
|
operatingCarrierPNR |
Operating carrier PNR code |
L,M |
string |
|
fromAirport |
Three letter origin airport / city code. |
L,M |
string |
|
toAirport |
Three letter destination airport / city code. |
L,M |
string |
|
operatingCarrierDesignator |
Airline code for the operating carrier. |
L,M |
string |
Can be either the two letter or the three letter designator. |
flightNumber |
Actual flight number |
L,M |
string |
|
flightDate |
Date of the flight. |
L,M |
key/value pairs:
with YYYY, MM, DD integers |
|
compartmentCode |
Compartment code. |
L,M |
string |
F (first class), J (business class), Y (economy/coach), etc… See resolution IATA 728 for full list. |
seatNumber |
Seat number. |
L,M |
string |
Seat number if one has been assigned. Can also be e.g. GATE or STBY. |
checkInSequenceNumber |
Five character check-in sequence number. |
L,M |
string |
|
passengerStatus |
Passenger status. |
L,M |
string |
0 for passenger not checked in, 1 for passenger checked in, 2 for baggage checked in but passenger not checked in, etc.. |
airlineNumericCode |
Three characters representing the airline code. |
L,C |
string |
|
serialNumber |
Serial number of the document. |
L,C |
string |
|
selecteeIndicator |
Whether the passenger is a selectee or not. |
L,C |
string |
|
internationalDocumentationVerification |
Whether the passenger requires travel document verification or not. |
L,C |
string |
|
marketingCarrierDesignator |
Marketing carrier designator. |
L,C |
string |
May be the same as the operating carrier. |
frequentFlyerAirlineDesignator |
Airline code for the FFP. |
L,C |
string |
May be the two character or three character code. |
frequentFlyerNumber |
Frequent flyer number. |
L,C |
string |
13-16 characters in length. |
idIndicator |
Codes for indicating industry discounts or agency discounts. |
L,C |
string |
|
freeBaggageAllowance |
Free baggage allowance. |
L,C |
string |
Will indicate free allowance in pieces (PC), kilos (K) or pounds (P) |
fastTrack |
Passenger is fast tracked. |
L,C |
string |
Y for yes, N for no. Blank if unqualified. |
airlineInfo |
For airline use. |
L,C |
string |
Can be of arbitrary length but limited by total available size of section. |
Parser Options
Following options can be set to fine-tune the behavior of the parser:
- “strictMode”: boolean (default:true)
Controls the strictness of the parser. When strictMode is set to true, every error in the input (invalid characters etc.) is treated as an error. Parsing is aborted upon encountering the first error. When strictMode is set to false, parsing continues for non-critical errors. The encountered problems can be queried for each field separately via the issues property, although for the “legs” fields the errors will propagate to the result.
- “referenceYear”: int? (default: null)
The date of issuance indicates the final digit of the year of issuance. To thus deduce the correct decade without ambiguity, the “referenceYear” may be set in the parser options.