blt950 / vPilot-Pushover

Plugin for vPilot to Pushover vPilot and Hoppie messages
GNU General Public License v3.0
13 stars 5 forks source link

Detect possible sim crash #12

Open RAZERZ opened 8 months ago

RAZERZ commented 8 months ago

Currently there does not seem to be a way to detect sim crashes purely from the exceptions raised (there is no exception in the Ibroker for this, I have raised this in the vatsim forums: https://forum.vatsim.net/t/vpilot-plugin-simulator-crash-detected/4453).

What one could do instead is send a notification upon a dropped connection using the event handler NetworkDisconnected. This is opposed to RequestDisconnect, which is called when pressing the disconnect button in vPilot.

What might be considered is adding this as an option in the .ini file

Tested on Prepar3D v5 with vPilot version 3.7.0, no issues found

blt950 commented 7 months ago

Hi @RAZERZ, thanks for the PR. This would be an interesting feature indeed.

I had a test on vPilot v3.7.0 on MSFS and it's unfortunately sending the "possible sim crash" message when clicking disconnect in vPilot.

I see you earlier tested reading the crash message to push a notification based on that. Did that work out? It's a bit hacky, but at least the closest we get with the plugin interface provided.

So sad vPilot is also closed source so it's impossible to PR in some useful functionalities there as well...

RAZERZ commented 7 months ago

Yeah I realized that it triggers even after clicking disconnect. I misunderstood the difference between RequestDisconnect and NetworkDisconnected

Unfortunately from the initial testing, there did not seem to be some way to read the raw text outputted which is a shame. I tried a combination of the RadioMessage sections but they did not seem to send the welcome text you get on initial log on. Maybe a SimNotReadyException is thrown when the sim crashes, I could do some further testing on that and see if I end up somewhere.

Ross Carlsson is apparently not working on the plugin part of vPilot anymore and this exception may or may not be added in the future.

blt950 commented 7 months ago

Alright, worth to checj if maybe SimNotReadyException could do the trick.

Depending on how it works, but perhaps SimNotReadyException with an active plugin (callsign var is set) could indicate a crash.

RAZERZ commented 7 months ago

Good point, I'll delve into this and see what I find