-
Notifications
You must be signed in to change notification settings - Fork 0
Camera Program Structure
Currently the software is in a prototype state. It is fully functional for the core, but is not ideal in that it is using system() calls to run other utilities. This is going to be corrected one day as slowly more features depend on having fine grain control. Also, it will most likely be broken up into seperate files as the system calls are removed
When the PI first boots, it should run this program. This gets the video stream ready and available and it starts waiting for the Admin to poll using UDP broadcast. Until the admin sends out the packet, we do not know what IP the admin is at. This is why we must wait, to get the packet and see where the source address was. When we find out, we move to connecting to the admin and reporting in. This puts us in a global list of connected devices.
The core of this software is to send a video preview and to take pictures. By default there is a thread running the video stream that is available to view on port 63136. In the main thread, we are waiting for connections on a socket. This socket is how we recieve instructions from the admin. The admin will translate page load requests from the user, such as /capturePicture and the admin will iterate through the Pis and send the IMAGE TAKE command in the header.
After recieving the command to take the picture, the video stream is stopped so that we may take control of the camera in still picture mode. We take the picture and put it into the image name output.png(subject to change with different encodings) and then restart the video stream. The still is taken after a short delay, as the camera takes time to 'warm up' and have the color become correct. After the video stream is restarted, a new connection from us to the admin is made and we send the image back.
Command | Type | Description ---- | ---- IMAGE TAKE | TCP | Take an image and then send it back to the admin UPDATE | TCP | Try to pull the update from the internet, compile, reboot REBOOT | TCP | Reboot the PI ADMIN ANNOUNCE | UDP | Report back to the admin that we are alive (heart beat) IMAGE CAPTURE | UDP | Take an image and add it to the queue to be send back to the admin