michielsweb Posted February 17, 2020 Report Share Posted February 17, 2020 (edited) Dear sir. i was wondering if u can make a simple "working" download? automatic connect. - fsuipc offset read. - fsuipc offset write - pdmg read or any other lvar read - pdmg write or any other lvar write this allow it easier to tingle whit the code. i been trying to get ure template going but it loads emptie. i have experience whit this way from polabs pokeys c# demo. this way u can simple copy edit in the program 🙂 Edited February 17, 2020 by michielsweb Link to comment Share on other sites More sharing options...
Paul Henty Posted February 17, 2020 Report Share Posted February 17, 2020 Quote i was wondering if u can make a simple "working" download? I would rather not. I have already spent many months writing extensive example code and application templates. It's all available here: http://fsuipc.paulhenty.com/#downloads The example application contains all the examples you ask for. Quote i been trying to get ure template going but it loads emptie. When you make a new project from a template there will be no documents open. You need to select something from the solution explorer. Or is your solution explorer also empty? Paul Link to comment Share on other sites More sharing options...
michielsweb Posted February 17, 2020 Author Report Share Posted February 17, 2020 (edited) solution explorer is also empty yes ! if u can help me get it open. i can figure the rest out 🙂 and ofcourse i understand ure point about the question 🙂 i respect that. friendly regards michiel Edited February 17, 2020 by michielsweb Link to comment Share on other sites More sharing options...
michielsweb Posted February 17, 2020 Author Report Share Posted February 17, 2020 sorry paul i got it opend 🙂 was my mistake Link to comment Share on other sites More sharing options...
Paul Henty Posted February 17, 2020 Report Share Posted February 17, 2020 Great, I'm glad you got it working. I'm here if you need help in the future, Paul Link to comment Share on other sites More sharing options...
michielsweb Posted February 17, 2020 Author Report Share Posted February 17, 2020 Sorry paul i feel such a idiot 🙂 trying to get some offsets loaded in a c# running into a few questions 🙂 FSUIPCConnection.ReadLVar("Engine1ThrottlePosition").ToString("F2"); is the F2 just a random name u picked? to create a string for anything good aslong as its unique? and this question: 3367 1 This byte shows doors that are open, one bit per door: 2^0 = Exit1 ... 2^3 = Exit 4. N.B. FSUIPC4 does handle up to 8 doors, one for each bit 0-7. Whether FSX can actually process Exits 5-8 is unknown however. would i be correct this is the way to handle this private offset<byte> MainEntry = new Offset<byte>(2^03367); sorry i am new to bytes. trying to get a basic understanding for a simple if else loop 🙂 Link to comment Share on other sites More sharing options...
Paul Henty Posted February 17, 2020 Report Share Posted February 17, 2020 Quote is the F2 just a random name u picked? to create a string for anything good aslong as its unique? It's not a name, it tells the ToString() method to format the string. "F2" means format this as a floating point number with 2 decimal places. F4 will give you 4 decimal places etc. There are other formatting options which you can see in the normal Microsoft documentation for Double.ToString(). Quote would i be correct this is the way to handle this private offset<byte> MainEntry = new Offset<byte>(2^03367); Mostly offsets store numbers (values) or strings. However there are a few like 0x3367 that use the individual bits (there are 8 bits in each byte) for different functions. In this case each door is represented by a different 'bit'. (A bit can either be 0 (closed) or 1 (open)). The DLL has an easy way of dealing with these types of 'bitwise' offsets. The offset just needs to be declared as a BitArray. The ExampleCode application has a section explaining how to declare and use BitArray offsets. See "AC002_BitArrays" under "Advanced Concepts". The example is for the lights offset, but the doors work the same way. Just remember that 0x3367 is only 1 byte long. The lights offset (0x0D0C) in the example is 2 bytes. You'll need to specify the length when you declare the offset. Paul Link to comment Share on other sites More sharing options...
michielsweb Posted February 17, 2020 Author Report Share Posted February 17, 2020 Thank you kind sir. for youre patience and kind help!! in learning this stuf!! 🙂 Link to comment Share on other sites More sharing options...
michielsweb Posted February 17, 2020 Author Report Share Posted February 17, 2020 sorry last question. private Offset<byte> maincabindoor = new Offset<byte>(0x6C14); its a 1 byte boolean (simple check if door is open or not) i have been trying to "read the value" of this byte . tried convert it bool int string. bool result = Convert.ToBoolean(maincabindoor); this is the only code i have working sofar where the program wil launch. but it crashes because fsuipc says its inconvertblehow can i extract or check the value of maincabindoor? Link to comment Share on other sites More sharing options...
Paul Henty Posted February 18, 2020 Report Share Posted February 18, 2020 If you want to convert it, you need to convert the Value of the offset, rather than the Offset itself: bool result = Convert.ToBoolean(maincabindoor.Value); However, you don't have to convert it - you can just test the value being 1 or 0: if (maincabindoor.Value == 1) { // Door is open } else { // Door is closed } Or maybe do something like this to get a string you can display: string mainDoorState = maincabindoor.Value == 1 ? "Open" : "Closed"; Depends on what you want to do with it. Paul 1 Link to comment Share on other sites More sharing options...
michielsweb Posted February 18, 2020 Author Report Share Posted February 18, 2020 wow paul how one capital can pain in the arse 🙂 value i typed like a milion times last night 🙂 ps: if a offset is not in the offset list. i have to read the lvars right? seeking offset for pdmg " chocks" and several for GSX but i reckon this wil be lvar reading am i correct? Link to comment Share on other sites More sharing options...
michielsweb Posted February 18, 2020 Author Report Share Posted February 18, 2020 yesss 🙂 i got the lvars working from GSX 🙂 now i go search some lvars from the pdmg 🙂 then i have GSX and doors " crew controlled " 1 Link to comment Share on other sites More sharing options...
michielsweb Posted February 18, 2020 Author Report Share Posted February 18, 2020 Sorry I am back 🙂 FSUIPCConnection.WriteLVar("L:FSDT_GSX_BOARDING_STATE", 2); //opening the pdmg 737 doors for gsx FSUIPCConnection.WriteLVar("EVT_DOOR_AFT_L", 1); now i know for sure GSX is correct as i use it in reading it too. but i cant write too it it seem can u advise me if i do something wrong Link to comment Share on other sites More sharing options...
Paul Henty Posted February 18, 2020 Report Share Posted February 18, 2020 Your code looks fine, however I can't advise on how to use the GSX LVars as I don't have this product. Maybe you're writing the wrong values, or maybe these variables are read-only. Do you have any documentation for this? You'll probably need to ask on GSX support forums if they have them, or ask them directly. Paul Link to comment Share on other sites More sharing options...
michielsweb Posted February 18, 2020 Author Report Share Posted February 18, 2020 little update: okay i totaly failed sofar on the lvar writing. to gsx luckily i can read gsx lvars. pdmg lvars i completly can read or write. sofar i managed work around whit offsets 😄 stil working on controlling the PDMG737 6 doors. (so "cabin crew can do their duties and controll them after captain gave permission. ;-))Running first Sound Tests and "timing work" (so the requirements are pretty spot on. just need little tinkering. trying to figure out if i can read the "fmc destination airport and alternate airport" for some extra functions Link to comment Share on other sites More sharing options...
michielsweb Posted February 18, 2020 Author Report Share Posted February 18, 2020 scratch doors from list 🙂 little work around but coding it in c now 🙂 Link to comment Share on other sites More sharing options...
Paul Henty Posted February 18, 2020 Report Share Posted February 18, 2020 Quote pdmg lvars i completly can read or write. sofar i managed work around whit offsets You should always use offsets if you can. Reading LVars is very slow compared to using offsets. Only use LVars as a last resort, when there are no offsets or controls (events). Quote stil working on controlling the PDMG737 6 doors. I think you can control the door using the PMDG custom controls (events). Send events using FSUIPCConnection.SendControlToFS(). There is an enum for the PMDG controls to make this easy. I think this might work: FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_DOOR_FWD_L, 1); I'm not sure of the parameter though (I don't use PMDG). It might be 1 = open, 0 = Closed. Or the parameter maybe ignored and the door just toggles whenever you send the control. You can test this out for yourself. The enum PMDG_737_MGX_Control contains the other door commands which you will see on the popup when you type the "." after it. Quote trying to figure out if i can read the "fmc destination airport and alternate airport" I can't see any way to do this. If the PMDG aircraft loads a flight plan into the FlightSim you might be able to get the destination airport from offset 0x6137. Declare as a string of length 5. Paul 1 Link to comment Share on other sites More sharing options...
michielsweb Posted February 18, 2020 Author Report Share Posted February 18, 2020 FSUIPCConnection.SendKeyToFS(Keys.F12, SendModifierKeys.Control, null); i have the same issue whit both options they seem to be in a endless extreme speed loop. whit the bottom case being the right code to open and shut. FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_DOOR_FWD_L, 1); Link to comment Share on other sites More sharing options...
Paul Henty Posted February 18, 2020 Report Share Posted February 18, 2020 It sounds like you've put this in the timer loop of the template you used. The timer method gets called a few times per second (maybe 20 I can't remember exactly). This is good if you're trying to get data in real time, but it doesn't make sense to put door commands here. You need to organise the code so that the appropriate things and in the timer loop and other things are outside. For example, maybe you want the doors opening on a button press. So you'll need to make a button and put the code on the click event. It might be that your application doesn't even need a timer, but I don't know the details of what you're trying to do here. Paul Link to comment Share on other sites More sharing options...
michielsweb Posted February 19, 2020 Author Report Share Posted February 19, 2020 oh fair point paul. good thinking 🙂 i go work on it Link to comment Share on other sites More sharing options...
michielsweb Posted February 19, 2020 Author Report Share Posted February 19, 2020 this seemed fix it: PERFORM ACTION WANTED. stop both timers and start first timer again 😄 incorrect did not work 😛 Link to comment Share on other sites More sharing options...
Paul Henty Posted February 19, 2020 Report Share Posted February 19, 2020 No, that's worse. That's an infinite loop that will run run as fast as possible. It will also block any user input to the application. It looks like you need to learn the basics of writing applications in C#. (That's really beyond the scope of what I can support here). Quote or do i realy need the timer things? I don't know what you want the application to do, so I don't really know if you need a timer or not. Generally you need a timer if you want the application to run automatically without user input, or if you want to display data in real time. For example, if you want your application to open and close doors automatically then you need a timer. If you want to display the state of the doors to the user in real time then you also need a timer. Note that if you're using the automatic connection template there are two timers. One of them tries to make connections to FSUIPC when the app is disconnected. This is required if you want an automatic connection. If you can describe what your app should do I might be able to give some general advice about how to structure the program. Paul Link to comment Share on other sites More sharing options...
michielsweb Posted February 19, 2020 Author Report Share Posted February 19, 2020 i managed to get it working 🙂 i was making the mistake 🙂 to rerun "main" before the ifs where completed 🙂 i added alot of extra "requirements and slowly it start respond in a order now 🙂 Link to comment Share on other sites More sharing options...
michielsweb Posted February 19, 2020 Author Report Share Posted February 19, 2020 trick is load the data in the top stop the timers. and restart them after the codes. and by adding between variables. like "boarding = 1; i stop the main boarding start proces. on repeat i apriciate this help i already put credits in the program 🙂 as i wil freely make it public . upon completion. lightweight opensource CABINCREW / GroundCrew. which runs from outside sim 🙂 Link to comment Share on other sites More sharing options...
michielsweb Posted February 19, 2020 Author Report Share Posted February 19, 2020 i programmed most already including sounds playing on right time. currently i am implenting the actions the cabin/ground crew should do. on the right timings and commands. small example 🙂 fases 0 upon loading aircraft. it wil automaticly start asking GSX for "make the plane connected whit stairs. aswel setting the "pdmg generator ready" it finishes by telling the captain "ground crew is live and connected. fase 1: Captain gives permision to board. (here is the fun thing!! this is 1 of 3 times u need to actualy push a button 🙂) open the main door. Ground and cabin wil do the other doors automaticly. while this is going u can hear the boarding process. fase 1.1 Cabin/Ground wil listen to GSX when to open and close the doors. aswel as catering and fuel is implented automaticly already through GSX fase 1.2 boarding is completed GroundCrew wil report boarding ready. Cabincrew wil report Cabin ready. (and make initial welcome announcement. Fase 2 Ground wil work whit the flightdeck to prepare for departure. i removed all nasty "ugly menus" by automate it. it wil only ask which way i want the push. fase 3 taxi + safety fase 4 is crew prepare for takeoff. all of this is done on aircraft, Gsx states and fsuipc offset states i am up to 12 stages 🙂 but u get the idea for now 😄 oh and yes cabin sounds are able to "make ure own " Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now