Skip to content

Commit

Permalink
Merge pull request #3551 from smartdevicelink/release/7.0.0
Browse files Browse the repository at this point in the history
7.0.0 Release
  • Loading branch information
Jack-Byrne authored Nov 5, 2020
2 parents 0ce7625 + 618a5e0 commit f270af4
Show file tree
Hide file tree
Showing 1,095 changed files with 50,936 additions and 106,526 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.com)
[![Build Status](http://opensdl-jenkins.luxoft.com:8080/view/develop/job/develop_nightly_coverage/badge/icon)](http://opensdl-jenkins.luxoft.com:8080/view/develop/job/develop_nightly_coverage/)
[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/badge/icon?subject=UT%20coverage%20build)](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/)
[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/badge/icon?subject=Smoke%20tests)](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/)
[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/badge/icon?subject=Coding%20style)](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/)

# SmartDeviceLink (SDL)

Expand All @@ -11,14 +13,14 @@ SmartDeviceLink (SDL) is a standard set of protocols and messages that connect a

## SDL Core

The Core component of SDL runs on a vehicle's computing system (head unit). Core’s primary responsibility is to route messages between connected smartphone applications and the vehicle HMI. It can connect a smartphone to a vehicle's head unit via a variety of transport protocols such as Bluetooth, USB, Android AOA, and TCP. Once a connection is established, Core discovers compatible applications and displays them to the driver for interaction via voice or display. The Core component is configured to follow a set of policies defined in its local policy database and updated by a [policy server](https://www.github.com/smartdevicelink/sdl_server). The messaging between a connected application and SDL Core is defined by the [Mobile API](https://github.com/smartdevicelink/sdl_core/blob/master/src/components/interfaces/MOBILE_API.xml) and the messaging between SDL Core and the vehicle is defined by the [HMI API](https://github.com/smartdevicelink/sdl_core/blob/master/src/components/interfaces/HMI_API.xml).
The Core component of SDL runs on a vehicle's computing system (head unit). Core’s primary responsibility is to route messages between connected smartphone applications and the vehicle HMI. It can connect a smartphone to a vehicle's head unit via a variety of transport protocols such as Bluetooth, USB, Android AOA, and TCP. Once a connection is established, Core discovers compatible applications and displays them to the driver for interaction via voice or display. The Core component is configured to follow a set of policies defined in its local policy database and updated by a [policy server](https://www.github.com/smartdevicelink/sdl_server). The messaging between a connected application and SDL Core is defined by the [Mobile API](https://github.com/smartdevicelink/rpc_spec/blob/master/MOBILE_API.xml) and the messaging between SDL Core and the vehicle is defined by the [HMI API](https://github.com/smartdevicelink/sdl_core/blob/master/src/components/interfaces/HMI_API.xml).

Pull Requests Welcome!

## Environment
Currently supported:
* Ubuntu Linux 16.04 with GCC 5.4.x
* Ubuntu Linux 18.04 with GCC 7.3.x
* Ubuntu Linux 18.04 with GCC 7.5.x
* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)

## Getting Started
Expand Down
Empty file added cppcheck.xml
Empty file.
3 changes: 2 additions & 1 deletion src/3rd_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ if (NOT ${Boost_FOUND})
include(ExternalProject)
ExternalProject_Add(
Boost
URL https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
URL https://mirror.bazel.build/dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
URL_HASH SHA256=da3411ea45622579d419bfda66f45cd0f8c32a181d84adfa936f5688388995cf
DOWNLOAD_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
SOURCE_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=system,thread,date_time,filesystem,regex --prefix=${3RD_PARTY_INSTALL_PREFIX}
Expand Down
14 changes: 9 additions & 5 deletions src/appMain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/smartDeviceLink.ini DESTINATION ${CMAKE_CU
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/sample_policy_manager.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/start.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/start_external_proprietary.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/core.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/core_external_proprietary.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/init_policy.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif ()
Expand Down Expand Up @@ -246,15 +246,19 @@ if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
endif ()

if (${EXTENDED_POLICY} STREQUAL "EXTERNAL_PROPRIETARY")
install(FILES start_external_proprietary.sh DESTINATION bin
install(FILES core_external_proprietary.sh DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE RENAME start.sh)
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE RENAME core.sh)
else()
install(FILES start.sh DESTINATION bin
install(FILES core.sh DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()

install(FILES start.sh daemon.sh DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

if(BUILD_TESTS)
add_subdirectory(test)
endif()
8 changes: 8 additions & 0 deletions src/appMain/core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
DIR=$(dirname $0)

EXTERNAL_POLICIES=false
if [ "$2" = "true" ]; then
EXTERNAL_POLICIES=true
fi
$DIR/daemon.sh $1 $EXTERNAL_POLICIES
9 changes: 9 additions & 0 deletions src/appMain/core_external_proprietary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
DIR=$(dirname $0)

EXTERNAL_POLICIES=true
# Allow for manual override to disable sample policy server
if [ "$2" = "false" ]; then
EXTERNAL_POLICIES=false
fi
$DIR/daemon.sh $1 $EXTERNAL_POLICIES
142 changes: 142 additions & 0 deletions src/appMain/daemon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/bin/bash
cd $(dirname $0)
COMMAND=$1
EXTERNAL_POLICIES=$2
DIR=$(pwd)

CORE_PID_FILE=${DIR}/core.pid
CORE_APPLICATION_NAME=smartDeviceLinkCore
PM_PID_FILE=${DIR}/policy_manager.pid
PM_APPLICATION_NAME=sample_policy_manager.py

function core_start() {
if [ -f "$CORE_PID_FILE" ] && [ -n "$(ps -p $(cat $CORE_PID_FILE) -o pid=)" ]; then
echo "Core is already running"
return 1
elif [ -n "$(pgrep -f $CORE_APPLICATION_NAME)" ]; then
echo "Core is already running outside of this script"
echo "All instances of Core can be stopped using the \"kill\" command"
return 2
else
echo "Starting SmartDeviceLink Core"
LD_LIBRARY_PATH=$DIR ${DIR}/${CORE_APPLICATION_NAME} &
CORE_PID=$!
echo $CORE_PID > $CORE_PID_FILE
return 0
fi
}

function core_stop() {
RESULT=1
if [ -f "$CORE_PID_FILE" ] && [ -n "$(ps -p $(cat $CORE_PID_FILE) -o pid=)" ]; then
echo "Stopping SmartDeviceLink Core"
CORE_PID=$(cat $CORE_PID_FILE)
kill $CORE_PID

# If Core doesn't close normally within 10 seconds, force-close it
timeout 10s tail --pid=$CORE_PID -f /dev/null
if [ -n "$(ps -p $CORE_PID -o pid=)" ]; then
echo "Core did not shut down properly, force-killing"
kill -9 $CORE_PID
fi
RESULT=0
fi

if [ -f "$CORE_PID_FILE" ]; then
rm $CORE_PID_FILE
fi
return $RESULT
}

function pm_install_dependencies() {
pip3 list | grep -F tornado > /dev/null
if [ $? -eq 1 ]; then
echo "Installing tornado python package"
sudo -H pip3 install tornado
fi
}

function pm_start() {
if [ -f "$PM_PID_FILE" ] && [ -n "$(ps -p $(cat $PM_PID_FILE) -o pid=)" ]; then
echo "Policy Server is already running"
return 1
elif [ -n "$(pgrep -f $PM_APPLICATION_NAME)" ]; then
echo "Policy Server is already running outside of this script"
echo "All instances of Core can be stopped using the \"kill\" command"
return 2
else
pm_install_dependencies
echo "Starting Policy Manager"
python3 ${DIR}/${PM_APPLICATION_NAME} --pack_port 8088 --unpack_port 8089 --add_http_header --encryption &
PM_PID=$!
echo $PM_PID > $PM_PID_FILE
return 0
fi
}

function pm_stop() {
RESULT=1
if [ -f "$PM_PID_FILE" ] && [ -n "$(ps -p $(cat $PM_PID_FILE) -o pid=)" ]; then
echo "Stopping Policy Manager"
kill -INT $(cat $PM_PID_FILE)
kill -9 $(cat $PM_PID_FILE)
RESULT=0
fi

# Clear PID regardless of whether the process was running or not
if [ -f "$PM_PID_FILE" ]; then
rm $PM_PID_FILE
fi
return $RESULT
}

if [ "$COMMAND" == "stop" ]; then
core_stop
if [ "$?" -ne 0 ]; then
echo "Core is not running (or was started outside of this script)"
fi

if [ "$EXTERNAL_POLICIES" == "true" ]; then
pm_stop
if [ "$?" -ne 0 ]; then
echo "Policy Server is not running (or was started outside of this script)"
fi
fi
elif [ "$COMMAND" == "restart" ]; then
core_stop
if [ "$?" -eq 0 ]; then
core_start
else
echo "Core is not running (or was started outside of this script)"
fi

if [ "$EXTERNAL_POLICIES" == "true" ]; then
pm_stop
if [ "$?" -eq 0 ]; then
pm_start
else
echo "Policy Server is not running (or was started outside of this script)"
fi
fi
elif [ "$COMMAND" == "start" ]; then
core_start
if [ "$EXTERNAL_POLICIES" == "true" ]; then
pm_start
fi
elif [ "$COMMAND" == "kill" ]; then
core_stop
pkill -9 -f $CORE_APPLICATION_NAME
if [ "$?" -eq 0 ]; then
echo "Killed all lingering instances of SDL Core"
fi

if [ "$EXTERNAL_POLICIES" == "true" ]; then
pm_stop
pkill -9 -f $PM_APPLICATION_NAME
if [ "$?" -eq 0 ]; then
echo "Killed all lingering instances of the Policy Server"
fi
fi
else
echo "usage: daemon.sh [start/restart/stop/kill] [use_sample_policy_manager?]"
fi
Loading

0 comments on commit f270af4

Please sign in to comment.