Filters
Filter values by
Operation
  • Add code model
  • Add code models from detected results
  • Find code model
  • Delete code model
| Customize Help
| Save Settings

McodeModel



Function Map
Synopsis
Add, find, or delete a code model within a code context.
Syntax
MIL_ID McodeModel(
MIL_ID ContextCodeId, //in
MIL_INT64 Operation, //in
MIL_INT64 CodeType, //in
MIL_INT Instance, //in
MIL_INT64 ControlFlag, //in
MIL_ID *ModelCodeIdPtr //in-out
)
Description

This function adds a code model to a code context, finds a code model of a particular type in a code context, or deletes a code model from a code context.

Specify the code type of the code model when adding the model. A code context can contain multiple code models of 1D code types (excluding GS1 databar, Planet, Postnet, and 4-state); for other code types, a code context can contain at most one code model. Although a code context can contain only one 2D code model, you can specify to perform a read, grade, or train operation on more than one occurrence of a Data Matrix code model (or any 1D code model that is not a GS1 Databar, Planet, Postnet, and 4-state code model), using McodeControl() with M_NUMBER.

Instead of individually adding models and specifying their code type, you can automatically detect the code type and encoding scheme of most 1D code occurrences in an image using McodeDetect(), and automatically add a code model for each type found. To do so, set the Operation parameter to M_RESET_FROM_DETECTED_RESULTS, and pass the code detect result buffer to the ControlFlag parameter. This first deletes all existing code models in the code context, and then adds a code model for each detected code type. If two code occurrences with the same code type but different encoding schemes are detected, only one code model of this type is added and its encoding scheme is set to M_ANY (if supported by the code type).

Use McodeControl() and McodeInquire() to configure or retrieve information about a code model or code context.

When you add a code model, it is assigned a code model identifier. To control or inquire about the code model, or to use the code model to write a symbol, you need its code model identifier. To retrieve the identifier of an existing code model in a code context (for example, in a restored code context), you can perform an M_FIND operation in one of two ways. If you know the code type, you can specify this and the instance of the code model of this type in the code context. Alternatively, you can pass M_ANY as the code type and specify the index of the code model in the code context. Aside from being associated with a code model identifier, a code model is given a sequential index number within the code context, in the order that the code model was added and starting from 0. If a code model is deleted, all code models with higher indices are shifted down one.

The added code models cannot be individually freed using McodeFree(). They are either automatically freed when their context is freed, or when they are removed from the context by calling McodeModel() with M_DELETE.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextCodeId

Specifies the code context in which to add, find, or delete the code model. The code context must have been previously allocated on the required system using McodeAlloc().

Operation

Specifies the operation to perform within the specified code context. This parameter must be set to one of the following values:

function map For specifying the type of operation to perform
Click to summarizeValue Description
Click to summarize M_ADD +

Adds a new code model to the code context. Specify the code type of the code model using the CodeType parameter.

(summarize)
Click to summarize M_DELETE

Deletes a code model within the code context, whose model identifier is specified by the ContextCodeId parameter.

For a M_DELETE operation, the CodeType and Instance parameters must be passed M_NULL.

(summarize)
Click to summarize M_FIND

Finds a code model within the code context, whose code type is specified by the CodeType parameter. If there are many code models having the same specified code type, you must specify which instance of the specified type using the Instance parameter.

(summarize)
Click to summarize M_RESET_FROM_DETECTED_RESULTS

Resets the code context and adds new code models to the context based on the results of an McodeDetect() operation. A code model is added for each code type that was detected by the McodeDetect() operation; if it detected two code occurrences with the same code type but different encoding schemes, only one code model of this type is added and its encoding scheme is set to M_ANY (if supported by the code type). All existing code models in the context are deleted.

When resetting the code context, M_INITIALIZATION_MODE is set to M_IMPROVED_RECOGNITION. For all code models added, M_POSITION_ACCURACY is set to M_HIGH, and M_CODE_SEARCH_MODE is set to M_BEST.

You must pass the code detect result buffer to the ControlFlag parameter.

(summarize)
Combination value for M_ADD.

You can add the following value to the above-mentioned value to determine whether a code type can be added to the code context, given the code type of the code models that already exist in the context.

function map For inquiring whether a code type can be added to the code context
Click to summarizeCombination value Description
Click to summarize M_SUPPORTED

Inquires whether the code type can be added to the code context, given the code type(s) that already exists in the context.

CodeType INQ

Specifies the code type of the code model to add or find in the code context. Note that if the Operation parameter is set to M_RESET_FROM_DETECTED_RESULTS or M_DELETE, set this parameter to M_NULL. Possible values for CodeType are listed below.

To find a code model of any type, the CodeType parameter must be set to the following:

function map For finding code models of any type
Click to summarizeValue Description
Click to summarize M_ANY

Matches all code types. This value can only be used when the Operation parameter is set to M_FIND.

(summarize)

To specify the type of a 1D code model to add or find, the CodeType parameter can be set to one of the following:

function map For specifying a 1D code type
Click to summarizeValue Description
Click to summarize M_4_STATE

Specifies a 4-state code type.

Click to summarize M_BC412

Specifies a BC412 code type.

Click to summarize M_CODABAR

Specifies a Codabar code type.

Click to summarize M_CODE39

Specifies a Code 39 code type.

Click to summarize M_CODE93

Specifies a Code 93 code type.

Click to summarize M_CODE128

Specifies a Code 128 code type.

Click to summarize M_EAN8

Specifies an EAN 8 code type.

Click to summarize M_EAN13

Specifies an EAN 13 code type.

Click to summarize M_EAN14

Specifies an EAN 14 code type.

Click to summarize M_GS1_128

Specifies a GS1-128 code type.

Click to summarize M_GS1_DATABAR

Specifies a GS1 Databar code type.

Click to summarize M_INDUSTRIAL25

Specifies an Industrial 2 of 5 (standard 2 of 5) code type.

Click to summarize M_INTERLEAVED25

Specifies an Interleaved 2 of 5 (ITF-14) code type.

M_INTERLEAVED25 is best used in a fixed-length application, with all reading equipment programmed to accept messages only of the correct length.

(summarize)
Click to summarize M_PHARMACODE

Specifies a Pharmacode code type.

Click to summarize M_PLANET

Specifies a Planet code type.

Click to summarize M_POSTNET

Specifies a Postnet code type.

Click to summarize M_UPC_A

Specifies a UPC-A code type.

Click to summarize M_UPC_E

Specifies a UPC-E code type.

To specify the type of a 2D code model to add or find, the CodeType parameter can be set to one of the following:

function map For specifying a 2D code type
Click to summarizeValue Description
Click to summarize M_AZTEC

Specifies an Aztec code type. This is a matrix code type.

(summarize)
Click to summarize M_DATAMATRIX

Specifies a Data Matrix code type. This is a matrix code type.

Note that this code type includes the Extended Rectangular Data Matrix (DMRE) type.

(summarize)
Click to summarize M_MAXICODE

Specifies a Maxicode code type. This is a matrix code type.

(summarize)
Click to summarize M_MICROPDF417

Specifies a MicroPDF417 code type. This is a cross-row code type.

(summarize)
Click to summarize M_MICROQRCODE

Specifies a Micro QR code type. This is a matrix code type.

(summarize)
Click to summarize M_PDF417

Specifies a PDF417 code type. This is a cross-row code type.

(summarize)
Click to summarize M_QRCODE

Specifies a QR code type. This is a matrix code type.

(summarize)
Click to summarize M_TRUNCATED_PDF417

Specifies a Truncated PDF417 code type. This is a cross-row code type.

(summarize)

To specify that the code model to add or find is a composite code, the CodeType parameter must be set to the following:

function map For specifying a composite code type
Click to summarizeValue Description
Click to summarize M_COMPOSITECODE

Specifies a composite code type. The code type is a composite of a 1D and a 2D code type; the particular combination of code types is determined by the specified encoding scheme.

(summarize)
Instance

Specifies the instance or the index of the code model, depending on the operation and whether a specific code type is specified. Note that if the Operation parameter is set to M_ADD or M_DELETE, set this parameter to M_NULL.

function map For specifying the instance of a code model
Click to summarizeValue Description
Click to summarize M_ALL

Specifies to add a code model for each code type in the code detect result buffer, when performing an M_RESET_FROM_DETECTED_RESULTS operation.

Click to summarize Value >= 0

Specifies the instance or index of the individual code model on which to perform the operation when performing an M_FIND operation. When performing an M_FIND operation and a specific code type is specified using the CodeType parameter, the Instance parameter must indicate the instance, starting at zero, of that particular code type. If CodeType is set to M_ANY, the Instance parameter must specfy the index of the code model.

(summarize)
ControlFlag

Specifies additional information required to perform the operation. When not performing an M_RESET_FROM_DETECTED_RESULTS operation, set this parameter to M_DEFAULT.

function map For specifying additional information required to perform the operation
Click to summarizeValue Description
Click to summarize M_DEFAULT

Specifies no additional information is required.

Click to summarize DetectResultCodeId

Specifies the identifier of the code detect result buffer to use to add models, when performing an M_RESET_FROM_DETECTED_RESULTS operation. The code detect result buffer must have been previously allocated using McodeAllocResult() with M_CODE_DETECT_RESULT and store the results of an McodeDetect() operation.

(summarize)
ModelCodeIdPtr

Specifies the address in which to return or from which to read the code model identifier, depending on operation. For M_ADD, M_RESET_FROM_DETECTED_RESULTS, and M_FIND operations, you can set this parameter to M_NULL, since this function also returns the code model identifier.

function map For specifying/retrieving the code model identifier
Click to summarizeValue Description
Click to summarize M_NULL

Specifies to ignore this parameter.

Click to summarize Address containing code model identifer to
delete

Specifies the address containing the identifier of the code model to delete from the context, when performing an M_DELETE operation.

Click to summarize Address in which to write the identifier of
code model added

Specifies the address in which to write the identifier of the code model added, when performing an M_ADD or M_RESET_FROM_DETECTED_RESULTS operation. In the latter case, if multiple code models are added, only the identifier of the first code model is returned; to retrieve the identifier of the other code models, perform an M_FIND operation for each additional code model, specifying its index and an M_ANY code type.

(summarize)
Click to summarize Address in which to write the identifier of
code model found

Specifies address in which to write the identifier of the code model found, when performing an M_FIND operation.

Return value
The returned value is the identifier of the (first) code model for a successful M_ADD, M_RESET_FROM_DETECTED_RESULTS, or M_FIND operation; if the model could not be added/found, M_NULL is returned. The returned value is M_NULL for an M_DELETE operation.
Compilation information
Header Include mil.h.
Library Use mil.lib; milcode.lib.
DLL Requires mil.dll; milcode.dll.
ADD DELETE FIND RESET FROM DETECTED RESULTS SUPPORTED ANY 4 STATE BC412 CODABAR CODE39 CODE93 CODE128 EAN8 EAN13 EAN14 GS1 128 GS1 DATABAR INDUSTRIAL25 INTERLEAVED25 PHARMACODE PLANET POSTNET UPC A UPC E AZTEC DATAMATRIX MAXICODE MICROPDF417 MICROQRCODE PDF417 QRCODE TRUNCATED PDF417 COMPOSITECODE ALL DEFAULT NULL ADD RESET FROM DETECTED RESULTS FIND DELETE