'Execute program when device is connected
I have been tasked to make a program that takes a screenshot of our cameras (and other things) that are attached to our cars, every 10 minutes. I have essentially made the program, but they want the program to only execute, once the camera is attached. The camera is being connected to a computer via. ethernet and have a static ip address of 172.31.44.1. I've been thinking about pinging the camera and then run everything afterwards. The thing is, if the camera is being disconnected, then I want the program to not exit, but just stop and then go again, if the camera is being connected again.
The code that's being run is this:
do
{
WindowState.GetWindowState();
_captureScreen();
Console.WriteLine($"Screenshot was taken at {DateTime.Now.TimeOfDay}");
Thread.Sleep(10 * 60 * 1000);
} while (true);
What would be the best solution? An event that's being triggered? A ping of the camera? Perhaps a Windows Event?
Thanks in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
