(TBarcodeFmx2D_MicroPDF417)
Returns the check sum of a barcode text that will be encoded into a series of structured append symbols.
type
{ Defined in the pfmxPDF417Com unit }
TPDF417_Option = (poIgnoreShiftBeforeECI, poFirst903TextAlphaLatch, poFirst904TextMixedLatch, po906TextAlphaLatch, po907TextAlphaLatch, po908TextAlphaLatch, po910TextAlphaLatch, po912TextAlphaLatch, po914TextAlphaLatch, po915TextAlphaLatch, poFirstFNC1MatchAI01, poMicroPDF417Explicit901);
{ Defined in the pfmxPDF417Com unit }
TPDF417_Options = set of TPDF417_Option;
{ Defined in the pfmxMicroPDF417 unit }
TMicroPDF417_Options = TPDF417_Options;
function GetCheckSum(Data: TBytes; AllowEscape: Boolean; var InvalidIndex: Integer; Options: TMicroPDF417_Options = []): TBytes; virtual;
The method returns the check sum of a barcode text that will be encoded into a series of MicroPDF417 structured append symbols. The value will be used in the structured append block, and the structured append block will be used by each symbol in the series of MicroPDF417 structured append symbols. See also the "Structured append" section in the "TBarcodeFmx2D_MicroPDF417" article.
Data: TBytes; It's the original input text before division into the each symbol in the series of structured append symbols. It is of type TBytes (it is in fact a byte array). You can use the method to caculate the check sum of a block of binary (bytes) data.
See also the "Data" property article.
AllowEscape: Boolean; Specifies whether to allow users to insert the escape sequences to the Data parameter value, in order to place the function characters and additional control information.
See also the "Escape sequences" section in the "TBarcodeFmx2D_MicroPDF417" article and the "AllowEscape" property article.
InvalidIndex: Integer; If there is any invalid byte value in the barcode text that is specified by the Data parameter, the parameter returns the position index of first invalid byte value, the index 0 denotes that the first byte is invalid. Otherwise, it returns the Verify_OK (-1).
This method can return one of these values (these consts are defined in the pfmxCore2D unit):
Verify_OK (-1):
It indicates the method succeeds.
Verify_InvalidIndex_Base (0), and greater than 0:
It indicates that an invalid byte value is in the Data parameter, the return value is the position index of the invalid byte value. The index 0 denotes that the first byte value is invalid.
Options: TPDF417_Options; The Options parameter is an advanced feature which allows low level control over data encoding. The parameter can be used to change the encoding algorithm and meanings of some fucntion codewords, in order to match the reader. The values that can be included in the Options parameter are defined in the pPDF417Com unit.
See also the "Options" property article.
If the method succeeds, it returns the check sum value, it's a 16-bit word value in decimal format, encoded as ASCII bytes sequence, in the TBytes array, and the InvalidIndex parameter returns the Verify_OK (-1). If the method fails, the InvalidIndex parameter returns a position index of first invalid byte in the Data parameter, it's an integer value greater than or equal to zero. See also the InvalidIndex parameter section above.
For example, the check sum is 1059, the return value is the byte array (TBytes):
($31{'1'}, $30{'0'}, $35{'5'}, $39{'9'})
The result array can be directly used as the check sum in the structured append block:
var
full_barcode_data, check_sum, structuredappend_block: TBytes;
invalid_index: Integer;
structuredappend_block_len, check_sum_len: Integer;
begin
full_barcode_data := ......;
check_sum := GetCheckSum(full_barcode_data, False, invalid_index, []);
if invalid_index <> -1 then exit;
SetLength(structuredappend_block, 15);
structuredappend_block[0] := $5c{'\'};
structuredappend_block[1] := $73{'s'};
structuredappend_block[2] := $5b{'['};
structuredappend_block[3] := $35{'5'};
structuredappend_block[4] := $2c{','}; // Index: 5
structuredappend_block[5] := $30{'0'};
structuredappend_block[6] := $32{'2'};
structuredappend_block[7] := $39{'9'};
structuredappend_block[8] := $2c{','}; // File_ID: 029
structuredappend_block[9] := $2c{','}; // File_Name:
structuredappend_block[10] := $2c{','}; // Amount:
structuredappend_block[11] := $2c{','}; // Time_Stamp:
structuredappend_block[12] := $2c{','}; // Sender:
structuredappend_block[13] := $2c{','}; // Address:
structuredappend_block[14] := $2c{','}; // File_Size:
structuredappend_block_len := Length(structuredappend_block);
check_sum_len := Length(check_sum);
SetLength(structuredappend_block, structuredappend_block_len + check_sum_len + 1);
Move(PByte(@check_sum[0])^, PByte(@structuredappend_block[structuredappend_block_len])^, check_sum_len);
structuredappend_block[structuredappend_block_len + check_sum_len] := $5d{']'};
//......
See also the "Sturctured append" section in the "TBarcodeFmx2D_MicroPDF417" article.