Jump to content
The simFlight Network Forums

cknipe

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by cknipe

  1. Hi, Well, now that I finally managed to get reading offsets in my think skull, I have to say that it is actually remarkably quick and easy, well done Pete and everyone else working on WideFS / FSUIPC :D I have to agree with Pete though, there are in some cases, some REALLY strange things with VB.NET (my Language of choice), but learning a new language now, is not something that I'm up to... Who knows, maybe next year... Anways, I'm trying to write to a offset now. I've choosen a VERY simple one to start off with (0262 - Pause Control). According to the docs, write 1 to Pause, 0 to Resume. Ok. I figured, that's easy enough.... To do this, I've used just about the same code as I use to read offsets (which, is working relatively well), and simply removed my _get, andchanged the _read to _write - ok, a bit more tweaking more than likely, but this is what I have right now: Public Function FSUIPC_0262(ByVal PauseGame As Boolean) As Boolean Dim dwOffset As Integer = &H262 ' We want to write to 0262 Dim dwSize As Integer = 2 ' Which, is 2 Bytes Dim dwToken As Integer = 0 Dim dwResult As Integer = 0 ' Open a link to FSUIPC. ' BTW - Pete, is it better to open a connection and leave it open ' or to open / close to FSUIPC at every call? If myFSUIPC.FSUIPC_Open(7, dwResult) Then ' For the faint hearted and if there is ever something wrong with ' Pete's code, let's do Exception Handling. Try ' Here, we are trying to write to FSUIPC. Because 0262 expects ' a Integer and not a Boolean, we do some magic here. If PauseGame = True Then ' We want to Pause the Simulator, write 1 to 0262. myFSUIPC.FSUIPC_Write(dwOffset, 1, dwToken, dwResult) Else ' Otherwise, Resume the Similator, write 0 to 0262 myFSUIPC.FSUIPC_Write(dwOffset, 0, dwToken, dwResult) End If Catch e As Exception ' TODO: Exception Handling (dwResult) Finally ' After all the writing, let's process it. myFSUIPC.FSUIPC_Process(dwResult) End Try ' Close up the Connection myFSUIPC.FSUIPC_Close() Else ' Connection to Simulator Failed End If End Function Lots of comments added, to let Pete understand what's going on :D The end result, is that the simulator is not paused when called as FSUIPC_0262(True) dwResult returns 0 at both the Write call, as well as the Process call as well. So it definately is being written, and it is being processed - without errors. But alas, the Sim just won't pause? Thanks, Chris.
  2. Got GigaBit here on my board... Hardly makes a dfference. Being the network fundy that I am (What I'm actually good at :D), WideFS / FSUIPC doesn't even use 20kb/s (and I run FSRealTime, ASV, AISmooth, and a couple of other things via WideFS at the same time). A modem will be fast enough for FSUIPC / WideFS on the current source. Yes, it obviously depends on the amounts of read/writes... But yeah. I can honestly say I doubt that anything in the 'transport' layer will be a problem any time soon... -- Chris
  3. Hi Pete, Yes, the value is always 29. Regardles of what plane, regardless of what state the simulator is in. The same is also happening with offset 3364 (Simulator ready) - which, never returns the 0 state. I'm sure I'm doing something wrong here... The problem is what :D Just quickly in regards to your suggestions, questions and answers... 1) ReDim, reinitialise and changes the size of the variable. In the case below, I changed the length of the array 2) More than likely not yes. There is a function ToString which will convert it. That didn't work either however. 3) The unused String was just me testing... I originally had: If myFSUIPC.FSUIPC_Read(&H3D00, 256, FSAircraft, dwResult) Then But that didn't work either. It also returned 29 :cry: And yes, it returns '29'. Nothing more, nothing less. I'm not a VB.NET pro no. I'm merely trying to figure out at this stage how things work.... The below for example, works right when it returns the state the the simulater is not ready. It does not return correctly when the simulator is ready however... ' Is Simulation Ready? If myFSUIPC.FSUIPC_Read(&H3364, 1, dwBytes(1), dwResult) Then If myFSUIPC.FSUIPC_Process(dwResult) Then If dwBytes(1) = 0 Then Me.Label9.Text = "OK" SimulatorReady = True Else Me.Label9.Text = "NOK" SimulatorReady = False End If End If End If The question thus really is not a matter of 'why is this not working', but rather one of 'what am I doing wrong'. Guess someone that knows VB.NET would have to jump in here... -- Chris.
  4. Hi, I'm having problems reading strings from FSUIPC... ' Aircraft Type Dim FSAircraft As String ReDim dwBytes(256) If myFSUIPC.FSUIPC_Read(&H3D00, 256, dwBytes(256), dwResult) Then If myFSUIPC.FSUIPC_Process(dwResult) Then MsgBox(dwBytes(256)) End If End If Am I going about this the wrong way??? The return value is always 29... I'm also using something similar to detect whether the simulator is ready. Again, is always returns non zero (Never ready), even when I'm flying :?:
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.