Obtain and Modify IP Configuration
This topic introduces how to obtain and modify the current IP address, subnet mask, and gateway of the laser profiler with the modify_ip_configurations sample on Windows.
Please refer to Usage Guide for HALCON Samples to obtain the samples and check the prerequisites for using the samples. |
Select the Laser Profiler
Follow these steps to select the laser profiler whose IP configuration you want to obtain or modify.
-
Open the sample in HDevelop: Open HDevelop, and drag the sample into HDevelop.
-
Step over the program (click the
button in the toolbar repeatedly), until the Variable Inspect: MechEyeProfilerInfos window pops up.
-
This window displays all the available laser profilers. Double-click the laser profiler that you want to connect, and copy the name after unique_name: or user_name:.
user_name is the custom laser profiler name. You can customize the camera name in Mech-Eye Viewer. -
Locate the following line, and replace LNX with the copied unique_name or user_name.
DeviceInfo := 'LNX'
Obtain the IP Address, Subnet Mask and Gateway
Follow these steps to obtain the current IP address, subnet mask and gateway of the laser profiler:
Run the sample by clicking in the toolbar or pressing the F5 key. In the Control Variables area, check the following variables for the current IP address, subnet mask, and gateway of the laser profiler.
-
CurrentIPAddressString: IP address
-
CurrentSubnetMaskString: subnet mask
-
CurrentDefaultGatewayString: gateway
Set Static IP Address
This sample sets a static IP address by default. Follow these steps to modify the IP address, subnet mask and gateway of the laser profiler:
-
Click
in the toolbar to reset program execution.
-
Locate the following line, and change the IP address, subnet mask and gateway to the values to be set:
IPAddressString := '192.168.1.100' SubnetMaskString := '255.255.255.0' DefaultGatewayString := '192.168.1.1'
-
Run the sample by clicking
in the toolbar or pressing the F5 key.
-
Restart the laser profiler to make the new settings take effect.
Set Dynamic IP Address
Follow these steps to dynamically assign an IP address to the laser profiler:
-
Click
in the toolbar to reset program execution.
-
Locate the following line, and replace true with false.
set_framegrabber_param (AcqHandle, 'GevCurrentIPConfigurationPersistentIP', true)
-
Run the sample by clicking
in the toolbar or pressing the F5 key.
-
Restart the laser profiler to make the new settings take effect.
When the laser profiler is connected to the computer directly, the IP address of the laser profiler cannot be dynamically assigned. |