mirror of https://github.com/hmatuschek/libsdr
Fixed build scripts to generate resource header files.
parent
4d79c7e1e4
commit
23d2e122bd
@ -0,0 +1,7 @@
|
|||||||
|
macro(link_resources HEADER_NAME)
|
||||||
|
#create_resources("${CMAKE_CURRENT_BINARY_DIR}/${HEADER_NAME}.hh" ${ARGN})
|
||||||
|
add_custom_target(${HEADER_NAME} ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND} -DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/${HEADER_NAME}.hh" -DRESOURCE_PATH="${CMAKE_CURRENT_SOURCE_DIR}" -DFILES="${ARGN}" -P "${PROJECT_SOURCE_DIR}/cmake/create_resources.cmake"
|
||||||
|
DEPENDS ${ARGN} SOURCES ${ARGN})
|
||||||
|
endmacro(link_resources)
|
||||||
|
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Implements the packing of resource files into a header file
|
||||||
|
#
|
||||||
|
get_filename_component(OUTPUT_FILE ${OUTPUT} NAME)
|
||||||
|
message(STATUS "Generate resource file '${OUTPUT_FILE}' from: ${FILES}")
|
||||||
|
# Create empty file
|
||||||
|
file(WRITE ${OUTPUT} "")
|
||||||
|
# For each resource file
|
||||||
|
foreach(file ${FILES})
|
||||||
|
# Normalize filename
|
||||||
|
string(REGEX MATCH "([^/]+)$" filename ${file})
|
||||||
|
string(REGEX REPLACE "\\.| " "_" filename ${filename})
|
||||||
|
# Read and convert file content
|
||||||
|
file(READ "${RESOURCE_PATH}/${file}" filedata HEX)
|
||||||
|
string(REGEX REPLACE "([0-9a-fA-F][0-9a-fA-F])" "0x\\1," filedata ${filedata})
|
||||||
|
# Update output file
|
||||||
|
file(APPEND ${OUTPUT}
|
||||||
|
"extern \"C\" {\n"
|
||||||
|
" static char ${filename}[] = {${filedata}};\n"
|
||||||
|
" static unsigned ${filename}_size = sizeof(${filename});\n"
|
||||||
|
"}\n")
|
||||||
|
endforeach()
|
||||||
@ -1,4 +1,8 @@
|
|||||||
#add_subdirectory(libhttpd)
|
|
||||||
|
# Creates a header file including the shared resources
|
||||||
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
link_resources(sdr_cmd_resources shared/index.html)
|
||||||
|
|
||||||
add_executable(sdr_cmd main.cc)
|
add_executable(sdr_cmd main.cc)
|
||||||
|
add_dependencies(sdr_cmd sdr_cmd_resources)
|
||||||
target_link_libraries(sdr_cmd ${LIBS} libsdr )
|
target_link_libraries(sdr_cmd ${LIBS} libsdr )
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
#include "json.hh"
|
|
||||||
|
|
||||||
JSON::JSON()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
#ifndef __SDR_HTTP_JSON_HH__
|
|
||||||
#define __SDR_HTTP_JSON_HH__
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __SDR_HTTP_JSON_HH__
|
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>sdr-aprs — An APRS receiver using libsdr.</title>
|
||||||
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
html, body, #map-canvas {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var map;
|
||||||
|
var connections = {};
|
||||||
|
var qth = null;
|
||||||
|
|
||||||
|
function onSetQTH (lon, lat) {
|
||||||
|
// Center map at QTH
|
||||||
|
map.setCenter(new google.maps.LatLng(lat, lon));
|
||||||
|
// Add or update the marker at QTH
|
||||||
|
if (null == qth) {
|
||||||
|
qth = new google.maps.Marker({
|
||||||
|
position: new google.maps.LatLng(lat, lon),
|
||||||
|
title: "QTH", map: map});
|
||||||
|
} else {
|
||||||
|
qth.setPosition(new google.maps.LatLng(lat, lon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onAddConnection (callsign, lon, lat, snr) {
|
||||||
|
// Check if connection exists
|
||||||
|
if (callsign in connections) {
|
||||||
|
// If connection exists, update SNR
|
||||||
|
connections[callsign].line.setOptions(options={
|
||||||
|
clickable: false, draggable: false, geodesic: true,
|
||||||
|
path: [qth.getPosition(), new google.maps.LatLng(lat, lon)],
|
||||||
|
strokeColor: '#0000FF', strokeOpacity: (1.0 + Math.min(0, snr/40)), strokeWeight: 2 } );
|
||||||
|
connections[callsign].marker.setPosition(new google.maps.LatLng(lat, lon));
|
||||||
|
} else {
|
||||||
|
// otherwise, add marker at location with label callsign and line from QTH to location
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: new google.maps.LatLng(lat, lon), title: callsign, map: map});
|
||||||
|
var line = new google.maps.Polyline({
|
||||||
|
clickable: false, draggable: false, geodesic: true,
|
||||||
|
path: [qth.getPosition(), new google.maps.LatLng(lat, lon)],
|
||||||
|
strokeColor: '#0000FF', strokeOpacity: (1.0 + Math.min(0, snr/40)), strokeWeight: 2 });
|
||||||
|
line.setMap(map);
|
||||||
|
connections[callsign] = { marker: marker, line: line };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initialize() {
|
||||||
|
// Create Map object
|
||||||
|
map = new google.maps.Map(
|
||||||
|
document.getElementById('map-canvas'),
|
||||||
|
{zoom:2, center: new google.maps.LatLng(0,0), streetViewControl:false});
|
||||||
|
}
|
||||||
|
|
||||||
|
google.maps.event.addDomListener(window, 'load', initialize);
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="map-canvas">
|
||||||
|
<p>Can not load Google Maps view. Check your internet conenction!</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue