I am trying to create a Diagnostic Service Request specifying only a PDU, and print back the corresponding qualifier of that service using the ToString function of the Request Class, on C# in Visual Studio. Both the Ecu class and the Request class are members of the Vector.Diagnostics assembly.
But I am confused about how one is supposed to use these classes.
Is it possible to create an object of the Ecu class,and create a new request with that object? I tried some code to do that, but it's simply showing errors or throwing a "NullReferenceException" during run-time.
Ecu New_Ecu = Vector.Diagnostics.Application.GetEcu("ECU6");
Request Sample = new New_Ecu.Request();
Sample = New_Ecu.CreateRequest(new byte[] { 0x10, 0x03 });
string Result = Sample.ToString();
Console.WriteLine(Result);
The errors are saying that Request class doesn't have a constructor. Why not? It's a class,ergo it must have a default constructor.
And if If I delete the second line, and make modifications to the third line as follows:
Request Sample = New_Ecu.CreateRequest(new byte[] { 0x10, 0x03 });
It's happy while I'm typing, but throws the above mentioned exception during run-time.
What is happening, and why?