Skip to content
GBG Documents & Biometrics Documentation

CMagLib library

Address

City

Class

DateOfBirth

Endorsements

ExpirationDate

Eyes

GetRawData

Hair

Height

InitLibrary

IsReaderValid

IssueDate

License

NameFirst

NameLast

NameMiddle

NameSuffix

Process

ProcessEx

Restriction

Sex

State

WasCardSweeped

Weight

Zip

ReleasePort

Returns the Address value in string format (read-only)

Syntax

Address As String

Parameters

None

Return Values

Returns the Address value

Returns the City value in string format (read-only)

Syntax

City As String

Parameters

None

Return Values

Returns the City value

Returns the Class value in string format (read-only)

Syntax

Class As String

Parameters

None

Return Values

Returns the Class value

Returns the DateOfBirth value in string format (read-only)

Syntax

DateOfBirth As String

Parameters

None

Return Values

Returns the DateOfBirth value

Returns the Endorsements value in string format (read-only)

Syntax

Endorsements As String

Parameters

None

Return Values

Returns the Endorsements value

Returns the ExpirationDate value in string format (read-only)

Syntax

ExpirationDate As String

Parameters

None

Return Values

Returns the ExpirationDate value

Returns the Eyes value in string format (read-only)

Syntax

Eyes As String

Parameters

None

Return Values

Returns the Eyes value

Returns the text data from the magnetic reader device without additional processing

Syntax

GetRawData(sData As String) As Long

Parameters

Parameter Description
[in] Data

Return Values

Value Description
MAG_ERR_NONE Data retrieved successfully
MAG_ERR_CARD_NOT-DETECTED Buffer is empty

Returns the Hair value in string format (read-only)

Syntax

Hair As String

Parameters

None

Return Values

Returns the Hair value

Returns the Height value in string format (read-only)

Syntax

Height As String

Parameters

None

Return Values

Returns the Height value

Scans COM1 – COM16 and searches for the magnetic reader device. After it is found, the reader is initialized and the library loads and is initialized.

Note: This function must be called before calling any other function in the library.

Syntax

InitLibrary(license As String) As Long

Parameters

Parameter Description
[in] license Null-terminated string that contains the license key value

Return Values

Value Description
LICENSE_VALID License is valid and library is ready to use
LICENSE_INVALID License invalid; all scanner operations disabled
LICENSE_EXPIRED License expired; all scanner operations disabled
LICENSE_DOES_NOT_MATCH_LIBRARY License invalid for this library; all library operations disabled
GENERAL_ERR_PLUG_NOT_FOUND Returned if the attached scanner is not one of the following: ScanShell 600 | ScanShell 800XX | ScanShell 1000 | ScanShell 2000XX | ScanShell 4000 | ScanShell 5000
MAG_ERR_NO_READER_FOUND Magnetic reader device not found on any of the PC ports

Detects if the magnetic stripe reader is connected and functioning. The reader is searched for in the COM port which is found in the InitLibrary function.

Syntax

IsReaderValid() As Long

Parameters

None

Return Values

Value Description
MAG_ERR_NO_READER_FOUND Reader not connected to PC
MAG_ERR_NONE Reader connected to PC and functioning correctly

Returns the IssueDate value in string format (read-only)

Syntax

IssueDate As String

Parameters

None

Return Values

Returns the IssueDate value

Returns the license value in string format (read-only)

Syntax

license As String

Parameters

None

Return Values

Returns the License value

Returns the NameFirst value in string format (read-only)

Syntax

NameFirst As String

Parameters

None

Return Values

Returns the NameFirst value

Returns the NameLast value in string format (read-only)

Syntax

NameLast As String

Parameters

None

Return Values

Returns the NameLast value

Returns the NameMiddle value in string format (read-only)

Syntax

NameMiddle As String

Parameters

None

Return Values

Returns the NameMiddle value

Returns the NameSuffix value in string format (read-only)

Syntax

NameSuffix As String

Parameters

None

Return Values

Returns the NameSuffix value

Processes the recently swiped card raw data. The raw data is scanned for format detection. If a specific format is detected, the data is parsed further and loads the library properties.

Syntax

Process() As Long

Parameters

None

Return Values

Value Description
LONG_AAMVA Standard AAMVA format (includes channel1, channel2 and channel3)
SHORT_AAMVA Short AAMVA format (includes channel1 and channel3)
OLD_CA_DMV Old DMV format (California)
OLD_LA_DMV Old DMV format (Louisiana)
UNKNOWN_FORMAT Unknown format; no further processing performed

Processes the recently swiped card raw data. The raw data is scanned for format detection. If a specific format is detected, the data is parsed further and loads the library properties.

Syntax

ProcessEx(strData As String) As Long

Parameters

Parameter Description
[in] strData

Return Values

Value Description
LONG_AAMVA Standard AAMVA format (includes channel1, channel2 and channel3)
SHORT_AAMVA Short AAMVA format (includes channel1 and channel3)
OLD_CA_DMV Old DMV format (California)
OLD_LA_DMV Old DMV format (Louisiana)
UNKNOWN_FORMAT Unknown format; no further processing performed

Returns the Restriction value in string format (read-only)

Syntax

Restriction As String

Parameters

None

Return Values

Returns the Restriction value

Returns the Sex value in string format (read-only)

Syntax

Sex As String

Parameters

None

Return Values

Returns the Sex value

Returns the State value in string format (read-only)

Syntax

State As String

Parameters

None

Return Values

Returns the State value

Call this function periodically to find out if a new card swipe was performed. If no new swipe was performed, the function returns MAG_ERR_CARD_NOT_DETECTED. If the reader detects a new swipe, it returns MAG_ERR_CARD_DETECTED. If the system is in error condition (due to bad initialization or disconnection of the reader from the PC), the function returns one of the other values.

Syntax

WasCardSweeped() As Long

Parameters

None

Return Values

Value Description
MAG_ERR_NO_READER_FOUND Reader is not connected to the PC
SERIAL_NOT_INIT Serial port not initialized
SERIAL_PORT_NOT_OPEN Serial port could not be opened
SERIAL_PORT_CONFIG_FAIL COM port configuration failed
SERIAL_COM_TIMEOUT_FAIL COM port timeout failure
MAG_ERR_CARD_NOT_DETECTED No new card swipe detected from last call to this function
MAG_ERR_CARD_DETECTED Recent card swipe detected and data available for processing

Returns the Weight value in string format (read-only)

Syntax

Weight As String

Parameters

None

Return Values

Returns the Weight value

Returns the Zip value in string format (read-only)

Syntax

Zip As String

Parameters

None

Return Values

Returns the Zip value

Releases the USB port and uninitializes the magnetic library

Syntax

ReleasePort()

Parameters

None

Return Values

None