Skip to content

Conversation

@cal-pratt
Copy link
Contributor

@cal-pratt cal-pratt commented May 3, 2017

This PR adds the ability to close and reopen views from the main view panel. This change also allows the user to restart the video feed from the main view.

Updates had to be made to the VideoDecoder class in order for this to work (There was a bug waiting for sockets to close, meaning this fixes #279 )

The view launcher class is created in the init and passed to the viewloader as an argument. Later when the stage is started, the launcher is passed the viewloader and creates the main stage.

@cal-pratt
Copy link
Contributor Author

Just made a lot of changes to this PR.

Firstly I removed the Unix process class completely. It was way to hard to properly manage the lifecycle of an application in java, so instead I created a systemd service for the camera feed. The PiCamera class now only has to hook into the service in order to control the camera. This removes the possibility of opening two instances of the camera feed at once and simplifies the code greatly.

In order to pass command line arguments to the service I made the main eer.service create a runtime directory /run/eer. Before the java code calls the systemd service a file called /run/eer/camera-environment is created with the arguments. Systemd parses these arguments and sends them to the program on startup.

The pid is also no longer required because we can now just reference the systemd service. Flipping the service can be performed by writing systemctl kill eer-camera.service --signal=SIGUSR1


[Service]
EnvironmentFile=/run/eer/camera-environment
ExecStart=/usr/bin/eer-camera-feed $host $port No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no newline here

process = UnixProcess.start("eer-camera", host, String.valueOf(port));
private static final Runtime RUNTIME = Runtime.getRuntime();

private static final String SERVICE = "eer-camera.service";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you config-ified this and the constructer arg at line 35 you could almost make this generic for managing any service. Probably not necessary for us now tho

Copy link
Contributor

@ConnorWhalen ConnorWhalen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good besides that one missing newline

@cal-pratt cal-pratt merged commit be2fac7 into master May 4, 2017
@cal-pratt cal-pratt deleted the reopen-views branch May 4, 2017 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rov class hangs on shutdown from exception

3 participants