more cleaning, adding GPS data to service control site
This commit is contained in:
16
README.md
16
README.md
@ -1,11 +1,15 @@
|
|||||||
This playbook will prep a computer to be a road trip car computer
|
This playbook preps a computer to be a road trip car computer
|
||||||
|
|
||||||
It will capture snapshots from an attached camera, and it will display the feed on the screen
|
It capture snapshots from an attached camera to local storage, and it displays the feed on the screen
|
||||||
|
|
||||||
It will also host a site for the remote end that searches a working directory for the newest file and displays it and it does so every second
|
It also hosts a site for the remote end that searches a working directory for the newest file and displays it and it does so every second
|
||||||
|
|
||||||
It will also have a site to press a button to start and stop the timelapse
|
It also has a site to press a button to start and stop the timelapse service
|
||||||
|
|
||||||
A lot of this doesn't exist yet or needs to be tested
|
It was designed to run on the GOLE Handheld from Amazon
|
||||||
|
|
||||||
I want to write most of it first and then push it out to test
|
https://www.amazon.com/HIGOLEPC-PC-PRO-Computer-Ethernet/dp/B0BCVXLD5W
|
||||||
|
|
||||||
|
Also, a USB GPS dongle is $15
|
||||||
|
|
||||||
|
https://www.amazon.com/dp/B07GJGSZB9
|
||||||
@ -39,13 +39,13 @@ kiosk_service_templates:
|
|||||||
user_data_dir: "/opt/chrome/one"
|
user_data_dir: "/opt/chrome/one"
|
||||||
extra_chrome_configs: |
|
extra_chrome_configs: |
|
||||||
--user-data-dir=/opt/chrome/one \
|
--user-data-dir=/opt/chrome/one \
|
||||||
- chrome_resolution: "720,550"
|
- chrome_resolution: "720,600"
|
||||||
chrome_website: "http://127.0.0.1:8081"
|
chrome_website: "http://127.0.0.1:8081"
|
||||||
service_name: chrome_timelapse_control
|
service_name: chrome_timelapse_control
|
||||||
extra_service_configs: ""
|
extra_service_configs: ""
|
||||||
user_data_dir: "/opt/chrome/two"
|
user_data_dir: "/opt/chrome/two"
|
||||||
extra_chrome_configs: |
|
extra_chrome_configs: |
|
||||||
--window-position="0,410" \
|
--window-position="0,450" \
|
||||||
--user-data-dir="/opt/chrome/two" \
|
--user-data-dir="/opt/chrome/two" \
|
||||||
|
|
||||||
create_data_dir: true
|
create_data_dir: true
|
||||||
|
|||||||
@ -14,30 +14,30 @@
|
|||||||
### Bottom Service Control Panel
|
### Bottom Service Control Panel
|
||||||
|
|
||||||
|
|
||||||
- name: Install Packages
|
#- name: Install Packages
|
||||||
apt:
|
# apt:
|
||||||
name: "{{ item }}"
|
# name: "{{ item }}"
|
||||||
state: present
|
# state: present
|
||||||
loop: "{{ main_packages }}"
|
# loop: "{{ main_packages }}"
|
||||||
|
#
|
||||||
- name: Install ustreamer
|
#- name: Install ustreamer
|
||||||
include_tasks: ustreamer.yaml
|
# include_tasks: ustreamer.yaml
|
||||||
|
#
|
||||||
- name: Install gps_service
|
#- name: Install gps_service
|
||||||
include_tasks: gps_service.yaml
|
# include_tasks: gps_service.yaml
|
||||||
|
#
|
||||||
- name: install timelapse service
|
#- name: install timelapse service
|
||||||
include_tasks: timelapse.yaml
|
# include_tasks: timelapse.yaml
|
||||||
|
#
|
||||||
- name: Install photo refresh site
|
#- name: Install photo refresh site
|
||||||
include_tasks: photo_refresh.yaml
|
# include_tasks: photo_refresh.yaml
|
||||||
|
#
|
||||||
- name: Install timelapse service control
|
#- name: Install timelapse service control
|
||||||
include_tasks: service_control.yaml
|
# include_tasks: service_control.yaml
|
||||||
|
#
|
||||||
- name: Install cosmos autologin user
|
#- name: Install cosmos autologin user
|
||||||
include_tasks: cosmos_autologin.yaml
|
# include_tasks: cosmos_autologin.yaml
|
||||||
|
#
|
||||||
- name: Set up Chrome Kiosk Services
|
- name: Set up Chrome Kiosk Services
|
||||||
include_tasks: chrome.yaml
|
include_tasks: chrome.yaml
|
||||||
|
|
||||||
|
|||||||
@ -104,6 +104,12 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
|
|
||||||
|
- name: service_control_website - template index.php
|
||||||
|
template:
|
||||||
|
src: index-service_control.php.j2
|
||||||
|
dest: "{{ service_control_web_folder }}/html/index.php"
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
# Start photo_refresh
|
# Start photo_refresh
|
||||||
###############################################
|
###############################################
|
||||||
|
|||||||
@ -52,6 +52,30 @@ function runAPI($submitted_status) {
|
|||||||
return isset($data['Status']) ? $data['Status'] : 'unknown';
|
return isset($data['Status']) ? $data['Status'] : 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getGPS(){
|
||||||
|
if (!file_exists("{{ gps_service_directory }}/gps_data")) {
|
||||||
|
return "No GPS data available.";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$LAT = shell_exec("cat {{ gps_service_directory }}/gps_data | grep lat | cut -d ':' -f 2 | awk '{printf(\"%.5f\n\", $1)}')");
|
||||||
|
$LON = shell_exec("cat {{ gps_service_directory }}/gps_data | grep lon | cut -d ':' -f 2 | awk '{printf(\"%.5f\n\", $1)}')");
|
||||||
|
$SPEED = floatval(trim(shell_exec("cat {{ gps_service_directory }}/gps_data | grep speed | cut -d ':' -f 2)"))) * 0.62;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return "Failed to parse gps_data: ".$e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($LAT)) {
|
||||||
|
return "No GPS data available.";
|
||||||
|
}
|
||||||
|
if (is_null($LON)) {
|
||||||
|
return "No GPS data available.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $LAT.", ".$LON.", ".$SPEED."mph";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if the button was clicked via AJAX request
|
// Check if the button was clicked via AJAX request
|
||||||
// if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
// if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
// $button_recent = true;
|
// $button_recent = true;
|
||||||
@ -166,7 +190,9 @@ if($button_recent){
|
|||||||
<div class="api-data">
|
<div class="api-data">
|
||||||
<!-- PHP will inject the data here -->
|
<!-- PHP will inject the data here -->
|
||||||
<?php
|
<?php
|
||||||
echo "Full Message:<br>".htmlspecialchars($message)."<p>Current Date:<br>".date("F j, Y, g:i:s a")."<p>";
|
echo "Full Message:<br>".htmlspecialchars($message)."<p>";
|
||||||
|
echo "Current Date:<br>".date("F j, Y, g:i:s a")."<p>";
|
||||||
|
echo "Current GPS Data:<br>".getGPS();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Reference in New Issue
Block a user