Touseefelahi / GigeVision

Simple GigeVision implementation, GVSP, GVCP protocol implemented
104 stars 32 forks source link

.net 5.0 suport #55

Closed YorkWong1995 closed 2 years ago

YorkWong1995 commented 2 years ago

I'm trying to run this project in .net 5.0 environment.
I reset master to SHA-1: 7ceeda21e49321d81399ec9e73efc7294d729f2d But still failed. Error info shows:

Could not find resource named 'BaseStyle'. Resource names are case-sensitive. The name 'LightImage2' does not exist in the namespace 'clr-namespace:GigeVisionLibrary.Test.Wpf'. Could not find metadata file "D:\SDK\GigeVision\GigeVision.Core\bin\Debug\net5.0\GigeVision.Core.dll" Project Gige.DeviceControl.Wpf is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Project Gige.DeviceControl.Wpf Support: net5.0-windows7.0 (.NETCoreApp,Version=v5.0) GigeVision.WpfTests Project "..\DeviceControl.Wpf\DeviceControl.Wpf.csproj" points to "net5.0-windows". It cannot be referenced by a project pointing to ".NETCoreApp,Version=v5.0" The project "..\GigeVision.Core\GigeVision.Core.csproj" points to "net5.0". It cannot be referenced by a project pointing to ".NETFramework,Version=v4.7.2".

hope your help, thank in advance

Touseefelahi commented 2 years ago

If you want to run on net5 just use the latest commit and change net6 to 5 in project file.

Ignore anything related to device control (if any).

Let me know if you still have any issue

YorkWong1995 commented 2 years ago

I used the latest commit and change net6 to 5 in project file: I used net5.0-windows or net5.0 instead of net6.0-windows or net6.0 in every .csproj file.

but it seems do not work. I also changed the genlcam version, because of the lastest version must use .net 6.0

but it will lead to can not find IPort when build GigeVision.Core

I have read readme.md but i still confused how to use this package.

Is there any ways that i can just use this Nuget package and get steam raw data?

Touseefelahi commented 2 years ago

I am not sure what would be the problem in your case

Yes, you can use the NuGet package for .net5 https://www.nuget.org/packages/GigeVision.Core/2.1.0

Touseefelahi commented 2 years ago

In the mean time I will check the issue that you mentioned

YorkWong1995 commented 2 years ago

Thanks a lot. I am using GigeVision.Core 2.1.0 now.

And i trying to write a demo to call the StartStreamAsync api with specific rxIP. And it shows some exception like below:

when i run the demo, shows: "System.ObjectDisposedException" (in System.Net.Sockets.dll) “System.ObjectDisposedException” (in System.Private.CoreLib.dll )

when i trigger the StartStreamAsync api, it shows rise exception :“GigeVision.Core.Exceptions.InvalidIpException”(in GigeVision.Core.dll)

Do you have any idea why it happens because i used a specific IP but it raise Exception says it is invalid

Touseefelahi commented 2 years ago

Can you specify your IP? It seems like the IP is not valid, and start the stream by passing your Computer IP as a parameter

As mentioned in the readme //For multiple interfaces you can define the Rx IP as: (In this example 192.168.10.221 is the PC IP)
bool isStarted = await camera.StartStreamAsync("192.168.10.221").ConfigureAwait(false);

YorkWong1995 commented 2 years ago

I am use the code below: string rxip = "172.16.40.11 "; bool rst = await camera.StartStreamAsync(rxip).ConfigureAwait(false);

I tried to specify rxip with PC IP and camera IP, both failed

Touseefelahi commented 2 years ago

Can you check again? In debug mode and post the error here (if any)

YorkWong1995 commented 2 years ago

Thanks a lot. I used the latest commit SHA-1: 7b5960d5eeae2ab72ef3d937c3cadd861d337bdc I delete .net 6.0 part and use x64 to build the project. And i success to run the GigeLibrary.Test.Wpf. Thanks again.

when i call the StartStreamAsync Api, it raised exception in Line 314 ((await gevSCPHostPort.SetValueAsync((uint)PortRx).ConfigureAwait(false) as GvcpReply).Status the exception says "Object reference not set to an instance of an object." After debug find var gevSCPHostPort = (await Gvcp.GetRegister(nameof(GvcpRegister.GevSCPHostPort))).pValue; returns null so the gevSCPHostPort is null I will comment later if i found reason Thanks thousand times

Touseefelahi commented 2 years ago

@YorkWong1995 Yes I noticed there's an issue. I will check it and update the branch No, actually it is fine, the issue in my case was Windows Security to allow private/public network access. We must enable to receive the stream

image

Touseefelahi commented 2 years ago

@YorkWong1995 what is RxPort value you are setting?

YorkWong1995 commented 2 years ago

I do not set RxPort, use default port, which is ramdom between 5000 and 6000.

I do not receive the security alert.

Touseefelahi commented 2 years ago

Install wireshark software and check the status of each command, it may give us some clue.

YorkWong1995 commented 2 years ago

I shut down the firewall but do not work. I will use wireshark to check this issue

YorkWong1995 commented 2 years ago

I checked xml get from camera. there is no name="GevSCPHostPort", name="GevSCDA" so var gevSCPHostPort = (await Gvcp.GetRegister(nameof(GvcpRegister.GevSCPHostPort))).pValue;
GetRegisterByName() can't get gevSCPHostPort

Touseefelahi commented 2 years ago

So I guess the camera that you have is not following standard naming convention. Can you share the xml here so that I can check if it can be solved by only changing the name of registers

Touseefelahi commented 2 years ago

It is also possible that the camera is following old standard. In this case we need to modify the register names. Or in worst case scenario, we can send the commands manullay using the resigter address. You can read the Readme file to know how to send read/write command using register address.

YorkWong1995 commented 2 years ago

camera.zip xml can't be uploaded, so i zipped it. I tried to search gevSCPHostPort register address, "0x0D00", in xml file, but still not found. so, i thought it may not contain this register value i am trying to write it manully

YorkWong1995 commented 2 years ago

~~i used the function in readme to send write command to write register.but reply status is GEV_STATUS_ACCESS_DENIED . Should i raise the priority or just because of the camera permission issue which i can not solve?~~

I have solved this problem, thanks a lot.

Touseefelahi commented 2 years ago

~~i used the function in readme to send write command to write register.but reply status is GEV_STATUS_ACCESS_DENIED .

Should i raise the priority or just because of the camera permission issue which i can not solve?~~

I have solved this problem, thanks a lot.

Great 👍 basically you need to get the control first. I'll update the Readme