Filter Library Camera Interface Physics

InterfaceDLL.h

00001 /*
00002  * InterfaceDll.h
00003  *
00004  * This file is part of the main program.
00005  * Computer Aided Measurement Environment for Realtime Atomic imaging (Camera)
00006  *
00007  * Copyright (C) 2004-2005, Leiden Probe Microscopy.
00008  * Copyright (C) 2004-2005, Universiteit Leiden.
00009  *
00010  * Authors: Els H. van Tol - Homan
00011  *
00012  * $Id: $
00013  */
00014 #if !defined(INTERFACEDLLSPEC_H__A5635676_074EF_176D4_AFEB_03455408547864__INCLUDED_)
00015 #define INTERFACEDLLSPEC_H__A5635676_074EF_176D4_AFEB_03455408547864__INCLUDED_
00016 
00017 #if _MSC_VER > 1000
00018 #pragma once
00019 #endif // _MSC_VER > 1000
00020 
00021 #pragma warning (push, 3)                       // disable warning 4200
00022 #pragma warning(disable : 4200)
00023 
00024 
00025 //-------------------------------------------------------------------------------//
00026 // Command- and Notify Message function calls
00027 //-------------------------------------------------------------------------------//
00028 // ------------------------------------------------------------------------------------
00029 /**
00030  *  \brief Command Message function calls
00031  *
00032  * Command- and Notify Message function calls
00033  *
00034  * \code
00035  * typedef      BOOL (*tSendSPMCommandMessage)(DWORD,LPARAM,LPARAM);
00036  * typedef BOOL (*tSendSPMNotifyMessage) (DWORD,LPARAM,LPARAM);
00037  * \endcode
00038  *
00039  * The Interface Dll is a so-called MFC Dll, dynamically linked to the MFC-libraries and (if needed) statically or dynamicly to the Objective Toolkit-libraries. The functions InitInstance and ExitInstance are called when the Dll is loaded in resp. freed from memory. Besides these MFC defined functions the SPM Interface Dll has one function for communicating with the Camera main program.
00040  * 
00041  * BOOL SendSPMCommand(DWORD dwCommand, LPARAM lParamA, LPARAM lParamB);
00042  * 
00043  * This function SendSPMCommand is called by the Camera main-program to send commands to the Interface Dll. These commands are defined in the remainder of this document. 
00044  * 
00045  * One of the first commands that must be send to the InterfaceDll is the SetSendNotifyProcAddres, to set the function address for returning commands from the InterfaceDll to the main program (called notifications).  This function is defined in the main program as:
00046  * 
00047  * BOOL SendNotify(DWORD dwCommand, LPARAM lParamA, LPARAM lParamB);
00048  * 
00049  * All commands return a TRUE when they are successfully completed, or FALSE when unsuccessful. The parameters lParamA and lParamB are 32 bit values, their meaning depends on the command send.
00050  * \code
00051  * // Main -> Dll
00052  * 
00053  * const DWORD  SPM_SetSendNotifyProcAddress    = 0x0001;               // Set function address for Notify messages
00054  * const DWORD  SPM_GetDeviceInfoStruct                 = 0x0002;               // Get Functional Description of Device
00055  * const DWORD  SPM_DeviceConfigureDialog               = 0x0010;               // Display a dialog for device configuration
00056  * const DWORD  SPM_GetDeviceConfig                             = 0x0011;               // Get Config to store it with project
00057  * const DWORD  SPM_SetDeviceConfig                             = 0x0012;               // Set Config loaded with a project
00058  *                              
00059  * const DWORD  SPM_GetDeviceStatus                             = 0x0020;               // Current Device Hardware Status
00060  * const DWORD  SPM_GetLastError                                = 0x0021;               // Get Last Error code and error string
00061  *                              
00062  * const DWORD  SPM_OpenDevice                                  = 0x0030;               // Init Hardware interface
00063  * const DWORD  SPM_CloseDevice                                 = 0x0031;               // Free Hardware interface
00064  *                              
00065  * const DWORD  SPM_CommandWindowCreate                 = 0x0100;               // Create the command-window    
00066  * const DWORD  SPM_CommandWindowClose                  = 0x0101;               // Free allocated controls from the window
00067  *                              
00068  * const DWORD  SPM_UserScanPositionUpdate              = 0x0A00;               // Transfer user rect to scan settings
00069  * const DWORD  SPM_UserIVPositionsUpdate               = 0x0A01;               // Transfer user coords to IV-settings
00070  * const DWORD  SPM_SetFrameParameters                  = 0x0A02;               // Transfer Frame params to scan settings
00071  * const DWORD  SPM_SetIVParameters                             = 0x0A03;               // Transfer IV-params to IV-settings
00072  *                              
00073  * const DWORD  SPM_DrawDevSpecFrameData                = 0x0B00;               // Draws Frame params in scanview
00074  * const DWORD  SPM_DrawDevSpecIVData                   = 0x0B01;               // Draws IV-params in ivview
00075  * 
00076  * const DWORD SPM_IVConfigureDialog                    = 0x0B02;               // Draw  IV-Params              
00077  * const DWORD  SPM_GetIVName                                   = 0x0B03;               // Get IV - name
00078  * const DWORD SPM_IVConfigureDialogClose               = 0x0B04;               // Close IV-Params              
00079  * 
00080  * const DWORD  SPM_SetParameters                               = 0x0B05;               // Set CAMERA parameters..
00081  * \endcode
00082  * SPM Command and Notification Message Reference:
00083  * 
00084  * 
00085  * 
00086  * SPM Command Messages:
00087  * 
00088  * Name : SetSendNotifyProcAddress
00089  * 
00090  * lParamA : LPPROC ReceivingNotifyHandler (DWORD dwCommand, 
00091  * LPARAM lParamA, LPARAM lParamB)
00092  * lParamB : NULL
00093  * 
00094  * Description:
00095  * This command sets the address of the function that receives en processes the notifications from the Dll. The Dll uses this address to send notifications to the main-programm. This command must be send first because other commands may need to pass back data to the main program. This can only work if the NotifyProc address is set.
00096  * 
00097  * 
00098  * Name : GetDeviceInfoStruct
00099  * 
00100  * lParamA : LPSPMDEVICEINFO lpDeviceInfo
00101  * lParamB : NULL
00102  * 
00103  * Description:
00104  * This command fills the structure with parameters defining this Dll, e.g. Name, version number, BuildDate and a short description. This command is used when the main program loads a project file, and wants to check if the currently loaded Dll is valid. Also this command is issued when the Dll is added to the interface-list, to get the description and version number.
00105  * Make sure to set the lpDeviceInfo->dwSize = sizeof(SPMDEVICEINFO) so the Dll can check the validity of the pointer.
00106  * 
00107  * 
00108  * Name : DeviceConfigureDialog
00109  * 
00110  * lParamA : HWND hParentWnd
00111  * lParamB : NULL
00112  * 
00113  * Description:
00114  * This command creates a modal dialog box in which the user can configure various settings for the device and it's hardware. These settings are more or less global settings and are infrequently accessed. The main program has no knowledge of these settings. 
00115  * The parameter hParentWnd is the window handle of the main program main window, use AfxGetMainWnd()->GetSaveHandle() for this parameter.
00116  * 
00117  * 
00118  * 
00119  * Name : GetDeviceConfig
00120  * 
00121  * lParamA : LPSPMDEVICECONFIG *lpDeviceConfig
00122  * lParamB : LPDWORD lpdwSize
00123  * 
00124  * Description:
00125  * With this command the Dll will return a structure with its current configuration and settings. This command is issued when a Project is saved, so the configuration and active state of the device will be preserved. The main program does not know the content of the structure. What it needs to know is its size, which can be different between Dll's. Therefore this command also returns the size of the structure in the lParamB parameter.
00126  * 
00127  * Note:        Besides the configuration, it is also possible to store the last scan-parameters. That results in having the latest parameters whenever a project is opened.
00128  * 
00129  * 
00130  * Name : SetDeviceConfig
00131  * 
00132  * lParamA : LPSPMDEVICECONFIG lpDevConfig
00133  * lParamB : NULL
00134  * 
00135  * Description:
00136  * With this command the Dll will restore the configuration and settings stored in the structure. This command is issued when a Project is loaded, so the configuration and last state of the device will be preserved. 
00137  * 
00138  * 
00139  * Name : GetDeviceStatus
00140  * 
00141  * lParamA : LPDWORD lpdwStatus
00142  * lParamB : NULL
00143  * 
00144  * Description:
00145  * This command can be used to query the current state of the Device. All possible states are listed in the chapter 'Defines, Structures and Constants'.
00146  * 
00147  * The main program should, at least, check the state of the device when:
00148  * 
00149  * Action       Before  During  After
00150  *                      
00151  * Loading Dll  -       -       SPM_CLOSED
00152  * OpenDevice   SPM_CLOSED      SPM_INIT        SPM_IDLE
00153  *                      
00154  * CloseDevice  SPM_IDLE        SPM_EXITING     SMP_CLOSED
00155  * Unload Dll   SPM_CLOSED      -       -
00156  * Name : GetLastError
00157  * 
00158  * lParamA : LPDWORD lpdwError
00159  * lParamB : LPCTSTR *lpszError
00160  * 
00161  * Description:
00162  * This command can be used to get an errorcode and/or errorstring from the device Dll after and unsuccessful command or during SPM_ERROR state. 
00163  * When lpszError is not NULL the command will also supply a description string of the errorcode, because the error may be device specific.
00164  * 
00165  * All device independent error codes are listed in the chapter 'Defines, Structures and Constants'.
00166  * 
00167  * 
00168  * Name : OpenDevice
00169  * 
00170  * lParamA : LPSPMDEVICEOPENDATA lpSpmDeviceOpenData
00171  * lParamB : NULL
00172  * 
00173  * Description:
00174  * This command will cause the Dll to initialize all hardware and get to a state in which it is ready for scanning and/or doing iv-measurements. It is possible that this may take a while, so this command only starts a servicing thread in the Dll, and then returns.
00175  * The main program can check the state of the Device later on, it should then be SPM_IDLE.
00176  * The servicing thread should initialize the hardware and when successful enables the StartScan and/or DoIV buttons on the command-window. 
00177  * 
00178  * The parameter lpSpmDeviceOpenData is a structure with variables for the Cyclic Buffer Storage file and data synchronisation. See the 'Structures' paragraph for a description. 
00179  * 
00180  * 
00181  * Name : CloseDevice
00182  * 
00183  * lParamA : NULL
00184  * lParamB : NULL
00185  * 
00186  * Description:
00187  * This command will cause the Dll to gracefully de-initialize all hardware, free allocated memory and return to the SPM_CLOSED state. The servicing thread should be ended and the StartScan and DoIV buttons on the command-window are disabled again. 
00188  * Like the OpenDevice this operation may take some time and therefore this command will only tell the servicing thread to start the shutdown-sequence, and returns immediately. 
00189  * 
00190  * 
00191  * Name : CommandWindowCreate
00192  * 
00193  * lParamA : HWND hParentWnd
00194  * lParamB : HWND *hCommandWnd
00195  * 
00196  * Description:
00197  * This command will initialize the command-window. The command-window is the interface to set the hardware parameters and start scans or iv's. The Dll is responsible for creating and handling its interface controls, the main program has no knowledge of them. Parameter lParamA is a pointer to the parent window, use AfxGetMainWnd()->GetSaveHandle() for this parameter
00198  * The parameter lParamB is a pointer to a HWND where the handle of the new command-window should be stored.
00199  * 
00200  * 
00201  * Name : CommandWindowClose
00202  * 
00203  * lParamA : NULL
00204  * lParamB : NULL
00205  * 
00206  * Description:
00207  * On receiving this command, the Dll should clear and remove the controls created during the CommandWindowCreate action.
00208  * 
00209  * 
00210  * Name : UserScanPositionUpdate
00211  * 
00212  * lParamA : LPSPMSCANPOSITION lpNewScanPosition
00213  * lParamB : NULL
00214  * 
00215  * Description:
00216  * When the user drags, rotates, or scales a new scanning area in the scan/measurement display, this command will be used to send the new scanposition to the Dll, and update the controls on the command-window. Once this command is issued the Dll must also sent back notifications if the user changes the scanposition in the command-window, to update the drag-box in the measurement display. 
00217  * 
00218  * If lParam is NULL, this command is issued as a request to get the current scanposition settings from the command-window. The Dll must send back an UpdateUserScanPostion-notification.
00219  * 
00220  * 
00221  * Name : UserIVPositionUpdate
00222  * 
00223  * lParamA : LPSPMIVPOSITIONS lpNewIVPositions
00224  * lParamB : NULL
00225  * 
00226  * Description:
00227  * When the user places or drags new IV positions in the scanframe display, this command will send the parameters to the Dll and the controls on the command-window. Once this command is issued the Dll should also sent back notifies if the user changes the parameters in the command-window, to update the scanframe display. 
00228  * 
00229  * 
00230  * Name : SetFrameParametes                                     (Not Implemented)
00231  * 
00232  * lParamA : LPSPMDEVICESPECIFICFRAMEDATA lpSpecificFrameData
00233  * lParamB : NULL
00234  * 
00235  * Description:
00236  * With this command the user can restore scan parameter setting from another scan. The parameters are set in the command-window.
00237  * 
00238  * 
00239  * Name : SetIVParametes                                                (Not Implemented)
00240  * 
00241  * lParamA : LPSPMDEVICESPECIFICIVDATA lpSpecificIVData
00242  * lParamB : NULL
00243  * 
00244  * Description:
00245  * With this command the user can restore IV parameter setting from another IV measurement. The parameters are set in the command-window.
00246  * 
00247  * 
00248  * Name : DrawDeviceSpecificFrameData
00249  * 
00250  * lParamA : LPSPMDEVICESPECIFICFRAMEDATA lpSpecificFrameData
00251  * lParamB : LPSPMDRAWINF *lpDrawInfo
00252  * 
00253  * Description:
00254  * Each frame has a set of parameters that are specific for the type of SPM. These parameters are unknown to the main program and can only be displayed by the corresponding Dll. This command draws these parameters on the scanframe display (referenced by lpDrawInfo). 
00255  * 
00256  * 
00257  * Name : DrawDeviceSpecificIVCurveData
00258  * 
00259  * lParamA : LPSPMDEVICESPECIFICIVDATA lpSpecificIVData
00260  * lParamB : LPSPMDRAWINF *lpDrawInfo 
00261  * 
00262  * 
00263  * Description:
00264  * Each IV-measurement has a set of parameters that are specific for the type of SPM. These parameters are unknown to the main program and can only be displayed by the corresponding Dll. This command draws these parameters on the IVCurve display (referenced by lpDrawInfo) with this command. 
00265  * 
00266  */
00267 typedef BOOL (*tSendSPMCommandMessage)(DWORD,LPARAM,LPARAM);
00268 
00269 /**
00270  *  \brief Command Message function calls
00271  *
00272  * Command- and Notify Message function calls
00273  *
00274  * \code
00275  * typedef      BOOL (*tSendSPMCommandMessage)(DWORD,LPARAM,LPARAM);
00276  * \endcode
00277  *
00278  * The Interface Dll is a so-called MFC Dll, dynamically linked to the MFC-libraries and (if needed) statically or dynamicly to the Objective Toolkit-libraries. The functions InitInstance and ExitInstance are called when the Dll is loaded in resp. freed from memory. Besides these MFC defined functions the SPM Interface Dll has one function for communicating with the Camera main program.
00279  * 
00280  * BOOL SendSPMCommand(DWORD dwCommand, LPARAM lParamA, LPARAM lParamB);
00281  * 
00282  * This function SendSPMCommand is called by the Camera main-program to send commands to the Interface Dll. These commands are defined in the remainder of this document. 
00283  * 
00284  * One of the first commands that must be send to the InterfaceDll is the SetSendNotifyProcAddres, to set the function address for returning commands from the InterfaceDll to the main program (called notifications).  This function is defined in the main program as:
00285  * 
00286  * \code
00287  * const DWORD  SPM_StartScanMeasurement                = 0x8000;               // Start a new Scan Measurement for following frames
00288  * const DWORD  SPM_UpdateFrameData                             = 0x8001;               // Update complete or partial frame to document
00289  * const DWORD  SPM_StopScanMeasurement                 = 0x8002;               // Scan Measurement is stopped
00290  * const DWORD  SPM_StopScanMeasurementRAW              = 0x8003;               // Scan Measurement is stopped "RAW" - write only !
00291  *                              
00292  * const DWORD  SPM_StartIVMeasurement                  = 0x8100;               // Start a new IV Measurement for following IVcurves
00293  * const DWORD  SPM_UpdateIVCurve                               = 0x8101;               // Update complete or partial iv-curve to document
00294  * const DWORD  SPM_StopIVMeasurement                   = 0x8102;               // IV Measurement is stopped
00295  *                              
00296  * const DWORD  SPM_UpdateUserScanPosition              = 0x8300;               // Transfer scan settings to on screen rect
00297  * const DWORD  SPM_UpdateUserIVPositions               = 0x8301;               // Transfer iv-settings to on screen markers
00298  *                              
00299  * const DWORD  SPM_OutputText                                  = 0x9000;               // Display text message in OutputWnd
00300  * const DWORD  SPM_DebugText                                   = 0x9001;               // Display text message in DebugWnd
00301  * const DWORD  SPM_SendIVDocument                              = 0x9002;               // Send IV Document Request
00302  * \endcode
00303  * 
00304  * SPM Notification Messages:
00305  * 
00306  * Name : StartScanMeasurement
00307  * 
00308  * lParamA : LPSPMSTARTSCAN lpStartScan
00309  * lParamB : NULL
00310  * 
00311  * Description:
00312  * This command starts a new scan measurement. The main program will create a new scan document for the frames following this command. Parameter A is a pointer to a structure containing the data common to all frames belonging to this document. It also defines which channels are active and the data they represent. See the Structures paragraph for a detailed description of the LPSPMSTARTSCAN structure.
00313  * 
00314  * 
00315  * Name : UpdateFrameData
00316  * 
00317  * lParamA : LPSPMUPDATEFRAME lpUpdateFrame
00318  * lParamB : DWORD      dwBitPattern
00319  * 
00320  * Description:
00321  * The Dll sends complete or partial frames to the current scan display. This is done by passing the LPSPMUPDATEFRAME structure to the main program. See the Structures paragraph for a detailed description of the LPSPMUPDATEFRAME structure. dwBitPattern represends the following: b1-b0 : BufferNumber, b8-b2 : Percentage of cyclic buffer used, b31-b9 : Number of times the cyclic buffer is rewritten (looped).
00322  * The dwBufferNumber is used by the main program to indicate which buffer is being used. This prevents the Interface Dll from overwriting data that it is being processed.
00323  * 
00324  * 
00325  * Name : StopScanMeasyrement
00326  * 
00327  * lParamA : NULL
00328  * lParamB : NULL
00329  * 
00330  * Description:
00331  * This message indicates that the scan measurement has ended. The main program can now start copying the data from the cyclic buffer to the project directory.
00332  * 
00333  * Name : StartIVMeasurement
00334  * 
00335  * lParamA : LPSPMSTARTIV lpStartIV
00336  * lParamB : NULL
00337  * 
00338  * Description:
00339  * This command starts a new IV measurement and requests the main program to create a new IV document. The IV-curves following after this command should be added to this document. Parameter A is a pointer to a structure containing the data common to all IV measurements belonging to this document. See the Structures paragraph for a detailed description of the LPSPMSTARTIV structure.
00340  * 
00341  * 
00342  * Name : UpdateIVCurveData
00343  * 
00344  * lParamA : LPSPMUPDATEIVCURVE lpUpdateIVCurve
00345  * lParamB : DWORD      dwBufferNumber
00346  * 
00347  * Description:
00348  * The Dll passes complete or partial IV-curve data to the main program for displaying. This is done by passing the LPSPMUPDATEIVCURVE structure. See the Structures paragraph for a detailed description of the LPSPMUPDATEIVCURVE structure. The dwBufferNumber is used by the to main program to indicate which buffer is being used. This prevents the Interface Dll from overwriting data that it is being processed.
00349  * 
00350  * 
00351  * Name : StopIVMeasurement
00352  * 
00353  * lParamA : NULL
00354  * lParamB : NULL
00355  * 
00356  * Description:
00357  * This message indicates that the IV measurement has been ended. The main program can now start copying the data from the cyclic buffer to the project directory.
00358  * 
00359  * 
00360  * Name : UpdateUserScanPosition
00361  *  
00362  * lParamA : LPSPMSCANPOSITION lpNewScanPosition
00363  * lParamB : NULL
00364  * 
00365  * Description:
00366  * When the user changes the parameters defining a new scanning area in the command-window, they can be displayed in the scanframe window as a rubberband-box. To do this the Dll must pass the new scanning position to the main program with this command. It is recommended to have a checkbox button in the command-window to turn on/off this behavior.
00367  * 
00368  * 
00369  * 
00370  * Name : UpdateUserIVPositions
00371  * 
00372  * lParamA : LPSPMIVPOSITIONS lpNewIVPositions
00373  * lParamB : NULL
00374  * 
00375  * Description:
00376  * When the user changes the parameters defining the IV-measurement points in the command-window, they can be displayed in the scanframe window. To do this the Dll must pass the new IV positions to the main program with this command. It is recommended to have a checkbox button in the command-window to turn on/off this behavior.
00377  * 
00378  * 
00379  * Name : OutputText
00380  * 
00381  * lParamA : LPCTSTR lpcsMessageString
00382  * lParamB : NULL
00383  * 
00384  * Description:
00385  * With this command the Dll can send text messages to the OutputWindow output.
00386  * 
00387  * Name : DebugText
00388  * 
00389  * lParamA : LPCTSTR lpcsMessageString
00390  * lParamB : NULL
00391  * 
00392  * Description:
00393  * With this command the Dll can send text messages to the OutputWindow debug.
00394  * 
00395  */
00396 typedef BOOL (*tSendSPMNotifyMessage) (DWORD,LPARAM,LPARAM);
00397 
00398 //-------------------------------------------------------------------------------//
00399 // Command- and Notify Message codes
00400 //-------------------------------------------------------------------------------//
00401 
00402 
00403 // Main -> Dll
00404 
00405 const DWORD     SPM_SetSendNotifyProcAddress    = 0x0001;               // Set function address for Notify messages
00406 const DWORD     SPM_GetDeviceInfoStruct                 = 0x0002;               // Get Functional Description of Device
00407 const DWORD     SPM_DeviceConfigureDialog               = 0x0010;               // Display a dialog for device configuration
00408 const DWORD     SPM_GetDeviceConfig                             = 0x0011;               // Get Config to store it with project
00409 const DWORD     SPM_SetDeviceConfig                             = 0x0012;               // Set Config loaded with a project
00410                                 
00411 const DWORD     SPM_GetDeviceStatus                             = 0x0020;               // Current Device Hardware Status
00412 const DWORD     SPM_GetLastError                                = 0x0021;               // Get Last Error code and error string
00413                                 
00414 const DWORD     SPM_OpenDevice                                  = 0x0030;               // Init Hardware interface
00415 const DWORD     SPM_CloseDevice                                 = 0x0031;               // Free Hardware interface
00416                                 
00417 const DWORD     SPM_CommandWindowCreate                 = 0x0100;               // Create the command-window    
00418 const DWORD     SPM_CommandWindowClose                  = 0x0101;               // Free allocated controls from the window
00419                                 
00420 const DWORD     SPM_UserScanPositionUpdate              = 0x0A00;               // Transfer user rect to scan settings
00421 const DWORD     SPM_UserIVPositionsUpdate               = 0x0A01;               // Transfer user coords to IV-settings
00422 const DWORD     SPM_SetFrameParameters                  = 0x0A02;               // Transfer Frame params to scan settings
00423 const DWORD     SPM_SetIVParameters                             = 0x0A03;               // Transfer IV-params to IV-settings
00424                                 
00425 const DWORD     SPM_DrawDevSpecFrameData                = 0x0B00;               // Draws Frame params in scanview
00426 const DWORD     SPM_DrawDevSpecIVData                   = 0x0B01;               // Draws IV-params in ivview
00427 
00428 const DWORD SPM_IVConfigureDialog                       = 0x0B02;               // Draw  IV-Params              
00429 const DWORD     SPM_GetIVName                                   = 0x0B03;               // Get IV - name
00430 const DWORD SPM_IVConfigureDialogClose          = 0x0B04;               // Close IV-Params              
00431 
00432 const DWORD     SPM_SetParameters                               = 0x0B05;               // Set CAMERA parameters..
00433 
00434 const DWORD     SPM_CheckDevice                                 = 0x0B06;               // Init Hardware interface
00435 const DWORD     SPM_STOPDevice                                  = 0x0B07;               // Init Hardware interface
00436 const DWORD     SPM_DeviceReady                                 = 0x0B08;               // Device is READY AGAIN
00437 
00438 
00439 // DLL -> Main
00440 
00441 const DWORD     SPM_StartScanMeasurement                = 0x8000;               // Start a new Scan Measurement for following frames
00442 const DWORD     SPM_UpdateFrameData                             = 0x8001;               // Update complete or partial frame to document
00443 const DWORD     SPM_StopScanMeasurement                 = 0x8002;               // Scan Measurement is stopped
00444 const DWORD     SPM_StopScanMeasurementRAW              = 0x8003;               // Scan Measurement is stopped "RAW" - write only !
00445                                 
00446 const DWORD     SPM_StartIVMeasurement                  = 0x8100;               // Start a new IV Measurement for following IVcurves
00447 const DWORD     SPM_UpdateIVCurve                               = 0x8101;               // Update complete or partial iv-curve to document
00448 const DWORD     SPM_StopIVMeasurement                   = 0x8102;               // IV Measurement is stopped
00449                                 
00450 const DWORD     SPM_UpdateUserScanPosition              = 0x8300;               // Transfer scan settings to on screen rect
00451 const DWORD     SPM_UpdateUserIVPositions               = 0x8301;               // Transfer iv-settings to on screen markers
00452                                 
00453 const DWORD     SPM_OutputText                                  = 0x9000;               // Display text message in OutputWnd
00454 const DWORD     SPM_DebugText                                   = 0x9001;               // Display text message in DebugWnd
00455 
00456 const DWORD SPM_SendIVDocument                          = 0x9002;               // Send IV Document Request
00457 
00458 
00459 //-------------------------------------------------------------------------------//
00460 // Cyclic Buffer Frame Markers and control codes
00461 //-------------------------------------------------------------------------------//
00462 
00463 #define SPM_CyclicFrameMarker "CAM_CBF0"
00464 const DWORD SPM_CyclicLoopedEOM                         = 0xFFFFFFFF;           // EndOfMeasurment looped buffer
00465 const DWORD SPM_CyclicNonLoopedEOM                      = 0xFFFFFFFE;           // EndOfMeasurment straight buffer
00466 const DWORD SPM_CyclicLoopEOF                           = 0xFFFFFFFD;           // EndOfFile loop marker
00467 
00468 
00469 //-------------------------------------------------------------------------------//
00470 // Interface device constants, flags and masks
00471 //-------------------------------------------------------------------------------//
00472 
00473 // Interface states
00474 const DWORD     SPM_NOSTATE                             = 0x0000;       // No state defined.
00475 const DWORD     SPM_CLOSED                              = 0x0001;       // The device is closed.
00476 const DWORD     SPM_ERROR                               = 0x0002;       // Hardware is not functioning.
00477 const DWORD     SPM_INIT                                = 0x0003;       // Device is initializing hardware.
00478 const DWORD     SPM_IDLE                                = 0x0004;       // Device and Hardware is ready and waiting.
00479 const DWORD     SPM_SCANNING_2D                 = 0x0005;       // Device is processing scan.
00480 const DWORD     SPM_IVING                               = 0x0006;       // Device is doing IV measurement.
00481 const DWORD     SPM_EXITING                             = 0x0007;       // Device is closing hardware.
00482 const DWORD     SPM_SCANNING_3D                 = 0x0008;       // Device is processing scan -3D.
00483 const DWORD     SPM_SCANNING_DIG                = 0x0009;       // Device is processing scan -DIG.
00484 
00485 // Interface error codes
00486 const DWORD SPM_ERR_NOERROR                     = 0x0000;       // Last Command was successful.
00487 const DWORD SPM_ERR_UNKOWNCOMMAND       = 0x0001;       // Last Command is unknown.
00488 const DWORD SPM_ERR_INVALID_PARAM       = 0x0002;       // Last Command had invalid parameter.
00489 const DWORD SPM_ERR_NO_NOTIFYPROC       = 0x0003;       // The notify procaddress is not set.
00490 const DWORD SPM_ERR_INVALID_DATA        = 0x0004;       // Command contains invalid data.
00491 const DWORD SPM_ERR_ALREADY_EXISTS      = 0x0005;       // 
00492 const DWORD SPM_ERR_NOTAVAILABLE        = 0x0006;       // 
00493 // Data control flags:
00494 
00495 
00496 // Scan Measurement Flags
00497 const DWORD SPM_SMF_FBYF                        = 0x000;        // Scandata is updated Frame by Frame. (default)
00498 const DWORD SPM_SMF_LBYL                        = 0x001;        // Scandata is updated Line by Line or even smaller parts.
00499 
00500 // Scandata Channel Mask:
00501 const DWORD SPM_SDCM_CHANNEL0           = 0x001;        // Channel 0 contains data.
00502 const DWORD SPM_SDCM_CHANNEL1           = 0x002;        // Channel 1 contains data.
00503 const DWORD SPM_SDCM_CHANNEL2           = 0x004;        // Channel 2 contains data.
00504 const DWORD SPM_SDCM_CHANNEL3           = 0x008;        // Channel 3 contains data.
00505 const DWORD SPM_SDCM_CHANNEL4           = 0x010;        // Channel 4 contains data.
00506 const DWORD SPM_SDCM_CHANNEL5           = 0x020;        // Channel 5 contains data.
00507 const DWORD SPM_SDCM_CHANNEL6           = 0x040;        // Channel 6 contains data.
00508 const DWORD SPM_SDCM_CHANNEL7           = 0x080;        // Channel 7 contains data.
00509 
00510 // Scandata Frame Flags:
00511 const DWORD SPM_SDFF_COMPLETE                   = 0x000;        // Either this is a complete frame or this is the last part of the frame.
00512 const DWORD SPM_SDFF_PARTIAL                    = 0x001;        // Structure contains partial frame data.
00513 const DWORD SPM_SDFF_DEVSPECDATA                = 0x002;        // Pointer to Device Specific data is valid.
00514 
00515 // Scandata Buffer Flags:
00516 const DWORD SPM_SDBF_LEFT2RIGHT                 = 0x001;        // Scan Buffer contains left2right data
00517 const DWORD SPM_SDBF_RIGHT2LEFT                 = 0x002;        // Scan Buffer contains right2left data
00518 
00519 // Scandata Buffer Parameter Mask:
00520 const DWORD SPM_SDBPM_MINZ                      = 0x001;        // Minimal Z-value is valid
00521 const DWORD SPM_SDBPM_MAXZ                      = 0x002;        // Maximum Z-value is valid
00522 const DWORD SPM_SDBPM_AVGZ                      = 0x004;        // Average Z-value is valid
00523 const DWORD SPM_SDBPM_SLOPEXY           = 0x008;        // Background plane slope values (X and Y) are valid
00524 const DWORD SPM_SDBPM_SECMOM            = 0x010;        // Sum of all squared data values
00525 
00526 // IV-Measurement Flags:
00527 
00528 // IV-Curve Flags:
00529 const int SPM_IVDBM_MINI                        = 0x001;        // Minimal I-value is valid
00530 const int SPM_IVDBM_MAXI                        = 0x002;        // Maximum I-value is valid
00531 
00532 //type of loading
00533 //NO SIM ANYMORE const int LOAD_PROJ                                    = 0x001;
00534 //NO SIM ANYMORE const int LOAD_LAST                                    = 0x002;
00535 //NO SIM ANYMORE const int LOAD_SIM                                 = 0x003;
00536 //NO SIM ANYMORE const int LOAD_ERROR                           = 0x004;
00537 
00538 //-------------------------------------------------------------------------------//
00539 // CScanTransBuffer
00540 //-------------------------------------------------------------------------------//
00541 
00542 class CScanTransferBuffer
00543 {
00544 public:
00545         CScanTransferBuffer();                                                                  // constuctor
00546         virtual ~CScanTransferBuffer();                                                 // deconstuctor
00547 
00548         // do not change order and size or insert new variables in 
00549         // this block, because all the variables are saved as one block
00550 
00551         DWORD   m_dwFlags;                                                              // Data L2R/R2L flags
00552         DWORD   m_dwSizeX;                                                              // X Size buffer
00553         DWORD   m_dwSizeY;                                                              // Y Size buffer
00554         DWORD   m_dwPixels;                                                             // Number of pixels in buffer
00555         double  m_dDataScaleFactor;                                             // Scale factor between 1 unit and 1 LSB
00556         int             m_nDataOffset;                                                  // Offset for ADC=0, 
00557                                                                                                         //      use : Abs.Height = DataScale * (ADCValue + DataOffset)
00558 
00559         DWORD   m_dwParameterMask;                                              // Mask register for optional parameters
00560         double  m_dSlopeX;                                                              // X Slope of backgroundplane
00561         double  m_dSlopeY;                                                              // Y Slope of backgroundplane
00562         double  m_dAverageZ;                                                    // Average Z
00563         int             m_nMinZ;                                                                // Min Z
00564         int     m_nMaxZ;                                                                // Max Z
00565 
00566         // block end
00567 
00568         short*  m_pwData;                                                               // pointer to the data (signed)
00569 
00570 private:
00571 
00572 #ifndef _DMABUFFERS
00573         DWORD   m_dwMemoryAllocated;                                    // Number of data-points allocated in buffer
00574 #endif // _DMABUFFERS
00575 
00576 public:
00577 
00578 #ifdef _DMABUFFERS // public om te kunnen checken of er wel data is
00579         DWORD   m_dwMemoryAllocated;                                    // Number of data-points allocated in buffer
00580 #endif // _DMABUFFERS
00581 
00582         BOOL    CheckAndSetBufferSize();                                // check and if needed allocate buffer
00583 };
00584 
00585 //-------------------------------------------------------------------------------//
00586 // Interface device Structures
00587 //-------------------------------------------------------------------------------//
00588 /**
00589  *  \brief Structure: SPMDEVICEINFO for PROTOCOL [main program - camera dll].
00590  *
00591  * Structure: SPMDEVICEINFO for PROTOCOL [main program - camera dll].
00592  *
00593  * Type to support the exchange of data between the CameraDLL and the main program.
00594  * 
00595  * \code
00596  * typedef struct __SpmDeviceInfo
00597  * {
00598  *      DWORD           dwSize;                         // Should be sizeof(SPMDEVICEINFO) 
00599  *      WORD            wMajorVersion;          // Major version number of Dll.
00600  *  WORD                wMinorVersion;          // Minor version number of Dll.
00601  *      LPCTSTR lpszDeviceName;                 // The name of the Device Interface Dll.
00602  *      LPCTSTR lpszDeviceDescription;  // Short functional description of Dll.
00603  *      LPCTSTR lpszBuildDate;                  // Creation date of Dll.
00604  *      LPCTSTR lpszManufacturer;               // Designer/Author of Dll.
00605  *      
00606  * } SPMDEVICEINFO , *LPSPMDEVICEINFO;
00607  * \endcode
00608  * 
00609  * The SpmDeviceInfo structure is used by the main program to get 
00610  * information from a Dll when it is added to the device list. Also 
00611  * the projectmanager uses this structure to check if the currently 
00612  * loaded Dll is correct to open a saved project.
00613  */
00614 
00615 typedef struct __SpmDeviceInfo
00616 {
00617         DWORD           dwSize;                                  ///<   Should be sizeof(SPMDEVICEINFO)
00618         WORD            wMajorVersion;                   ///<   Major version number of Dll.
00619         WORD            wMinorVersion;                   ///<   Minor version number of Dll.
00620         LPCTSTR         lpcsDeviceName;                  ///<   The name of the Device Interface Dll.
00621         LPCTSTR         lpcsDeviceDescription;   ///<   Short functional description of Dll.
00622         LPCTSTR         lpcsBuildDate;                   ///<   Creation date of Dll.
00623         LPCTSTR         lpcsManufacturer;                ///<   Designer/Author of Dll.
00624 } SPMDEVICEINFO, *LPSPMDEVICEINFO;
00625 
00626 /**
00627  *  \brief Structure: SPMDEVICECONFIG for PROTOCOL [main program - camera dll].
00628  *
00629  * Structure: SPMDEVICECONFIG for PROTOCOL [main program - camera dll].
00630  *
00631  * Type to support the exchange of data between the CameraDLL and the main program.
00632  * 
00633  * \code
00634  *  typedef struct __SpmDeviceConfig
00635  * {
00636  *      DWORD   dwSize;                 // Size of this structure in bytes
00637  *      //
00638  *      // device specific data
00639  *      // optional: Last scan- and IV, parameters
00640  *      //
00641  * } SPMDEVICECONFIG, * LPSPMDEVICECONFIG;
00642  * \endcode
00643  * 
00644  * This structure is used by the GetDeviceConfig, en SetDeviceConfig commands. 
00645  * The main program has no knowledge of the content of this structure, this is Dll 
00646  * specific data. With the dwSize parameter the main program is able to store 
00647  * data to and load data from the project file.
00648  */
00649 typedef struct __SpmDeviceConfig
00650 {
00651         DWORD   dwSize;                 ///<   Size of this structure in bytes
00652         //
00653         // device specific data
00654         // optional: Last scan- and IV, parameters
00655         //
00656 } SPMDEVICECONFIG, * LPSPMDEVICECONFIG;
00657 
00658 /**
00659  *  \brief Structure: SPMDEVICEOPENDATA for PROTOCOL [main program - camera dll].
00660  *
00661  * Structure: SPMDEVICEOPENDATA for PROTOCOL [main program - camera dll].
00662  *
00663  * Type to support the exchange of data between the CameraDLL and the main program.
00664  * 
00665  * \code
00666  * typedef struct __SpmDeviceOpenData
00667  * {
00668  *      HANDLE          fhCyclicBuffer;                 // FileHandle to buffer storage file
00669  *      DWORD           dwMaxCyclicBufferSize;  // Maximum buffersize in Megabytes
00670  *      
00671  *      LPCRITICAL_SECTION csInUse;                     // Synchronisation object
00672  *      LPDWORD         lpdwProccessingPacket;  // Pointer to main packet processing.
00673  * 
00674  * } SPMDEVICEOPENDATA, * LPSPMDEVICEOPENDATA;
00675  * \endcode
00676  * 
00677  * This structure is used by the OpenDevice command. It passes a handle to the cyclic buffer file, opened by the main program. It sets the maximum available size for this file. The main program must close the file when the device is closed.
00678  * The critical section object is used for synchronising access to the processing variable. This variable lpdwProccessingPacket indicates which packet, received by an UpdateFrame Notification, is currently being processed by the main for displaying.
00679  */
00680 typedef struct __SpmDeviceOpenData
00681 {
00682         HANDLE          fhCyclicBuffer;                 ///< FileHandle to buffer storage file
00683         HANDLE          fhWaveFormDef;                  ///< FileHandle to waveform def. file
00684         HANDLE          fhCameraConfig;                 ///< FileHandle to camera configuration file
00685 
00686         DWORD           dwMaxCyclicBufferSize;  ///< Maximum buffersize in Megabytes
00687         
00688         LPCRITICAL_SECTION csInUse;                     ///< Synchronisation object
00689         LPDWORD         lpdwProccessingPacket;  ///< Pointer to main packet processing.
00690 
00691 } SPMDEVICEOPENDATA, * LPSPMDEVICEOPENDATA;
00692 
00693 /**
00694  *  \brief Structure: SPMSCANPOSITION for PROTOCOL [main program - camera dll].
00695  *
00696  * Structure: SPMSCANPOSITION for PROTOCOL [main program - camera dll].
00697  *
00698  * Type to support the exchange of data between the CameraDLL and the main program.
00699  * 
00700  * \code
00701  * typedef struct __SpmScanPosition
00702  * {
00703  *      int                     nXOffset;               // XOffset of center of area in picometer
00704  *      int                     nYOffset;               // YOffset of center of area in picometer
00705  *      double          dXStepSize;             // X Step size of area in picometer
00706  *      double          dYStepSize;             // Y Step size of area in picometer
00707  *      DWORD           dwOrgScanXSize; // Original X Size in pixels
00708  *      DWORD           dwOrgScanYSize; // Original X Size in pixels
00709  *      double          dScanAngle;             // Rotation of scan around center in rad.
00710  * } SPMSCANPOSITION, *LPSPMSCANPOSITION;
00711  * \endcode
00712  *
00713  * This structure is used by two commands, in two directions. 
00714  * The UserScanPositionUpdate-command is send by the main program to update 
00715  * the scanning area when the user drags a rubberband-box in the scanframe display. 
00716  * The data is then used to set new scanning parameters.
00717  * In the other direction the data is send from the Dll to the main program 
00718  * to update the rubberband-box when the parameters in the command-window are changed. This is done by the UpdateUserScanPosition-notification.
00719  *
00720  */
00721 typedef struct __SpmScanPosition
00722 {
00723         int                     nXOffset;               ///< XOffset of center of area in picometer
00724         int                     nYOffset;               ///< YOffset of center of area in picometer
00725         double          dXStepSize;             ///< X Step size of area in picometer
00726         double          dYStepSize;             ///< Y Step size of area in picometer
00727         DWORD           dwOrgScanXSize; ///< Original X Size in pixels
00728         DWORD           dwOrgScanYSize; ///< Original X Size in pixels
00729         double          dScanAngle;             ///< Rotation of scan around center in rad.
00730 } SPMSCANPOSITION, *LPSPMSCANPOSITION;
00731 
00732 
00733 /**
00734  *  \brief Structure: SPMIVPOSITIONS for PROTOCOL [main program - camera dll].
00735  *
00736  * Structure: SPMIVPOSITIONS for PROTOCOL [main program - camera dll].
00737  *
00738  * Type to support the exchange of data between the CameraDLL and the main program.
00739  * 
00740  * \code
00741  *  typedef struct __SpmIVPositions
00742  * {
00743  *      int                     nNumberOfPoints;        // Number of points in structure
00744  *      int                     nPos[];                         // array of X,Y position in picometer
00745  * 
00746  * } SPMIVPOSITIONS, *LPSPMIVPOSITIONS;
00747  * \endcode
00748  * 
00749  * This structure is used by two commands, in two directions. 
00750  * The UserIVPositionUpdate-command is send by the main program to update the 
00751  * IV-points when the user places or drags markers in the scanframe display. 
00752  * The data is then used to transfer these points to the Dll.
00753  * In the other direction the data is send from the Dll to the main program to update the markers when the positions in the command-window are changed. This is done by the UpdateUserIVPosition-notification.
00754  */
00755 
00756 typedef struct __SpmIVPositions
00757 {
00758         int                     nNumberOfPoints;        ///< Number of points in structure
00759         int                     nPos[];                         ///< array of X,Y position in picometer
00760 
00761 } SPMIVPOSITIONS, *LPSPMIVPOSITIONS;
00762 
00763 
00764 /**
00765  *  \brief Structure: SPMDRAWINF for PROTOCOL [main program - camera dll].
00766  *
00767  * Structure: SPMDRAWINF for PROTOCOL [main program - camera dll].
00768  *
00769  * Type to support the exchange of data between the CameraDLL and the main program.
00770  * 
00771  * \code
00772  * typedef struct __SpmDrawInf
00773  * {
00774  *      CDC*            pDC;                    // Handle of the device context to draw onto.
00775  *      RECT            rcRect;                 // Valid Area of the window to draw.
00776  *      DWORD           dwDrawCode;             // Code         0: Full draw, All parameters.
00777  *                                                              //      1: Medium draw, only useful parameters.
00778  *                                                              //      2: Low draw, only essential parameters.
00779  * } SPMDRAWINF, *LPSPMDRAWINF;
00780  * \endcode
00781  * This structure is used by the DrawDeviceSpecificFrameData- and 
00782  * DrawDeviceSpecificIVData commands. These commands request the Dll to draw 
00783  * Device Specific data onto the scan- or IVView windows. The hWnd parameter 
00784  * gives the handle to the view-window. The rect-sctucture defines the area 
00785  * where it is allowed to draw. The Drawcode is used to select how much data 
00786  * is to drawn onto the view. 
00787  */
00788 typedef struct __SpmDrawInf
00789 {
00790         CDC*            pDC;                    ///< Handle of the device context to draw onto.
00791         RECT            rcRect;                 ///<  Valid Area of the window to draw.
00792         DWORD           dwDrawCode;             ///< Code       0: Full draw, All parameters.
00793                                                                 ///<    1: Medium draw, only useful parameters.
00794                                                                 ///< 2: Low draw, only essential parameters.
00795 } SPMDRAWINF, *LPSPMDRAWINF;
00796 
00797 
00798 /**
00799  *  \brief Structure: SPMDEVICESPECIFICFRAMEDATA for PROTOCOL [main program - camera dll].
00800  *
00801  * Structure: SPMDEVICESPECIFICFRAMEDATA for PROTOCOL [main program - camera dll].
00802  *
00803  * Type to support the exchange of data between the CameraDLL and the main program.
00804  * 
00805  * \code
00806  * typedef struct __SpmDeviceSpecificFrameData
00807  * {
00808  *      DWORD           dwSize;                         ///< Size of this structure in bytes
00809  *      //
00810  *      // device specific frame data
00811  *      //
00812  * } SPMDEVICESPECIFICFRAMEDATA, * LPSPMDEVICESPECIFICFRAMEDATA;
00813  * \endcode
00814  * The Dll can store various parameters belonging to a frame in this structure. 
00815  * This structure is passed to the main program when adding frames with the 
00816  * UpdateFrameData-notification. Because the main program does not know it contents, 
00817  * it will ask the Dll to display this data with the DrawDeviceSpecificFrameData-command. 
00818  * The main program can load and save this structure because it size is specified in 
00819  * the dwSize variable. 
00820  *
00821  */
00822 typedef struct __SpmDeviceSpecificFrameData
00823 {
00824         DWORD           dwSize;                         ///< Size of this structure in bytes
00825         //
00826         // device specific frame data
00827         //
00828 } SPMDEVICESPECIFICFRAMEDATA, * LPSPMDEVICESPECIFICFRAMEDATA;
00829 
00830 
00831 typedef struct __SpmFORCameraDeviceSpecificFrameData 
00832 {
00833         DWORD           dwSize;                 // Size of this structure in bytes
00834         //
00835         // device specific frame data
00836         //
00837         double  dPixelClock;                    //pixelclock
00838         UINT    uSamplingRate;                  //sampling rate (.. samples /point for triangular scan movement)
00839         UINT    uOverSampling;                  //Oversampling most of the time 8x
00840 
00841         // Peter TODO eigenlijk moet de gain van alle gebruikte kanalen in deze frame komen
00842         UINT    uZAmpGain;                              //Z Amplifier gain
00843         UINT    uDeltaZAmpGain;                 //dZ Amplifier gain
00844         UINT    uBandWidth;                             //Bandwidth
00845         double  dZOffset;                               //ZOffset 
00846         double  dZdZFactor;                             //Z/dZ factor
00847 
00848         double  dXRounding;                             //X Rounding
00849         UINT    uBackwardStroke ;               //Backward stroke
00850         
00851         double dSampleVoltage;                  //sample volatge
00852         
00853         UINT    uAttenuatorTriangular;  //Attenuator triangular scan movement
00854         UINT    uAttenuatorSawTooth;    //Attenuator saw tooth scan movement
00855         UINT    uSampleSlopeX;                  //Sample slope in x-direction
00856         UINT    uSampleSlopeY;                  //Sample slope in y-direction
00857 
00858         UINT    uIntegrationTime;               //integration time regulator
00859         UINT    uProportionalGain;              //proportional gain regulator
00860         UINT    uWishedTunnelingCurrent;//wished tunneling current
00861 
00862         // Peter 3d : hoe geef ik parameters door aan het hoofdprogramma
00863         int             i3dMeasPerPixel;                //igv 3d aantal meteingen per pixel, anders 0
00864         int             i3dDisplayIndex;                //igv 3d index in array om te displayen
00865         int             i3dFrameNumber;                 //igv 3d line-number
00866 
00867         // Peter Extra Mixer
00868         double  dExtraMixerOffset;              // Extra Mixer Offset in [V]
00869         int     iExtraMixerAmpX;                        // Extra Mixer Amplification X in bits
00870         int iExtraMixerAmpY;                    // Extra Mixer Amplification Y in bits
00871         UINT uExtraMixerAttenuation;    // Extra Mixer Attenuation 1:gain=1,2:gain=0.1,3:gain=0.01,4=gain=0.001
00872         UINT uExtraMixerSlewRate;               // Extra Mixer SlewRate in bits 5..65535
00873 
00874         // Peter multiADC
00875         BOOL    bADCchannels[8];                // ADC kanalen in gebruik
00876 
00877         char    csIVName[MAX_PATH];             // Linked I/V name
00878         
00879 } SPMFORCAMERADEVICESPECIFICFRAMEDATA, *LPSPMFORCAMERADEVICESPECIFICFRAMEDATA;
00880 
00881 
00882 
00883 /**
00884  *  \brief Structure: SPMDEVICESPECIFICIVDATA for PROTOCOL [main program - camera dll].
00885  *
00886  * Structure: SPMDEVICESPECIFICIVDATA for PROTOCOL [main program - camera dll].
00887  *
00888  * Type to support the exchange of data between the CameraDLL and the main program.
00889  * 
00890  * \code
00891  * typedef struct __SpmDeviceSpecificIVData
00892  * {
00893  *      DWORD           dwSize;                 ///< Size of this structure in bytes
00894  *      //
00895  *      // device specific IV data
00896  *      //
00897  * } SPMDEVICESPECIFICIVDATA, * LPSPMDEVICESPECIFICIVDATA;
00898  * \endcode
00899  * The Dll can store various parameters belonging to an IV-measure in this structure.
00900  * This structure is passed to the main program when adding IVcurves with the 
00901  * UpdateIVCurveData-notification. Because the main program does not know it 
00902  * contents, it will ask the Dll to display this data with the DrawDeviceSpecificIVCurveData-command. 
00903  * The main program can load and save this structure because it size is specified in the dwSize variable. 
00904  */
00905 typedef struct __SpmDeviceSpecificIVData
00906 {
00907         DWORD           dwSize;                 ///< Size of this structure in bytes
00908         //
00909         // device specific IV data
00910         //
00911 } SPMDEVICESPECIFICIVDATA, * LPSPMDEVICESPECIFICIVDATA;
00912 
00913 /**
00914  *  \brief Structure: SPMNEWSCANDOC (START SCAN) for PROTOCOL [main program - camera dll].
00915  *
00916  * Structure: SPMNEWSCANDOC for PROTOCOL [main program - camera dll].
00917  *
00918  * Type to support the exchange of data between the CameraDLL and the main program.
00919  * 
00920  * \code
00921  * typedef struct __SpmStartScan
00922  * {
00923  *      DWORD dwFlags;                                          ///< Scan mode flags    (SPM_SMF-flags)
00924  *      DWORD dwChannelMask;                            ///< Bitmask of active channels
00925  *      LPCTSTR lpcsChannelName[8];                     ///< 8 ptr's to strings with channel name
00926  *      LPCTSTR lpcsChannelUnit[8];                     ///< 8 ptr's to strings with channel unit
00927  * } SPMNEWSCANDOC, *LPSPMNEWSCANDOC;
00928  * \endcode
00929  *
00930  * The Dll uses this structure when a new scan is started. It sends the 
00931  * StartScanMeasurement-notification. It sets information about the frames that 
00932  * follow. The dwFlag parameter defines the update mode of this measurement, either 
00933  * Frame-by-Frame of Line-by-Line. Furthermore it defines which channels are active 
00934  * (dwChannelMask) and per channel: a name and a unity string 
00935  * (lpcsChannelName, lpcsChannelUnit). The conversion factor is stored per frame 
00936  * per channel. 
00937  * 
00938  * The dwFlags uses the SPM_SMF_xxx defines.
00939  * The dwChannelMask uses the SPM_SDCM_xxx defines.
00940  * 
00941  */
00942 typedef struct __SpmStartScan
00943 {
00944         DWORD dwFlags;                                          ///< Scan mode flags    (SPM_SMF-flags)
00945         DWORD dwChannelMask;                            ///< Bitmask of active channels
00946         LPCTSTR lpcsChannelName[8];                     ///< 8 ptr's to strings with channel name
00947         LPCTSTR lpcsChannelUnit[8];                     ///<   8 ptr's to strings with channel unit
00948 } SPMNEWSCANDOC, *LPSPMNEWSCANDOC;
00949 
00950 /**
00951  *  \brief Structure: SPMFILENAME for PROTOCOL [main program - camera dll].
00952  *
00953  * Structure: SPMFILENAME for PROTOCOL [main program - camera dll].
00954  *
00955  * Type to support the exchange of data between the CameraDLL and the main program.
00956  * 
00957  * \code
00958  * typedef struct __SpmScanFileName
00959  * {
00960  *      LPCTSTR lpcsDocumentName;           ///< Folder where iv-Document are stored
00961  * } SPMFILENAME, *LPSPMFILENAME;
00962  * \endcode
00963  *
00964  * Setting Camera parameters, such as the project directory.
00965  * Used to store additional information (files) in the project directory.
00966  * 
00967  */
00968 typedef struct __SpmScanFileName
00969 {
00970         LPCTSTR lpcsDocumentName;           ///< Folder where iv-Document are stored
00971 } SPMFILENAME, *LPSPMFILENAME;
00972 
00973 
00974 
00975 /**
00976  *  \brief Structure: SPMSCANIVPARAMETERS for PROTOCOL [main program - camera dll].
00977  *
00978  * Structure: SPMSCANIVPARAMETERS for PROTOCOL [main program - camera dll].
00979  *
00980  * Type to support the exchange of data between the CameraDLL and the main program.
00981  * 
00982  * \code
00983  * typedef struct __SpmScanIVParameters
00984  * {
00985  *              int     iOffsetx;
00986  *              int     iOffsety;
00987  *              UINT  nSizeNmX;
00988  *              UINT  nSizeNmY;
00989  *              double dAngle;
00990  * } SPMSCANIVPARAMETERS, *LPSCANIVPARAMETERS;
00991  * \endcode
00992  *
00993  * This structure is used to send an array of i/v points to the main program.
00994  * 
00995  * In the camera dll, the user can choose, to get an i/v - spectrum on these positions.
00996  */
00997 typedef struct __SpmScanIVParameters
00998 {
00999   int   iOffsetx;               ///< x - position (iv-point)
01000   int   iOffsety;               ///< y - position (iv-point)
01001   UINT  nSizeNmX;               ///< X Size of image in nm
01002   UINT  nSizeNmY;               ///< Y Size of image in nm
01003   double dAngle;                ///< Angle always 0.0  [not used]
01004 } SPMSCANIVPARAMETERS, *LPSCANIVPARAMETERS;
01005 
01006 
01007 /**
01008  *  \brief Structure: SPMCAMERAPARAMETERS for PROTOCOL [main program - camera dll].
01009  *
01010  * Structure: SPMCAMERAPARAMETERS for PROTOCOL [main program - camera dll].
01011  *
01012  * Type to support the exchange of data between the CameraDLL and the main program.
01013  * 
01014  * \code
01015  * typedef struct __SpmCameraParameters
01016  * {
01017  *      LPCTSTR lpcsDocumentPath;           ///<  Suggested document name (can be NULL)  
01018  * } SPMCAMERAPARAMETERS, *LPCAMERAPARAMETERS;
01019  * \endcode
01020  *
01021  * Setting Camera parameters, such as the project directory.
01022  * Used to store additional information (files) in the project directory.
01023  * 
01024  */
01025 typedef struct __SpmCameraParameters
01026 {
01027         LPCTSTR lpcsDocumentPath;           ///<  Project directory  
01028 } SPMCAMERAPARAMETERS, *LPCAMERAPARAMETERS;
01029 
01030 
01031 
01032 /**
01033  *  \brief Structure: SPMUPDATEFRAME for PROTOCOL [main program - camera dll].
01034  *
01035  * Structure: SPMUPDATEFRAME for PROTOCOL [main program - camera dll].
01036  *
01037  * Type to support the exchange of data between the CameraDLL and the main program.
01038  * 
01039  * \code
01040  * typedef struct __SpmStartIV
01041  * {
01042  *      DWORD dwFlags;                                  // Update flags (SPM_SDFF)
01043  *      DWORD dwPixelOffset;                    // Offset in partial frame
01044  *      DWORD dwNumOfPixels;                    // Number of pixels to add to frame
01045  *  DWORD dwFrameNumber;                        // Frame number
01046  *  CTime       ctTime;                                 // Time/date, use Ctime::GetCurrentTime();
01047  * 
01048  *  LPSPMSCANPOSITION   lpScanPosition;
01049  *  LPSPMDEVICESPECIFICFRAMEDATA         lpDevSpecFrameData;
01050  * 
01051  *      CScanTransferBuffer *Channels[8];               // Pointers to the frames data (8 channels)
01052  * 
01053  *      // ------------------ these buffers contain: -------------------------
01054  *      
01055  *  // DWORD dwFlags;                                   // Left/Right data flags (SPM_SDBF)
01056  *  // DWORD dwSizeX;                                   // Frame Size in X pixels
01057  *  // DWORD dwSizeY;                                   // Frame Size in Y pixels
01058  *  // DWORD dwPixels;                                  // Number of Pixels in buffer
01059  * 
01060  *  // LPWORD wScanData;                                // ptr to scandata base address
01061  *  // double dDataConversionFactor;    // Factor to convert 1 lsb to the unit name
01062  *  // int      dDataOffset;                            // Offset in ADC values, so that:
01063  *                                                                      // ConvFactor * (ADC+Offset) = Abs.Value
01064  * 
01065  *  // DWORD dwParamMask;                               // Parameter mask (SPM_SDBPM)
01066  *      // double dSlopeX;                                      // X Slope of background plane
01067  *      // double dSlopeY;                                      // Y Slope of background plane
01068  *      // double dAveragdeZ;                           // Average Z
01069  *      // int nMinZ;                                           // Minimal Z 
01070  *      // int nMaxZ;                                           // Maximal Z
01071  *  // ----------------------------------------------------------------------------
01072  * } SPMNEWIVDOC, *LPSPMNEWIVDOC;
01073  * \endcode
01074  *
01075  * This structure is used by the Dll notification UpdateFrameData. It contains information about the frames to be updated on the display. This frame can be a complete frame or a partial frame.
01076  * 
01077  * The dwFlags parameter defines if the frame is completed or partial, if the lpDevSpecFrameData parameter is valid and also it sets flags for further display processing: subback/differentiate. It uses the SPM_SDFF_xxx defines, See paragraph 'Defines'.
01078  * 
01079  * The dwPixelOffset and dwNumOfPixels are used when adding partial frames. The Offset parameter is the number of pixels already added before and therefore the start pixel of the data in this frame. The NumOfPixels parameter specifies the number of new valid pixels in this frame.
01080  * 
01081  * When adding complete frames the Offset parameter must be 0 and the NumOfPixels parameter should be X-size times Y-size pixels. 
01082  * 
01083  * The dwFrameNumber is a framecounter, the Dll should count the frames it adds to the document. The main program can use this number to check if it is missing frames (underrun).
01084  * 
01085  * The lpScanPostion is a pointer to a structure that gives information about the scan location. The lpDevSpecFrameData parameter is a pointer to a device specific data structure that can contain all sorts of parameters. E.g. Sample Voltage, Drift compensation, RegulationLoop parameters. etc.
01086  * 
01087  * For each active channel there is a pointer to a CScanBuffer class which contains the actual measurement data. The not active channels must point to NULL. 
01088  * 
01089  * Within the buffer: 
01090  * 
01091  * dwFlags flag defining Left/Right data, it uses the SPM_SDBF_xx defines.
01092  * dwSizeX size of buffer in samplepoint (pixels) in X direction. dwSizeY size of buffer in samplepoint (pixels) in Y direction. dwPixels size of scandata block, should be X*Y for unidirectional frames, 2*X*Y for bi-directional frames.     
01093  * 
01094  * The factor dDataConversionFactor is the conversion factor for calulating 1 lsb of data to the unit specified in field name in the SPMSTARTSCAN structure.
01095  * 
01096  * lpScanData is a  pointer to the first point in the scanframe, all pixels are 16 bit. 
01097  * 
01098  * dwMask specifies which parameters are valid. If the Dll has the opportunity to calculate these values it can pass them to the main program (when the frame is completed). dwMask can be any combination of the SPM_SDBPM_xxx defines, see paragraph 'Defines'.
01099  * 
01100  * dSlopeX is the average slope angle in X-direction in radians of the data set. dSlopeY is the average slope angle in Y-direction in radians. dAveragdeZ is the average of the data set. dMinZ and dMaxZ are the minimal respectively maximal value of the data.
01101  * 
01102  */
01103 typedef struct __SpmUpdateFrame
01104 {
01105         DWORD dwFlags;                          ///< Update flags       (SPM_SDFF-flags)
01106         DWORD dwPixelOffset[8];         ///<  Offset in partial frame
01107         DWORD dwNumOfPixels[8];         ///<  Number of pixels to add to frame
01108         DWORD dwFrameNumber;            ///<  Frame number
01109         CTime ctTime;                           ///< Time of aquisition
01110 
01111         LPSPMSCANPOSITION                               lpScanPosition;
01112         LPSPMDEVICESPECIFICFRAMEDATA    lpDevSpecFrameData;
01113 
01114         CScanTransferBuffer             *Channels[8];   ///<  8 pointers to channel scanbuffers
01115 
01116 } SPMUPDATEFRAME, *LPSPMUPDATEFRAME;
01117 
01118 
01119 /**
01120  *  \brief Structure: SPMNEWIVDOC (START IV SCAN) for PROTOCOL [main program - camera dll].
01121  *
01122  * Structure: SPMNEWIVDOC for PROTOCOL [main program - camera dll].
01123  *
01124  * Type to support the exchange of data between the CameraDLL and the main program.
01125  * 
01126  * \code
01127  * typedef struct __SpmStartIV
01128  * {
01129  *      DWORD dwFlags;                                          ///< Parameter flags (not used)
01130  *      DWORD dwNumberOfSamples;                        ///< Number of points in Curve Data.
01131  *      DWORD dwSamplingClock;                          ///< Sampling clockspeed.
01132  * 
01133  *      LPCTSTR lpcsMeasurementName;            ///< Pointer to string with measurement name
01134  *      LPCTSTR lpcsMeasurementUnit;            ///< Pointer to string with in what units we are measuring
01135  *      LPCTSTR lpcsMeasurementTitle;           ///< Pointer to string with a nice Title for the measurement
01136  * 
01137  *      double dStartVoltage;                           ///< Voltage Ramp start pos.
01138  *      double dEndVoltage;                                     ///< Voltage Ramp end pos.
01139  * } SPMNEWIVDOC, *LPSPMNEWIVDOC;
01140  * \endcode
01141  *
01142  * The Dll uses this structure when a new IV-measurement is started. It sends the StartIVMeasurement-notification. 
01143  *
01144  * The dwFlags parameter is unused.
01145  * 
01146  * dwNumberOfSamples contains the total number of samplepoints per IVcurve, and the dwSamplingClock parameter 
01147  * specifies the average sampling clockspeed in Hz.
01148  * The dStartVoltage and dEndVoltage define the linear voltage ramp. 
01149  */
01150 typedef struct __SpmStartIV
01151 {
01152         DWORD dwFlags;                                          ///< Parameter flags (not used)
01153         DWORD dwNumberOfSamples;                        ///< Number of points in Curve Data.
01154         DWORD dwSamplingClock;                          ///< Sampling clockspeed.
01155 
01156         LPCTSTR lpcsMeasurementName;            ///< Pointer to string with measurement name
01157         LPCTSTR lpcsMeasurementUnit;            ///< Pointer to string with in what units we are measuring
01158         LPCTSTR lpcsMeasurementTitle;           ///< Pointer to string with a nice Title for the measurement
01159 
01160         double dStartVoltage;                           ///< Voltage Ramp start pos.
01161         double dEndVoltage;                                     ///< Voltage Ramp end pos.
01162 } SPMNEWIVDOC, *LPSPMNEWIVDOC;
01163 
01164 /**
01165  *  \brief Structure: SPMADDIVCURVE for PROTOCOL [main program - camera dll].
01166  *
01167  * Structure: SPMADDIVCURVE for PROTOCOL [main program - camera dll].
01168  *
01169  * Type to support the exchange of data between the CameraDLL and the main program.
01170  * 
01171  * \code
01172  * typedef struct __SpmUpdateIVCurve
01173  * {
01174  *      DWORD dwFlags;                          // Parameter flags (not used)
01175  *      DWORD dwMask;                           // Parameter mask (MinMax flag)
01176  *      DWORD dwNumOfPoints;            // Number of points to add to curve
01177  * 
01178  *      DWORD dwCurveNumber;            // Curve Number.
01179  *      int       nPositionX;                   // IV point position in picometer.
01180  *      int       nPositionY;                   // IV point position in picometer.
01181  * 
01182  *      LPSPMDEVICESPECIFICIVDATA lpDevSpecIVData;
01183  *      short* wIVData;                         // ptr to IVcurve base address
01184  * 
01185  *      int    nMinI;                           // Minimal Current
01186  *      int    nMaxI;                           // Maximal Current
01187  * 
01188  *      double  dDataScaleFactor;       // Scale factor between 1 unit and 1 LSB
01189  *      int     nDataOffset;                    // Offset for ADC=0, 
01190  *                                                              //      use : Abs.Height = DataScale * (ADCValue + DataOffset)
01191  * 
01192  * 
01193  * } SPMUPDATEIVCURVE, *LPSPMUPDATEIVCURVE;
01194  * 
01195  * \endcode
01196  *
01197  * This structure is used by the Dll notification UpdateIVCurveData. It contains information about the IVCurves to be added to the document. 
01198  * 
01199  * The dwPointsOffset and dwNumOfPoints are used when adding partial curves. The Offset parameter is the number of samplepoints already added before and therefore the start point of this partial data curve. The NumOfPoints parameter specifies the number of new valid samplepoints in this frame.
01200  * 
01201  * When adding complete frames the Offset parameter must be 0 and the NumOfPoints parameter should be dwNumberOfSamples. 
01202  * 
01203  * The dwCurveNumber is a curvecounter, the Dll should count the frames it adds to the document. The main program can use this number to check if it is missing curves (underrun).
01204  * 
01205  * The dwPositionX and dwPositionY define the position where the IV curve is made. The lpDevSpecIVData parameter is a pointer to a device specific data structure that can contain all sorts of parameters. E.g. Amplifier Gain, Sample Temperature.
01206  * 
01207  * lpIVData is a  pointer to the first point in the IVCurve, all samplepoints are 16 bit. Data organization is set in the StartIVMeasurement-notification.
01208  * 
01209  * dwMask specifies which parameters are valid. If the Dll has the opportunity to calculate these values it can pass them to the main program (when the IVCurve is completed). dwMask can be any combination of the following: SPM_IDM_MINI, SPM_IDM_MAXI. 
01210  * The nMinZ and nMaxZ are the minimal respectively maximal value of the data.
01211  * 
01212  */
01213 typedef struct __SpmUpdateIVCurve
01214 {
01215         DWORD dwFlags;                          ///<  Parameter flags (not used)
01216         DWORD dwMask;                           ///<  Parameter mask (MinMax flag)
01217         DWORD dwNumOfPoints;            ///<  Number of points to add to curve
01218 
01219         DWORD dwCurveNumber;            ///<  Curve Number.
01220         int       nPositionX;                   ///<  IV point position in picometer.
01221         int       nPositionY;                   ///<  IV point position in picometer.
01222 
01223         LPSPMDEVICESPECIFICIVDATA lpDevSpecIVData;
01224         short* wIVData;                         ///<  ptr to IVcurve base address
01225 
01226         int    nMinI;                           ///<  Minimal Current
01227         int    nMaxI;                           ///<  Maximal Current
01228 
01229         double  dDataScaleFactor;       ///<  Scale factor between 1 unit and 1 LSB
01230         int             nDataOffset;            ///<  Offset for ADC=0, 
01231                                                                 ///<   use : Abs.Height = DataScale * (ADCValue + DataOffset)
01232 
01233 } SPMADDIVCURVE, *LPSPMADDIVCURVE;
01234 
01235 #pragma warning(pop)
01236 
01237 
01238 #endif // !defined(INTERFACEDLLSPEC_H__A5635676_074EF_176D4_AFEB_03455408547864__INCLUDED_)

Camera Filter Library documentation © 2004-2007 by Leiden Probe Microscopy