The text of a manual · part 25 of 28
HawkEye 1500 Series Reference & Programmers Manual, pages 241 to 250
Pages 241 to 250 of 276
The original document is the PDF (1.3 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the Microscan HE1510, RVSI CiMatrix HE1510 and Siemens HE1510
Page 241
Example 5, Image Overlay Graphics and Auto Connection s = s & " Failed = " & .CountDecodeFail End With midc.TextOut 8, 6, s
2 ReadRunner Programming
End If midc.SetBkMode TRANSPARENT midc.SetPen 1, 1, vbRed midc.MoveTo 320, 0 midc.LineTo 320, 480 midc.MoveTo 0, 240 midc.LineTo 640, 240 End If End Sub
Now, let’s walk through this project step by step. 1.
The MY_CAMERA constant at the top should be changed to be the network name of your camera. Instead of using the CameraDropdown, we will connect to this camera as soon as it’s discovered on the network.
2.
Custom overlay graphics are accomplished by creating an object that implements the MiDrawObj interface. This can be a separate class module, but can also be a form, so we’ll just use our main form for this. Notice the Implements MiDrawObj statement towards the top of the code. As a result of this statement, you will be required to fill in a MiDrawObj_Draw subroutine. We’ll get to that soon.
3.
This project uses a MiCoordinator as well as a MiImageConnection. These are declared at the top, allocated in Form_Load, and released in Form_Unload.
4.
We also need a place to temporally stash a MiCycleReport, so we declare a variable of that type called saveReport. It will be set in the OnNewRecord event handler. It needs to be released in Form_Unload.
5.
For this example, we will need to define a font, so we declare a new StdFont called myFont. In Form_Load, we set the font’s Name and Size.
6.
The MiCoordinator has a list of devices on the network. Although the device we’re interested in may already be in the list, it also may not yet be discovered. To avoid unnecessary complication, we start off by clearing this list in Form_Load by calling the ClearDevices method. This ensures that, as each device is discovered, we will get an OnDeviceDiscovered event. In the OnDeviceDiscovered event handler, we check to see if the name of the device just discovered matches the one we’re looking for and, if so, calls
Rev 2.4.1, Nov 2008
HawkEye 1500 Reference & Programmers Manual
2-23
Page 242
Chapter
2
ReadRunner Programming Reference
DeviceFocusSet with the device name. This, in turn, will cause our ImageConnection to connect.
2-24
7.
In the OnNewRecord event handler, we call the MiImageView1.NewRecord method to show the image as normal. We will also stash away a reference to the MiCycleReport by setting our saveReport variable to it.
8.
To make the MiImageView control aware that we want to overlay our own graphics, notice the line MiImageView1.DrawObjAdd Me, “overlay” in Form_Load. This instructs the MiImageView control that we are adding a custom drawing object, which happens to be this form (using the VB keyword ”Me”). The second parameter is a symbolic name given to the drawing object, which you will need if you want to be able to remove it later. You can call it anything you want, so here we’re calling it “overlay”.
9.
The Implements MiDrawObj statement at the beginning means we are now required to implement the MiDrawObj_Draw method. This method will get called every time the MiImageDisplay is updated. The parameter supplied to the method gives us a very useful object of type MiDC. This object provides methods for drawing lines, rectangles, ellipses, and text. You can set pen styles, fonts, etc. And, most importantly, it scales all graphics for you so you just draw in image coordinates. In this example, a crosshair is drawn and text string is displayed with the decode string and some counters.
HawkEye 1500 Reference & Programmers Manual
Rev 2.4.1, Nov
Page 243
Example 6, Custom ROI
Example 6, Custom ROI This example illustrates how to set and change the ROI. Before you run the example, you need to make sure that the HawkEye™ 1500 is in Continuous Trigger mode (i.e., TRIG C) and decoding a Data Matrix. Here are the descriptions of this example: •
Establish a connection to a HawkEye™ 1500.
•
Display images.
•
Display number of reads per minute.
•
Use a checkbox control to enable or disable the custom ROI box display in the image.
•
When the custom ROI is displayed in the image, grab the corner or handle of the ROI and resize it. You can also drag and reposition the ROI by grabbing it anywhere inside the ROI box.
In the sample code: 1.
Include the class module SearchArea that implements the MiDrawHandles interface to make custom graphics “dragable” and the MiDrawObj interface to draw custom graphics in MiImageView.
2.
Select the CameraDropdown component and place it across the top of the form.
3.
Add a label on the form and use it to display the number of reads per minute using the ReadsPerMin property of MiCycleReport.
4.
Select a Checkbox control and place it on the form. Implement the Click event such that when the checkbox is checked, the custom ROI is displayed and can be resized and dragable.
5.
Select the Imageview component and position it on the form.
Figure 2–1 shows a dragable ROI with four green handles that is displayed when the ROI checkbox is checked.
Rev 2.4.1, Nov 2008
HawkEye 1500 Reference & Programmers Manual
2-25
ReadRunner Programming
2
Page 244
Chapter
2
ReadRunner Programming Reference
FIGURE 2–1. Draggable ROI with Four Green Handles
2-26
HawkEye 1500 Reference & Programmers Manual
Rev 2.4.1, Nov
Page 245
Example 7, Verification Report
Example 7, Verification Report
•
Establish a connection to a HawkEye™ 1500.
•
Display images.
•
Display Verification Report.
In the sample code: 1.
Select the CameraDropdown component and place it across the top of the form.
2.
Select the Imageview component and position it on the form.
3.
Select the VerifyReportGrid component and position it on the form.
4.
In the OnNewRecord event of the ReportConnection object, invoke the NewRecord method of the VerifyReportGrid object to display the verification report.
Figure 2–2 shows the verification report being displayed.
Rev 2.4.1, Nov 2008
HawkEye 1500 Reference & Programmers Manual
2-27
2 ReadRunner Programming
This example illustrates how to display the verification report. Before you run the example, you need to make sure that the HawkEye™ 1500 is in Continuous Trigger mode (i.e., TRIG C) reading a Data Matrix and the AIM (ISO 16022) verification is enabled. Here are the descriptions of this example:
Page 246
Chapter
2
ReadRunner Programming Reference
FIGURE 2–2. Verification Report
2-28
HawkEye 1500 Reference & Programmers Manual
Rev 2.4.1, Nov
Page 247
Example 8, Verification Data
Example 8, Verification Data
•
Establish a connection to a HawkEye™ 1500.
•
Display images.
•
Display verification data.
In the sample code: 1.
Select the CameraDropdown component and place it across the top of the form.
2.
Select the Imageview component and position it on the form.
3.
Add labels and text boxes for displaying Current Status, Error message, Total Count, Good Count, Fair Count, and Poor Count.
4.
In the OnNewRecord event of the ReportConnection object, get the verification data from the VerifyReport property of the MiCycleReport object.
Figure 2–3 shows the verification data being displayed.
Rev 2.4.1, Nov 2008
HawkEye 1500 Reference & Programmers Manual
2-29
2 ReadRunner Programming
This example illustrates how to display the verification data such as verification status, counters for total, good, fair, and poor. Before you run the example, you need to make sure that the HawkEye™ 1500 is in Continuous Trigger mode (i.e., TRIG C) reading a Data Matrix and the AIM (ISO 16022) verification is enabled. Here are the descriptions of this example:
Page 248
Chapter
2
ReadRunner Programming Reference
FIGURE 2–3. Verification Data
2-30
HawkEye 1500 Reference & Programmers Manual
Rev 2.4.1, Nov
Page 249
Example 9, TCP Socket Communication
Example 9, TCP Socket Communication
Before you run the example, you need to make sure that the HawkEye™ 1500 is in Continuous Trigger mode (i.e., TRIG C) reading a Data Matrix. Here are the descriptions of this example: •
In Remote Host Information frame, specify the IP Address of the HawkEye™ 1500 camera.
•
Set Port Number to be 40495 (command port).
•
Click the button Connect To Server and ensure Connected To Server status is shown.
•
Type the command VER in the Data to Send to Server box, then press Send. Observe the reply from the camera consisting of Time Stamp and version numbers shown below the TimeStamp: + Data Received from Server box.
•
Click the button Disconnect from Server, then change the Port Number to 49098.
•
Click the button Connect To Server and ensure Connected To Server status is shown. Observe the decoded data sent from the camera shown below the TimeStamp: + Data Received from Server box.
In the sample code: 1.
Select the Winsock control and place it on the form.
2.
Create the Remote Host Information frame add two text boxes for remote host name or IP Address and remote port number. Add a label to show connection status. Add a button for Connect To Server.
3.
Add a text box for typing in the command (Data to Send to Server) and a corresponding button Send.
4.
Add a text box for displaying the data received from the camera.
Rev 2.4.1, Nov 2008
HawkEye 1500 Reference & Programmers Manual
2-31
2 ReadRunner Programming
This example illustrates how to communicate with the HawkEye™ 1500 from a custom VB program. The VB program uses the Winsock control running as a TCP client communicating with the camera as a TCP server. The command port 49095 allows commands to be issued to the camera and replies to be seen. Note that the reply window prepends a timestamp on the message and that multiline replies zip by quickly. Ports 49098, 49099, 49100, and 49101 map to TCP1 through TCP4, respectively, from the “Output Settings...” dialog in ReadRunner.
Page 250
Chapter
2
ReadRunner Programming Reference
5.
In the Click event of the Connect To Server button, call the Connect subroutine which uses the Connect method of the Winsock control to connect the remote server using the host name and port number entered by the user.
6.
Use the Winsock Connect event to display the Connection Status, which is “Connected to Server”.
7.
Use the Winsock SendData method to send the command.
8.
Use the Winsock DataArrival event and GetData method to receive the data from the camera.
Figure 2–4 shows the communication between the TCP/IP Client and the camera. FIGURE 2–4. Communication Between TCP/IP Client & the Camera
2-32
HawkEye 1500 Reference & Programmers Manual
Rev 2.4.1, Nov