The basic block diagram of setup is as below:
So this contains two parts, one is authentication and second
is security.
Here is the flow chart of how security part works.
How to detect a fast motion, how to send an SMS in a C program are already explained in the given links.
Now, the question is how to do these things simultaneously?
Well, the answer obviously is Multi-threading. There can be one main thread
that continuously checks for a fast motion. There could be another thread that sends
the alert text SMS, and one more which will transfer image from our machine to
a central system. Threading in C can be easily understood by googling a bit.
Here is the link to the source code.
Before running this code, what you will need to do is
generate an ssh-key and copy it in the central machines. That way you will be
allowed to scp command (copy over ssh) without typing the ssh password. Here is a link that explains it.
Second part is Authentication:
Well now, generating a passcode is like generating a random
number, which explained here. Sending the generated passcode via SMS is
explained here. But, there is whole lot
of other stuff here, for example starting a timer, getting the passcode “secretly”,
stop getting the data after timer expires. All these processes are drawn in
diagram below.
So the functions:
2.
Now, to get passcode “secretly”, you can see
here
3.
To kill an application, you need to run command “kill
process_id”( which is done after the timer expires)
Now all these things, are included in a git-hub project here.
Thanks for reading, comment are most welcome.