#ifndef _LEGEODEV_H_
#define _LEGEODEV_H_

#ifndef LEGEODEV_FUNC
#ifdef __cplusplus
#define LEGEODEV_FUNC extern "C"
#else
#define LEGEODEV_FUNC
#endif // __cplusplus
#endif // LEGEODEV_FUNC


#define LD_ERROR    -1


LEGEODEV_FUNC int __stdcall legeoDev_ReadBmp(BITMAPINFO* pBmpInfo, BYTE* pBytes);
LEGEODEV_FUNC int __stdcall legeoDev_ReadClipboard();
LEGEODEV_FUNC int __stdcall legeoDev_ReadFile(BYTE* pFileName);
// Call one of the versions of 'legeoDev_Read' to perform the READING PROCESS
// (which is described in the legeo manual) for a given image.
// The first version accepts a standard bitmap image (BMP).
// The second version uses an image, which has previously been copied to clipboard.
// The third version loads an image file using the given file name including the path
// (supported file formats: bmp, jpg, png, tif).
//
// The functions return the NUMBER OF MESSAGES found in the image
// or the value 'LD_ERROR' if some error has occurred.


LEGEODEV_FUNC int __stdcall legeoDev_GetNextMessage(BYTE* pBuffer, int nBufferLength,
                                                    int* pCorners = NULL,
                                                    bool* pContainsBinaryData = NULL);
// When the function 'legeoDev_Read' has returned and if it indicates
// a number of messages greater than zero, you may use 'legeoDev_GetNextMessage'
// to RETRIEVE THE MESSAGES found in the image. Each call yields one single message,
// use consecutive calls to get all of them.
// You need to provide a BYTE BUFFER for the message (pass its address in 'pBuffer' and
// its size in 'nBufferLength'). The message will always be terminated by a zero byte,
// but be aware that - in case it contains binary data - there may also be zero bytes
// inside the message which are part of the information. The function's RETURN VALUE
// gives you the true number of bytes written into the buffer (excluding the terminating zero).
// Optionally, you may provide an array of 8 integers pointed to by 'pCorners' which will
// be filled with the COORDINATES OF THE FOUR CORNERS of the message symbol
// (x1,y1,x2,y2,x3,y3,x4,y4).
// If desired, the information whether or not the message CONTAINS BINARY DATA is put into
// the variable pointed to by 'pContainsBinaryData'.


LEGEODEV_FUNC int __stdcall legeoDev_GetLastError(BYTE* pBuffer, int nBufferLength);
// If 'legeoDev_Read' returns 'LD_ERROR', use 'legeoDev_GetLastError' to get the
// corresponding error message string. Provide a BYTE BUFFER as in 'legeoDev_GetNextMessage'.
// Here, the buffer's contents may always be treated as a zero-terminated character string.
// Again, the function's RETURN VALUE gives the true number of characters put into
// the buffer (excluding the terminating zero).


LEGEODEV_FUNC void __stdcall legeoDev_ResetSelfAdaption();
// Call this function to reset the self adaption. All legeo readers, which support
// the self adaption feature, will be reset to their initial "standard configuration"
// as described in the legeo manual. After this, successful reading will be impossible
// unless you allow the readers to readapt to your images. This can be done very easily
// by calling 'legeoDev_Read' for a set of typical sample images (repeat the samples
// cyclicly until the reading performance becomes satisfactory).


LEGEODEV_FUNC void __stdcall legeoDev_DisplayRegistrationDialog();
// Use this function to display the standard registration dialog for legeoDev,
// which shows the registration information and allows the user to enter an activation key.


LEGEODEV_FUNC void __stdcall legeoDev_GetRegistrationInfo(bool* pIsAuthorized,
                                                          BYTE* pComputerID = NULL,
                                                          BYTE* pCustomerName = NULL);
// If you don't want to use the standard registration dialog,
// you may call 'legeoDev_GetRegistrationInfo' to get all the related information into your
// application program and display your own user interface for registration.
// The variable referenced by 'pIsAuthorized' will contain the value 'true',
// if there is a valid registration for legeoDev.
// If you provide byte buffers for the computer ID and/or the customer name, each buffer
// must be at least 21 bytes long. The buffers will contain usual zero-terminated
// character strings. The computer ID is needed to get an activation key from PATTERN EXPERT.


LEGEODEV_FUNC bool __stdcall legeoDev_ApplyActivationKey(BYTE* pKey);
// Use this function to register legeoDev. You need to pass the valid activation key
// obtained from PATTERN EXPERT in a zero-terminated character string (referenced by 'pKey').
// When the function returns, the return value will inform you whether or not
// there is a valid authorization now.



#endif // _LEGEODEV_H_
