Table: | For specifying the type of operation to perform |
+ combination: | For inquiring whether a code type can be added to the code context |
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 |
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.
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().
Specifies the operation to perform within the specified code context. This parameter must be set to one of the following values:
For specifying the type of operation to
perform
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_ADD + |
Adds a new code model to the code context. Specify the code type of the code model using the CodeType parameter. (summarize)Adds a new code model to the code context. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Deletes a code model within the code context, whose model identifier is specified by the ContextCodeId parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Finds a code model within the code context, whose code type is specified by the CodeType parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Resets the code context and adds new code models to the context based on the results of an McodeDetect() operation. (more details...) |
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.
For inquiring whether a code type can be added to the
code context
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description | ||||||||||||||||||||||||||||||||||||||
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. |
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:
For finding code models of any type
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_ANY |
Matches all code types. This value can only be used when the Operation parameter is set to M_FIND. (summarize)Matches all code types. (more details...) |
To specify the type of a 1D code model to add or find, the CodeType parameter can be set to one of the following:
For specifying a 1D code type
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_4_STATE |
Specifies a 4-state code type. |
||||||||||||||||||||||||||||||||||||||
M_BC412 |
Specifies a BC412 code type. |
||||||||||||||||||||||||||||||||||||||
M_CODABAR |
Specifies a Codabar code type. |
||||||||||||||||||||||||||||||||||||||
M_CODE39 |
Specifies a Code 39 code type. |
||||||||||||||||||||||||||||||||||||||
M_CODE93 |
Specifies a Code 93 code type. |
||||||||||||||||||||||||||||||||||||||
M_CODE128 |
Specifies a Code 128 code type. |
||||||||||||||||||||||||||||||||||||||
M_EAN8 |
Specifies an EAN 8 code type. |
||||||||||||||||||||||||||||||||||||||
M_EAN13 |
Specifies an EAN 13 code type. |
||||||||||||||||||||||||||||||||||||||
M_EAN14 |
Specifies an EAN 14 code type. |
||||||||||||||||||||||||||||||||||||||
M_GS1_128 |
Specifies a GS1-128 code type. |
||||||||||||||||||||||||||||||||||||||
M_GS1_DATABAR |
Specifies a GS1 Databar code type. |
||||||||||||||||||||||||||||||||||||||
M_INDUSTRIAL25 |
Specifies an Industrial 2 of 5 (standard 2 of 5) code type. |
||||||||||||||||||||||||||||||||||||||
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)Specifies an Interleaved 2 of 5 (ITF-14) code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PHARMACODE |
Specifies a Pharmacode code type. |
||||||||||||||||||||||||||||||||||||||
M_PLANET |
Specifies a Planet code type. |
||||||||||||||||||||||||||||||||||||||
M_POSTNET |
Specifies a Postnet code type. |
||||||||||||||||||||||||||||||||||||||
M_UPC_A |
Specifies a UPC-A code type. |
||||||||||||||||||||||||||||||||||||||
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:
For specifying a 2D code type
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_AZTEC |
Specifies an Aztec code type. This is a matrix code type. (summarize)Specifies an Aztec code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
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)Specifies a Data Matrix code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_MAXICODE |
Specifies a Maxicode code type. This is a matrix code type. (summarize)Specifies a Maxicode code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_MICROPDF417 |
Specifies a MicroPDF417 code type. This is a cross-row code type. (summarize)Specifies a MicroPDF417 code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_MICROQRCODE |
Specifies a Micro QR code type. This is a matrix code type. (summarize)Specifies a Micro QR code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PDF417 |
Specifies a PDF417 code type. This is a cross-row code type. (summarize)Specifies a PDF417 code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_QRCODE |
Specifies a QR code type. This is a matrix code type. (summarize)Specifies a QR code type. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_TRUNCATED_PDF417 |
Specifies a Truncated PDF417 code type. This is a cross-row code type. (summarize)Specifies a Truncated PDF417 code type. (more details...) |
To specify that the code model to add or find is a composite code, the CodeType parameter must be set to the following:
For specifying a composite code type
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
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)Specifies a composite code type. (more details...) |
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.
For specifying the instance of a code
model
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
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. |
||||||||||||||||||||||||||||||||||||||
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)Specifies the instance or index of the individual code model on which to perform the operation when performing an M_FIND operation. (more details...) |
Specifies additional information required to perform the operation. When not performing an M_RESET_FROM_DETECTED_RESULTS operation, set this parameter to M_DEFAULT.
For specifying additional information required to
perform the operation
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies no additional information is required. |
||||||||||||||||||||||||||||||||||||||
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)Specifies the identifier of the code detect result buffer to use to add models, when performing an M_RESET_FROM_DETECTED_RESULTS operation. (more details...) |
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.
For specifying/retrieving the code model
identifier
|
|||||||||||||||||||||||||||||||||||||||
Value | Description | ||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to ignore this parameter. |
||||||||||||||||||||||||||||||||||||||
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. |
||||||||||||||||||||||||||||||||||||||
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)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. (more details...) |
||||||||||||||||||||||||||||||||||||||
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. |
Header | Include mil.h. |
Library | Use mil.lib; milcode.lib. |
DLL | Requires mil.dll; milcode.dll. |