| MIL 10 Reference
| Customize Help
| Save Settings

McodeModel



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
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.

A code context can contain multiple models of 1D code types (excluding GS1 Databar, Planet, Postnet, and 4-state code), 2D codes types, and composite code types. You can add multiple code models to the code context by calling McodeModel() multiple times.

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

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, aside from being associated with a code model identifier, the code model is given a sequential index number within the code context, in the order that the code model was added. If a code model is deleted, all code models with higher indices are shifted down one.

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
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
CollapseValue Description
Collapse M_ADD

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

(summarize)
Collapse 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)
Collapse 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)
CodeType INQ

Specifies the code type of the code model to add or find from the code context. Note that if the Operation parameter is set to 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
CollapseValue Description
Collapse 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
CollapseValue Description
Collapse M_4_STATE

Specifies a 4-state code type.

Collapse M_BC412

Specifies a BC412 code type.

Collapse M_CODABAR

Specifies a Codabar code type.

Collapse M_CODE39

Specifies a Code 39 code type.

Collapse M_CODE93

Specifies a Code 93 code type.

Collapse M_CODE128

Specifies a Code 128 code type.

Collapse M_EAN8

Specifies an EAN 8 code type.

Collapse M_EAN13

Specifies an EAN 13 code type.

Collapse M_EAN14

Specifies an EAN 14 code type.

Collapse M_GS1_128

Specifies a GS1-128 code type.

Collapse M_GS1_DATABAR

Specifies a GS1 Databar code type.

Collapse M_INDUSTRIAL25

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

Collapse M_INTERLEAVED25

Specifies an Interleaved 25 (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)
Collapse M_PHARMACODE

Specifies a Pharmacode code type.

Collapse M_PLANET

Specifies a Planet code type.

Collapse M_POSTNET

Specifies a Postnet code type.

Collapse M_UPC_A

Specifies a UPC-A code type.

Collapse 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
CollapseValue Description
Collapse M_AZTEC

Specifies an Aztec code type. This is a type of Matrix code.

(summarize)
Collapse M_DATAMATRIX

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

(summarize)
Collapse M_MAXICODE

Specifies a Maxicode code type. This is a type of Matrix code.

(summarize)
Collapse M_MICROPDF417

Specifies a MicroPDF417 code type. This is a type of Cross-row code.

(summarize)
Collapse M_MICROQRCODE

Specifies a Micro QR code type. This is a type of Matrix code.

(summarize)
Collapse M_PDF417

Specifies a PDF417 code type. This is a type of Cross-row code.

(summarize)
Collapse M_QRCODE

Specifies a QR code type. This is a type of Matrix code.

(summarize)
Collapse M_TRUNCATED_PDF417

Specifies a Truncated PDF417 code type. This is a type of Cross-row code.

(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
CollapseValue Description
Collapse 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 of the code model to find in the context. Note that if the Operation parameter is set to M_ADD or M_DELETE, set this parameter to M_NULL.

Each code model is associated with a unique identifier, starting at zero, when it is added to a code context, this is a model's instance. If a code type is specified using the CodeType parameter, the Instance parameter must indicate the instance, starting at zero, of that particular code type.

function map For specifying the instance of a code model
CollapseValue Description
Collapse Value

Specifies the instance of the individual code model on which to perform the operation.

ControlFlag

Specifies the function's control flag. Reserved for future expansion. This parameter must be set to M_DEFAULT.

ModelCodeIdPtr

Specifies the address in which to return the code model identifier for M_ADD and M_FIND operations. For a M_DELETE operation, ModelCodeIdPtr specifies the identifier of the model to be deleted. For M_ADD and M_FIND operations, you can set this parameter to M_NULL, since this function also returns the code model identifier.

Return value
The returned value is the identifier of the code model for a successful M_ADD operation; if the model could not be added, M_NULL is returned. The returned value is the identifier of the code model for a successful M_FIND operation; M_NULL is returned if no code model is found. 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 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