Home

EzLIB API User Manual

image

Contents

1. STEP 11 Draw the graph MyTrend Paint 64 6 Appendix 6 1 Error Table define _NO_ERROR define _EXEC_ERROR define _OPENFILE_ERROR define SETUP ERROR define FRAM INIT ERROR define REGISTER ERROR define NONE MAOS ERROR define INCORECT RUN MODE define DIVIDE ZERO ERROR define SET Interrupt ERROR define I8048 ERROR NO MODULE define I8048 ERROR OPEN DEVICE define I8048 ERROR INVALID PARAMETER define I8048 ERROR INVALID HANDLE define I8048 ERROR CALL IOCTL define I8048 ERROR GET IST EVENT define IN USE ERROR define NO USE ERROR define OUT OF RANGE ERROR define AES NOT SETKEY ERROR define AES CHECK ERROR define CREATE THREAD ERROR define INOUT ERROR define STP PARAMETER ERROR define SYSTEM VERSION ERROR define DEVICE CHECK ERROR define DEVICE NOT INIT 10 20 edi 32 33 34 35 36 50 51 co 80 81 B 100 150 200 201 202 65 define DEVICE NOT WinCon define AES REGCODE LENTH ERROR define AES REGMSG define FILE NOT OPEN the file not open define READ FILE
2. 3 1 5 Width of BMP image bool Get BMP OK This function checks whether the bitmap image was loaded successful from the file into memory Return Value Description true Loading operation was successful false Loading operation failed 32 3 1 6 Load BMP to CDC bool Draw BMP Fit CDC pDC CPoint ptDest CSize size BOOL bForceBackground This function first sets the size and location of the bitmap destination rectangle on the CDC and then copies the bitmap from the memory into the destination rectangle The bitmap will be stretched or compressed to fit the dimensions of the destination rectangle Parameter Range Description pDC Pointer to the target The device context on which the CDC bitmap should be drawn The xy coordinates in logical units ptDest of the upper left corner of the destination rectangle size Destination rectangle bForceBackground TRUE FALSE Show the bitmap in the foreground or background Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix 33 3 1 7 BMP location on CDC bool Draw BMP CDC pDC CPoint ptDest BOOL bForceBackground This function copies the bitmap to the specified location on the CDC but will not change the dimension of the bitmap Parameter Range Description pDC Pointer to the target The device conte
3. Directory computer to change to Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 4 1 1 4 1 4 Change local directory long FtpCld LPCTSTR Directory This function changes the working directory on the local computer Parameter Range Description Directory Specifies the directory on the local computer to change to Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 4 1 1 40 4 1 5 File transfer to FTP server long FtpPut LPCTSTR LocalFile LPCTSTR RemoteFile This function copies one file from the local machine to the remote machine Parameter Range Description LocalFile Pointer to a Unicode Specifies the name of the local file to character array copy F Pointer to a Unicode Specifies the file name to use on the RemoteFile character array remote computer ftp server Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 4 1 1 4 4 1 6 File transfer to FTP client long FtpGet LPCTSTR RemoteFile LPCTSTR LocalFile This function copies a remote file to the local computer FTP client Parameter Range Description Pointer to
4. long SocketReceiveOff short SocketNumber This function disables the triggering of the callback function Parameter Range Description SocketNumber 0 15 Socket number Return Value Description 0 If no error occurs this function returns zero Nonzero Error consult the error table at the appendix Example see chapter 4 2 4 46 5 Trend View The trend view is graphical user interface to visualize process values or calculated values over time The trend view is a line graph where time is measured on the horizontal axis and the variable being observed is measured on the vertical axis It records process values for each time interval and joins these values by a line to visualize the change in data It can show multiple curves simultaneously to allow processes data comparison The TRENDA class does not support data recording and can only display a maximum of 1024 process values The class supports the following settings 5 1 Axis labels Gridlines colors width and style Trend line colors width style and visibility Border line colors width and style Graph background colors Legend Main configuration The basic approach to creating a chart is as follows Declare a CTRENDA object Determine the size and position of the graph frame Set the drawing area properties background color size direction of the time axis Assign the trend view graph a di
5. DArray j ARRAY i i Write data to a file void OnWriteArraytoFile CEzZLIB EzLIB OnFillArrayData Create and open a new file for writing data if EzLIB Start_FileIO PATH true 1 0 Write data to the file Close the file after the write operation has completed EzLIB Array To_File amp DArray sizeof DArray true 18 2 3 3 Reading from a file long File TO Array LPVOI DWORD nBytesToRead bool Flag D lpBuffer This function reads data from a file It copies a specified number of bytes from the file to the buffer pointed to by the LpBuffer parameter Before using this function open the file with the Start FileIO function During the copying process no data is formatted the data is read exactly as it exists in the file Parameter Range Description lpBuffer Pointer to an array A pointer to the buffer that receives the data read from a file nBytesToWrite 0 to 4 294 967 295 The maximum number of bytes to read After the file has been copied to the array determine whether Flag d e to close the file true EE e or to leave the file open false Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example typedef struct BYTE TYPE long PARA long BB long WORK BYTE ARRAY 100 DEMO_Data D
6. CTRENDA MyTrend MyTrend SetFrameP 1 PS SOLID 3 RGB 255 255 255 white MyTrend SetFrameP 2 PS_DASH 1 RGB 255 0 0 red MyTrend SetFrameP 3 PS_DASH 1 RGB 0 255 0 green 1 graph frame 2 vertical gridline 3 horizontal gridline 5 2 2 Trend line property setting void SetCurveP BYTE Cno int nPenStyle int nWidth COLORREF crColor bool IS Used This function sets the line style width and color of the selected trend line Parameter Range Description Select a trend line The cTRENDA class Cno 0 7 supports multiple lines that means up 53 to eight trend lines each representing a variable can be plotted on the graph PS_SOLID nPenStyle z Select a solid or dash line type Y PS_DASH yp nWidth 1 45 Line width Line color crColor Example RGB 255 255 255 white Indicate whether the selected trend line should be displayed or disabled IS Used bedi Play false true display trend line false disable trend line Example CTRENDA MyTrend MyTrend SetCu 0 PS SOLI RGB 255 0 0 true red yTrend SetCu 1 PS SOLI RGB 255 255 0 true yellow yTrend SetCurveP 2 PS SOLI RGB 255 0 255 true pink yTrend SetCu 3 PS SOLID 1 RGB 255 255 111 true yellow MyTrend SetCurveP 4 PS SOLID 1 RGB 0 255 255 true blue MyTrend SetCu 5 PS SOLID 1 RGB 127
7. Chart plotting direction e 0O plotting of data points starts on the right and each new point will be added to the left of the previous point e plotting of data points starts on the left and each new point will be added to the right of the previous point EzDemo10 Trend 49 5 1 2 Assign a parent window void SET CDC CI DC pDC This function puts the trend view bitmap to a device context CDC of a dialog window on which it will be displayed Parameter Range Description Pointer to a device context of the parent window PDC Use the following expression to get the pointer to the dialog window CDC this GetDC Example CTRENDA MyTrend MyTrend SET CDC this GetDC 5 1 3 Scaling gridlines and labels void Set Rang f loat fMin Y loat fMax X loat fMax Y f f f loat fMin_X int iDevN_X int iDevN Y This function sets the upper and lower limit of the vertical axis In addition it sets the number of vertical and horizontal gridlines for the visible section Data of the vertical axis is scaled according to the maximum and minimum axis values So for example if Min Y 10 and fMax Y 60 then a value of 10 will be at the bottom of the chart and 60 will be at the top Axis labels are positioned according to the horizontal gridlines 50 Parameter Range Description
8. ENDA MyTrengd MyTrend ChangeRangeX 4 500 60 MyTrend Paint Redraw the graph MyTrend Paint MyTrend Paint Redraw the graph MyTrend Paint 61 5 5 Example The main purpose of this example is to demonstrate the sequence in which the CTRENDA member functions have to be called in order to display the trend graph correctly Example STEP 1 Declare the following three global objects CTRENDA MyTrend CEzZLIB EZzLIB CDC WorkCDC void CTrendViewDlg InitializeTrendView STEP 2 Declare CRect object Initilize the object with the position and size of the graph window CRect rect 0 O0 400 350 STEP 3 Set the general properties of the graph area like size and color MyTrend Creat rect 50 50 50 50 RGB 0 0 0 100 XDir Right Lift STEP 4 Attach the trend graph and the global device context to the dialog window WorkCDC Attach this GetDC MyTrend SET CDC this GetDC STEP 5 Set the line type width and color of the frame and the grid lines MyTrend SetFrameP 1 PS SOLID 3 RGB 255 255 255 white MyTrend SetFrameP 2 PS DASH 1 RGB 255 0 0 red MyTrend SetFrameP 3 PS DASH 1 RGB 0 255 0 green STEP 6 Set the lower and upper limit of the vertical axis Determine the number of gridlines for the veritcal and horizontal axis A label is automatically attached to
9. 0 127 true purple MyTrend SetCurveP 6 PS SOLID 1 RGB 0 255 0 true green MyTrend SetCu 7 PS SOLI RGB 100 44 44 true brown Trend line no 7 Trend line no 0 54 5 3 Adding new data readings to the graph 5 3 1 Method 1 void AddRecord double fData 8 CString Dtime This function updates one or more trend lines to newest readings and automatically adds a new time label to the grid The y axis vertical axis in the line graph indicates a quantity e g ampere volt liters or percentage while the horizontal x axis represents the time For multi lines trends the data in the fData array represents the y values of different curves at a specific time Dtime For example the new position of the trend line 0 is determined by the y value stored in the variable fData 0 and the time x axis stored in the variable Dtime Parameter Range Description Vertical axis Each of the eight array elements stores fD E asale S data for one of the eight trend lines at a specific time Horizontal axis time axis Dtime The time at which the reading took place Example 1 55 By calling the function SinusCurve at fixed time interval a sinus curve will be displayed CTRI EZ C END A MyTreng IB EzLIB void CTrendViewDlg SinusCurve CString DataTime wchar t tcDate 15 wchar t tc
10. EzLIB DWORD To Float dw BitField 0 0047237873 dw BitField 123456789 f BitField EzLIB DWORD To Float dw BitField 1 6535997e 034 11 2 2 2 Float to DWORD DWORD Float To DWORD float fData This function copies the bit field of the float variable to the memory block of the DWORD variable No data conversion takes place Parameter Range Description fData 3 4E 38 Source memory block Return Value Description 0 to jas e 4 294 967 295 The copied bit field will be interpreted as a float type Example CEzLIB EzLIB DWORD dw_BitField 0 float f_BitField 0 f BitField 0 dw BitFiel EzLIB Float f BitField 100 dw BitFiel EzLIB Float f BitField 1000 dw BitFiel EzLIB Float DWORD f_BitField DWORD BitField D 1120403456 DWORD f BitField 1148846080 12 2 2 3 Double to DWORD array void DOUBLE To DWORDS DWORD dwData 2 double DData This function copies an eight byte long bit field of a double variable to two DWORD variables with four bytes memory blocks each The memory of the entire double variable is copied to the memory of two DWORD variables without changing the bit order Parameter Range Description DData 7E 308 Source memo
11. Read from file NO ERROR Please open first ERROR DEFOE define _WRITE_FIL F I RROR Write to file error define ETHERNET CONNECTION ERROR define ALREADY RUN WARNING define BATTERYI1 LEVEL WARNING define BATTERY2 LEVEL WARNING for i8094H A for i8094 F define MOTION OPI define I8094H TIM for i8092 F i18094 F define _MOTION_NO_ EOUT ERROR i8094H A RE G_ERROR E NCONFIG ERROR for i80 define define define SYSTEM NOT MOTION INTP ERROR 92 F i18094 F i18094H A NON MOTION ALREADY RUN READY 202 450 251 300 S10 320 10 FX 22 50 51 52 Sd 54 100 66
12. each gridline MyTrend Set Range 0 0 60 0 0 0 60 0 3 10 STEP 7 Set the line type width and color of the trend lines MyTrend SetCurveP 0 PS_SOLID 2 RGB 255 DK YU true MyTrend SetCurveP 1 PS_SOLID 2 RGB 255 455 D true MyTrend SetCurveP 2 PS_SOLID 2 RGB 255 D 255 ttrtue yTrend SetCurveP 3 PS_SOLID 1 RGB 295 2595 111 fTalsse yTrend SetCurveP 4 PS_SOLID 1 RGB 0 a 255 255 false MyTrend SetCurveP 5 PS SOLID 1 RGB 127 D 127 false yT ISa ES SOLID 1 RGB 0 255 0 false y D 100 44 44 false Trend SetCurveP Trend SetCurveP 7 PS SOLI RGB 62 STEP 8 Draw the frame MyTrend Paint void CTrendViewDlg DrawTrendView CString DataTime wchar t tcDate 15 wchar t tcTime 15 int 1 static double x 0 double fData 8 for i 0 i lt 100 i STEP 8 Load the data for the y axis vertical axis Data O 5 0 x 60 0 fData 1 9 2 5 x 60 0 fData 2 x 60 0 if x lt 20 0 x else x 0 0 STEP 9 Load data for the vertical gridline labels Read the current date and time EzLIB Get Date tcDate EzLIB Get Time tcTime Copy the date and time to the time CString DataTime Format L s r n s tcDate tcTime STEP 10 Update the graph with the new data and labels MyTrend AddRecord fData DataTime
13. fMin X 3 4E 38 Of no significance for the trend view object use Min X 0 fMin Y 3 4E 38 den minimum value of the vertical fMax X 3 4E 38 Of no significance for the trend view object use Max X 0 fMax Y 3 4E 38 Ee maximum value of the vertical 2 147 483 648 to e GE iDevN X 2 147 483 647 Set the number of vertical gridlines 2 147 483 648 to TM iDevN Y 2 147 483 647 Set the number horizontal gridlines Example CTRENDA MyTrend MyTrend Set Range 0 60 0 60 5 10 iv XE 51 5 1 4 Legend setting void SetLegend bool ShowFlag WORD XSpace This function enables the legend display and allows the user to set the distance of legends from the right border of the graph area Parameter Range Description true Display legends GA false Hide legends XSpace 1 200 Distance from the right border 5 2 Line properties 5 2 1 Frame and gridline property setting TC Ct void SetFrameP BYTE Target int nPenStyle int nWidth COLORREF crColor This function sets the line style width and color of the frame or the gridlines Parameter Range Description graph frame Target 2 vertical gridline Select a line 3 horizontal gridline PS SOLID nPenStyle PS DASH Select a solid or dash line type 52 nWidth 1 10 Line width crColor Line color Example
14. settings Password Open the password window EzLIB Call Shell 3 22 2 5 Date and Time 2 5 1 Get local date and time bool bool void Get DT TCHAR tcDT 30 Year bool Month bool Week bool Day Hour bool Minute bool Second bool mSecond This function retrieves the current date and time Parameter Range Description A pointer to a 30 element array which teDT 30 Pointer to an UNICODE stores the date and time character array Example 2009 12 1 07 13 35 45 45265 T true Reads the year false Ignores the year Retrieves the month based on local HER true time in the range 1 through 12 1 January false Ignores the month S Retrieves the day of the week based on Week local time false Ignores the week number Retrieves the day of the month based true on local time in the range 1 through 31 false Ignores the day T Retrieves the hour based on local Hour time in the range 0 through 23 false Ignores the hour Retrieves the minute based on local Erue i Minute time in the range 0 through 59 false Ignores the year Retrieves the second based on local REUS i Second time in the range 0 through 59 false Ignores the year 23 true mSecond Reads the milliseconds false Ignores the milliseconds Example CEzLIB EzLIB TCHAR tcDT 30 Read the local da
15. the file does not exist Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example 16 2 3 2 Writing to a file long Array TO File LPCVOI DWORD nBytesToWrite bool Flag D lpBuffer This function writes data to the specified file It copies a specified number of bytes from the buffer that is pointed to by the nBytesToWrite parameter into the file specified by the Start FileIO function Array TO File does not perform any formatting on the data Parameter Range Description lpBuffer Pointer to an array A pointer to the buffer containing the data to be written to the file nBytesToWrite 0 to 4 294 967 295 The number of bytes to write to the file Flag true false After the array has been written to the file determine whether to e close the file true or e leave file open false Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example typedef struct BYTE TYPE long PARA long BB long WORK BYTE ARRAY 100 DEMO_Data Define an array as buffer DEMO Data DArray 100 17 file name TCHAR PATH 100 TEXT ArrayFile dat void OnFillArrayData int 11 7 for j 0 j 100 j for i 0 i lt 100 i
16. to a remote TCP IP server on a connected socket Parameter Range Description SocketNumber 0 15 Socket number Pointer to a Unicode Buffer containing the data to be String i character string transmitted Return Value Description 0 If no error occurs this function returns zero Nonzero Error consult the error table at the appendix Example see chapter 4 2 4 44 4 2 4 Receive data callback function long SocketReceiveOn short SocketNumber ptTSRFunc2 SRF This function triggers a call back function as soon as data is arriving Parameter Range Description SocketNumber 0 15 Socket number SRF Callback function Return Value Description 0 If no error occurs this function returns zero Nonzero Error consult the error table at the appendix Example CEzLIB EzLIB User defined callback function void SocketReceiveO CString AA BYTE Data long Lenth BYTE Re 5000 0 memcpy Re Data Lenth void OnEthernetTest BOOL rec rec EzLIB SocketInitial 0 _T 10 0 0 20 60000 rec EzLIB SocketSend 0 T WinCon IP 10 0 0 26 rec EzLIB SocketReceiveOn 0 amp ptTSRFunc2 SocketReceive0 void OnEthernetClose BOOL rec rec EzLIB SocketReceiveOff 0 rec EzLIB SocketClose 0 45 4 2 5 Receive data callback function
17. DOK CString m FileName dlg GetPathName if m_FileName IsEmpty Save BMP to file m BMP Save BMP m FileName void CCDC_DEMOD1g OnDrawBMP TODO Add your control notification handler code here m BMP Draw BMP this GetDC CPoint 0 0 0 void CCDC_DEMOD1g OnDrawBMP TODO Add your control notification handler code here m BMP Draw BMP this GetDC CPoint 0 0 0 void CCDC_DEMOD1g OnDrawBMPFit TODO Add your control notification handler code here CRect rect 0 0 800 550 m BMP Draw BME Fit this GetDC CPoint 0 0 rect Size 0 30 3 1 2 Save BMP image bool Save_BMP LPCTSTR lpszFileName This function saves the bitmap image Parameter Range Description f Pointer to a Unicode lpszFileName Bitmap file name character array Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example 3 1 3 Height of BMP image WORD Get BMP Height This function retrieves the height of the bitmap image in the memory Return Value Description 0 to 65 535 Height in pixel 31 3 1 4 Width of BMP image WORI D Get BMP Width This function retrieves the width of the bitmap image in the memory Return Value Description 0 to 65 535 Width in pixel
18. EZLIB API User Manual Version 4 3 EzProg C KO ICP DAS CO LTD Warranty All products manufactured by ICPDAS Inc are warranted against defective materials for a period of one year from the date of delivery to the original purchaser Warning ICPDAS Inc assumes no liability for damages consequent to the use of this product ICPDAS Inc reserves the right to change this manual at any time without notice The information furnished by ICPDAS Inc is believed to be accurate and reliable However no responsibility is assumed by ICPDAS Inc for its use or for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 1997 2009 by ICPDAS Inc LTD All rights reserved worldwide Trademark The names used for identification only maybe registered trademarks of their respective companies License The user can use modify and backup this software on a single machine The user may not reproduce transfer or distribute this software or any copy in whole or in part Technical Support If you have problems about using the product please contact ICP DAS Product Support Email Service icpdas com Table of Contents 1 2 3 4 ingenita E 5 Cie e rA X a E EE E ak a Ek 6 2 1 e dau gen AAA 6 2 1 1 CString to float AAO 6 2 1 2 Float to eia 8 2 1 3 WOES to double ascites cane deesse esae eet efe Ma tees edidit ande 9 2 1 4 Double t
19. TR lpszFileName This function loads the image of a bitmap file into memory Parameter Range Description Pointer to an Unicode lpszFileName character array Bitmap file name 28 Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example global variables CEZBMP m_BMP CDC WorkCDC void CCDC_DEMOD1g OnGetBMPCDC Select file and load file CString strFilter L Bitmap Files bmp bmp All Files CFileDialog dlg TRUE NULL NULL OFN HIDEREADONLY OFN EXPLORER strFilter NULL if dlg DoModal IDOK if m BMP Open BMP dlg GetPathName BMP_OK t rue Printer OK false Monitor OK false this SetWindowText dlg GetPathName else BMP_OK false AfxMessageBox _T Unable to open bitmap file GET the BMP CDC WorkCDC Attach m BMP Get BME DC this GetDC Draw the image of the bitmap file to the screen void CCDC_DEMOD1g OnBMPDraw if WorkCDC Draw Work 29 void CCDC_DEMOD1g OnBMPSave Select a file CString strFilter L Bitmap Files bmp bmp All Files Seri p CFileDialog dlg false NULL NULL OFN HIDEREADONLY OFN EXPLORER strFilter NULL if dlg DoModal I
20. Time 15 int i double fData 8 static const float DtoGrade 3 1415926535 180 static int Data count 0 Update the array with new data of a sinus curve for i 0 i lt 8 i fData i J 25 sin Data count DtoGrade 10 425 i 150 if Data_count lt 360 Data_count tt else Data_count 1 Read the current date and time EzLIB Get Date tcDate EzLIB Get Time tcTime Copy the date and time to the time CString Pz DataTime Format L s r n s tcDate tcTime Update the graph with the new data yTrend AddRecord fData DataTime Redraw the graph yTrend Paint 56 5 3 2 Method 2 void AddRecord do do do do do do do do ubl ubl ubl ubl ubl ubl ubl ubl CString Dtime D qm qu q IE qu 5 e fDataO fDatal fData2 fData3 fData4 fDatab5 fData6 fData7 This function has the same properties as the function discussed under method 1 except that the values for the vertical axis are not stored in an array but in eight float variables Parameter Range Description Vertical axis fData0 34E 38 Each of the eight data types stores data fData7 for one of the eight trend lines at a specific time Horizontal axis time axis Dtime 1 5 The time at which the reading took place Example 2 Directly displaying analog input data This can be done by directly reading the analog input data from the analog cha
21. a 14 2 2 6 BYTE array to double double BYTES To DOUBLE BYTE BData 8 This function copies the memory of a BYTE array with a length of eight elements to the memory block of a double variable Parameter Range Description BData 8 Pointer to BYTE array Source memory block Return Value Description 1 7E 308 The copied bit field will be interpreted as a double type Example CEzLIB EzLIB double Da 0 BYTE BArry 8 12 33 87 956 11 45 0 100 Da EzLIB BYTES To DOUBL E BArry 15 2 3 File system operations 2 3 1 Creating or opening a file long Start FileIO LPCTSTR lpszFileName bool ReadWrite BYTE OpenMode This function creates a new file or opens an existing file When you call this function it searches for a file in the directory that you specify Depending on the ReadWrite parameter you can open an existing file or create a new file When you open a file you have to set the read write access for that file Parameter Range Description Pointer to wide character lpszFileName Name of the file to open array true true write to file ReadWrite false false read from file Creates and opens a new file 1 2 Opens a file If the file does not exist OpenMode 2 the function creates a new file 3 3 Opens an existing file The function fails if
22. a Unicode RemoteFile Specifies the remote file to copy character array Pointer to a Unicode Specifies the name to use on the local LocalFile character array computer FTP client Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 4 1 1 42 4 2 TCP IP connection 4 2 1 Initializing a TCP IP socket long SocketInitial short SocketNumber LPCTSTR IpAddress long IpPort This function creates a TCP IP socket and connects to a remote TCP IP server Parameter Range Description SocketNumber 0 15 Socket number IpAddress TCP server IP address IpPort 0 65535 TCP IP server port number Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix Example see chapter 4 2 4 4 2 2 Close a TCP IP connection long SocketClose short SocketNumber This function closes an existing socket and thereby terminates a TCP IP connection Parameter Range Description 43 SocketNumber 0 15 Socket number Return Value Description 0 If no error occurs this function returns zero Nonzero Error consult the error table at the appendix Example see chapter 4 2 4 4 2 3 Send data long SocketSend short SocketNumber LPCTSTR String This function sends data
23. alog window Set up labels legends grids Set the line properties style width color Populate the chart object with your data Display data on the graph 47 5 1 1 Creating a trend view object Create LPCRECT pRect int iLeft int iRight int iTop int iBottom COLORREF RGB WORD RecordDataNo WORD XDir This function initializes the line chart object sets its size position and background color Parameter Range Description pRect The position of the main frame on the dialog window Top left e LONG left e LONG top Bottom right e LONG right LONG bottom iLeft 1 200 Left position of the graph area relative to the left main frame position iRight 1 200 Right position of the graph area relative to the right main frame position iTop 1 200 Top position of the graph area relative to the top main frame position iBottom 1 200 Bottom position of the graph area relative to the bottom main frame position RGB Background color RecordDataNo 10 1024 Sets the scale resolution of the visible horizontal axis time axis It determines the number of divisions of the visible timeline in the graph The RecordDataNo parameter basically specifies the maximum number of data points to be displayed on the visible time section XDir XDir_Right_Lift 0 The direction of the horizontal axis 48 XDir_Lift_Right 1
24. ay or hide a trend Ime irati rta ziak rrean sass ROSE eon en e Un 59 5 4 2 Modifying vertical AXIS e 60 5 4 3 Modifying horizontal axis range rra 60 5 5 js Cirio M OT e ee a 62 GORE A EAEE Eka Lon oder atu Code e 65 6 1 Brrot ESE 65 1 Introduction EzLib is a collection of reusable software components and assists software developers to write application programs for the Window CE platform The library is written and optimized for the Microsoft Visual Studio 2008 IDE The ExLib library consists of four classes 1 CEzLIB class String to number conversion and vice versa Manipulation of data types Reading from and writing to file Date and time functions FTP communication TCP IP communication Open applet window mo Rogp 2 CEzBMP class a Create a bitmap drawing b Display a bitmap on dialog window c Save a bitmap to file 3 CTRENDA class a Creating a trend line graph 2 General APIs This chapter describes API for the following actions 2 1 CString type conversions Manipulation of data types Reading from file writing to file Retrieving current date and time Open programs in the control panel String conversion 2 1 1 CString to float float CString _To_Float CString CStr This function converts a CString string to a floating point value by interpreting the input characters as a number The function stops reading the input string at the first character that it cannot recognize as par
25. efine an array as buffer DEMO_Data DArray 100 19 file name TCHAR PATH 100 TEXT NNArrayFile dat Read data from a file CEZzLIB EzLIB void CRW ArrayFileDlg OnReadArrayfromFile Open an existing file for reading data if EzLIB Start FileIO PATH false 3 0 Copy data from the file to an array Close the file after the read operation has finished EzLIB File To Array amp DArray sizeof DArray true 2 3 4 Getth e file size DWORD Get File Length DWORD HighDWORD This function retrieves the size of the specified file Parameter Range Description Pointer to an array A pointer to the variable where the HighDWORD high order double word of the file size is returned Return Value Description 0 to 4 294 067 295 File size in bytes 20 2 4 Programs in the control panel The Control Panel is a part of the Microsoft Windows graphical user interface which allows users to view and manipulate basic system settings and controls via applets such as network connection adding and removing software controlling user accounts and changing accessibility options 2 4 4 Open an applet window void Call Shell WORD ShellNo This function allows you to open a component of the control panel which allows users to define a range of settings for their PAC such as disp
26. lay properties keyboard properties network configuration and regional settings The program in the control panel can be accessed manually by clicking Start Settings Control Panel Description View and modify system digital certificates for this device Date Time Change date time and time zone information A Display Change desktop background EO Input Panel Change current SIP and options amp akeyboard Change keyboard repeat rate and delay Mouse Adjust mouse double click time Network and Dial up Connecti Connects to other computers networks and the Internet 82 Owner Change owner s personal profile 8 Password Change owner s password and set security options A Regional Settings Change how numbers currencies dates and times are displayed ZG Remove Programs Removes programs from your device Storage Manager Manage your storage media and disk partitions E System View system information and change memory settings Parameter Range Description ShellNo Keyboard Properties Enter Password Enter Password System Properties rd DD Oy B Lak bd E Si Display Properties 21 oo Mouse Properties 10 11 Input Panel Properties 12 Remove Programs 13 Date Time Properties 14 Certificates 15 16 Example CEzLIB EzLIB Enter Password You must enter your password to E change these
27. n be plotted on the graph Visible true false Visible or invisible Example CTRENDA MyTreng MyTrend SetVisible 3 true display trend line no 3 MyTrend SetVisible 4 false hide trend line no 4 MyTrend SetVisible 5 true display trend line no 5 Redraw the graph MyTrend Paint 59 5 4 2 Modifying vertical axis range void ChangeRangeY double fMin Y double fMax Y This function modifies the upper and lower limit of the vertical axis and therefore also the scale of the axis In addition it resets the number of horizontal gridlines and the labels for the vertical axis Parameter Range Description fMin Y 3 4E 38 Set the minimum value forthe vertical axis fMax Y 3 4E 38 Se maximum value for the vertical 5 4 3 Modifying horizontal axis range void ChangeRangeX int iDevN_X WORD RecordDataNo This function modifies the number of vertical gridlines and the vertical gridline labels In addition it modifies the resolution of the visible horizontal axis Parameter Range Description iDevN X 3 20 Set the number of vertical gridlines Set the number of divisions for the horizontal axis This variable sets the RecordDataNo 10 1024 resolution of the horizontal axis The higher the value the more data can be displayed on the visible graph Example CTRENDA MyTrend MyTrend ChangeRangeX 3 100 CTRI
28. nnel by using the IN_AI function This function is described in the EzCore manual CTRENDA MyTrend CEzLIB EzLIB CString DataTime wchar t tcDate 15 wchar t tcTime 15 void CTrendViewDlg SinusCurve Read the current date and EzLIB Get Date tcDate EzLIB Get Time tcTime time 57 Copy the date and time to the time CString DataTime Format L s r n s tcDate tcTime EzProg I IN AI MyTrend AddRecord IN AI 0 IN AI 1 IN AI 2 IN AI 3 IN AI 4 IN AI 5 IN AI 6 IN AI 7 DataTime MyTrend Paint 5 3 3 Delete all trend lines void ClearRecord This function removes all trend lines and time labels from the graph 5 3 4 Redraw graph void Paint This function redraws the graph Any changes made to the graph property the line trend itself or other settings concerning the visual part of the graph requires a Paint function call to display the changes Example see previous examples 58 5 4 Change the display status and range 5 4 1 Display or hide a trend line void SetVisible BYTE Cno bool Visible This function enables you to select a trend line and make it visible or invisible during runtime Parameter Range Description Select one trend line The cTRENDA class supports multiple lines that Cno 0 7 means up to eight trend lines each representing a variable ca
29. o CSI autartikoa 10 2 2 Copying of memory Blocks AEA 11 2 541 DWORD to float s ehe DU e REI RO AUREOS T PSI Ee DICIS 11 22 2 Float to DWORD acetone suas ce EDU RO botas tal oed coc 12 2 2 3 Double to DW BAA ESNEA 13 2 2 4 DWORD array taa UAE 13 220 Double to B Y EB atfay iustos iste ie Paesi duis mro te shed iere roce iri ep rae 14 2 2 6 BYTE array to doubles cies ae eh cito edid ee eee 15 Z3 aei rea Ea SOR 16 2 3 1 Creating or opening a Deos ease i E tuat eo E OU M ede PATREM 16 2 3 2 Writing toa FING e REE n 17 2 3 3 Uk from a fle ee et d itin E us 19 2 3 4 Gebtlie Te SIVE Cate a Ree e ROE UE ee ne eT On ee eee 20 2 4 Programs in the control panel essere eene 21 2 4 1 Open an applet window aaa do nose qi eut iai pulo UE ota piden pe n A 21 2 5 AUS ea A 23 2 5 1 Geblocal date and Ime ose atento i ee Privat bre dieti a e at UE 23 23 2 ICE local dat n T 25 2 5 9 Get Toca REO asin toa i vss o Ne iso ae eg en oe cA 26 Context EAEE 27 3 1 BMP CDC interface EEA 28 3 1 1 Load a BMP AAE 28 SE Save PMP RAE 31 3 1 3 Height of BMP IMa agia aa EET 31 3 1 4 Width of BMP 11magg ice ertet P HARE ene a Y enterau 32 3 1 5 Width of EAEE 22 3 1 6 oad BMP t CD acea tenista tutte iate Debu dipsa unma Muss 33 3 1 7 BMP location on LAE 34 3 1 8 Retrieve the CDC of the SANE 35 3 2 Monitor CDG interface csse eoe eit esr E aU andes saedusageaavsuesbeasasastaaeauaraaroandanee 36 3 2 1 Ret
30. or DC this GetDC if WorkCDC Monitor_OK true BMP_OK false Printer_OK false MessageBox _T Get Monitor CDC OK else Monitor_OK false MessageBox _T Get Monitor CDC Error 36 Draw on the screen void CCDC_DEMOD1g OnMonitorDraw TODO Add your control notification handler code here if WorkCDC amp amp Monitor_OK Invalidate update the screen Updates the screen void CCDC_DEMOD1g OnPaint CPaintDC dc this device context for painting TODO Add your message handler code here if WorkCDC amp amp Monitor_OK Draw_Work Do not call CDialog OnPaint for painting messages 37 4 Ethernet Connection The chapter describes TCP IP and FTP client functions which enable data exchange with an ftp or a TCP IP server 4 1 FTP internet connection File Transfer Protocol FTP is a standard network protocol used to exchange and manipulate files over a TCP IP based network such as the Internet The FTP is commonly used for copying files to and from other computers These computers may be at the same site or at different sites thousands of miles apart The local computer FTP client refers to the computer which program calls the EzLib FTP function The remote computer FTP server listens for incoming connections from clients After a connection has been established with the server is responding to FTP commands from the clien
31. ray digit of the double value is represented by one Unicode character Example CEzLIB EzLIB float fData 3 1234567 CString fString Lb fString EzLIB Float To CString fData 0 3 12346 fString EzLIB Float To CString fData 1 3 1 FString EzLIB Float To CString fData 2 3 12 fString EzLIB Float To CString fData 3 3 123 FString EzLIB Float To CString fData 4 3 1235 fString EzLIB Float To CString fData 5 3 12346 fString EzLIB Float To CString fData 6 3 12357 FfString EzLIB Float To CString fData 7 3 12357 2 1 3 CString to double double CString To DOUBLE CString CStr This function returns the double value produced by interpreting the CString string characters as a number The function stops reading the input string at the first character that it cannot recognize as part of a number Space or tab characters will be ignored Parameter Range Description cstr Maximum 50 characters CString to be converted Return Value Description 0 0 The return value is 0 0 if the input cannot be converted to a double value 1 7E 308 Double value range Example 2 1 4 Double to CString CString DOUBLE To CString double DData long DotNo This function converts the value of a double variable into a CString s
32. rieve the monitor CTs access arcade oui tea dac aot residue t aes 36 Ethernet CONNEC HOM d aaa iaku tua uada anion da edat eMe 38 4 1 FTP internet GOO SEO arteztarauak torea rma 38 4 1 1 Connect Io ET P Server AAO 38 4 1 2 Close I TP Server connec BOTE eso ee EEAO AE eee pipe 39 4 1 3 Change remote AE 40 4 1 4 Change local Eee tOLy EO 40 4 1 5 File transfer to FTP server AAE 41 4 1 6 File transfer to FTP GIS 42 42 7 TEPIP GOBUGCUOD osse USER RENE Thea quete toc es ident atu ad one detecte Oradea 43 4 2 1 Initializing a TCP IP socket AEE 43 4 2 2 Closed TCP IP Cris CUO xe ase oa cop aon tese t te SEDE NOE RD UNS IG ee E ERE 43 4 2 3 Send CLA Aisa ds onam iate vo Bal wd dea seg deu pM A AE DELE i LM DE 44 4 2 4 Receive data callback function eii tritt teet retener etin 45 4 2 5 Receive data callback function Jide coe eene s karta 46 Trend ARREA E daa Men pcd aaah tua Md c LE 47 5 1 Mam configuration ernst nerriet eas 47 5 1 1 Creating a trend view ObJegls eode to tantaia 48 5 1 2 Assign a parent WINDOW vais eite ined aetan 50 5 1 3 Scaling gridlines and E taera iraia auge 50 5 1 4 Legend bo gua 52 5 2 LAME Alu 52 5 21 Frame and gridline property setting rrura 52 3 22 Trend me property Seung o oe no srt eto gs 53 5 3 Adding new data readings to the Grus 55 5 3 1 Me thod Ea ienen aa a a EO a 55 5 3 2 Aula aba 57 AS Delete al trend EAO 58 5 3 4 hic auci cU TREES 58 5 4 Change the display status and range rrua 59 5 4 1 Displ
33. ry dwData 2 Pointer to a DWORD array Destination memory Example CEzLIB EzLIB double Da 25245245 23525 DWORD DArry 2 0 0 EzLIB DOUBLE_To_DWORDS DArry Da 2 2 4 DWORD array to double double DWORDS_To DOUBLE DWORD dwData 2 This function copies the memory of an array of two DWORDs to the memory block of a double variable Parameter Range Description dwData 2 Pointer to DWORD array Source memory block 13 Return Value Description 1 7E 308 The copied bit field will be interpreted as a double type Example CEzLIB EzLIB double Da 0 DWORD DArry 2 20000 145525 DaRET EzLIB DWORDS_To_DOUBL E DArry 2 2 5 Double to BYTE array void DOUBLE To BYTES BYTE BData 8 double DData This function copies an eight byte long bit field of a double variable to a BYTE array with a length of eight elements The memory of the entire double variable is copied to the memory of a BYTE array without changing the bit order Parameter Range Description DData 7E 308 Source memory e Destination memory BData 8 Ge OEE Make sure that the BYTE array has at least y eight elements Example double Da CEzLIB EzLIB 25245245 23525 BYTE BArry 8 0 0 0 0 0 0 0 0 EzLIB DOUBLI E To BYTES BArry D
34. t 4 1 1 Connect to FTP server long FtpInitial LPCTSTR FtpAddress long FtpPort LPCTSTR UserName LPCTSTR Password This function connects to the specified FTP server and attempts to automatically log the user in to the FTP server Parameter Range Description FtpAddress FTP server IP address FtpPort 0 65535 FTP sever port Specifies a user name with which to UserName log in to the remote computer Password Specifies the password for user name Return Value Description 38 0 Execution was successful Nonzero Error consult the error table at the appendix Example CEzLIB EzLIB void CEzZLIB_TESTD1g OnFTPTest BOOL rec rec EzLIB FtpInitial T 10 0 0 110 21 _T Anonymous T 0 rec EzLIB FtpCwd NNTemp rec EzLIB FtpPut U test BMPT rec EzLIB FtpGet Ltest BMP EzLIB FtpClose T test BMP T test BMP _T rec EzLIB FtpCld _T Temp _T _T bi lA 4 1 2 Close FTP server connection void FtpClose This function closes the connection to the FTP server Example see chapter 4 1 1 39 4 1 3 Change remote directory long FtpCwd LPCTSTR Directory This function changes the directory on the remote computer Parameter Range Description Specifies the directory on the remote
35. t of a number Space or tab characters will be ignored Parameter Range Description cstr Maximum 50 characters CString to be converted Return Value Description 0 0 The return value is 0 0 if the input cannot be converted to a float value 3 4E 38 Floating point range Example CEzLIB EzLIB float fRet 0 CString fString l L I 1 CString fString 2 L 1 12345678 CString fString_3 L 1 12345678 4j CString fString 4 L k1 3 CString fString 5 L 0 loat fString 1 1 1 loat fString 2 1 1234568 F F Float fString_3 1 1234568 F F fRet EzLIB CString To fRet EzLIB CString To EzLIB CString To O O fRet Ez E fRet EzLIB CString To Float fString 4 0 0 ERROR fRet EzLIB CString To Float fString 5 0 0 2 1 2 Float to CString CString Float To CString float fData long DotNo This function converts the value of a float variable into a CString string Parameter Range Description fData AAE 38 Float value to be converted Specifies is the maximum number of digits to be printed after the decimal point DotNo 0 to 7 0 will not format the number of digits of the float value Return Value Description Character CString string displays the float value as a wide character array Each ar
36. tDeviceCaps CDC SelectStockObject CDC GetHalftoneBrush CDC StretchBlt The APIs provided by ICPDAS allows you to directly e display the CDC on the screen e save the CDC to file or e print the CDC Example Define a bitmap object CEzBMP m BMP CDC WorkCDC CEZDEMO7 CDCDlg th BOOL CEZDEMO7_CDCD1g OnInitDialog CDialog OnInitDialog Set the icon for this dialog The framework does this automatically when the application s main window is not a dialog SetIcon m_hIcon TRUE Set big icon SetIcon m_hIcon FALSE Set small icon CenterWindow GetDesktopWindow center to the hpc screen TODO Add extra initialization here th this return TRUE return TRUE unless you set the focus to a control 27 Draw to the screen void Draw Work Draw Lines WorkCDC MoveTo 0 0 WorkCDC LineTo 300 200 WorkCDC MoveTo 300 0 WorkCDC LineTo 0 200 d Select font CFont font VERIFY font CreatePointFont 240 T Arial amp WorkCDC CFont def_font WorkCDC SelectObject amp font font DeleteObject sese Set TEXT Color WorkCDC SetTextColor RGB 0 0 0 Draw TEXT WorkCDC DrawText ICPDAS Text Example CRect 50 300 1200 400 0 WorkCDC SelectObject def_font 3 1 BMP CDC interface 3 1 1 Load a BMP file bool Open BMP LPCTS
37. te and time EzLIB Get_DT tcDT true tru trie tru e Egiz true true true Example output 2009 12 1 07 13 35 45 45265 24 2 5 2 Get local date void Get Date TCHAR tcDate 15 This function retrieves the current date Parameter Range Description A pointer to a 15 element array which tcDate 15 Pointer to an UNICODE stores the date character array Example 2009 12 07 Example CEzLIB EzLIB TCHAR tcDate 15 Read the current date EzLIB Get Date tcDate Example output 2009 12 07 25 2 5 3 Get local time void Get Time TCHAR tcTime 15 This function retrieves the current date Parameter Range Description A pointer to a 15 element array which teTime 15 Pointer to an UNICODE receives the time string character array Example 14 32 59 Example CEzLIB EzLIB TCHAR tcTime 15 Example output Read the current time EzLIB Get Time tcTime 14 32 59 26 3 Context drawing The device context DC enables the programmer to draw and write on the device context and to directly display save and print its content independent of the hardware MFC for Windows CE supports the following methods of the CDC class CDC BitBlt CDC GetMapMode CDC DrawEdge CDC MaskBit CDC DrawText CDC Polygon CDC ExtTextOut CDC PolyPolygon CDC Ge
38. tring Parameter Range Description DData 1 7E 308 Double value to be converted Specifies is the maximum number of digits to be printed after the decimal point DotNo 0 to 15 0 will not format the number of digits of the float value Return Value Description Unicode e f CString string displays the double value as a wide character array Each Character Ga E digit of the double value is represented by one Unicode character 10 2 2 Copying of memory blocks The APIs in this section copies a bit field from the memory of a specific data type to a memory of another data type of the same size The bit field is not altered during the copying process Therefore not the value of a data type is copied but only the bit field data No data conversion takes place 2 2 1 DWORD to float float DWORD To Float DWORD dwData This function copies a DWORD bit field of four bytes to a float variable The bit field of the entire DWORD memory is copied to the float memory without changing any bits Parameter Range Description dwData 0 to 4 294 967 295 Bit field source Return Value Description 3 4E 38 Floating point range Example CEzLIB EzLIB DWORD dw_BitField 0 float f_BitField 0 dw_BitField 0 Ez f BitField EzLIB DWORD To Float dw BitField gt 0 dw BitField 1000000000 f BitField
39. xt on which the CDC bitmap should be drawn The xy coordinates in logical units ptDest of the upper left corner of the bitmap rectangle bForceBackground TRUE FALSE Show the bitmap in the foreground or background Return Value Description 0 Execution was successful Nonzero Error consult the error table at the appendix 34 3 1 8 Retrieve the CDC of the BMP Q DC Get BMP DC CDC pDC This function retrieves a pointer to the bitmaps device context CDC so that the user can use the methods of the CDC to directly draw and write on the bitmaps device context CDC methods are provided for drawing text working with fonts drawing lines and drawing simple shapes ellipses and polygons Parameter Range Description Pointer to a CDC pDC Use this gt GetDC Return Value Description Pointer to a CDC 35 3 2 Monitor CDC interface 3 2 1 Retrieve the monitor CDC Q DC Get Monitor DC CDC pDC This function returns a pointer to a device context which manages the display associated with the client area of a window Parameter Range Description Pointer to a CDC pDC Use this GetDC Return Value Description Pointer to a window CDC Example CEzBMP m BMP CDC WorkCDC void CCDC DEMODIlg OnGetMonitorCDC WorkCDC Attach m BMP Get Monit

Download Pdf Manuals

image

Related Search

Related Contents

Hunter Bacteria-Free Vaporizer  Bedienungsanleitung - GMC  Soleus Air KFHHP-22 User's Manual    取扱説明書 - 村田製作所  マジックゲートメモリースティック リーダー/ライター  Service Manual 3200 Level 1&2  

Copyright © All rights reserved.
Failed to retrieve file