The online racing simulator
Searching in All forums
(4 results)
korrea
S2 licensed
Hi!

I've got one problem with InSinDotNET. I'm only using Outgage. I open the connection, subscribe to event and it work OK. But, the properties: engineOilPressure, engineOilTemp and engineWaterTemp is always = 0.0

Is it a bug?? Or something is wrong in my code??

Thanks in advance!
korrea
S2 licensed
DarkTimes, you are right! With

outsim = new OutSim();

it's work perfect! I don't know what I was doing...

Thank you very much!.
korrea
S2 licensed
Hi DarkTimes. Here is my code:

MainLoop Code:

void mainLoop()
{
testlfs.LFS testfls = new LFS();
float pitch = 0;
while (true)
{
if (!testfls.IsConnected)
testfls.Connect();
else
pitch = testfls.pitch;

System.Threading.Thread.Sleep(20);
}
}

LFS Class:


class LFS
{
private OutSim outsim;
public bool IsConnected = false;
public float pitch = 0;

public LFS()
{
outsim = new OutSim(1);
outsim.PacketReceived += new EventHandler<OutSimEventArgs>(outsim_PacketReceived);
}

public void Connect()
{
if (!outsim.IsConnected)
{
outsim.Connect("127.0.0.1", 29999);
this.IsConnected = true;
}
}

void outsim_PacketReceived(object sender, OutSimEventArgs e)
{
this.pitch = e.Pitch;
}
}

If I run this program with LFS, all works perfect. But if I start this program without LFS and, I run LFS, it never launch outsim_PacketReceived, I must stop and run the program. I need do this automatically.

Thanks for your response!
korrea
S2 licensed
Hi. I've got one problem with InSim.NET library. (I think is my bad, but I would like ask you...)

I would like to make an application for LFS with .NET. I do the next:

- Declare outsim/outgage variables
- Initialize variables
- Subscribe to outsim_PacketReceived event
- Enter in a loop:
- is outsim disconnect? (no)-> Connect to outsim
- get all variable set in outsim_PacketReceived event

But there is a problem with the loop. The IsConnected property is lying me, is not connected but the value is true! If I close connection and try to reconnect, I'm getting a exception... And I don't know what can I do here¿?

Sorry for my bad english, the question is simply, what is the operation for get an application is connected to outsim automatically?

Thank you!
FGED GREDG RDFGDR GSFDG