LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

C# Wrapper Cognex Dataman 8000 Ethernet Connection

I need to Integrate Cognex Dataman Wireless Handheld scanner in to existing Application.
Cognex has provided SDK in C#.  Below SDK link

http://www.cognex.com/support/downloads/File.aspx?d=2628

 

I used CVI Tool .Net Controller to convert DLL in to instument which seems to works.

calling this .Net assemblies from Labwindows CVI. I used below link as reference.

http://zone.ni.com/reference/en-XX/help/370051T-01/cvi/libref/cvidotnet_sample_code/

 

Below is code that suppose to connect to cognex scanner.

/*
			Creates a new instance of the ethernet connector with the
			specified system IP address.

			-------------------- Prototype 
			int Cognex_DataMan_SDK_EthSystemConnector__Create
        	(Cognex_DataMan_SDK_EthSystemConnector *Instance_Handle,
         		System_Net_IPAddress address,
         		CDotNetHandle *Exception_Handle);

			System_Net_IPAddress IPAddress='{192.168.001.244}';

		 	---------------------
			*/
			Cognex_DataMan_SDK_EthSystemConnector__Create (&DM_Connector, IPAddress, 0);
			
			//Cognex_DataMan_SDK_EthSystemConnector__Create (&DM_Connector, 0, 0);
			Cognex_DataMan_SDK_EthSystemConnector_Set_UserName (DM_Connector,"Admin", 0);
			Cognex_DataMan_SDK_EthSystemConnector_Set_Password (DM_Connector, "", 0);
						 
			Cognex_DataMan_SDK_DataManSystem__Create (&DM_system, DM_Connector, 0);
			Cognex_DataMan_SDK_DataManSystem_Connect (DM_system, 0);
			

 


My problem is below line it's not taking ipaddress.

Cognex_DataMan_SDK_EthSystemConnector__Create (&DM_Connector, IPAddress, 0);

I have attached source code for LabWindows and sample application for C# which is working

 

 Please advise , I have no sucess so far with this

Download All
0 Kudos
Message 1 of 9
(11,985 Views)

How are you getting handling Cognex_DataMan_SDK_EthSystemConnector *Instance_Handle?

What you are you obtaining the Instance_Handle?

0 Kudos
Message 2 of 9
(11,975 Views)
Cognex_DataMan_SDK_ISystemConnector DM_Connector;
Cognex_DataMan_SDK_DataManSystem DM_system;
System_Net_IPAddress IPAddress="192.168.001.244";

 

It's define as gloabl.

0 Kudos
Message 3 of 9
(11,969 Views)

@aspireaccer wrote:
Cognex_DataMan_SDK_ISystemConnector DM_Connector;
Cognex_DataMan_SDK_DataManSystem DM_system;
System_Net_IPAddress IPAddress="192.168.001.244";

 

It's define as gloabl.


Yes, but it needs to be initialized with a value.

How are you going about obtaining a value for it?

 

I don't want to install the SDK on my work laptop, but if you could attach the C# .cs file, it may be useful.

Message 4 of 9
(11,955 Views)

Thank you so much for your time.

 

I have attached SDK documentation and also I have attached zip file of C# source code.

 

From Manual instructions.

 

Connect to your Ethernet device by performing the following steps:

1. Create a connector to your device:

EthSystemConnector myConn = new EthSystemConnector(deviceIP);

where deviceIp is either a known IP address or one that was discovered by an EthSystemDiscoverer.

2. Specify user name and password:

myConn.UserName = "admin"; myConn.Password = "password or empty string";

3. Create a new DataManSystem instance with the created connector:

DataManSystem mySystem = new DataManSystem(myConn);

4. Call the Connect() method of your DataManSystem instance:

mySystem.Connect();

5. (Optional) Verify if you are connected:

if (mySystem.IsConnected)

6. To disconnect, call

mySystem.Disconnect();

 

Download All
0 Kudos
Message 5 of 9
(11,947 Views)

I think I found problem but I still need to try and verify

 

I'm missing following. I need to do following convertion.

System.Net.IPAddress ipaddress = System.Net.IPAddress.Parse("192.168.1.244");
0 Kudos
Message 6 of 9
(11,941 Views)

What is YOUR code that you have written?

 

Edit:   192.168.1.244 string is being converted to Integer64 in that code snippet you posted.

 

 

0 Kudos
Message 7 of 9
(11,929 Views)

hi

my prject is the same as u but with labview 

i found a problem in connecting to the divice 

please help 

thx

Message 8 of 9
(7,601 Views)

Since this forum post is 4 years old and not related to LabVIEW, I would recommend starting a new thread with details about your specific issue so it can gain more visibility. I suggest including the details listed below:

 

1. What specific problem do you have connecting to the device?

2. What specific device are you using?

3. Have you installed the device drivers from IDNet?

4. How are you physically connecting to the device and does your computer recognize the instrument?

Applications Engineering
National Instruments
0 Kudos
Message 9 of 9
(7,589 Views)