summaryrefslogtreecommitdiff
path: root/src/components/utils/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/utils/test')
-rw-r--r--src/components/utils/test/CMakeLists.txt41
-rw-r--r--src/components/utils/test/async_runner_test.cc25
-rw-r--r--src/components/utils/test/auto_trace_test.cc121
-rw-r--r--src/components/utils/test/back_trace_test.cc7
-rw-r--r--src/components/utils/test/bitstream_test.cc105
-rw-r--r--src/components/utils/test/conditional_variable_test.cc68
-rw-r--r--src/components/utils/test/custom_string_test.cc319
-rw-r--r--src/components/utils/test/data_accessor_test.cc48
-rw-r--r--src/components/utils/test/date_time_test.cc183
-rw-r--r--src/components/utils/test/file_system_test.cc232
-rw-r--r--src/components/utils/test/generated_code_with_sqlite_test.cc217
-rw-r--r--src/components/utils/test/include/utils/generated_code_with_sqlite_test.h407
-rw-r--r--src/components/utils/test/include/utils/mock_timer_task.h52
-rw-r--r--src/components/utils/test/include/utils/test_handler.h (renamed from src/components/utils/test/signals_linux_test.cc)32
-rw-r--r--src/components/utils/test/log_message_loop_thread_test.cc34
-rw-r--r--src/components/utils/test/message_loop_thread_test.cc52
-rw-r--r--src/components/utils/test/message_queue_test.cc55
-rw-r--r--src/components/utils/test/messagemeter_test.cc241
-rw-r--r--src/components/utils/test/posix_thread_test.cc97
-rw-r--r--src/components/utils/test/prioritized_queue_test.cc43
-rw-r--r--src/components/utils/test/qdb_wrapper/sql_database_test.cc139
-rw-r--r--src/components/utils/test/qdb_wrapper/sql_query_test.cc311
-rw-r--r--src/components/utils/test/resource_usage_test.cc16
-rw-r--r--src/components/utils/test/rwlock_posix_test.cc24
-rw-r--r--src/components/utils/test/shared_ptr_test.cc55
-rw-r--r--src/components/utils/test/singleton_test.cc72
-rw-r--r--src/components/utils/test/smartDeviceLink.ini19
-rw-r--r--src/components/utils/test/sqlite_wrapper/sql_database_test.cc223
-rw-r--r--src/components/utils/test/sqlite_wrapper/sql_query_test.cc380
-rw-r--r--src/components/utils/test/stl_utils_test.cc19
-rw-r--r--src/components/utils/test/system_test.cc33
-rw-r--r--src/components/utils/test/test_generator/CMakeLists.txt65
-rw-r--r--src/components/utils/test/test_generator/MOBILE_API.xml4999
-rw-r--r--src/components/utils/test/test_generator/generated_msg_version_test.cc77
-rw-r--r--src/components/utils/test/thread_validator_test.cc7
-rw-r--r--src/components/utils/test/timer_test.cc326
-rw-r--r--src/components/utils/test/timer_thread_test.cc153
37 files changed, 8427 insertions, 870 deletions
diff --git a/src/components/utils/test/CMakeLists.txt b/src/components/utils/test/CMakeLists.txt
index d194f7628a..6ec12a17e6 100644
--- a/src/components/utils/test/CMakeLists.txt
+++ b/src/components/utils/test/CMakeLists.txt
@@ -32,23 +32,21 @@ if(BUILD_TESTS)
include_directories (
${JSONCPP_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include
- ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include
- ${COMPONENTS_DIR}/utils/include/utils
- ${COMPONENTS_DIR}/include/utils
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/utils/include
${COMPONENTS_DIR}/rpc_base/include
${COMPONENTS_DIR}/utils/test/include
+ ${COMPONENTS_DIR}/policy/include
)
set(testSources
messagemeter_test.cc
file_system_test.cc
- #date_time_test.cc
+ date_time_test.cc
system_test.cc
- signals_linux_test.cc
thread_validator_test.cc
conditional_variable_test.cc
- #message_queue_test.cc
+ message_queue_test.cc
resource_usage_test.cc
bitstream_test.cc
prioritized_queue_test.cc
@@ -57,27 +55,28 @@ set(testSources
singleton_test.cc
#posix_thread_test.cc
stl_utils_test.cc
- #timer_thread_test.cc
rwlock_posix_test.cc
async_runner_test.cc
- #shared_ptr_test.cc
- #scope_guard_test.cc
- #atomic_object_test.cc
+ shared_ptr_test.cc
+ scope_guard_test.cc
+ atomic_object_test.cc
+ message_loop_thread_test.cc
+ custom_string_test.cc
+ timer_test.cc
)
set(testLibraries
gmock
Utils
Policy
+ ConfigProfile
)
-include_directories(${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct_ext)
-
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
# --- Tests for QDB Wrapper
list (APPEND testSources
- # ./qdb_wrapper/sql_database_test.cc
- # ./qdb_wrapper/sql_query_test.cc
+ ./qdb_wrapper/sql_database_test.cc
+ ./qdb_wrapper/sql_query_test.cc
)
file(COPY qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@@ -86,12 +85,9 @@ else ()
# --- Tests for SQLite Wrapper
find_package(Sqlite3 REQUIRED)
list (APPEND testSources
- # ./sqlite_wrapper/sql_database_test.cc
- # ./sqlite_wrapper/sql_query_test.cc
- # generated_code_with_sqlite_test.cc
-
- # TODO{ALeshin} APPLINK-11132 AssertTrue in SetUpTestCase() return false
- #policy_manager_impl_stress_test.cc
+ ./sqlite_wrapper/sql_database_test.cc
+ ./sqlite_wrapper/sql_query_test.cc
+ generated_code_with_sqlite_test.cc
)
list (APPEND testLibraries sqlite3)
endif()
@@ -107,7 +103,10 @@ endif()
file(COPY testscript.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY smartDeviceLink.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
create_test("utils_test" "${testSources}" "${testLibraries}")
+add_subdirectory(test_generator)
+
endif()
diff --git a/src/components/utils/test/async_runner_test.cc b/src/components/utils/test/async_runner_test.cc
index e0db33bb96..9badbadf1c 100644
--- a/src/components/utils/test/async_runner_test.cc
+++ b/src/components/utils/test/async_runner_test.cc
@@ -30,14 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdlib.h>
#include <ctime>
-#include "lock.h"
-#include "threads/async_runner.h"
-#include "utils/conditional_variable.h"
+#include <stdlib.h>
#include "gtest/gtest.h"
+#include "utils/lock.h"
+#include "utils/conditional_variable.h"
+#include "utils/threads/async_runner.h"
+
namespace test {
namespace components {
namespace utils {
@@ -59,9 +60,7 @@ class TestThreadDelegate : public ThreadDelegate {
class AsyncRunnerTest : public ::testing::Test {
public:
- AsyncRunnerTest()
- : kDelegatesNum_(1),
- asr_pt_(NULL) {
+ AsyncRunnerTest() : kDelegatesNum_(1), asr_pt_(NULL) {
CreateAsyncRunner();
CreateThreadsArray();
}
@@ -75,13 +74,13 @@ class AsyncRunnerTest : public ::testing::Test {
Lock test_lock_;
uint32_t kDelegatesNum_;
ConditionalVariable cond_var_;
- TestThreadDelegate **delegates_;
- AsyncRunner *asr_pt_;
+ TestThreadDelegate** delegates_;
+ AsyncRunner* asr_pt_;
void CreateThreadsArray() {
srand(std::time(NULL));
kDelegatesNum_ = (rand() % 20 + 1);
- delegates_ = new TestThreadDelegate*[kDelegatesNum_];
+ delegates_ = new TestThreadDelegate* [kDelegatesNum_];
}
void DeleteThreadsArray() {
@@ -111,8 +110,9 @@ TEST_F(AsyncRunnerTest, ASyncRunManyDelegates_ExpectSuccessfulAllDelegatesRun) {
EXPECT_EQ(kDelegatesNum_, check_value);
}
-//TODO(VVeremjova) APPLINK-12834 Sometimes delegates do not run
-TEST_F(AsyncRunnerTest, DISABLED_RunManyDelegatesAndStop_ExpectSuccessfulDelegatesStop) {
+// TODO(VVeremjova) APPLINK-12834 Sometimes delegates do not run
+TEST_F(AsyncRunnerTest,
+ DISABLED_RunManyDelegatesAndStop_ExpectSuccessfulDelegatesStop) {
AutoLock lock(test_lock_);
// Clear global value before test
check_value = 0;
@@ -138,4 +138,3 @@ TEST_F(AsyncRunnerTest, DISABLED_RunManyDelegatesAndStop_ExpectSuccessfulDelegat
} // namespace utils
} // namespace components
} // namespace test
-
diff --git a/src/components/utils/test/auto_trace_test.cc b/src/components/utils/test/auto_trace_test.cc
index a53f4aa1e0..1290ce7e96 100644
--- a/src/components/utils/test/auto_trace_test.cc
+++ b/src/components/utils/test/auto_trace_test.cc
@@ -30,73 +30,116 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <fstream>
+#include <ctime>
+
#include "gtest/gtest.h"
#include "utils/auto_trace.h"
-#include "logger.h"
-#include <fstream>
+#include "utils/logger.h"
+#include "utils/log_message_loop_thread.h"
+#include "utils/threads/message_loop_thread.h"
+#include "utils/file_system.h"
+#include "utils/threads/thread.h"
+#include "utils/date_time.h"
+#include "utils/logger_status.h"
+#include "utils/helpers.h"
namespace test {
namespace components {
-namespace utils {
+namespace utils_test {
using namespace ::logger;
-CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog");
+CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog")
+
+namespace {
+const std::string kFileName =
+ file_system::CurrentWorkingDirectory() + "/AutoTraceTestLogFile.log";
+} // namespace
void Preconditions() {
- //delete file with previous logs
- const char* file_name = "AutoTraceTestLogFile.log";
- std::remove(file_name);
+ // Delete file with previous logs
+ if (file_system::FileExists(kFileName)) {
+ // If logger is active now deleting log file cause undefined befaviour.
+ DEINIT_LOGGER();
+ ASSERT_TRUE(file_system::DeleteFile(kFileName))
+ << "Can't delete AutoTraceTestLogFile.log";
+ }
}
void InitLogger() {
- INIT_LOGGER("log4cxx.properties");
+ // Set enabled logs
+ INIT_LOGGER("log4cxx.properties", true);
+ // DEINIT_LOGGER will be called in test_main.cc
}
-void CreateDeleteAutoTrace(const std::string & testlog) {
+void CreateDeleteAutoTrace(const std::string& testlog) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, testlog);
}
-bool CheckTraceInFile(const std::string & testlog) {
-
- bool isLogFound = false;
- std::string line;
-
- std::ifstream file_log("AutoTraceTestLogFile.log");
+/**
+ * @brief IsLogLineContains cheks if log line contains debug message with
+ * specified debug message
+ * @param log_line line to search in
+ * @param debug_level expected debug level
+ * @param debug_log_message expected debug message
+ * @return true if debug_message exist in log_line with debug_level
+ */
+bool IsLogLineContains(const std::string& log_line,
+ const std::string& debug_level,
+ const std::string& debug_message) {
+ return log_line.find(debug_level) != std::string::npos &&
+ log_line.find(debug_message) != std::string::npos;
+}
- if (file_log.is_open()) {
- while (getline(file_log, line)) {
- std::size_t found = line.find(testlog);
- std::size_t founddebug = line.find("DEBUG");
- if ((found != std::string::npos) && (founddebug != std::string::npos)) {
- isLogFound = true;
- break;
- }
- }
- file_log.close();
- } else {
- std::cout << "file cannot be opened \n";
+/**
+ * @brief CheckAutoTraceDebugInFile chacks if logfile contains autotrace and
+ * debug for test AutoTrace_WriteToFile_ReadCorrectString
+ * @param debug_message message that should be logged with DEBUG level
+ * @return true if trace enter, trace exit, debug message exist in log file
+ */
+bool CheckAutoTraceDebugInFile(const std::string& debug_message) {
+ using namespace helpers;
+ const std::string debug_log_level = "DEBUG";
+ const std::string trace_log_level = "TRACE";
+ const std::string enter_message = ": Enter";
+ const std::string exit_message = ": Exit";
+ std::ifstream file_log(kFileName);
+ if (!file_log.is_open()) {
+ return false;
}
- return isLogFound;
-}
-void DeinitLogger() {
- DEINIT_LOGGER();
+ bool debug_found = false;
+ bool trace_enter = false;
+ bool trace_exit = false;
+ for (std::string line;
+ Compare<bool, EQ, ONE>(false, debug_found, trace_enter, trace_exit) &&
+ getline(file_log, line);) {
+ debug_found = debug_found
+ ? debug_found
+ : IsLogLineContains(line, debug_log_level, debug_message);
+ trace_enter = trace_enter
+ ? trace_enter
+ : IsLogLineContains(line, trace_log_level, enter_message);
+ trace_exit = trace_exit
+ ? trace_exit
+ : IsLogLineContains(line, trace_log_level, exit_message);
+ }
+ file_log.close();
+ return Compare<bool, EQ, ALL>(true, debug_found, trace_enter, trace_exit);
}
-
-//TODO(VVeremjova) APPLINK-12832 Logger does not write debug information in file
-TEST(AutoTraceTest, DISABLED_Basic) {
- const std::string testlog =
- "Test trace is working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
+// TODO(DTrunov) : Enable after APPLINK-25006 will be resolved
+TEST(AutoTraceTest, DISABLED_AutoTrace_WriteToFile_ReadCorrectString) {
+ const std::string testlog = "Test trace is working!";
Preconditions();
InitLogger();
CreateDeleteAutoTrace(testlog);
- DeinitLogger();
- ASSERT_TRUE(CheckTraceInFile(testlog));
+ FLUSH_LOGGER();
+ ASSERT_TRUE(CheckAutoTraceDebugInFile(testlog));
}
-} // namespace utils
+} // namespace utils_test
} // namespace components
} // namespace test
diff --git a/src/components/utils/test/back_trace_test.cc b/src/components/utils/test/back_trace_test.cc
index 12d5df81fc..071c4d3342 100644
--- a/src/components/utils/test/back_trace_test.cc
+++ b/src/components/utils/test/back_trace_test.cc
@@ -40,11 +40,10 @@ namespace utils {
using namespace ::utils;
TEST(BackTraceTest, CallStackShouldNotBeEmpty) {
-
- //arrange
+ // arrange
Backtrace newtrace = Backtrace();
- std::vector < std::string > symbols = newtrace.CallStack();
- //assert
+ std::vector<std::string> symbols = newtrace.CallStack();
+ // assert
ASSERT_FALSE(symbols.empty());
}
diff --git a/src/components/utils/test/bitstream_test.cc b/src/components/utils/test/bitstream_test.cc
index 07a80bde07..df27aaa835 100644
--- a/src/components/utils/test/bitstream_test.cc
+++ b/src/components/utils/test/bitstream_test.cc
@@ -42,19 +42,19 @@ namespace utils {
using ::utils::BitStream;
TEST(BitstreamTest, CreateBitstream_WithDataWithDatasize_BitStreamIsGood) {
-
- //arrange
+ // arrange
uint8_t data = 10;
size_t bits = 2;
BitStream bs(&data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
}
-TEST(BitstreamTest, ExtractBitstreamInUint8_ExtractAllData_BitStreamIsGoodDataExtractedCorrectly) {
-
- //arrange
+TEST(
+ BitstreamTest,
+ ExtractBitstreamInUint8_ExtractAllData_BitStreamIsGoodDataExtractedCorrectly) {
+ // arrange
uint8_t data = 10;
size_t bits = 2;
BitStream bs(&data, bits);
@@ -62,15 +62,15 @@ TEST(BitstreamTest, ExtractBitstreamInUint8_ExtractAllData_BitStreamIsGoodDataEx
uint8_t extract_data = 0;
Extract(&bs, &extract_data);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
EXPECT_EQ(data, extract_data);
}
-TEST(BitstreamTest, ExtractBitstreamInUint8_WithDataWithZeroSize_BitStreamIsBad) {
-
- //arrange
+TEST(BitstreamTest,
+ ExtractBitstreamInUint8_WithDataWithZeroSize_BitStreamIsBad) {
+ // arrange
uint8_t data = 10;
size_t bits = 0;
BitStream bs(&data, bits);
@@ -78,13 +78,14 @@ TEST(BitstreamTest, ExtractBitstreamInUint8_WithDataWithZeroSize_BitStreamIsBad)
uint8_t extract_data = 0;
Extract(&bs, &extract_data);
- //assert
+ // assert
EXPECT_TRUE(bs.IsBad());
}
-TEST(BitstreamTest, ExtractBitstreamInUint32_WithDatasizeEq4_BitStreamIsGoodDataExtractedCorrectly) {
-
- //arrange
+TEST(
+ BitstreamTest,
+ ExtractBitstreamInUint32_WithDatasizeEq4_BitStreamIsGoodDataExtractedCorrectly) {
+ // arrange
uint8_t data = 10;
size_t bits = 4;
BitStream bs(&data, bits);
@@ -92,14 +93,12 @@ TEST(BitstreamTest, ExtractBitstreamInUint32_WithDatasizeEq4_BitStreamIsGoodData
uint32_t extract_data = 0;
Extract(&bs, &extract_data);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
-
}
TEST(BitstreamTest, ExtractBitstreamInUint32_DatasizeLess4_BitStreamIsBad) {
-
- //arrange
+ // arrange
uint8_t data = 10;
size_t bits = 3;
BitStream bs(&data, bits);
@@ -107,14 +106,12 @@ TEST(BitstreamTest, ExtractBitstreamInUint32_DatasizeLess4_BitStreamIsBad) {
uint32_t extract_data = 0;
Extract(&bs, &extract_data);
- //assert
+ // assert
EXPECT_TRUE(bs.IsBad());
-
}
TEST(BitstreamTest, ExtractFullBitstream_WithDataWithDatasize_BitStreamIsGood) {
-
- //arrange
+ // arrange
uint8_t data = 10;
size_t bits = 8;
BitStream bs(&data, bits);
@@ -123,15 +120,15 @@ TEST(BitstreamTest, ExtractFullBitstream_WithDataWithDatasize_BitStreamIsGood) {
Extract(&bs, &extract_data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
EXPECT_EQ(data, extract_data);
}
-TEST(BitstreamTest, ExtractBitstreamInString_WithDataWithDatasize_BitStreamIsGood) {
-
- //arrange
+TEST(BitstreamTest,
+ ExtractBitstreamInString_WithDataWithDatasize_BitStreamIsGood) {
+ // arrange
uint8_t data = 10;
size_t bits = 2;
BitStream bs(&data, bits);
@@ -141,46 +138,45 @@ TEST(BitstreamTest, ExtractBitstreamInString_WithDataWithDatasize_BitStreamIsGoo
Extract(&bs, &strdata, length);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
}
TEST(BitstreamTest, CreateBitstream_NoDataZeroDatasize_BitStreamIsGood) {
-
- //arrange
- uint8_t *data = NULL;
+ // arrange
+ uint8_t* data = NULL;
size_t bits = 0;
BitStream bs(data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
}
-TEST(BitstreamTest, CreateBitstream_NoDataWithUpperboundDataSize_BitStreamIsGood) {
-
- //arrange
- uint8_t *data = NULL;
+TEST(BitstreamTest,
+ CreateBitstream_NoDataWithUpperboundDataSize_BitStreamIsGood) {
+ // arrange
+ uint8_t* data = NULL;
size_t bits = 65535;
BitStream bs(data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
}
-TEST(BitstreamTest, CreateBitstream_WithUpperboundDataWithLessDataSize_BitStreamIsGood) {
-
- //arrange
+TEST(BitstreamTest,
+ CreateBitstream_WithUpperboundDataWithLessDataSize_BitStreamIsGood) {
+ // arrange
uint8_t data = 255;
size_t bits = sizeof(char);
BitStream bs(&data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
}
-TEST(BitstreamTest, ExtractBitstream_WithUpperboundDataWithLessDataSize_BitStreamIsGood) {
-
- //arrange
+TEST(BitstreamTest,
+ ExtractBitstream_WithUpperboundDataWithLessDataSize_BitStreamIsGood) {
+ // arrange
uint8_t data = 255;
size_t bits = sizeof(char);
BitStream bs(&data, bits);
@@ -188,13 +184,13 @@ TEST(BitstreamTest, ExtractBitstream_WithUpperboundDataWithLessDataSize_BitStrea
uint8_t extract_data = 0;
Extract(&bs, &extract_data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
}
-TEST(BitstreamTest, ExtractBitstream_WithUpperboundDataWithZeroDataSize_BitStreamIsGood) {
-
- //arrange
+TEST(BitstreamTest,
+ ExtractBitstream_WithUpperboundDataWithZeroDataSize_BitStreamIsGood) {
+ // arrange
uint8_t data = 255;
size_t bits = 0;
BitStream bs(&data, bits);
@@ -202,26 +198,25 @@ TEST(BitstreamTest, ExtractBitstream_WithUpperboundDataWithZeroDataSize_BitStrea
uint8_t extract_data = 0;
Extract(&bs, &extract_data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
}
TEST(BitstreamTest, ExtractBitstream_WithDataMarkedBad_ExpectIsBad) {
-
- //arrange
+ // arrange
uint8_t data = 255;
size_t bits = sizeof(int);
BitStream bs(&data, bits);
- //assert
+ // assert
EXPECT_TRUE(bs.IsGood());
- //act
+ // act
bs.MarkBad();
- //assert
+ // assert
EXPECT_TRUE(bs.IsBad());
- //act
+ // act
Extract(&bs, &data, bits);
- //arrange
+ // arrange
EXPECT_TRUE(bs.IsBad());
}
diff --git a/src/components/utils/test/conditional_variable_test.cc b/src/components/utils/test/conditional_variable_test.cc
index a898732ffc..8c3bd7db8c 100644
--- a/src/components/utils/test/conditional_variable_test.cc
+++ b/src/components/utils/test/conditional_variable_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <pthread.h>
#include <iostream>
-
-#include "lock.h"
-#include "macro.h"
+#include <pthread.h>
#include "gtest/gtest.h"
+
+#include "utils/lock.h"
+#include "utils/macro.h"
#include "utils/conditional_variable.h"
namespace test {
@@ -45,22 +45,20 @@ namespace utils {
class ConditionalVariableTest : public ::testing::Test {
public:
- ConditionalVariableTest()
- : test_value_("initialized"),
- counter_(0) {
- }
+ ConditionalVariableTest() : test_value_("initialized"), counter_(0) {}
void check_counter();
void task_one();
- static void* check_counter_helper(void *context) {
- (reinterpret_cast<ConditionalVariableTest *>(context))->check_counter();
+ static void* check_counter_helper(void* context) {
+ (reinterpret_cast<ConditionalVariableTest*>(context))->check_counter();
return NULL;
}
- static void* task_one_helper(void *context) {
- (reinterpret_cast<ConditionalVariableTest *>(context))->task_one();
+ static void* task_one_helper(void* context) {
+ (reinterpret_cast<ConditionalVariableTest*>(context))->task_one();
return NULL;
}
+
protected:
std::string test_value_;
sync_primitives::ConditionalVariable cond_var_;
@@ -73,10 +71,13 @@ void ConditionalVariableTest::check_counter() {
sync_primitives::AutoLock test_lock(test_mutex_);
if (counter_ <= 1) {
counter_++;
- cond_var_.Wait(test_mutex_); // Mutex unlock & Thread sleeps until Notification
- }
- else if(counter_ == 2) { // Checking for equal 2 in this specific case. Because we were waiting for 2 threads to be finished
- cond_var_.Broadcast(); // Notify All threads waiting on conditional variable
+ cond_var_.Wait(
+ test_mutex_); // Mutex unlock & Thread sleeps until Notification
+ } else if (counter_ == 2) { // Checking for equal 2 in this specific case.
+ // Because we were waiting for 2 threads to be
+ // finished
+ cond_var_
+ .Broadcast(); // Notify All threads waiting on conditional variable
}
}
@@ -84,18 +85,18 @@ void ConditionalVariableTest::check_counter() {
void ConditionalVariableTest::task_one() {
sync_primitives::AutoLock test_lock(test_mutex_);
test_value_ = "changed by thread 1";
- cond_var_.NotifyOne(); // Notify At least one thread waiting on conditional variable
+ cond_var_.NotifyOne(); // Notify At least one thread waiting on conditional
+ // variable
test_value_ = "changed again by thread 1";
}
-TEST_F(ConditionalVariableTest, CheckNotifyOne_OneThreadNotified_ExpectSuccessful) {
+TEST_F(ConditionalVariableTest,
+ CheckNotifyOne_OneThreadNotified_ExpectSuccessful) {
pthread_t thread1;
sync_primitives::AutoLock test_lock(test_mutex_);
test_value_ = "changed by main thread";
- const bool thread_created = pthread_create(&thread1,
- NULL,
- &ConditionalVariableTest::task_one_helper,
- this);
+ const bool thread_created = pthread_create(
+ &thread1, NULL, &ConditionalVariableTest::task_one_helper, this);
ASSERT_FALSE(thread_created) << "thread1 is not created!";
test_value_ = "changed twice by main thread";
cond_var_.WaitFor(test_lock, 2000);
@@ -103,30 +104,29 @@ TEST_F(ConditionalVariableTest, CheckNotifyOne_OneThreadNotified_ExpectSuccessfu
EXPECT_EQ(last_value, test_value_);
}
-TEST_F(ConditionalVariableTest, CheckBroadcast_AllThreadsNotified_ExpectSuccessful) {
+TEST_F(ConditionalVariableTest,
+ CheckBroadcast_AllThreadsNotified_ExpectSuccessful) {
pthread_t thread1;
pthread_t thread2;
- bool thread_created = pthread_create(&thread1,
- NULL,
- &ConditionalVariableTest::check_counter_helper,
- this);
+ bool thread_created = pthread_create(
+ &thread1, NULL, &ConditionalVariableTest::check_counter_helper, this);
ASSERT_FALSE(thread_created) << "thread1 is not created!";
- thread_created = pthread_create(&thread2,
- NULL,
- &ConditionalVariableTest::check_counter_helper,
- this);
+ thread_created = pthread_create(
+ &thread2, NULL, &ConditionalVariableTest::check_counter_helper, this);
ASSERT_FALSE(thread_created) << "thread2 is not created!";
check_counter();
EXPECT_EQ(2u, counter_);
}
-TEST_F(ConditionalVariableTest, CheckWaitForWithTimeout1sec_ThreadBlockedForTimeout_ExpectSuccessfulWakeUp) {
+TEST_F(
+ ConditionalVariableTest,
+ CheckWaitForWithTimeout1sec_ThreadBlockedForTimeout_ExpectSuccessfulWakeUp) {
sync_primitives::AutoLock test_lock(test_mutex_);
- sync_primitives::ConditionalVariable::WaitStatus wait_st = cond_var_.WaitFor(test_lock, 1000);
+ sync_primitives::ConditionalVariable::WaitStatus wait_st =
+ cond_var_.WaitFor(test_lock, 1000);
EXPECT_EQ(sync_primitives::ConditionalVariable::kTimeout, wait_st);
}
} // namespace utils
} // namespace components
} // namespace test
-
diff --git a/src/components/utils/test/custom_string_test.cc b/src/components/utils/test/custom_string_test.cc
new file mode 100644
index 0000000000..3610bfb36b
--- /dev/null
+++ b/src/components/utils/test/custom_string_test.cc
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iostream>
+#include <string>
+#include "gtest/gtest.h"
+#include "utils/custom_string.h"
+
+namespace custom_str = utils::custom_string;
+
+namespace test {
+namespace components {
+namespace utils {
+
+std::string CreateMultibyteString(uint8_t* array, size_t array_size) {
+ return std::string(array, array + array_size);
+}
+
+class CustomStringTest : public ::testing::TestWithParam<std::string> {
+ protected:
+ static void SetUpTestCase() {
+ const size_t kSizeStr = 8;
+ uint8_t array[] = {0xD0,
+ 0xA2,
+ 0xD0,
+ 0xB5,
+ 0xD1,
+ 0x81,
+ 0xD1,
+ 0x82}; // Array contains russian word "Тест"
+ mbstring1_ = CreateMultibyteString(array, kSizeStr);
+ mbstring2_ = mbstring1_ + "abc";
+ amount_symbols_mbstring1_ = 4; // amount of symbols from string mbstring1_
+ amount_symbols_mbstring2_ = 7; // amount of symbols from string mbstring2_
+ amount_bytes_mbstring1_ = mbstring1_.size();
+ amount_bytes_mbstring2_ = mbstring2_.size();
+ }
+
+ public:
+ static std::string mbstring1_; // String contains russian word "Тест"
+ static std::string
+ mbstring2_; // String contains russian word with ASCII symbols "Тестabc"
+ static size_t amount_symbols_mbstring1_;
+ static size_t amount_symbols_mbstring2_;
+ static size_t amount_bytes_mbstring1_;
+ static size_t amount_bytes_mbstring2_;
+};
+
+std::string CustomStringTest::mbstring1_ = "";
+std::string CustomStringTest::mbstring2_ = "";
+size_t CustomStringTest::amount_symbols_mbstring1_ = 0;
+size_t CustomStringTest::amount_symbols_mbstring2_ = 0;
+size_t CustomStringTest::amount_bytes_mbstring1_ = 0;
+size_t CustomStringTest::amount_bytes_mbstring2_ = 0;
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectSizeAndIsASCIIStringEQTrue) {
+ std::string str("Test string");
+ custom_str::CustomString obj(str);
+
+ EXPECT_EQ(str.size(), obj.size());
+ EXPECT_EQ(str.length(), obj.length());
+ EXPECT_EQ(str.size(), obj.length_bytes());
+ EXPECT_TRUE(obj.is_ascii_string());
+ EXPECT_FALSE(obj.empty());
+}
+
+TEST_F(CustomStringTest,
+ AddEmptyToCustomString_ExpectCorrectSizeAndIsASCIIStringEQTrue) {
+ std::string str;
+ custom_str::CustomString obj(str);
+
+ EXPECT_EQ(str.size(), obj.size());
+ EXPECT_EQ(str.length(), obj.length());
+ EXPECT_EQ(str.size(), obj.length_bytes());
+ EXPECT_TRUE(obj.is_ascii_string());
+ EXPECT_TRUE(obj.empty());
+}
+
+TEST_F(CustomStringTest,
+ AddEmptyToCustomString_ExpectCorrectWorkOfMethodAsMBString) {
+ std::string str;
+ custom_str::CustomString obj(str);
+ EXPECT_TRUE(str == obj.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfMethodAsMBString) {
+ std::string str("Test string");
+ custom_str::CustomString obj(str);
+ EXPECT_TRUE(str == obj.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfAppendOperator) {
+ custom_str::CustomString obj("Test string");
+ custom_str::CustomString obj1("abc");
+ custom_str::CustomString obj_empty;
+ std::string str("abc");
+ std::string str_empty;
+ std::string str_result("Test stringabc");
+ std::string str_result1("Test string");
+ custom_str::CustomString obj_result;
+ obj_result = obj + obj1;
+ EXPECT_TRUE(str_result == obj_result.AsMBString());
+ obj_result = obj + obj_empty;
+ EXPECT_TRUE(str_result1 == obj_result.AsMBString());
+ obj_result = obj + str;
+ EXPECT_TRUE(str_result == obj_result.AsMBString());
+ obj_result = obj + str_empty;
+ EXPECT_TRUE(str_result1 == obj_result.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddEmptyStringToCustomString_ExpectCorrectWorkOfAppendOperator) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj("abc");
+ custom_str::CustomString obj_empty1;
+ std::string str("abc");
+ std::string str_empty;
+ custom_str::CustomString obj_result;
+ obj_result = obj_empty + obj;
+ EXPECT_TRUE(str == obj_result.AsMBString());
+ obj_result = obj_empty + obj_empty1;
+ EXPECT_TRUE(str_empty == obj_result.AsMBString());
+ obj_result = obj_empty + str;
+ EXPECT_TRUE(str == obj_result.AsMBString());
+ obj_result = obj_empty + str_empty;
+ EXPECT_TRUE(str_empty == obj_result.AsMBString());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddASCIIAndEmptyStringToCustomString_ExpectCorrectWorkOfCompareOperator) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj_empty1;
+ custom_str::CustomString obj("abc");
+ custom_str::CustomString obj1("abc");
+ std::string str_empty;
+ std::string str("abc");
+
+ EXPECT_TRUE(obj_empty == obj_empty1);
+ EXPECT_FALSE(obj_empty == obj1);
+ EXPECT_TRUE(obj_empty == str_empty);
+ EXPECT_FALSE(obj_empty == str);
+ EXPECT_TRUE(obj == obj1);
+ EXPECT_TRUE(obj == str);
+ EXPECT_FALSE(obj == str_empty);
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIAndEmptyStringToCustomString_ExpectCorrectWorkOfCompareMethod) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj("abc");
+ std::string str_empty;
+ std::string str("abc");
+
+ EXPECT_TRUE(obj_empty.compare(str_empty) == 0);
+ EXPECT_TRUE(obj_empty.compare(str) != 0);
+ EXPECT_TRUE(obj_empty.compare("") == 0);
+ EXPECT_TRUE(obj_empty.compare("abc") != 0);
+ EXPECT_TRUE(obj.compare(str_empty) != 0);
+ EXPECT_TRUE(obj.compare(str) == 0);
+ EXPECT_TRUE(obj.compare("") != 0);
+ EXPECT_TRUE(obj.compare("abc") == 0);
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfAtMethod) {
+ std::string str("abc");
+ custom_str::CustomString obj(str);
+ for (size_t i = 0; i < obj.size(); ++i) {
+ EXPECT_TRUE(obj.at(i) == str[i]);
+ }
+}
+
+TEST_F(
+ CustomStringTest,
+ AddASCIIAndEmptyStringToCustomString_ExpectCorrectWorkOfCompareIgnoreCaseMethod) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj_empty1;
+ custom_str::CustomString obj("abc");
+ custom_str::CustomString obj1("AbC");
+ custom_str::CustomString obj2("AbCd");
+
+ EXPECT_TRUE(obj_empty.CompareIgnoreCase(obj_empty1));
+ EXPECT_FALSE(obj_empty.CompareIgnoreCase(obj));
+ EXPECT_TRUE(obj.CompareIgnoreCase(obj1));
+ EXPECT_TRUE(obj.CompareIgnoreCase(obj));
+ EXPECT_FALSE(obj.CompareIgnoreCase(obj2));
+ EXPECT_FALSE(obj.CompareIgnoreCase(obj_empty));
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfToWStringMethod) {
+ custom_str::CustomString obj("abc");
+ std::wstring wstr(L"abc");
+ EXPECT_TRUE(wstr == obj.ToWString());
+}
+
+TEST_F(CustomStringTest,
+ AddUTF8StringToCustomString_ExpectCorrectSizeAndIsASCIIStringEQFalse) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ EXPECT_EQ(obj.size(), CustomStringTest::amount_symbols_mbstring1_);
+ EXPECT_EQ(obj.length(), CustomStringTest::amount_symbols_mbstring1_);
+ EXPECT_EQ(obj.length_bytes(), CustomStringTest::amount_bytes_mbstring1_);
+ EXPECT_FALSE(obj.is_ascii_string());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddMixingUTF8WithASCIIStringToCustomString_ExpectCorrectSizeAndIsASCIIStringEQFalse) {
+ custom_str::CustomString obj(CustomStringTest::mbstring2_);
+ EXPECT_EQ(obj.size(), CustomStringTest::amount_symbols_mbstring2_);
+ EXPECT_EQ(obj.length(), CustomStringTest::amount_symbols_mbstring2_);
+ EXPECT_EQ(obj.length_bytes(), CustomStringTest::amount_bytes_mbstring2_);
+ EXPECT_FALSE(obj.is_ascii_string());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddUTF8StringAndMixingUTF8WithASCIIToCustomString_ExpectCorrectWorkOfMethodAsMBString) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ EXPECT_TRUE(CustomStringTest::mbstring1_ == obj.AsMBString());
+ EXPECT_TRUE(CustomStringTest::mbstring2_ == obj1.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddUTF8StringToCustomString_ExpectCorrectConvertingToWString) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ std::wstring wstr1(L"Тест");
+ std::wstring wstr2(L"Тестabc");
+ EXPECT_TRUE(wstr1 == obj.ToWString());
+ EXPECT_TRUE(wstr2 == obj1.ToWString());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddSameMultiByteStringsToCustomString_ExpectCorrectCaseSensetiveComparing) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj_1(CustomStringTest::mbstring1_);
+ EXPECT_TRUE(obj == obj_1);
+ EXPECT_TRUE(obj == CustomStringTest::mbstring1_);
+ EXPECT_EQ(0, obj.compare(CustomStringTest::mbstring1_.c_str()));
+ EXPECT_EQ(0, obj.compare(CustomStringTest::mbstring1_));
+}
+
+TEST_F(
+ CustomStringTest,
+ AddDiferenceMultiByteStringsToCustomString_ExpectCorrectCaseSensetiveComparing) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ EXPECT_FALSE(obj == obj1);
+ EXPECT_FALSE(obj == CustomStringTest::mbstring2_);
+ EXPECT_TRUE(obj.compare(CustomStringTest::mbstring2_) != 0);
+}
+
+TEST_F(
+ CustomStringTest,
+ AddDiferenceMultiByteStringsToCustomString_ExpectCorrectCaseInsensitiveComparing) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ EXPECT_FALSE(obj.CompareIgnoreCase(obj1));
+ EXPECT_FALSE(obj.CompareIgnoreCase(CustomStringTest::mbstring2_.c_str()));
+}
+
+TEST_F(
+ CustomStringTest,
+ AddSameMultiByteStringsToCustomString_ExpectCorrectCaseInsensitiveComparing) {
+ const size_t kSizeStr = 8;
+ uint8_t array[] = {0xD1,
+ 0x82,
+ 0xD0,
+ 0xB5,
+ 0xD1,
+ 0x81,
+ 0xD0,
+ 0xA2}; // String contains russian word "тесТ"
+ std::string mbstring = CreateMultibyteString(array, kSizeStr);
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(mbstring);
+ EXPECT_TRUE(obj.CompareIgnoreCase(obj1));
+ EXPECT_TRUE(obj.CompareIgnoreCase(mbstring.c_str()));
+}
+
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/data_accessor_test.cc b/src/components/utils/test/data_accessor_test.cc
index 105ec8517f..b15310ff3f 100644
--- a/src/components/utils/test/data_accessor_test.cc
+++ b/src/components/utils/test/data_accessor_test.cc
@@ -39,31 +39,28 @@ namespace components {
namespace utils {
TEST(DataAccessorTest, CreateDataAccessor) {
-
- //arrange
+ // arrange
int test_value = 10;
sync_primitives::Lock testSet_lock_;
DataAccessor<int> testdata(test_value, testSet_lock_);
int data_from_testdata = testdata.GetData();
- //assert
+ // assert
EXPECT_EQ(test_value, data_from_testdata);
}
TEST(DataAccessorTest, CreateDataAccessor_MutexIsLocked_CannotLockItAgain) {
-
- //arrange
+ // arrange
int test_value = 10;
sync_primitives::Lock testSet_lock_;
DataAccessor<int> testdata(test_value, testSet_lock_);
- //assert
+ // assert
EXPECT_FALSE(testSet_lock_.Try());
}
TEST(DataAccessorTest, CopyDataAccessor_GetDataFromDataAccessors) {
-
- //arrange
+ // arrange
int test_value = 10;
sync_primitives::Lock testSet_lock_;
DataAccessor<int> testdata(test_value, testSet_lock_);
@@ -72,15 +69,15 @@ TEST(DataAccessorTest, CopyDataAccessor_GetDataFromDataAccessors) {
int data_from_testdata = testdata.GetData();
int data_from_testdata_copy = testdata_copy.GetData();
- //assert
+ // assert
EXPECT_EQ(data_from_testdata, data_from_testdata_copy);
EXPECT_FALSE(testSet_lock_.Try());
}
-TEST(DataAccessorTest,ChangedDataInDataAccessor_ChangeData_DataInDataAccessorIsChanged) {
-
- //arrange
+TEST(DataAccessorTest,
+ ChangedDataInDataAccessor_ChangeData_DataInDataAccessorIsChanged) {
+ // arrange
int test_value = 10;
sync_primitives::Lock testSet_lock_;
DataAccessor<int> testdata(test_value, testSet_lock_);
@@ -88,32 +85,31 @@ TEST(DataAccessorTest,ChangedDataInDataAccessor_ChangeData_DataInDataAccessorIsC
int data_from_testdata_after_change = testdata.GetData();
- //assert
+ // assert
EXPECT_EQ(test_value, data_from_testdata_after_change);
}
-TEST(DataAccessorTest, DeleteDataAccessor_CreatedOneDeleteOneThread_MutexIsUnlocked) {
-
- //arrange
+TEST(DataAccessorTest,
+ DeleteDataAccessor_CreatedOneDeleteOneThread_MutexIsUnlocked) {
+ // arrange
int test_value = 10;
sync_primitives::Lock testSet_lock_;
{
DataAccessor<int> testdata(test_value, testSet_lock_);
- //assert
+ // assert
EXPECT_FALSE(testSet_lock_.Try());
}
- //assert
+ // assert
EXPECT_TRUE(testSet_lock_.Try());
testSet_lock_.Release();
-
}
-TEST(DataAccessorTest, DeleteDataAccessor_CreatedThreadAndCopyDeleteBothThreads_MutexIsUnlocked) {
-
- //arrange
+TEST(DataAccessorTest,
+ DeleteDataAccessor_CreatedThreadAndCopyDeleteBothThreads_MutexIsUnlocked) {
+ // arrange
int test_value = 10;
sync_primitives::Lock testSet_lock_;
{
@@ -121,18 +117,16 @@ TEST(DataAccessorTest, DeleteDataAccessor_CreatedThreadAndCopyDeleteBothThreads_
{
DataAccessor<int> testdata_copy(testdata);
- //assert
+ // assert
EXPECT_FALSE(testSet_lock_.Try());
}
- //assert
+ // assert
EXPECT_FALSE(testSet_lock_.Try());
-
}
- //assert
+ // assert
EXPECT_TRUE(testSet_lock_.Try());
testSet_lock_.Release();
-
}
} // namespace utils
diff --git a/src/components/utils/test/date_time_test.cc b/src/components/utils/test/date_time_test.cc
index db2b101825..fc34b7a998 100644
--- a/src/components/utils/test/date_time_test.cc
+++ b/src/components/utils/test/date_time_test.cc
@@ -39,165 +39,163 @@ namespace utils {
using namespace date_time;
TEST(DateTimeTest, GetCurrentTime) {
-
- //arrange
+ // arrange
const TimevalStruct time1 = date_time::DateTime::getCurrentTime();
- //assert
+ // assert
ASSERT_NE(0, time1.tv_sec);
ASSERT_GE(time1.tv_usec, 0);
- //act
+ // act
const TimevalStruct time2 = date_time::DateTime::getCurrentTime();
- //assert
+ // assert
ASSERT_NE(0, time2.tv_sec);
ASSERT_GE(time2.tv_usec, 0);
ASSERT_GE(time2.tv_sec, time1.tv_sec);
}
TEST(DateTimeTest, GetSecs) {
- //arrange
+ // arrange
TimevalStruct time;
time.tv_sec = 1;
- time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
- //assert
+ // assert
ASSERT_EQ(1, date_time::DateTime::getSecs(time));
}
TEST(DateTimeTest, GetmSecs) {
- //arrange
+ // arrange
TimevalStruct time;
time.tv_sec = 1;
- time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
- int64_t expect_value = time.tv_sec
- * date_time::DateTime::MILLISECONDS_IN_SECOND
- + time.tv_usec / date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
- //assert
+ int64_t expect_value =
+ time.tv_sec * date_time::DateTime::MILLISECONDS_IN_SECOND +
+ time.tv_usec / date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ // assert
ASSERT_EQ(expect_value, date_time::DateTime::getmSecs(time));
}
TEST(DateTimeTest, GetuSecs) {
- //arrange
+ // arrange
TimevalStruct time;
time.tv_sec = 3;
time.tv_usec = 4;
- int64_t expect_value = time.tv_sec
- * date_time::DateTime::MILLISECONDS_IN_SECOND
- * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS + time.tv_usec;
- //assert
+ int64_t expect_value = time.tv_sec *
+ date_time::DateTime::MILLISECONDS_IN_SECOND *
+ date_time::DateTime::MICROSECONDS_IN_MILLISECOND +
+ time.tv_usec;
+ // assert
ASSERT_EQ(expect_value, date_time::DateTime::getuSecs(time));
}
TEST(DateTimeTest, GetuSecsmSecs) {
- //arrange
+ // arrange
TimevalStruct time;
time.tv_sec = 5;
time.tv_usec = 6;
- int64_t expect_value = date_time::DateTime::getuSecs(time)
- / date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ int64_t expect_value = date_time::DateTime::getuSecs(time) /
+ date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
- //assert
+ // assert
ASSERT_EQ(expect_value, date_time::DateTime::getmSecs(time));
}
TEST(DateTimeTest, CalculateTimeSpan) {
- //arrange
+ // arrange
const TimevalStruct time = date_time::DateTime::getCurrentTime();
const uint32_t sleep_time_mSec = 10;
- usleep(sleep_time_mSec * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS);
+ usleep(sleep_time_mSec * date_time::DateTime::MICROSECONDS_IN_MILLISECOND);
- //assert
+ // assert
ASSERT_GE(date_time::DateTime::calculateTimeSpan(time), sleep_time_mSec);
}
TEST(DateTimeTest, CalculateTimeDiff) {
-
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
TimevalStruct time2;
time2.tv_sec = 3;
- time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
- //time2 to time1
+ // time2 to time1
TimevalStruct diff1;
diff1.tv_sec = time2.tv_sec - time1.tv_sec;
diff1.tv_usec = time2.tv_usec - time1.tv_usec;
- const int64_t mSecDiff = static_cast<int64_t>(diff1.tv_sec) * 1000
- + diff1.tv_usec / 1000;
+ const int64_t mSecDiff =
+ static_cast<int64_t>(diff1.tv_sec) * 1000 + diff1.tv_usec / 1000;
- //assert
+ // assert
ASSERT_EQ(mSecDiff, date_time::DateTime::calculateTimeDiff(time2, time1));
- //time1 to time2
+ // time1 to time2
TimevalStruct diff2;
diff2.tv_sec = time1.tv_sec - time2.tv_sec;
diff2.tv_usec = time1.tv_usec - time2.tv_usec;
- const int64_t mSecDiff2 = -(static_cast<int64_t>(diff2.tv_sec) * 1000
- + diff2.tv_usec / 1000);
+ const int64_t mSecDiff2 =
+ -(static_cast<int64_t>(diff2.tv_sec) * 1000 + diff2.tv_usec / 1000);
- //assert
+ // assert
ASSERT_EQ(mSecDiff2, date_time::DateTime::calculateTimeDiff(time1, time2));
}
TEST(DateTimeTest, CalculateEqualTimeDiff) {
TimevalStruct time1;
time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
TimevalStruct time2;
time2.tv_sec = 1;
- time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time2, time1));
ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time1, time2));
}
TEST(DateTimeTest, compareTime) {
-
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
TimevalStruct time2;
time2.tv_sec = 2;
- time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
- //assert
+ // assert
ASSERT_EQ(LESS, date_time::DateTime::compareTime(time1, time2));
ASSERT_EQ(GREATER, date_time::DateTime::compareTime(time2, time1));
ASSERT_NE(EQUAL, date_time::DateTime::compareTime(time2, time1));
- //act
+ // act
TimevalStruct time3 = date_time::DateTime::Sub(time2, time1);
- //assert
+ // assert
ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time1, time3));
}
TEST(DateTimeTest, GetSecs_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 0;
time1.tv_usec = date_time::DateTime::MICROSECONDS_IN_SECOND;
- //assert
+ // assert
ASSERT_EQ(1, date_time::DateTime::getSecs(time1));
}
TEST(DateTimeTest, compareTime_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 1;
time1.tv_usec = 0;
@@ -206,14 +204,14 @@ TEST(DateTimeTest, compareTime_UsecConvertedInSec) {
time2.tv_sec = 0;
time2.tv_usec = date_time::DateTime::MICROSECONDS_IN_SECOND;
- //assert
+ // assert
ASSERT_EQ(1, date_time::DateTime::getSecs(time1));
ASSERT_EQ(1, date_time::DateTime::getSecs(time2));
ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time1, time2));
}
TEST(DateTimeTest, compareEqualTime_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 1;
time1.tv_usec = 0;
@@ -222,12 +220,12 @@ TEST(DateTimeTest, compareEqualTime_UsecConvertedInSec) {
time2.tv_sec = 0;
time2.tv_usec = date_time::DateTime::MICROSECONDS_IN_SECOND;
- //assert
+ // assert
ASSERT_TRUE(date_time::DateTime::Equal(time1, time2));
}
TEST(DateTimeTest, compareLessTime_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 1;
time1.tv_usec = 0;
@@ -236,12 +234,12 @@ TEST(DateTimeTest, compareLessTime_UsecConvertedInSec) {
time2.tv_sec = 0;
time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_SECOND;
- //assert
+ // assert
ASSERT_TRUE(date_time::DateTime::Less(time1, time2));
}
TEST(DateTimeTest, compareGreaterTime_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 1;
time1.tv_usec = 0;
@@ -250,12 +248,12 @@ TEST(DateTimeTest, compareGreaterTime_UsecConvertedInSec) {
time2.tv_sec = 0;
time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_SECOND;
- //assert
+ // assert
ASSERT_TRUE(date_time::DateTime::Greater(time2, time1));
}
TEST(DateTimeTest, CalculateTimeSub_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 1;
time1.tv_usec = 0;
@@ -266,12 +264,12 @@ TEST(DateTimeTest, CalculateTimeSub_UsecConvertedInSec) {
TimevalStruct time3 = date_time::DateTime::Sub(time2, time1);
- //assert
+ // assert
ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time1, time3));
}
TEST(DateTimeTest, CalculateTimeDiff_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 2;
time1.tv_usec = 5 * date_time::DateTime::MICROSECONDS_IN_SECOND;
@@ -280,13 +278,13 @@ TEST(DateTimeTest, CalculateTimeDiff_UsecConvertedInSec) {
time2.tv_sec = 3;
time2.tv_usec = 1 * date_time::DateTime::MICROSECONDS_IN_SECOND;
- //assert
+ // assert
ASSERT_EQ(3000, date_time::DateTime::calculateTimeDiff(time2, time1));
ASSERT_EQ(3000, date_time::DateTime::calculateTimeDiff(time1, time2));
}
TEST(DateTimeTest, CalculateEqualTimeDiff_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 2;
time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_SECOND;
@@ -295,13 +293,13 @@ TEST(DateTimeTest, CalculateEqualTimeDiff_UsecConvertedInSec) {
time2.tv_sec = 3;
time2.tv_usec = 1 * date_time::DateTime::MICROSECONDS_IN_SECOND;
- //assert
+ // assert
ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time2, time1));
ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time1, time2));
}
TEST(DateTimeTest, CalculateEqualTimeSub_UsecConvertedInSec) {
- //arrange
+ // arrange
TimevalStruct time1;
time1.tv_sec = 3;
time1.tv_usec = 0;
@@ -316,12 +314,13 @@ TEST(DateTimeTest, CalculateEqualTimeSub_UsecConvertedInSec) {
TimevalStruct time_expected;
time_expected.tv_sec = 0;
time_expected.tv_usec = 0;
- //assert
+ // assert
ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time_expected, time3));
ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time_expected, time4));
}
-TEST(DateTimeTest, AddMilliseconds_SetMillisecondMultiplesSecond_ExpectChangeTime) {
+TEST(DateTimeTest,
+ AddMilliseconds_SetMillisecondMultiplesSecond_ExpectChangeTime) {
TimevalStruct time1;
time1.tv_sec = 3;
time1.tv_usec = 0;
@@ -331,7 +330,8 @@ TEST(DateTimeTest, AddMilliseconds_SetMillisecondMultiplesSecond_ExpectChangeTim
ASSERT_EQ(0, time1.tv_usec);
}
-TEST(DateTimeTest, AddMilliseconds_SetMillisecondNotMultiplesSecond_ExpectChangeTime) {
+TEST(DateTimeTest,
+ AddMilliseconds_SetMillisecondNotMultiplesSecond_ExpectChangeTime) {
TimevalStruct time1;
uint32_t milliseconds = 7500;
time1.tv_sec = 3;
@@ -341,7 +341,8 @@ TEST(DateTimeTest, AddMilliseconds_SetMillisecondNotMultiplesSecond_ExpectChange
ASSERT_EQ(500000, time1.tv_usec);
}
-TEST(DateTimeTest, AddMilliseconds_SetMilliSecondLessThenSeconds_ExpectChangeTime) {
+TEST(DateTimeTest,
+ AddMilliseconds_SetMilliSecondLessThenSeconds_ExpectChangeTime) {
TimevalStruct time1;
uint32_t milliseconds = 500;
time1.tv_sec = 3;
@@ -351,7 +352,8 @@ TEST(DateTimeTest, AddMilliseconds_SetMilliSecondLessThenSeconds_ExpectChangeTim
ASSERT_EQ(500000, time1.tv_usec);
}
-TEST(DateTimeTest, AddMilliseconds_SetMillisecondEqualNull_ExpectNotChangeTime) {
+TEST(DateTimeTest,
+ AddMilliseconds_SetMillisecondEqualNull_ExpectNotChangeTime) {
TimevalStruct time1;
uint32_t milliseconds = 0;
time1.tv_sec = 3;
@@ -371,32 +373,31 @@ TEST(DateTimeTest, AddMilliseconds_SetOverlowMicrosecond_ExpectChangeTime) {
ASSERT_EQ(100000, time1.tv_usec);
}
-TEST(DateTimeTest, Operator_minus_TimevalStruct_positive){
- TimevalStruct time1;
- TimevalStruct time2;
- TimevalStruct time3;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
- time2.tv_sec = 3;
- time2.tv_usec = 0;
- time3.tv_sec = 2;
- time3.tv_usec = 9000000;
- ASSERT_EQ(0, date_time::DateTime::getSecs(time1 - time2));
- ASSERT_EQ(8000000, date_time::DateTime::getuSecs(time3 - time1));
+TEST(DateTimeTest, Operator_minus_TimevalStruct_positive) {
+ TimevalStruct time1;
+ TimevalStruct time2;
+ TimevalStruct time3;
+ time1.tv_sec = 3;
+ time1.tv_usec = 0;
+ time2.tv_sec = 3;
+ time2.tv_usec = 0;
+ time3.tv_sec = 2;
+ time3.tv_usec = 9000000;
+ ASSERT_EQ(0, date_time::DateTime::getSecs(time1 - time2));
+ ASSERT_EQ(8000000, date_time::DateTime::getuSecs(time3 - time1));
}
-TEST(DateTimeTest, Operator_minus_TimevalStruct_negative){
- TimevalStruct time1;
- TimevalStruct time2;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
- time2.tv_sec = 2;
- time2.tv_usec = 9000000;
- ASSERT_NE(1, date_time::DateTime::getSecs(time1 - time2));
- ASSERT_NE(-8000000, date_time::DateTime::getSecs(time2 - time1));
+TEST(DateTimeTest, Operator_minus_TimevalStruct_negative) {
+ TimevalStruct time1;
+ TimevalStruct time2;
+ time1.tv_sec = 3;
+ time1.tv_usec = 0;
+ time2.tv_sec = 2;
+ time2.tv_usec = 9000000;
+ ASSERT_NE(1, date_time::DateTime::getSecs(time1 - time2));
+ ASSERT_NE(-8000000, date_time::DateTime::getSecs(time2 - time1));
}
-
} // namespace utils
} // namespace components
} // namespace test
diff --git a/src/components/utils/test/file_system_test.cc b/src/components/utils/test/file_system_test.cc
index 4e36608f9f..1d90721680 100644
--- a/src/components/utils/test/file_system_test.cc
+++ b/src/components/utils/test/file_system_test.cc
@@ -32,6 +32,9 @@
#include <algorithm>
#include <fstream>
+#include <vector>
+#include <string>
+
#include "gtest/gtest.h"
#include "utils/file_system.h"
@@ -39,10 +42,24 @@ namespace test {
namespace components {
namespace utils {
+typedef std::vector<std::string> StringArray;
+
using namespace file_system;
-TEST(FileSystemTest, CreateDeleteDirectory) {
+namespace {
+StringArray MergeStringsToArray(const std::string& first,
+ const std::string& second) {
+ StringArray array_of_strings;
+ array_of_strings.reserve(2);
+
+ array_of_strings.push_back(first);
+ array_of_strings.push_back(second);
+ return array_of_strings;
+}
+}
+
+TEST(FileSystemTest, CreateDeleteDirectory) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
// Directory creation
CreateDirectory("./Test directory");
@@ -69,12 +86,12 @@ TEST(FileSystemTest, CreateDirectoryTwice) {
// Directory removing
EXPECT_TRUE(RemoveDirectory("./Test directory", false));
- //try delete directory again
+ // Try to delete directory again
EXPECT_FALSE(RemoveDirectory("./Test directory", false));
EXPECT_FALSE(DirectoryExists("./Test directory"));
}
-TEST(FileSystemTest,DeleteDirectoryRecursively) {
+TEST(FileSystemTest, DeleteDirectoryRecursively) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
// Create directories
CreateDirectory("./Test directory");
@@ -119,9 +136,8 @@ TEST(FileSystemTest, CreateDirectoryRecursivelyDeleteRecursively) {
TEST(FileSystemTest, TwiceCreateDirectoryRecursivelyDeleteRecursivelyOnce) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
// Create directories recursively
- EXPECT_TRUE(
- CreateDirectoryRecursively(
- "./Test directory/Test directory 2/Test directory 3"));
+ EXPECT_TRUE(CreateDirectoryRecursively(
+ "./Test directory/Test directory 2/Test directory 3"));
// Check that all directories are created
EXPECT_TRUE(DirectoryExists("./Test directory"));
@@ -136,9 +152,8 @@ TEST(FileSystemTest, TwiceCreateDirectoryRecursivelyDeleteRecursivelyOnce) {
IsDirectory("./Test directory/Test directory 2/Test directory 3"));
// Create directories recursively second time
- EXPECT_TRUE(
- CreateDirectoryRecursively(
- "./Test directory/Test directory 2/Test directory 3"));
+ EXPECT_TRUE(CreateDirectoryRecursively(
+ "./Test directory/Test directory 2/Test directory 3"));
EXPECT_TRUE(DirectoryExists("./Test directory"));
@@ -167,7 +182,7 @@ TEST(FileSystemTest, CreateDeleteFile) {
// Delete file
EXPECT_TRUE(DeleteFile("./test file"));
- //try delete file again
+ // Try to delete file again
EXPECT_FALSE(DeleteFile("./test file"));
EXPECT_FALSE(FileExists("./test file"));
}
@@ -264,11 +279,11 @@ TEST(FileSystemTest, OpenFileWriteInFileStream) {
delete test_file;
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
-// Check data
+ // Check data
for (uint i = 0; i < data_size; ++i) {
EXPECT_EQ(data[i], result[i]);
}
@@ -300,7 +315,7 @@ TEST(FileSystemTest, CannotWriteInClosedFileStream) {
delete test_file;
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_TRUE(result.empty());
@@ -327,7 +342,7 @@ TEST(FileSystemTest, CreateWriteInFileStream_CreateFileAgain_FileRewritten) {
Close(test_file);
delete test_file;
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -351,7 +366,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFile_FileStreamNotClosed) {
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -363,7 +378,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFile_FileStreamNotClosed) {
Close(test_file);
delete test_file;
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -371,7 +386,8 @@ TEST(FileSystemTest, CreateFileStream_WriteInFile_FileStreamNotClosed) {
EXPECT_FALSE(FileExists("./test file"));
}
-TEST(FileSystemTest, CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLastData) {
+TEST(FileSystemTest,
+ CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLastData) {
ASSERT_FALSE(FileExists("./test file"));
// Create and open file
@@ -380,7 +396,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLa
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -399,7 +415,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLa
Close(test_file);
delete test_file;
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -451,7 +467,7 @@ TEST(FileSystemTest, WriteInFilestreamTwice_FileRewritten) {
delete test_file;
delete test_file_2;
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
// Check data
@@ -503,7 +519,7 @@ TEST(FileSystemTest, WriteInFilestreamConsequentially_FileRewritten) {
delete test_file;
delete test_file_2;
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -529,7 +545,7 @@ TEST(FileSystemTest, CreateFileTwiceWriteInFileTwice) {
EXPECT_TRUE(FileExists("./test file"));
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -540,7 +556,7 @@ TEST(FileSystemTest, CreateFileTwiceWriteInFileTwice) {
EXPECT_TRUE(CreateFile("./test file"));
EXPECT_TRUE(CreateFile("./test file"));
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (uint i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -549,7 +565,7 @@ TEST(FileSystemTest, CreateFileTwiceWriteInFileTwice) {
EXPECT_TRUE(Write("./test file", data_2));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -574,21 +590,21 @@ TEST(FileSystemTest, WriteInFileTwiceFileRewritten) {
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
EXPECT_TRUE(Write("./test file", data));
// Write data to file again
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (uint i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
EXPECT_TRUE(Write("./test file", data_2));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -610,7 +626,7 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_TRUE(FileExists("./test file"));
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -619,7 +635,7 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_TRUE(Write("./test file", data));
// Write in file second time
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (int i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -628,11 +644,11 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_TRUE(Write("./test file", data_2, std::ios_base::app));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
- std::vector < uint8_t > data_check;
+ std::vector<uint8_t> data_check;
for (int i = 0; i < 2 * data_size; ++i) {
data_check.push_back(i);
}
@@ -647,7 +663,8 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_FALSE(FileExists("./test file"));
}
-TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBothData) {
+TEST(FileSystemTest,
+ WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBothData) {
ASSERT_FALSE(FileExists("./test file"));
// Create and open file
@@ -656,7 +673,7 @@ TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBoth
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -669,7 +686,7 @@ TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBoth
delete test_file;
// Write in file second time
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (uint i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -678,11 +695,11 @@ TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBoth
EXPECT_TRUE(Write("./test file", data_2, std::ios_base::app));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
- std::vector < uint8_t > data_check;
+ std::vector<uint8_t> data_check;
for (uint i = 0; i < 2 * data_size; ++i) {
data_check.push_back(i);
}
@@ -717,7 +734,7 @@ TEST(FileSystemTest, OpenFileStreamForRead_WriteInFileStream) {
EXPECT_FALSE(test_file->is_open());
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -738,7 +755,7 @@ TEST(FileSystemTest, OpenFileStreamForRead_WriteInFileStream) {
TEST(FileSystemTest, WriteFileNotExists) {
ASSERT_FALSE(FileExists("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./test file", data));
// File now exists
@@ -751,7 +768,7 @@ TEST(FileSystemTest, WriteFileReadFile) {
ASSERT_FALSE(FileExists("./test file"));
EXPECT_TRUE(CreateFile("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./test file", data));
@@ -770,12 +787,12 @@ TEST(FileSystemTest, WriteBinaryDataReadBinaryFile) {
ASSERT_FALSE(FileExists("./test file"));
EXPECT_TRUE(CreateFile("./test file"));
- uint8_t tmp[] = { 1, 2, 3, 4};
+ uint8_t tmp[] = {1, 2, 3, 4};
std::vector<uint8_t> data(tmp, tmp + 4);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
EXPECT_EQ(data, result);
@@ -790,7 +807,7 @@ TEST(FileSystemTest, WriteBinaryDataTwice_FileRewritten) {
EXPECT_TRUE(FileExists("./test file"));
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -798,7 +815,7 @@ TEST(FileSystemTest, WriteBinaryDataTwice_FileRewritten) {
EXPECT_TRUE(WriteBinaryFile("./test file", data));
// Write in file second time
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (int i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -807,7 +824,7 @@ TEST(FileSystemTest, WriteBinaryDataTwice_FileRewritten) {
EXPECT_TRUE(WriteBinaryFile("./test file", data_2));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -825,7 +842,7 @@ TEST(FileSystemTest, WriteBinaryDataFileNotExists) {
ASSERT_FALSE(FileExists("./test file"));
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -839,13 +856,13 @@ TEST(FileSystemTest, WriteBinaryDataFileNotExists) {
TEST(FileSystemTest, WriteDataAsBinaryData) {
ASSERT_FALSE(FileExists("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
ASSERT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -867,7 +884,7 @@ TEST(FileSystemTest, WriteEmptyData) {
ASSERT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_TRUE(result.empty());
@@ -884,7 +901,7 @@ TEST(FileSystemTest, WriteEmptyDataAsBinaryData) {
ASSERT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_TRUE(result.empty());
@@ -896,14 +913,14 @@ TEST(FileSystemTest, WriteBinaryData_WriteDataInTheEndOfFile) {
ASSERT_FALSE(FileExists("./test file"));
// Write binary file
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
ASSERT_TRUE(FileExists("./test file"));
// Write in file second time
int32_t data_size = 4;
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (int i = 0; i < data_size; ++i) {
data_2.push_back(i);
}
@@ -912,7 +929,7 @@ TEST(FileSystemTest, WriteBinaryData_WriteDataInTheEndOfFile) {
EXPECT_TRUE(Write("./test file", data_2, std::ios_base::app));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -934,7 +951,7 @@ TEST(FileSystemTest, CreateFile_WriteDataWithFlagOpenForReading) {
EXPECT_TRUE(CreateFile("./test file"));
// Write data in file
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -942,7 +959,7 @@ TEST(FileSystemTest, CreateFile_WriteDataWithFlagOpenForReading) {
EXPECT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -956,12 +973,13 @@ TEST(FileSystemTest, CreateFile_WriteDataWithFlagOpenForReading) {
EXPECT_FALSE(FileExists("./test file"));
}
-TEST(FileSystemTest, FileDoesNotCreated_WriteFileWithFlagOpenForReadingIsImpossible) {
+TEST(FileSystemTest,
+ FileIsntCreated_WriteFileWithFlagOpenForReadingIsImpossible) {
ASSERT_FALSE(FileExists("./test file"));
// Write data in file is impossible
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -974,7 +992,7 @@ TEST(FileSystemTest, WriteFileGetSize) {
EXPECT_TRUE(CreateFile("./test file"));
EXPECT_EQ(0, FileSize("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./test file", data));
@@ -1007,7 +1025,7 @@ TEST(FileSystemTest, GetFileModificationTime) {
uint64_t modif_time = GetFileModificationTime("./test file");
EXPECT_LE(0ul, modif_time);
- std::vector < uint8_t > data(1, 1);
+ std::vector<uint8_t> data(1, 1);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
EXPECT_LE(0ul, GetFileModificationTime("./test file"));
@@ -1021,7 +1039,7 @@ TEST(FileSystemTest, ListFiles) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectory("./Test directory");
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_TRUE(list.empty());
@@ -1046,7 +1064,7 @@ TEST(FileSystemTest, ListFilesIncludeSubdirectory) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectoryRecursively("./Test directory/Test directory 2/");
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_FALSE(list.empty());
EXPECT_EQ(1u, list.size());
@@ -1060,7 +1078,7 @@ TEST(FileSystemTest, ListFilesDoesNotIncludeFilesInSubdirectory) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectoryRecursively("./Test directory/Test directory 2/");
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_FALSE(list.empty());
@@ -1079,14 +1097,13 @@ TEST(FileSystemTest, ListFilesDoesNotIncludeFilesInSubdirectory) {
}
TEST(FileSystemTest, GetAvailableDiskSpace) {
-
// Get available disk space before directory with file creaction and after
uint64_t available_space = GetAvailableDiskSpace(".");
EXPECT_NE(0u, available_space);
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectory("./Test directory");
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./Test directory/test file", data));
@@ -1115,7 +1132,7 @@ TEST(FileSystemTest, DirectorySize) {
// Get size of nonempty directory with empty file
EXPECT_EQ(0u, DirectorySize("./Test directory"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./Test directory/test file", data));
@@ -1159,7 +1176,7 @@ TEST(FileSystemTest, DeleteAllContentInDirectory) {
DirectoryExists("./Test directory/Test directory 2/Test directory 3"));
EXPECT_FALSE(DirectoryExists("./Test directory/Test directory 2"));
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_TRUE(list.empty());
@@ -1169,6 +1186,91 @@ TEST(FileSystemTest, DeleteAllContentInDirectory) {
EXPECT_FALSE(DirectoryExists("./Test directory"));
}
+TEST(FileSystemTest, GetAbsolutePath) {
+ const std::string& abs_path = GetAbsolutePath(".");
+ // Getting absolute current path from system
+ const std::string& absolute_current_path = CurrentWorkingDirectory();
+ EXPECT_EQ('/', abs_path[0]);
+ EXPECT_EQ(absolute_current_path, abs_path);
+}
+
+TEST(FileSystemTest,
+ GetAbsolutePath_InvalidOrEmptyPathName_EmptyAbsolutePathName) {
+ // Array of invalid paths
+ const StringArray rel_path = MergeStringsToArray("not_exists_dir", " ");
+
+ // Check
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ("", path_for_check);
+ }
+}
+
+TEST(FileSystemTest, GetAbsolutePath_ValidRelPaths_CorrectAbsolutePath) {
+ // Array of relative dirs
+ const StringArray rel_path = MergeStringsToArray(
+ "first_level_path", "first_level_path/second_level_path1");
+
+ // Create some directories in current
+ CreateDirectoryRecursively(rel_path[1]);
+ // Get absolute current dir
+ const std::string& absolute_current_dir = GetAbsolutePath(".");
+ // Check
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ // Concating rel_path to current dir path
+ const std::string& correct_absolute_path =
+ absolute_current_dir + "/" + rel_path[i];
+ // Get absolute path for rel dir
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ(correct_absolute_path, path_for_check);
+ }
+ // Cleanup after test case
+ if (DirectoryExists(rel_path[0])) {
+ RemoveDirectory(rel_path[0], true);
+ }
+}
+
+TEST(FileSystemTest,
+ GetAbsolutePath_ValidRelPathsFromParrentDir_CorrectAbsolutePath) {
+ // Array of relative dirs
+ const StringArray rel_path = MergeStringsToArray(
+ "../first_level_path", "../first_level_path/second_level_path1");
+
+ // Create some directories in parrent of this
+ CreateDirectoryRecursively(rel_path[1]);
+
+ // Get absolute parrent dir
+ const std::string& absolute_parrent_dir = GetAbsolutePath("../");
+ // Check
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ // Concatenation rel_path to current dir path
+ const std::string& relative_dir_name = rel_path[i].substr(3);
+ const std::string& correct_absolute_path =
+ absolute_parrent_dir + "/" + relative_dir_name;
+ // Get absolute path for rel dir
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ(correct_absolute_path, path_for_check);
+ }
+ // Cleanup after test case
+ if (DirectoryExists(rel_path[0])) {
+ RemoveDirectory(rel_path[0], true);
+ }
+}
+
+TEST(FileSystemTest, GetAbsolutePath_TrickiPath_CorrectAbsolutePath) {
+ // Array of relative dirs
+ const StringArray rel_path =
+ MergeStringsToArray("../src/../../application_manager/../utils/test",
+ "../../../components/utils/test");
+
+ const std::string& absolute_current_path = CurrentWorkingDirectory();
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ // Get absolute path for rel dir
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ(absolute_current_path, path_for_check);
+ }
+}
+
} // namespace utils
} // namespace components
} // namespace test
diff --git a/src/components/utils/test/generated_code_with_sqlite_test.cc b/src/components/utils/test/generated_code_with_sqlite_test.cc
new file mode 100644
index 0000000000..0feb040f49
--- /dev/null
+++ b/src/components/utils/test/generated_code_with_sqlite_test.cc
@@ -0,0 +1,217 @@
+/* Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sqlite3.h>
+#include "gtest/gtest.h"
+#include "utils/generated_code_with_sqlite_test.h"
+
+namespace rpc {
+
+class GeneratedCodeTest : public ::testing::Test {
+ public:
+ static void SetUpTestCase() {
+ sqlite3* conn;
+ sqlite3_open((kDatabaseName + ".sqlite").c_str(), &conn);
+ sqlite3_exec(conn, kEndpointsCreation.c_str(), NULL, NULL, NULL);
+ sqlite3_exec(conn, kEndpointsContent.c_str(), NULL, NULL, NULL);
+ sqlite3_exec(conn, kAppPoliciesCreation.c_str(), NULL, NULL, NULL);
+ sqlite3_exec(conn, kGroupsCreation.c_str(), NULL, NULL, NULL);
+ sqlite3_close(conn);
+ }
+
+ static void TearDownTestCase() {
+ remove((kDatabaseName + ".sqlite").c_str());
+ }
+
+ static const std::string kDatabaseName;
+ static const std::string kEndpointsCreation;
+ static const std::string kEndpointsContent;
+ static const std::string kAppPoliciesCreation;
+ static const std::string kGroupsCreation;
+};
+
+const std::string GeneratedCodeTest::kDatabaseName = "test_db";
+
+const std::string GeneratedCodeTest::kEndpointsCreation =
+ "CREATE TABLE Endpoints ("
+ "endpoint_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
+ "service_id VARCHAR(45) NOT NULL,"
+ "application_id VARCHAR(45),"
+ "url VARCHAR(45) NOT NULL,"
+ "is_default INTEGER NOT NULL CHECK(is_default>=0))";
+
+const std::string GeneratedCodeTest::kEndpointsContent =
+ "INSERT INTO Endpoints "
+ "VALUES (1, '0x07', null, 'http://url.example.com', 1)";
+
+const std::string GeneratedCodeTest::kAppPoliciesCreation =
+ "CREATE TABLE AppPolicies ("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
+ "application_id VARCHAR(45),"
+ "priority VARCHAR(45),"
+ "is_default INTEGER NOT NULL CHECK(is_default>=0))";
+
+const std::string GeneratedCodeTest::kGroupsCreation =
+ "CREATE TABLE Groups ("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
+ "application_id VARCHAR(45) NOT NULL,"
+ "group_name VARCHAR(45) NOT NULL )";
+
+TEST_F(GeneratedCodeTest,
+ FindSectionEndpoints_OpenDBSetDefaultUrl_ExpectDefaultUrl) {
+ // arrange
+ dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName);
+
+ // assert
+ EXPECT_TRUE(db.Open());
+ policy_table::ServiceEndpoints ep;
+
+ // assert
+ EXPECT_TRUE(policy_table::FindSection(&db, ep));
+ EXPECT_EQ(1u, ep.size());
+
+ // act
+ std::string url = ep["0x07"]["default"].front();
+
+ // assert
+ EXPECT_EQ("http://url.example.com", url);
+}
+
+TEST_F(GeneratedCodeTest,
+ RemoveSectionEndpoints_RemoveSectionEndpoints_Expect0EndPoints) {
+ // arrange
+ dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName);
+
+ // assert
+ EXPECT_TRUE(db.Open());
+
+ // act
+ policy_table::ServiceEndpoints ep;
+
+ // assert
+ EXPECT_TRUE(policy_table::RemoveSection(&db, ep));
+ dbms::SQLQuery sqlquery(&db);
+
+ // act
+ std::string check_query = "select count (*) from endpoints";
+
+ // assert
+ EXPECT_TRUE(sqlquery.Prepare(check_query));
+ EXPECT_TRUE(sqlquery.Exec());
+ // Index for binding starts from 1, index for results starts from 0
+ EXPECT_EQ(0, sqlquery.GetInteger(0));
+}
+
+TEST_F(GeneratedCodeTest,
+ UpdateSectionEndpoints_SetUrlPoint_ExpectPointEqualsUrl) {
+ // arrange
+ dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName);
+
+ // assert
+ EXPECT_TRUE(db.Open());
+
+ // act
+ std::string test_url = "http://url.example.com";
+
+ policy_table::URL urls;
+ urls.push_back(test_url);
+
+ policy_table::URLList urllist;
+ urllist["default"] = urls;
+
+ policy_table::ServiceEndpoints ep;
+ ep["0x07"] = urllist;
+
+ // assert
+ EXPECT_TRUE(policy_table::UpdateSection(&db, ep));
+
+ dbms::SQLQuery sqlquery(&db);
+ std::string num_of_records_check = "select count (*) from endpoints";
+
+ // assert
+ EXPECT_TRUE(sqlquery.Prepare(num_of_records_check));
+ EXPECT_TRUE(sqlquery.Exec());
+ // Index for binding starts from 1, index for results starts from 0
+ EXPECT_EQ(1, sqlquery.GetInteger(0));
+ EXPECT_TRUE(sqlquery.Reset());
+
+ // act
+ std::string url_check_query = "select * from endpoints";
+
+ // assert
+ EXPECT_TRUE(sqlquery.Prepare(url_check_query));
+ EXPECT_TRUE(sqlquery.Exec());
+ // Index for binding starts from 1, index for results starts from 0
+ EXPECT_EQ(test_url, sqlquery.GetString(3));
+}
+
+TEST_F(GeneratedCodeTest,
+ UpdateSectionAppPolicies_SetAppParams_ExpectDBHasThem) {
+ // arrange
+ dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName);
+
+ // assert
+ EXPECT_TRUE(db.Open());
+
+ // act
+ policy_table::ApplicationPolicies ap;
+ const std::string application_id = "12345678";
+ ap[application_id].groups.push_back("Base-4");
+ ap[application_id].priority = policy_table::P_NORMAL;
+
+ // assert
+ EXPECT_TRUE(policy_table::UpdateSection(&db, ap));
+
+ // act
+ dbms::SQLQuery sqlquery(&db);
+
+ // assert
+ EXPECT_TRUE(sqlquery.Prepare("select count (*) from AppPolicies"));
+ EXPECT_TRUE(sqlquery.Exec());
+ // Index for binding starts from 1, index for results starts from 0
+ EXPECT_EQ(1, sqlquery.GetInteger(0));
+ EXPECT_TRUE(sqlquery.Reset());
+
+ EXPECT_TRUE(sqlquery.Prepare("select count (*) from Groups"));
+ EXPECT_TRUE(sqlquery.Exec());
+ // Index for binding starts from 1, index for results starts from 0
+ EXPECT_EQ(1, sqlquery.GetInteger(0));
+ EXPECT_TRUE(sqlquery.Reset());
+
+ EXPECT_TRUE(sqlquery.Prepare(
+ "select application_id from Groups where group_name='Base-4'"));
+ EXPECT_TRUE(sqlquery.Exec());
+ // Index for binding starts from 1, index for results starts from 0
+ EXPECT_EQ(application_id, sqlquery.GetString(0));
+ EXPECT_TRUE(sqlquery.Reset());
+}
+
+} // namespace rpc
diff --git a/src/components/utils/test/include/utils/generated_code_with_sqlite_test.h b/src/components/utils/test/include/utils/generated_code_with_sqlite_test.h
new file mode 100644
index 0000000000..8455639c07
--- /dev/null
+++ b/src/components/utils/test/include/utils/generated_code_with_sqlite_test.h
@@ -0,0 +1,407 @@
+/* Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_GENERATED_CODE_WITH_SQLITE_TEST_H_
+#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_GENERATED_CODE_WITH_SQLITE_TEST_H_
+
+#include <string>
+#include "policy/policy_table/types.h"
+#include "rpc_base/rpc_base.h"
+#include "utils/sqlite_wrapper/sql_query.h"
+#include "utils/sqlite_wrapper/sql_database.h"
+
+namespace policy_table = rpc::policy_table_interface_base;
+namespace dbms = utils::dbms;
+
+namespace rpc {
+namespace policy_table_interface_base {
+
+bool FindSection(dbms::SQLDatabase* db, policy_table::ServiceEndpoints& ep) {
+ /*
+ * Following table structure is assumed:
+ *
+ * table Endpoints
+ * index, service_type, application_id, url, is_default
+ *
+ * If url belongs to default section, application_id should be null and
+ *is_defaut = true
+ * Otherwise application_id should be set and is_default = false
+ */
+
+ std::string query = "select * from Endpoints";
+
+ dbms::SQLQuery sqlquery(db);
+ sqlquery.Prepare(query);
+ if (!sqlquery.Exec()) {
+ return false;
+ }
+
+ /*
+ * Following query result is assumed (data from wp1_policy_table.json):
+ * 1, 0x07, null, http://applinkqa.trafficmanager.net/api/policies, true
+ */
+
+ policy_table::URL urls;
+ urls.push_back(sqlquery.GetString(3));
+
+ policy_table::URLList urllist;
+ if (sqlquery.GetBoolean(4)) {
+ urllist["default"] = urls;
+ } else {
+ urllist[sqlquery.GetString(2)] = urls;
+ }
+
+ policy_table::ServiceEndpoints new_ep;
+ new_ep[sqlquery.GetString(1)] = urllist;
+
+ ep = new_ep;
+
+ return true;
+}
+
+bool FindSection(dbms::SQLDatabase* db, policy_table::ModuleConfig& mc) {
+ policy_table::ModuleConfig new_mc;
+ FindSection(db, new_mc.endpoints);
+ mc = new_mc;
+
+ return true;
+}
+
+bool RemoveSection(dbms::SQLDatabase* db,
+ const policy_table::ApplicationPolicies& ap) {
+ dbms::SQLQuery sqlquery(db);
+ bool is_policies_removed = sqlquery.Exec("delete from AppPolicies");
+ // bool is_nicknames_removed = sqlquery.Exec("delete from Nicknames");
+ bool is_groups_removed = sqlquery.Exec("delete from Groups");
+
+ return is_policies_removed /*&& is_nicknames_removed*/ && is_groups_removed;
+}
+
+bool RemoveSection(dbms::SQLDatabase* db,
+ const policy_table::ServiceEndpoints& ep) {
+ std::string query = "delete from Endpoints";
+ dbms::SQLQuery sqlquery(db);
+ return sqlquery.Exec(query);
+}
+
+bool RemoveSection(dbms::SQLDatabase* db,
+ const policy_table::ModuleConfig& mc) {
+ // std::string query = "delete * from ModuleConfig";
+ // sqlite::SQLQuery sqlquery(db);
+ // sqlquery.Exec(query);
+
+ return RemoveSection(db, mc.endpoints);
+}
+
+bool RemoveSection(dbms::SQLDatabase* db,
+ const policy_table::FunctionalGroupings& fg) {
+ std::string query = "delete from FunctionalGroups";
+ dbms::SQLQuery sqlquery(db);
+ return sqlquery.Exec(query);
+}
+
+bool UpdateSection(dbms::SQLDatabase* db,
+ const policy_table::ServiceEndpoints& ep) {
+ /*
+ * Following table structure is assumed:
+ *
+ * table Endpoints
+ * index, service_type, application_id, url, is_default
+ *
+ * If url belongs to default section, application_id should be null and
+ *is_defaut = true
+ * Otherwise application_id should be set and is_default = false
+ */
+
+ // According to documentation, we have to REPLACE this part on update coming,
+ // so we delete all data first;
+ if (!RemoveSection(db, ep)) {
+ return false;
+ }
+
+ std::string query = "insert into Endpoints values(?,?,?,?,?)";
+ dbms::SQLQuery sqlquery(db);
+ sqlquery.Prepare(query);
+
+ policy_table::ServiceEndpoints::const_iterator it_ep = ep.begin();
+ policy_table::ServiceEndpoints::const_iterator it_ep_end = ep.end();
+
+ // TODO: use define for int from stdint.h
+ for (int index = 1; it_ep != it_ep_end; ++it_ep, ++index) {
+ policy_table::URLList::const_iterator it_urllist = (*it_ep).second.begin();
+ policy_table::URLList::const_iterator it_urllist_end =
+ (*it_ep).second.end();
+
+ for (; it_urllist != it_urllist_end; ++it_urllist) {
+ policy_table::URL::const_iterator it_url = (*it_urllist).second.begin();
+ policy_table::URL::const_iterator it_url_end = (*it_urllist).second.end();
+
+ for (; it_url != it_url_end; ++it_url) {
+ // Index binding
+ sqlquery.Bind(0, index);
+
+ // Service type binding
+ sqlquery.Bind(1, (*it_ep).first);
+
+ // Application_id and is_default binding
+ std::string url_list_name = (*it_urllist).first;
+ if ("default" == url_list_name) {
+ sqlquery.Bind(2, "null");
+ sqlquery.Bind(4, true);
+ } else {
+ sqlquery.Bind(2, url_list_name);
+ sqlquery.Bind(4, false);
+ }
+
+ // URL binding
+ sqlquery.Bind(3, (*it_url));
+
+ if (sqlquery.Exec()) {
+ sqlquery.Reset();
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+bool UpdateSection(dbms::SQLDatabase* db,
+ const policy_table::ModuleConfig& mc) {
+ UpdateSection(db, mc.endpoints);
+ return true;
+}
+
+bool UpdateSection(dbms::SQLDatabase* db,
+ const policy_table::FunctionalGroupings& fg) {
+ /*
+ * Following table structure is assumed:
+ *
+ * table Rpcs - list of all available RPC commands
+ * index, rpc
+ *
+ * table HmiLevels -list of all available hmi levels
+ * index, hmi_level
+ *
+ * table Groups - list of functional group names
+ * index, group_name
+ *
+ * table FunctionalGroups - list of functional groups
+ * index, group_name_id, rpc_id, hmi_level_id
+ *
+ */
+
+ // According to documentation, we have to REPLACE this part on update coming,
+ // so we delete all data first;
+ if (!RemoveSection(db, fg)) {
+ return false;
+ }
+
+ std::string query =
+ "insert into FunctionalGroups values("
+ "?,"
+ "(select index from Groups where group_name=?),"
+ "(select index from Rpcs where rpc=?),"
+ "(select index from HmiLevels where hmi_levels=?)";
+
+ dbms::SQLQuery sqlquery(db);
+ sqlquery.Prepare(query);
+
+ policy_table::FunctionalGroupings::const_iterator it_fg = fg.begin();
+ policy_table::FunctionalGroupings::const_iterator it_fg_end = fg.end();
+
+ for (int index = 1; it_fg != it_fg_end; ++it_fg, ++index) {
+ policy_table::Rpcs rpcs = (*it_fg).second;
+ policy_table::Rpc::const_iterator it_rpcs = rpcs.rpcs.begin();
+ policy_table::Rpc::const_iterator it_rpcs_end = rpcs.rpcs.end();
+
+ for (; it_rpcs != it_rpcs_end; ++it_rpcs) {
+ policy_table::RpcParameters rpc_params = (*it_rpcs).second;
+
+ policy_table::HmiLevels::const_iterator it_hmi_levels =
+ rpc_params.hmi_levels.begin();
+ policy_table::HmiLevels::const_iterator it_hmi_levels_end =
+ rpc_params.hmi_levels.end();
+
+ for (; it_hmi_levels != it_hmi_levels_end; ++it_hmi_levels) {
+ // Index binding
+ sqlquery.Bind(0, index);
+
+ // Group name binding
+ sqlquery.Bind(1, (*it_fg).first);
+
+ // RPC name binding
+ sqlquery.Bind(2, (*it_rpcs).first);
+
+ // Hmi levels binding
+ sqlquery.Bind(3, (*it_hmi_levels));
+ if (sqlquery.Exec()) {
+ sqlquery.Reset();
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+bool UpdateSection(dbms::SQLDatabase* db, const policy_table::Table& pt) {
+ UpdateSection(db, pt.policy_table.module_config);
+ UpdateSection(db, pt.policy_table.functional_groupings);
+ return true;
+}
+
+bool UpdateSection(dbms::SQLDatabase* db,
+ const policy_table::ApplicationPolicies& ap) {
+ /*
+ * Following structure is assumed:
+ *
+ * table Groups - list of functional groups for application
+ * index, application_id, functional_group_id
+ *
+ * table Nicknames - list of nickname for application
+ * index, application_id, nickname
+ *
+ * table AppPolicies - policies for applications
+ * index, application_id, priority, is_default
+ *
+ */
+
+ // According to documentation, we have to REPLACE this part on update coming,
+ // so we delete all data first;
+ if (!RemoveSection(db, ap)) {
+ return false;
+ }
+
+ std::string groups_query =
+ "insert into Groups values ("
+ "?,"
+ "?,"
+ "?)";
+ dbms::SQLQuery groups_sqlquery(db);
+ groups_sqlquery.Prepare(groups_query);
+
+ std::string nicknames_query = "insert into Nicknames values(?,?,?)";
+ dbms::SQLQuery nicknames_sqlquery(db);
+ nicknames_sqlquery.Prepare(nicknames_query);
+
+ std::string app_policies_query = "insert into AppPolicies values(?,?,?,?)";
+ dbms::SQLQuery app_policies_sqlquery(db);
+ app_policies_sqlquery.Prepare(app_policies_query);
+
+ policy_table::ApplicationPolicies::const_iterator it_ap = ap.begin();
+ policy_table::ApplicationPolicies::const_iterator it_ap_end = ap.end();
+
+ for (int index = 0; it_ap != it_ap_end; ++it_ap, ++index) {
+ // Index binding for AppPolicies table
+ app_policies_sqlquery.Bind(0, index);
+
+ std::string app_policy_name = (*it_ap).first;
+ bool is_default_policy = "default" == app_policy_name ? true : false;
+ if (is_default_policy) {
+ app_policies_sqlquery.Bind(1, "null");
+ app_policies_sqlquery.Bind(3, true);
+ } else {
+ app_policies_sqlquery.Bind(1, app_policy_name);
+ app_policies_sqlquery.Bind(3, false);
+ }
+
+ // Struct contains groups, nicknames, priority for application/default
+ // section
+ policy_table::ApplicationParams app_params = (*it_ap).second;
+
+ // Priority binding
+ app_policies_sqlquery.Bind(2, app_params.priority);
+ app_policies_sqlquery.Bind(2, "Dummy priority parameter");
+
+ // Add record to AppPolicies table
+ if (app_policies_sqlquery.Exec()) {
+ app_policies_sqlquery.Reset();
+ } else {
+ return false;
+ }
+
+ if (!is_default_policy) {
+ // Seems, there is generator issue with Optional type inheritance
+ // It should have pubic inheritance from type T to have array
+ // begin/end methods in its interface
+ // To be discussed with I.Kozyrenko
+
+ // policy_table::StringArray::const_iterator it_nicknames =
+ // app_params.nicknames.begin();
+ // policy_table::StringArray::const_iterator it_nicknames_end =
+ // app_params.nicknames.end();
+ //
+ // for (int nick_index = 0;it_nicknames != it_nicknames_end; ++
+ // it_nicknames, ++nick_index) {
+ // nicknames_sqlquery.Bind(0, nick_index);
+ // nicknames_sqlquery.Bind(1, app_policy_name);
+ //
+ // nicknames_sqlquery.Bind(2, (*it_nicknames));
+ //
+ // if (nicknames_sqlquery.Exec()) {
+ // nicknames_sqlquery.Reset();
+ // } else {
+ // return false;
+ // }
+ // }
+
+ policy_table::Strings::const_iterator it_groups =
+ app_params.groups.begin();
+ policy_table::Strings::const_iterator it_groups_end =
+ app_params.groups.end();
+
+ for (int group_index = 0; it_groups != it_groups_end;
+ ++it_groups, ++group_index) {
+ groups_sqlquery.Bind(0, group_index);
+ groups_sqlquery.Bind(1, app_policy_name);
+ groups_sqlquery.Bind(2, (*it_groups));
+
+ if (groups_sqlquery.Exec()) {
+ groups_sqlquery.Reset();
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+} // namespace policy_table_interface_base
+} // namespace rpc
+
+#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_GENERATED_CODE_WITH_SQLITE_TEST_H_
diff --git a/src/components/utils/test/include/utils/mock_timer_task.h b/src/components/utils/test/include/utils/mock_timer_task.h
new file mode 100644
index 0000000000..06ac893c81
--- /dev/null
+++ b/src/components/utils/test/include/utils/mock_timer_task.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_TIMER_TASK_H_
+#define SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_TIMER_TASK_H_
+
+#include "gmock/gmock.h"
+#include "utils/timer_task.h"
+
+namespace test {
+namespace components {
+namespace timer_test {
+
+class MockTimerTask : public timer::TimerTask {
+ public:
+ MOCK_CONST_METHOD0(run, void());
+};
+
+} // namespace timer_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_TIMER_TASK_H_
diff --git a/src/components/utils/test/signals_linux_test.cc b/src/components/utils/test/include/utils/test_handler.h
index 263f240ec8..34127b7bdd 100644
--- a/src/components/utils/test/signals_linux_test.cc
+++ b/src/components/utils/test/include/utils/test_handler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,26 +30,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <unistd.h>
-#include <assert.h>
-#include "gtest/gtest.h"
-#include "utils/signals.h"
+#include <queue>
+
+#include "utils/macro.h"
+#include "utils/threads/message_loop_thread.h"
namespace test {
namespace components {
-namespace utils {
-
-void handler(int sig) {
-}
+namespace utils_test {
-TEST(SignalsLinuxTest, SubscribeToTerminateSignal_Positive) {
- ASSERT_TRUE(::utils::SubscribeToTerminateSignal(handler));
-}
+typedef std::queue<bool> BoolQueue;
+typedef threads::MessageLoopThread<BoolQueue> TestLoopThread;
-TEST(SignalsLinuxTest, SubscribeToFaultSignal_Positive) {
- ASSERT_TRUE(::utils::SubscribeToFaultSignal(handler));
-}
+class TestHandler : public TestLoopThread::Handler {
+ virtual void Handle(const BoolQueue::value_type test_value) OVERRIDE {}
+};
-} // namespace utils
-} // namespace components
-} // namespace test
+} // namespace utils_test
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/log_message_loop_thread_test.cc b/src/components/utils/test/log_message_loop_thread_test.cc
index 789bf62f45..14515961bb 100644
--- a/src/components/utils/test/log_message_loop_thread_test.cc
+++ b/src/components/utils/test/log_message_loop_thread_test.cc
@@ -42,34 +42,16 @@ namespace utils {
using namespace ::logger;
using ::testing::_;
-TEST(LogMessageLoopThread,CreateLogMessageSingleton) {
- //if logger_status is LoggerThreadNotCreated or LoggerThreadCreated,
- // creation of singleton will be impossible
- logger::logger_status = CreatingLoggerThread;
-
- LogMessageLoopThread *instance_1 = LogMessageLoopThread::instance();
- LogMessageLoopThread *instance_2 = LogMessageLoopThread::instance();
-
- //assert
- EXPECT_EQ(instance_1, instance_2);
-
- LogMessageLoopThread::destroy();
-
- EXPECT_FALSE(LogMessageLoopThread::exists());
- logger::logger_status = LoggerThreadNotCreated;
-}
-
TEST(LogMessageLoopThread, DestroyLogMessage_loggerStatusDeletingLogger) {
logger::logger_status = CreatingLoggerThread;
- LogMessageLoopThread::instance();
-
- //assert
+ LogMessageLoopThread* loop_thread = new LogMessageLoopThread();
+ // assert
EXPECT_EQ(CreatingLoggerThread, logger::logger_status);
- //act
- LogMessageLoopThread::destroy();
+ // act
+ delete loop_thread;
- //assert
+ // assert
EXPECT_EQ(DeletingLoggerThread, logger::logger_status);
logger::logger_status = LoggerThreadNotCreated;
@@ -84,10 +66,10 @@ TEST(LogMessageLoopThread, HandleNeverCalled) {
logger::logger_status = CreatingLoggerThread;
MockLogMessageTest mmock;
- EXPECT_CALL(mmock,Handle(_)).Times(0);
- LogMessageLoopThread::instance();
+ EXPECT_CALL(mmock, Handle(_)).Times(0);
+ LogMessageLoopThread* loop_thread = new LogMessageLoopThread();
- LogMessageLoopThread::destroy();
+ delete loop_thread;
logger::logger_status = LoggerThreadNotCreated;
}
diff --git a/src/components/utils/test/message_loop_thread_test.cc b/src/components/utils/test/message_loop_thread_test.cc
new file mode 100644
index 0000000000..c2a8c6851d
--- /dev/null
+++ b/src/components/utils/test/message_loop_thread_test.cc
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+#include "utils/test_handler.h"
+
+namespace test {
+namespace components {
+namespace utils_test {
+
+TEST(MessageLoopThreadTest, GetMessageQueueSize_AddValueToQueue_CorrectSize) {
+ TestHandler test_handler;
+ TestLoopThread message_loop_thread("test", &test_handler);
+
+ ASSERT_EQ(0u, message_loop_thread.GetMessageQueueSize());
+
+ message_loop_thread.PostMessage(true);
+ ASSERT_EQ(1u, message_loop_thread.GetMessageQueueSize());
+}
+
+} // namespace utils_test
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/message_queue_test.cc b/src/components/utils/test/message_queue_test.cc
index 8ce7196b07..d80016c6a8 100644
--- a/src/components/utils/test/message_queue_test.cc
+++ b/src/components/utils/test/message_queue_test.cc
@@ -43,21 +43,20 @@ using ::utils::MessageQueue;
class MessageQueueTest : public testing::Test {
public:
MessageQueueTest()
- : test_val_1("Hello,"),
- test_val_2("Beautiful "),
- test_val_3("World!"),
- test_line(""),
- check_value(false) {
- }
+ : test_val_1("Hello,")
+ , test_val_2("Beautiful ")
+ , test_val_3("World!")
+ , test_line("")
+ , check_value(false) {}
void add_one_element_to_queue();
void extract_from_queue();
void add_three_elements_to_queue();
void ShutDownQueue();
- static void* add_one_element_to_queue_helper(void *context);
- static void* extract_from_queue_helper(void *context);
- static void* add_three_elements_to_queue_helper(void *context);
- static void* ShutDownQueue_helper(void *context);
+ static void* add_one_element_to_queue_helper(void* context);
+ static void* extract_from_queue_helper(void* context);
+ static void* add_three_elements_to_queue_helper(void* context);
+ static void* ShutDownQueue_helper(void* context);
protected:
MessageQueue<std::string> test_queue;
@@ -96,20 +95,20 @@ void MessageQueueTest::ShutDownQueue() {
pthread_exit(NULL);
}
-void* MessageQueueTest::add_one_element_to_queue_helper(void *context) {
- (reinterpret_cast<MessageQueueTest *>(context))->add_one_element_to_queue();
+void* MessageQueueTest::add_one_element_to_queue_helper(void* context) {
+ (reinterpret_cast<MessageQueueTest*>(context))->add_one_element_to_queue();
return NULL;
}
-void* MessageQueueTest::extract_from_queue_helper(void *context) {
- (reinterpret_cast<MessageQueueTest *>(context))->extract_from_queue();
+void* MessageQueueTest::extract_from_queue_helper(void* context) {
+ (reinterpret_cast<MessageQueueTest*>(context))->extract_from_queue();
return NULL;
}
-void* MessageQueueTest::add_three_elements_to_queue_helper(void *context) {
- (reinterpret_cast<MessageQueueTest *>(context))->add_three_elements_to_queue();
+void* MessageQueueTest::add_three_elements_to_queue_helper(void* context) {
+ (reinterpret_cast<MessageQueueTest*>(context))->add_three_elements_to_queue();
return NULL;
}
-void* MessageQueueTest::ShutDownQueue_helper(void *context) {
- (reinterpret_cast<MessageQueueTest *>(context))->ShutDownQueue();
+void* MessageQueueTest::ShutDownQueue_helper(void* context) {
+ (reinterpret_cast<MessageQueueTest*>(context))->ShutDownQueue();
return NULL;
}
@@ -119,9 +118,13 @@ TEST_F(MessageQueueTest, DefaultCtorTest_ExpectEmptyQueueCreated) {
ASSERT_EQ(test_value, test_queue.empty());
}
-TEST_F(MessageQueueTest, MessageQueuePushThreeElementsTest_ExpectThreeElementsAdded) {
+TEST_F(MessageQueueTest,
+ MessageQueuePushThreeElementsTest_ExpectThreeElementsAdded) {
pthread_t thread1;
- pthread_create(&thread1, NULL, &MessageQueueTest::add_three_elements_to_queue_helper, this);
+ pthread_create(&thread1,
+ NULL,
+ &MessageQueueTest::add_three_elements_to_queue_helper,
+ this);
pthread_join(thread1, NULL);
// check if 3 elements were added successfully
ASSERT_EQ(3u, test_queue.size());
@@ -140,12 +143,15 @@ TEST_F(MessageQueueTest, NotEmptyMessageQueueResetTest_ExpectEmptyQueue) {
ASSERT_EQ(0u, test_queue.size());
}
-TEST_F(MessageQueueTest, MessageQueuePopOneElementTest_ExpectOneElementRemovedFromQueue) {
+TEST_F(MessageQueueTest,
+ MessageQueuePopOneElementTest_ExpectOneElementRemovedFromQueue) {
pthread_t thread1;
pthread_t thread2;
// Creating threads with thread function mentioned above
- pthread_create(&thread1, NULL, &MessageQueueTest::add_one_element_to_queue_helper, this);
- pthread_create(&thread2, NULL, &MessageQueueTest::extract_from_queue_helper, this);
+ pthread_create(
+ &thread1, NULL, &MessageQueueTest::add_one_element_to_queue_helper, this);
+ pthread_create(
+ &thread2, NULL, &MessageQueueTest::extract_from_queue_helper, this);
// Primary thread waits until thread 2 to be finished
pthread_join(thread2, NULL);
// Check if first element was removed successfully
@@ -154,7 +160,8 @@ TEST_F(MessageQueueTest, MessageQueuePopOneElementTest_ExpectOneElementRemovedFr
ASSERT_EQ(0u, test_queue.size());
}
-TEST_F(MessageQueueTest, MessageQueueShutdownTest_ExpectMessageQueueWillBeShutDown) {
+TEST_F(MessageQueueTest,
+ MessageQueueShutdownTest_ExpectMessageQueueWillBeShutDown) {
pthread_t thread1;
// Creating thread with thread function mentioned above
pthread_create(&thread1, NULL, &MessageQueueTest::ShutDownQueue_helper, this);
diff --git a/src/components/utils/test/messagemeter_test.cc b/src/components/utils/test/messagemeter_test.cc
index 6c13ab345e..69db658542 100644
--- a/src/components/utils/test/messagemeter_test.cc
+++ b/src/components/utils/test/messagemeter_test.cc
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, Ford Motor Company
+* Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,44 +40,40 @@
#include "utils/messagemeter.h"
#include "utils/date_time.h"
-namespace test {
-namespace components {
-namespace utils {
+namespace test {
+namespace components {
+namespace utils {
// Pair of values <second, msecond>
typedef std::pair<int, int> TimePair;
-const TimePair testing_time_pairs[] = { TimePair(0, 50),
- TimePair(0, 100),
- TimePair(0, 200),
- TimePair(0, 500),
- TimePair(0, 900),
- TimePair(1, 0),
- TimePair(1, 500) };
-
-class MessageMeterTest: public ::testing::TestWithParam<TimePair> {
+const TimePair testing_time_pairs[] = {TimePair(0, 50),
+ TimePair(0, 100),
+ TimePair(0, 200),
+ TimePair(0, 500),
+ TimePair(0, 900),
+ TimePair(1, 0),
+ TimePair(1, 500)};
+
+class MessageMeterTest : public ::testing::TestWithParam<TimePair> {
protected:
void SetUp() OVERRIDE {
- usecs = date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ usecs = date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
id1 = 0x0;
id2 = 0xABCDEF;
id3 = 0xFEBCDA;
const TimePair time_pair = GetParam();
- EXPECT_GT(usecs,
- time_pair.second) << "Wrong time (msecs) value";
+ EXPECT_GT(usecs, time_pair.second) << "Wrong time (msecs) value";
time_range.tv_sec = time_pair.first;
time_range.tv_usec = time_pair.second * usecs;
- EXPECT_LT(0,
- date_time::DateTime::getuSecs(time_range))
+ EXPECT_LT(0, date_time::DateTime::getuSecs(time_range))
<< "Wrong test case with null range value";
meter.set_time_range(time_range);
- // Get range in msec less than original for correct waitng in tests
- time_range_msecs = date_time::DateTime::getmSecs(time_range) * 0.95;
- }
- void TearDown() OVERRIDE {
+ time_range_msecs = date_time::DateTime::getmSecs(time_range);
}
+ void TearDown() OVERRIDE {}
::utils::MessageMeter<int> meter;
TimevalStruct time_range = {0, 0};
int64_t time_range_msecs;
@@ -87,29 +83,28 @@ class MessageMeterTest: public ::testing::TestWithParam<TimePair> {
TEST(MessageMeterTest, DefaultTimeRange) {
const ::utils::MessageMeter<int> default_meter;
- const TimevalStruct time_second {1, 0};
+ const TimevalStruct time_second{1, 0};
EXPECT_EQ(time_second, default_meter.time_range());
}
TEST(MessageMeterTest, TimeRangeSetter) {
::utils::MessageMeter<int> meter;
- TimevalStruct time_range {0, 0};
+ TimevalStruct time_range{0, 0};
const int test_count_secs = 1000;
// Skip 1000th msec value as wrong for TimevalStruct
const int test_count_msecs = 999;
for (int sec = test_count_secs; sec >= 0; --sec) {
for (int msec = test_count_msecs; msec >= 0; --msec) {
time_range.tv_sec = sec;
- time_range.tv_usec = msec * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time_range.tv_usec =
+ msec * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
// Setter TimevalStruct
meter.set_time_range(time_range);
- EXPECT_EQ(time_range,
- meter.time_range()) << sec << "." << msec << " sec";
+ EXPECT_EQ(time_range, meter.time_range()) << sec << "." << msec << " sec";
// Setter mSecs
meter.set_time_range(sec * date_time::DateTime::MILLISECONDS_IN_SECOND +
msec);
- EXPECT_EQ(time_range,
- meter.time_range()) << sec << "." << msec << " sec";
+ EXPECT_EQ(time_range, meter.time_range()) << sec << "." << msec << " sec";
}
}
}
@@ -118,160 +113,148 @@ TEST(MessageMeterTest, AddingWithNullTimeRange) {
::utils::MessageMeter<int> meter;
const int id1 = 1;
const int id2 = 2;
- const TimevalStruct null_time_range {0, 0};
+ const TimevalStruct null_time_range{0, 0};
meter.set_time_range(null_time_range);
for (int i = 0; i < 10000; ++i) {
// 1st Connection
- EXPECT_EQ(0u,
- meter.TrackMessage(id1));
- EXPECT_EQ(0u,
- meter.Frequency(id1));
+ EXPECT_EQ(0u, meter.TrackMessage(id1));
+ EXPECT_EQ(0u, meter.Frequency(id1));
// 2d Connection
- EXPECT_EQ(0u,
- meter.TrackMessage(id2));
- EXPECT_EQ(0u,
- meter.Frequency(id2));
+ EXPECT_EQ(0u, meter.TrackMessage(id2));
+ EXPECT_EQ(0u, meter.Frequency(id2));
}
}
-TEST_P(MessageMeterTest, AddingOverPeriod) {
+TEST_P(MessageMeterTest, TrackMessage_AddingOverPeriod_CorrectCountOfMessages) {
size_t messages = 0;
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
// Add messages for less range period
- while (date_time::DateTime::calculateTimeSpan(start_time)
- < time_range_msecs) {
+ int64_t time_span;
+ while ((time_span = date_time::DateTime::calculateTimeSpan(start_time)) <
+ time_range_msecs) {
++messages;
- EXPECT_EQ(messages,
- meter.TrackMessage(id1));
- EXPECT_EQ(messages,
- meter.Frequency(id1));
+
+ size_t tracked_frequency = meter.TrackMessage(id1);
+ size_t frequency = meter.Frequency(id1);
+
+ EXPECT_GE(messages, tracked_frequency)
+ << "Tracked messages can`t be over cycles.";
+
+ if (messages > frequency) {
+ EXPECT_GE(time_range_msecs, time_span);
+ break;
+ }
+ EXPECT_EQ(tracked_frequency, frequency);
}
}
-TEST_P(MessageMeterTest, AddingOverPeriod_MultiIds) {
+TEST_P(MessageMeterTest,
+ TrackMessage_AddingOverPeriodMultiIds_CorrectCountOfMessages) {
size_t messages = 0;
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
// Add messages for less range period
- while (date_time::DateTime::calculateTimeSpan(start_time)
- < time_range_msecs) {
+ int64_t time_span;
+ while ((time_span = date_time::DateTime::calculateTimeSpan(start_time)) <
+ time_range_msecs) {
++messages;
- // 1st Connection
- EXPECT_EQ(messages,
- meter.TrackMessage(id1));
- EXPECT_EQ(messages,
- meter.Frequency(id1));
- // 2d Connection
- EXPECT_EQ(messages,
- meter.TrackMessage(id2));
- EXPECT_EQ(messages,
- meter.Frequency(id2));
-
- // 3d Connection
- EXPECT_EQ(messages,
- meter.TrackMessage(id3));
- EXPECT_EQ(messages,
- meter.Frequency(id3));
+ size_t tracked_frequency_id1 = meter.TrackMessage(id1);
+ size_t tracked_frequency_id2 = meter.TrackMessage(id2);
+ size_t tracked_frequency_id3 = meter.TrackMessage(id3);
+ size_t frequency_id1 = meter.Frequency(id1);
+ size_t frequency_id2 = meter.Frequency(id2);
+ size_t frequency_id3 = meter.Frequency(id3);
+
+ EXPECT_GE(messages, tracked_frequency_id1)
+ << "Tracked messages can`t be over cycles.";
+ EXPECT_GE(messages, tracked_frequency_id2)
+ << "Tracked messages can`t be over cycles.";
+ EXPECT_GE(messages, tracked_frequency_id3)
+ << "Tracked messages can`t be over cycles.";
+
+ if (messages > frequency_id1 || messages > frequency_id2 ||
+ messages > frequency_id3) {
+ EXPECT_GE(time_range_msecs, time_span);
+ break;
+ }
+ EXPECT_EQ(tracked_frequency_id1, frequency_id1);
+ EXPECT_EQ(tracked_frequency_id2, frequency_id2);
+ EXPECT_EQ(tracked_frequency_id3, frequency_id3);
}
}
-TEST_P(MessageMeterTest, CountingOverPeriod) {
+TEST_P(MessageMeterTest, Frequency_CountingOverPeriod_CorrectCountOfMessages) {
const size_t one_message = 1;
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
- EXPECT_EQ(one_message,
- meter.TrackMessage(id1));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id2));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id3));
- const int sleep_usecs = 500;
+ EXPECT_EQ(one_message, meter.TrackMessage(id1));
+ EXPECT_EQ(one_message, meter.TrackMessage(id2));
+ EXPECT_EQ(one_message, meter.TrackMessage(id3));
+
// Check messages count over period
- while (date_time::DateTime::calculateTimeSpan(start_time)
- < time_range_msecs) {
- usleep(sleep_usecs);
- EXPECT_EQ(one_message,
- meter.Frequency(id1));
- EXPECT_EQ(one_message,
- meter.Frequency(id2));
- EXPECT_EQ(one_message,
- meter.Frequency(id3));
+ int64_t time_span;
+ while ((time_span = date_time::DateTime::calculateTimeSpan(start_time)) <
+ time_range_msecs) {
+ usleep(time_range_msecs);
+
+ if (one_message != meter.Frequency(id1) ||
+ one_message != meter.Frequency(id2) ||
+ one_message != meter.Frequency(id3)) {
+ EXPECT_GE(time_range_msecs, time_span);
+ break;
+ }
}
}
TEST_P(MessageMeterTest, CountingOutOfPeriod) {
const size_t one_message = 1;
- EXPECT_EQ(one_message,
- meter.TrackMessage(id1));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id2));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id3));
+ EXPECT_EQ(one_message, meter.TrackMessage(id1));
+ EXPECT_EQ(one_message, meter.TrackMessage(id2));
+ EXPECT_EQ(one_message, meter.TrackMessage(id3));
// sleep more than time range
usleep(time_range_msecs * usecs * 1.1);
- EXPECT_EQ(0u,
- meter.Frequency(id1));
- EXPECT_EQ(0u,
- meter.Frequency(id2));
- EXPECT_EQ(0u,
- meter.Frequency(id3));
+ EXPECT_EQ(0u, meter.Frequency(id1));
+ EXPECT_EQ(0u, meter.Frequency(id2));
+ EXPECT_EQ(0u, meter.Frequency(id3));
}
TEST_P(MessageMeterTest, ClearId) {
const size_t one_message = 1;
- EXPECT_EQ(one_message,
- meter.TrackMessage(id1));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id2));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id3));
+ EXPECT_EQ(one_message, meter.TrackMessage(id1));
+ EXPECT_EQ(one_message, meter.TrackMessage(id2));
+ EXPECT_EQ(one_message, meter.TrackMessage(id3));
meter.RemoveIdentifier(id1);
- EXPECT_EQ(0u,
- meter.Frequency(id1));
- EXPECT_EQ(one_message,
- meter.Frequency(id2));
- EXPECT_EQ(one_message,
- meter.Frequency(id3));
+ EXPECT_EQ(0u, meter.Frequency(id1));
+ EXPECT_EQ(one_message, meter.Frequency(id2));
+ EXPECT_EQ(one_message, meter.Frequency(id3));
meter.RemoveIdentifier(id2);
- EXPECT_EQ(0u,
- meter.Frequency(id1));
- EXPECT_EQ(0u,
- meter.Frequency(id2));
- EXPECT_EQ(one_message,
- meter.Frequency(id3));
+ EXPECT_EQ(0u, meter.Frequency(id1));
+ EXPECT_EQ(0u, meter.Frequency(id2));
+ EXPECT_EQ(one_message, meter.Frequency(id3));
meter.RemoveIdentifier(id3);
- EXPECT_EQ(0u,
- meter.Frequency(id1));
- EXPECT_EQ(0u,
- meter.Frequency(id2));
- EXPECT_EQ(0u,
- meter.Frequency(id3));
+ EXPECT_EQ(0u, meter.Frequency(id1));
+ EXPECT_EQ(0u, meter.Frequency(id2));
+ EXPECT_EQ(0u, meter.Frequency(id3));
}
TEST_P(MessageMeterTest, ClearIds) {
const size_t one_message = 1;
- EXPECT_EQ(one_message,
- meter.TrackMessage(id1));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id2));
- EXPECT_EQ(one_message,
- meter.TrackMessage(id3));
+ EXPECT_EQ(one_message, meter.TrackMessage(id1));
+ EXPECT_EQ(one_message, meter.TrackMessage(id2));
+ EXPECT_EQ(one_message, meter.TrackMessage(id3));
meter.ClearIdentifiers();
- EXPECT_EQ(0u,
- meter.Frequency(id2));
- EXPECT_EQ(0u,
- meter.Frequency(id2));
- EXPECT_EQ(0u,
- meter.Frequency(id3));
+ EXPECT_EQ(0u, meter.Frequency(id2));
+ EXPECT_EQ(0u, meter.Frequency(id2));
+ EXPECT_EQ(0u, meter.Frequency(id3));
}
INSTANTIATE_TEST_CASE_P(MessageMeterTestCase,
diff --git a/src/components/utils/test/posix_thread_test.cc b/src/components/utils/test/posix_thread_test.cc
index d597f036d0..f98794d08a 100644
--- a/src/components/utils/test/posix_thread_test.cc
+++ b/src/components/utils/test/posix_thread_test.cc
@@ -41,13 +41,14 @@ namespace utils {
using namespace sync_primitives;
using namespace threads;
-// TODO(AByzhynar): Change this to use Gtest class to create all variables for every TEST_F
+// TODO(AByzhynar): Change this to use Gtest class to create all variables for
+// every TEST_F
// TODO(AByzhynar): Add multithreading tests
namespace {
const uint32_t MAX_SIZE = 20;
const size_t MyStackSize = 32768;
-const char *threadName("test thread");
+const char* threadName("test thread");
const std::string test_thread_name("THREAD");
sync_primitives::ConditionalVariable cond_var_;
sync_primitives::Lock test_mutex_;
@@ -56,9 +57,7 @@ sync_primitives::Lock test_mutex_;
// ThreadDelegate successor
class TestThreadDelegate : public threads::ThreadDelegate {
public:
- TestThreadDelegate()
- : check_value_(false) {
- }
+ TestThreadDelegate() : check_value_(false) {}
void threadMain() {
AutoLock test_lock(test_mutex_);
check_value_ = true;
@@ -68,14 +67,15 @@ class TestThreadDelegate : public threads::ThreadDelegate {
bool check_value() const {
return check_value_;
}
+
private:
bool check_value_;
};
TEST(PosixThreadTest, CreateThread_ExpectThreadCreated) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
EXPECT_TRUE(thread != NULL);
@@ -89,8 +89,8 @@ TEST(PosixThreadTest, CreateThread_ExpectThreadCreated) {
TEST(PosixThreadTest, CheckCreatedThreadName_ExpectCorrectName) {
// Arrange
- threads::Thread *thread = NULL;
- threads::ThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ threads::ThreadDelegate* threadDelegate = new TestThreadDelegate();
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
// Check thread was created with correct name
@@ -100,10 +100,11 @@ TEST(PosixThreadTest, CheckCreatedThreadName_ExpectCorrectName) {
EXPECT_EQ(NULL, thread->delegate());
}
-TEST(PosixThreadTest, CheckCreatedThreadNameChangeToLongName_ExpectThreadNameReduced) {
+TEST(PosixThreadTest,
+ CheckCreatedThreadNameChangeToLongName_ExpectThreadNameReduced) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
@@ -124,14 +125,17 @@ TEST(PosixThreadTest, CheckCreatedThreadNameChangeToLongName_ExpectThreadNameRed
EXPECT_EQ(NULL, thread->delegate());
}
-TEST(PosixThreadTest, StartCreatedThreadWithOptionsJoinableAndMyStackSize_ExpectMyStackSizeStackAndJoinableThreadStarted) {
+TEST(
+ PosixThreadTest,
+ StartCreatedThreadWithOptionsJoinableAndMyStackSize_ExpectMyStackSizeStackAndJoinableThreadStarted) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
- // Start thread with following options (Stack size = 32768 & thread is joinable)
+ // Start thread with following options (Stack size = 32768 & thread is
+ // joinable)
thread->start(threads::ThreadOptions(MyStackSize));
// Check thread is joinable
EXPECT_TRUE(thread->is_joinable());
@@ -144,10 +148,12 @@ TEST(PosixThreadTest, StartCreatedThreadWithOptionsJoinableAndMyStackSize_Expect
EXPECT_EQ(NULL, thread->delegate());
}
-TEST(PosixThreadTest, StartCreatedThreadWithDefaultOptions_ExpectZeroStackAndJoinableThreadStarted) {
+TEST(
+ PosixThreadTest,
+ StartCreatedThreadWithDefaultOptions_ExpectZeroStackAndJoinableThreadStarted) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
@@ -164,10 +170,12 @@ TEST(PosixThreadTest, StartCreatedThreadWithDefaultOptions_ExpectZeroStackAndJoi
EXPECT_EQ(NULL, thread->delegate());
}
-TEST(PosixThreadTest, StartThreadWithZeroStackAndDetached_ExpectMinimumStackAndDetachedThreadStarted) {
+TEST(
+ PosixThreadTest,
+ StartThreadWithZeroStackAndDetached_ExpectMinimumStackAndDetachedThreadStarted) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
@@ -184,10 +192,12 @@ TEST(PosixThreadTest, StartThreadWithZeroStackAndDetached_ExpectMinimumStackAndD
EXPECT_EQ(NULL, thread->delegate());
}
-TEST(PosixThreadTest, DISABLED_CheckCreatedThreadNameChangeToEmpty_ExpectThreadNameChangedToEmpty) {
+TEST(
+ PosixThreadTest,
+ DISABLED_CheckCreatedThreadNameChangeToEmpty_ExpectThreadNameChangedToEmpty) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
@@ -208,10 +218,11 @@ TEST(PosixThreadTest, DISABLED_CheckCreatedThreadNameChangeToEmpty_ExpectThreadN
EXPECT_EQ(NULL, thread->delegate());
}
-TEST(PosixThreadTest, CheckCreatedThreadNameChangeToShortName_ExpectThreadNameChangedToShort) {
+TEST(PosixThreadTest,
+ CheckCreatedThreadNameChangeToShortName_ExpectThreadNameChangedToShort) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
@@ -235,13 +246,14 @@ TEST(PosixThreadTest, CheckCreatedThreadNameChangeToShortName_ExpectThreadNameCh
TEST(PosixThreadTest, StartThread_ExpectThreadStarted) {
// Arrange
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
// Start created thread
- EXPECT_TRUE(thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
+ EXPECT_TRUE(
+ thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
cond_var_.WaitFor(test_lock, 10000);
EXPECT_TRUE(threadDelegate->check_value());
DeleteThread(thread);
@@ -253,17 +265,19 @@ TEST(PosixThreadTest, StartOneThreadTwice_ExpectTheSameThreadStartedTwice) {
// Arrange
PlatformThreadHandle thread1_id;
PlatformThreadHandle thread2_id;
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
// Start created thread
- EXPECT_TRUE(thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
+ EXPECT_TRUE(
+ thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
thread1_id = thread->CurrentId();
thread->stop();
// Try to start thread again
- EXPECT_TRUE(thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
+ EXPECT_TRUE(
+ thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
thread2_id = thread->CurrentId();
EXPECT_EQ(thread1_id, thread2_id);
cond_var_.WaitFor(test_lock, 10000);
@@ -273,17 +287,19 @@ TEST(PosixThreadTest, StartOneThreadTwice_ExpectTheSameThreadStartedTwice) {
EXPECT_EQ(NULL, thread->delegate());
}
-TEST(PosixThreadTest, StartOneThreadAgainAfterRename_ExpectRenamedThreadStarted) {
+TEST(PosixThreadTest,
+ StartOneThreadAgainAfterRename_ExpectRenamedThreadStarted) {
// Arrange
PlatformThreadHandle thread1_id;
PlatformThreadHandle thread2_id;
- threads::Thread *thread = NULL;
- TestThreadDelegate *threadDelegate = new TestThreadDelegate();
+ threads::Thread* thread = NULL;
+ TestThreadDelegate* threadDelegate = new TestThreadDelegate();
AutoLock test_lock(test_mutex_);
// Create thread
ASSERT_NO_THROW(thread = CreateThread(threadName, threadDelegate));
// Start created thread
- EXPECT_TRUE(thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
+ EXPECT_TRUE(
+ thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
thread1_id = thread->CurrentId();
// Rename started thread. Name will be cut to 15 symbols + '\0'
// This is the limit in current POSIX thread implementation
@@ -295,7 +311,8 @@ TEST(PosixThreadTest, StartOneThreadAgainAfterRename_ExpectRenamedThreadStarted)
EXPECT_EQ(test_thread_name, std::string(name));
// Stop thread
thread->stop();
- EXPECT_TRUE(thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
+ EXPECT_TRUE(
+ thread->start(threads::ThreadOptions(threads::Thread::kMinStackSize)));
thread2_id = thread->CurrentId();
// Expect the same thread started with the the same name
EXPECT_EQ(test_thread_name, std::string(name));
diff --git a/src/components/utils/test/prioritized_queue_test.cc b/src/components/utils/test/prioritized_queue_test.cc
index 19e168cdce..ef105f6c4e 100644
--- a/src/components/utils/test/prioritized_queue_test.cc
+++ b/src/components/utils/test/prioritized_queue_test.cc
@@ -41,16 +41,13 @@ using ::utils::PrioritizedQueue;
class TestMessage {
public:
- TestMessage()
- : priority(0) {
- }
+ TestMessage() : priority(0) {}
TestMessage(std::string message, size_t msg_priority)
- : msg_(message),
- priority(msg_priority) {
- }
+ : msg_(message), priority(msg_priority) {}
size_t PriorityOrder() const;
std::string msg() const;
- friend bool operator==(const TestMessage &msg1, const TestMessage &msg2);
+ friend bool operator==(const TestMessage& msg1, const TestMessage& msg2);
+
private:
std::string msg_;
size_t priority;
@@ -64,9 +61,9 @@ std::string TestMessage::msg() const {
return msg_;
}
-bool operator==(const TestMessage &msg1, const TestMessage &msg2) {
- return (msg1.msg() == msg2.msg()
- && msg1.PriorityOrder() == msg2.PriorityOrder());
+bool operator==(const TestMessage& msg1, const TestMessage& msg2) {
+ return (msg1.msg() == msg2.msg() &&
+ msg1.PriorityOrder() == msg2.PriorityOrder());
}
class PrioritizedQueueTest : public testing::Test {
@@ -108,13 +105,15 @@ TEST_F(PrioritizedQueueTest, AddFourElementsTest_ExpectQueueNotEmpty) {
EXPECT_FALSE(test_queue.empty());
}
-TEST_F(PrioritizedQueueTest, CheckMessageOrder_ExpectMessageWithHighestPriorityAddedFirst) {
+TEST_F(PrioritizedQueueTest,
+ CheckMessageOrder_ExpectMessageWithHighestPriorityAddedFirst) {
// Creating 4 messages with different priorities
TestMessage message1("Ford", 111);
TestMessage message2("Hello", 21);
TestMessage message3("Luxoft", 14);
TestMessage message4("from", 4);
- // Adding created messages to Prioritized queue. Expect queue ordered according priority
+ // Adding created messages to Prioritized queue. Expect queue ordered
+ // according priority
test_queue.push(message4);
test_queue.push(message3);
test_queue.push(message1);
@@ -123,7 +122,8 @@ TEST_F(PrioritizedQueueTest, CheckMessageOrder_ExpectMessageWithHighestPriorityA
EXPECT_EQ(message1, test_queue.front());
}
-TEST_F(PrioritizedQueueTest, Push_AddMessagesWithEqualPriority_ExpectMessagesWithEqualPriorityAdded) {
+TEST_F(PrioritizedQueueTest,
+ Push_AddMessagesWithEqualPriority_ExpectMessagesWithEqualPriorityAdded) {
// Creating 2 messages with the same priorities
TestMessage message1("Hello", 111);
TestMessage message2("Luxoft", 111);
@@ -134,14 +134,17 @@ TEST_F(PrioritizedQueueTest, Push_AddMessagesWithEqualPriority_ExpectMessagesWit
EXPECT_EQ(2u, test_queue.size());
}
-TEST_F(PrioritizedQueueTest, Pop_OneElementInPriorityQueue_ExpectQueueStillAliveWithRestMessagesWithEqualPriority) {
+TEST_F(
+ PrioritizedQueueTest,
+ Pop_OneElementInPriorityQueue_ExpectQueueStillAliveWithRestMessagesWithEqualPriority) {
// Creating 4 messages with same priorities
TestMessage message1("Ford's", 111);
TestMessage message2("Partner", 111);
// Adding created messages to Prioritized queue.
test_queue.push(message1);
test_queue.push(message2);
- // Expect 2 messages were added successfully to One element of prioritized queue
+ // Expect 2 messages were added successfully to One element of prioritized
+ // queue
EXPECT_EQ(2u, test_queue.size());
// Extracting first element from the queue
EXPECT_EQ(message1, test_queue.front());
@@ -153,7 +156,9 @@ TEST_F(PrioritizedQueueTest, Pop_OneElementInPriorityQueue_ExpectQueueStillAlive
EXPECT_EQ(0u, test_queue.size());
}
-TEST_F(PrioritizedQueueTest, Pop_TwoElementsInPriorityQueue_ExpectElementErasedIfOnlyOneWithConcretePriorityExist) {
+TEST_F(
+ PrioritizedQueueTest,
+ Pop_TwoElementsInPriorityQueue_ExpectElementErasedIfOnlyOneWithConcretePriorityExist) {
// Creating 2 messages with same priority and 1 with different
TestMessage message1("Hello", 111);
TestMessage message2("Luxoft", 111);
@@ -162,7 +167,8 @@ TEST_F(PrioritizedQueueTest, Pop_TwoElementsInPriorityQueue_ExpectElementErasedI
test_queue.push(message1);
test_queue.push(message2);
test_queue.push(message3);
- // Expect 3 messages were added successfully to Two elements of prioritized queue
+ // Expect 3 messages were added successfully to Two elements of prioritized
+ // queue
EXPECT_EQ(3u, test_queue.size());
// Extracting first element from the queue
EXPECT_EQ(message1, test_queue.front());
@@ -177,7 +183,8 @@ TEST_F(PrioritizedQueueTest, Pop_TwoElementsInPriorityQueue_ExpectElementErasedI
EXPECT_EQ(0u, test_queue.size());
}
-TEST_F(PrioritizedQueueTest, NotEmptyPrioritizedQueuePopElement_ExpectQueueDecreasedOneElement) {
+TEST_F(PrioritizedQueueTest,
+ NotEmptyPrioritizedQueuePopElement_ExpectQueueDecreasedOneElement) {
// Creating 4 prioritized messages
TestMessage message1("Alice", 111);
TestMessage message2("in", 14);
diff --git a/src/components/utils/test/qdb_wrapper/sql_database_test.cc b/src/components/utils/test/qdb_wrapper/sql_database_test.cc
new file mode 100644
index 0000000000..881141f18c
--- /dev/null
+++ b/src/components/utils/test/qdb_wrapper/sql_database_test.cc
@@ -0,0 +1,139 @@
+/* Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <cstdlib>
+
+#include "gtest/gtest.h"
+
+#include "qdb_wrapper/sql_error.h"
+#include "qdb_wrapper/sql_database.h"
+
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
+
+namespace test {
+namespace components {
+namespace utils {
+namespace dbms {
+
+::testing::AssertionResult IsError(SQLError error) {
+ if (error.number() != ::utils::dbms::OK) {
+ return ::testing::AssertionSuccess() << error.text();
+ } else {
+ return ::testing::AssertionFailure() << error.text();
+ }
+}
+
+TEST(SQLDatabaseTest, OpenClose) {
+ SQLDatabase db("test-database");
+ bool ret = db.Open();
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+
+ db.Close();
+ EXPECT_FALSE(IsError(db.LastError()));
+}
+
+TEST(SQLDatabaseTest, DoubleOpen) {
+ SQLDatabase db("test-database");
+ bool ret = db.Open();
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+ ret = db.Open();
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+ db.Close();
+}
+
+TEST(SQLDatabaseTest, DoubleClose) {
+ SQLDatabase db("test-database");
+ bool ret = db.Open();
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+
+ db.Close();
+ EXPECT_FALSE(IsError(db.LastError()));
+ db.Close();
+ EXPECT_FALSE(IsError(db.LastError()));
+}
+
+TEST(SQLDatabaseTest, CloseWithoutOpen) {
+ SQLDatabase db("test-database");
+ db.Close();
+ EXPECT_FALSE(IsError(db.LastError()));
+}
+
+TEST(SQLDatabaseTest, CommitTransaction) {
+ SQLDatabase db("test-database");
+ ASSERT_TRUE(db.Open());
+ EXPECT_TRUE(db.BeginTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+ EXPECT_TRUE(db.CommitTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+ db.Close();
+}
+
+TEST(SQLDatabaseTest, RollbackTransaction) {
+ SQLDatabase db("test-database");
+ ASSERT_TRUE(db.Open());
+ EXPECT_TRUE(db.BeginTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+ EXPECT_TRUE(db.RollbackTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+ db.Close();
+}
+
+TEST(SQLDatabaseTest, FailedCommitTransaction) {
+ SQLDatabase db("test-database");
+ ASSERT_TRUE(db.Open());
+ EXPECT_FALSE(db.CommitTransaction());
+ EXPECT_TRUE(IsError(db.LastError()));
+ db.Close();
+}
+
+TEST(SQLDatabaseTest, FailedRollbackTransaction) {
+ SQLDatabase db("test-database");
+ ASSERT_TRUE(db.Open());
+ EXPECT_FALSE(db.RollbackTransaction());
+ EXPECT_TRUE(IsError(db.LastError()));
+ db.Close();
+}
+
+TEST(SQLDatabaseTest, BadTransaction) {
+ SQLDatabase db("test-database");
+ EXPECT_FALSE(db.BeginTransaction());
+ EXPECT_TRUE(IsError(db.LastError()));
+}
+
+} // namespace dbms
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/qdb_wrapper/sql_query_test.cc b/src/components/utils/test/qdb_wrapper/sql_query_test.cc
new file mode 100644
index 0000000000..6c866ffb9d
--- /dev/null
+++ b/src/components/utils/test/qdb_wrapper/sql_query_test.cc
@@ -0,0 +1,311 @@
+/* Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <qdb/qdb.h>
+#include <string>
+
+#include "gtest/gtest.h"
+
+#include "qdb_wrapper/sql_error.h"
+#include "qdb_wrapper/sql_database.h"
+#include "qdb_wrapper/sql_query.h"
+
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLQuery;
+
+namespace test {
+namespace components {
+namespace utils {
+namespace dbms {
+
+class SQLQueryTest : public ::testing::Test {
+ protected:
+ static qdb_hdl_t* conn;
+ static const std::string kDatabaseName;
+
+ static void SetUpTestCase() {
+ conn = qdb_connect(kDatabaseName.c_str(), 0);
+ ASSERT_TRUE(conn);
+ int ret = qdb_statement(conn,
+ "CREATE TABLE testTable (integerValue INTEGER,"
+ " doubleValue REAL, stringValue TEXT)");
+ ASSERT_NE(-1, ret);
+ }
+
+ static void TearDownTestCase() {
+ qdb_statement(conn, "DROP TABLE IF EXISTS testTable");
+ qdb_disconnect(conn);
+ }
+
+ void SetUp() {
+ qdb_statement(conn, "DELETE FROM testTable");
+ }
+
+ ::testing::AssertionResult IsError(SQLError error) {
+ if (error.number() != ::policy::dbms::OK) {
+ return ::testing::AssertionSuccess() << error.text();
+ } else {
+ return ::testing::AssertionFailure() << error.text();
+ }
+ }
+};
+
+qdb_hdl_t* SQLQueryTest::conn = 0;
+const std::string SQLQueryTest::kDatabaseName = "test-query";
+
+TEST_F(SQLQueryTest, Query) {
+ const std::string kSelect("SELECT * FROM testTable WHERE integerValue = ?");
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ query.Prepare(kSelect);
+ EXPECT_STREQ(kSelect.c_str(), query.query().c_str());
+}
+
+TEST_F(SQLQueryTest, ExecString) {
+ const std::string kInsert(
+ "INSERT INTO testTable"
+ " (integerValue, doubleValue, stringValue)"
+ " VALUES(1, 1.1, 'one-один')");
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Exec(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, BindInteger) {
+ const std::string kInsert("INSERT INTO testTable (integerValue) VALUES (?)");
+ const int kIntegerValue = 2;
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0, kIntegerValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, BindDouble) {
+ const std::string kInsert("INSERT INTO testTable (doubleValue) VALUES (?)");
+ const double kDoubleValue = 3.3;
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0, kDoubleValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, BindString) {
+ const std::string kInsert("INSERT INTO testTable (stringValue) VALUES (?)");
+ const std::string kStringValue = "four-четыре";
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0, kStringValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, BindAllTypes) {
+ const std::string kInsert(
+ "INSERT INTO testTable (integerValue, doubleValue,"
+ " stringValue) VALUES (?, ?, ?)");
+ const int kIntegerValue = 5;
+ const double kDoubleValue = 5.5;
+ const std::string kStringValue = "five-пять";
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0, kIntegerValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(1, kDoubleValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(2, kStringValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, Value) {
+ const char* insert =
+ "INSERT INTO testTable "
+ "(integerValue, doubleValue, stringValue) "
+ "VALUES (6, 6.6, 'six-шесть');";
+ ASSERT_NE(-1, qdb_statement(conn, insert));
+
+ const std::string kSelect(
+ "SELECT integerValue, doubleValue, stringValue"
+ " FROM testTable WHERE integerValue = 6");
+ const int kIntegerValue = 6;
+ const double kDoubleValue = 6.6;
+ const std::string kStringValue = "six-шесть";
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Prepare(kSelect));
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_EQ(kIntegerValue, query.GetInteger(0));
+ EXPECT_EQ(kDoubleValue, query.GetDouble(1));
+ EXPECT_EQ(kStringValue, query.GetString(2));
+ EXPECT_FALSE(query.Next());
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, EmptySelect) {
+ const std::string kSelect(
+ "SELECT integerValue, doubleValue, stringValue"
+ " FROM testTable WHERE 0");
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Prepare(kSelect));
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, NextAndBind) {
+ const char* insert =
+ "INSERT INTO testTable "
+ "(integerValue, doubleValue, stringValue) "
+ "VALUES (7, 7.7, 'seven-семь');";
+ ASSERT_NE(-1, qdb_statement(conn, insert));
+
+ const std::string kSelect(
+ "SELECT integerValue, doubleValue, stringValue"
+ " FROM testTable WHERE integerValue = ?");
+ const int kIntegerValue = 7;
+ const double kDoubleValue = 7.7;
+ const std::string kStringValue = "seven-семь";
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ ASSERT_TRUE(query.Prepare(kSelect));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0, kIntegerValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ ASSERT_FALSE(IsError(query.LastError()));
+ EXPECT_EQ(kIntegerValue, query.GetInteger(0));
+ EXPECT_EQ(kDoubleValue, query.GetDouble(1));
+ EXPECT_EQ(kStringValue, query.GetString(2));
+ EXPECT_FALSE(query.Next());
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, LastInsertId) {
+ const char* create =
+ "CREATE TABLE idTable ( "
+ "id INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "value TEXT)";
+ ASSERT_NE(-1, qdb_statement(conn, create));
+
+ const int64_t kExpectId = 1;
+ const std::string kValue("Test last id of insert row");
+ const std::string kInsert("INSERT INTO idTable (value) VALUES(?)");
+
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ ASSERT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0, kValue);
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ ASSERT_FALSE(IsError(query.LastError()));
+ EXPECT_EQ(kExpectId, query.LastInsertId());
+
+ ASSERT_NE(-1, qdb_statement(conn, "DROP TABLE idTable"));
+}
+
+TEST_F(SQLQueryTest, BindNull) {
+ const std::string kInsert(
+ "INSERT INTO testTable (`integerValue`)"
+ " VALUES (?)");
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ ASSERT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0);
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ ASSERT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, DoublePrepare) {
+ SQLDatabase* db = new SQLDatabase(kDatabaseName);
+ ASSERT_TRUE(db->Open());
+
+ SQLQuery query(db);
+ EXPECT_TRUE(query.Prepare("SELECT * FROM testTable"));
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Prepare("SELECT * FROM testTable"));
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+} // namespace dbms
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/resource_usage_test.cc b/src/components/utils/test/resource_usage_test.cc
index cac5dc2e31..96b4fe4b49 100644
--- a/src/components/utils/test/resource_usage_test.cc
+++ b/src/components/utils/test/resource_usage_test.cc
@@ -60,25 +60,24 @@ TEST_F(ResourceUsagePrivateTest, GetMemInfoTest) {
}
TEST_F(ResourceUsagePrivateTest, GetStatPathTest_FileExists) {
- //arrange
+ // arrange
std::string filename = res.GetStatPath();
- //assert
+ // assert
EXPECT_TRUE(file_system::FileExists(filename));
}
TEST_F(ResourceUsagePrivateTest, GetStatPathTest_ReadFile) {
- //arrange
+ // arrange
std::string filename = res.GetStatPath();
std::string output;
- //assert
+ // assert
EXPECT_TRUE(file_system::ReadFile(filename, output));
-
}
TEST_F(ResourceUsagePrivateTest, GetProcPathTest) {
- ///arrange
+ /// arrange
std::string fd = res.GetProcPath();
std::string filename = res.GetStatPath();
- //assert
+ // assert
EXPECT_EQ(filename, fd + "/stat");
}
}
@@ -88,7 +87,8 @@ namespace components {
namespace utils_test {
TEST(ResourceUsageTest, SuccesfulGrabResources) {
- ::utils::ResourseUsage* resources = ::utils::Resources::getCurrentResourseUsage();
+ ::utils::ResourseUsage* resources =
+ ::utils::Resources::getCurrentResourseUsage();
EXPECT_TRUE(resources != NULL);
delete resources;
}
diff --git a/src/components/utils/test/rwlock_posix_test.cc b/src/components/utils/test/rwlock_posix_test.cc
index 779b57ff32..6cb140f4c5 100644
--- a/src/components/utils/test/rwlock_posix_test.cc
+++ b/src/components/utils/test/rwlock_posix_test.cc
@@ -72,20 +72,20 @@ class RWlockTest : public ::testing::Test {
}
}
- static void* ReadLock_helper(void *context) {
- RWlockTest *temp = reinterpret_cast<RWlockTest *>(context);
+ static void* ReadLock_helper(void* context) {
+ RWlockTest* temp = reinterpret_cast<RWlockTest*>(context);
temp->ReadLock();
return NULL;
}
- static void* TryReadLock_helper(void *context) {
- RWlockTest *temp = reinterpret_cast<RWlockTest *>(context);
+ static void* TryReadLock_helper(void* context) {
+ RWlockTest* temp = reinterpret_cast<RWlockTest*>(context);
temp->ExpectReadLockFail();
return NULL;
}
- static void* TryWriteLock_helper(void *context) {
- RWlockTest *temp = reinterpret_cast<RWlockTest *>(context);
+ static void* TryWriteLock_helper(void* context) {
+ RWlockTest* temp = reinterpret_cast<RWlockTest*>(context);
temp->ExpectWriteLockFail();
return NULL;
}
@@ -101,7 +101,8 @@ TEST_F(RWlockTest, AcquireForReading_ExpectAccessForReading) {
EXPECT_TRUE(test_rwlock.AcquireForReading());
// Try to lock rw lock for reading again
EXPECT_TRUE(test_rwlock.AcquireForReading());
- // Creating kNumThreads threads, starting them with callback function, waits until all of them finished
+ // Creating kNumThreads threads, starting them with callback function, waits
+ // until all of them finished
ThreadsDispatcher(&RWlockTest::ReadLock_helper);
// Releasing RW locks
EXPECT_TRUE(test_rwlock.Release());
@@ -113,7 +114,8 @@ TEST_F(RWlockTest, AcquireForReading_ExpectNoAccessForWriting) {
EXPECT_TRUE(test_rwlock.AcquireForReading());
// Try to lock rw lock for writing
EXPECT_FALSE(test_rwlock.TryAcquireForWriting());
- // Creating kNumThreads threads, starting them with callback function, waits until all of them finished
+ // Creating kNumThreads threads, starting them with callback function, waits
+ // until all of them finished
ThreadsDispatcher(&RWlockTest::TryWriteLock_helper);
EXPECT_TRUE(test_rwlock.Release());
}
@@ -123,7 +125,8 @@ TEST_F(RWlockTest, AcquireForWriting_ExpectNoAccessForReading) {
EXPECT_TRUE(test_rwlock.AcquireForWriting());
// Try to lock rw lock for reading
EXPECT_FALSE(test_rwlock.TryAcquireForReading());
- // Creating kNumThreads threads, starting them with callback function, waits until all of them finished
+ // Creating kNumThreads threads, starting them with callback function, waits
+ // until all of them finished
ThreadsDispatcher(&RWlockTest::TryReadLock_helper);
EXPECT_TRUE(test_rwlock.Release());
}
@@ -133,7 +136,8 @@ TEST_F(RWlockTest, AcquireForWriting_ExpectNoMoreAccessForWriting) {
EXPECT_TRUE(test_rwlock.AcquireForWriting());
// Try to lock rw lock for reading
EXPECT_FALSE(test_rwlock.TryAcquireForWriting());
- // Creating kNumThreads threads, starting them with callback function, waits until all of them finished
+ // Creating kNumThreads threads, starting them with callback function, waits
+ // until all of them finished
ThreadsDispatcher(&RWlockTest::TryWriteLock_helper);
EXPECT_TRUE(test_rwlock.Release());
}
diff --git a/src/components/utils/test/shared_ptr_test.cc b/src/components/utils/test/shared_ptr_test.cc
index 92d867fe76..85682073aa 100644
--- a/src/components/utils/test/shared_ptr_test.cc
+++ b/src/components/utils/test/shared_ptr_test.cc
@@ -42,20 +42,20 @@ namespace utils {
namespace SharedPtrTest {
class CMockObject {
- public:
- CMockObject(int id);
- virtual ~CMockObject();
- virtual int getId() const;
+ public:
+ CMockObject(int id);
+ virtual ~CMockObject();
+ virtual int getId() const;
- MOCK_METHOD0(destructor, void ());
+ MOCK_METHOD0(destructor, void());
- private:
- int mId_;
+ private:
+ int mId_;
};
class CExtendedMockObject : public CMockObject {
- public:
- CExtendedMockObject(int id);
+ public:
+ CExtendedMockObject(int id);
};
} // namespace CMockObject
@@ -66,9 +66,7 @@ class CExtendedMockObject : public CMockObject {
using namespace test::components::utils::SharedPtrTest;
using ::testing::NiceMock;
-CMockObject::CMockObject(int id)
- : mId_(id) {
-}
+CMockObject::CMockObject(int id) : mId_(id) {}
CMockObject::~CMockObject() {
destructor();
@@ -78,9 +76,7 @@ int CMockObject::getId() const {
return mId_;
}
-CExtendedMockObject::CExtendedMockObject(int id)
- : CMockObject(id) {
-}
+CExtendedMockObject::CExtendedMockObject(int id) : CMockObject(id) {}
typedef utils::SharedPtr<CMockObject> tMockObjectPtr;
typedef utils::SharedPtr<CExtendedMockObject> tExtendedMockObjectPtr;
@@ -120,9 +116,9 @@ TEST(SharedPtrTest, CopyConstructorTest) {
ASSERT_EQ(1, p3->getId());
ASSERT_EQ(3u, *(p3.get_ReferenceCounter()));
{
- tMockObjectPtr p4 = p3;
- ASSERT_EQ(1, p4->getId());
- ASSERT_EQ(4u, *(p3.get_ReferenceCounter()));
+ tMockObjectPtr p4 = p3;
+ ASSERT_EQ(1, p4->getId());
+ ASSERT_EQ(4u, *(p3.get_ReferenceCounter()));
}
// Check reference counter decreased
ASSERT_EQ(3u, *(p3.get_ReferenceCounter()));
@@ -283,10 +279,9 @@ TEST(SharedPtrTest, LessThanOperatorTest) {
// Checks
if (object1 < object2) {
- ASSERT_TRUE(p1 < p2);
- }
- else {
- ASSERT_FALSE(p1 < p2);
+ ASSERT_TRUE(p1 < p2);
+ } else {
+ ASSERT_FALSE(p1 < p2);
}
EXPECT_CALL(*object1, destructor());
@@ -309,7 +304,8 @@ TEST(SharedPtrTest, StaticPointerCastTest_DerivedToBase_ExpectCastOk) {
ASSERT_EQ(2, ep1->getId());
ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
// Cast from SharedPtr to Derived class to SharedPtr to Base class
- p1 = utils::SharedPtr<CExtendedMockObject>::static_pointer_cast< CMockObject >(ep1);
+ p1 = utils::SharedPtr<CExtendedMockObject>::static_pointer_cast<CMockObject>(
+ ep1);
// Checks
ASSERT_EQ(2, p1->getId());
ASSERT_EQ(2u, *(p1.get_ReferenceCounter()));
@@ -334,7 +330,8 @@ TEST(SharedPtrTest, StaticPointerCastTest_BaseToDerived_ExpectCastOk) {
ASSERT_EQ(2, ep1->getId());
ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
// Cast from SharedPtr to Base class to SharedPtr to Derived class
- ep1 = utils::SharedPtr<CMockObject>::static_pointer_cast<CExtendedMockObject>(p1);
+ ep1 = utils::SharedPtr<CMockObject>::static_pointer_cast<CExtendedMockObject>(
+ p1);
// Checks
ASSERT_EQ(1, ep1->getId());
ASSERT_EQ(2u, *(ep1.get_ReferenceCounter()));
@@ -359,7 +356,8 @@ TEST(SharedPtrTest, DynamicPointerCastTest_DerivedToBase_ExpectCastOk) {
ASSERT_EQ(2, ep1->getId());
ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
// Cast from SharedPtr to Derived class to SharedPtr to Base class
- p1 = utils::SharedPtr<CExtendedMockObject>::dynamic_pointer_cast< CMockObject >(ep1);
+ p1 = utils::SharedPtr<CExtendedMockObject>::dynamic_pointer_cast<CMockObject>(
+ ep1);
// Checks
ASSERT_EQ(2, p1->getId());
ASSERT_EQ(2u, *(p1.get_ReferenceCounter()));
@@ -384,7 +382,9 @@ TEST(SharedPtrTest, DynamicPointerCastTest_BaseToDerived_ExpectNullPtr) {
ASSERT_EQ(2, ep1->getId());
ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
// Cast from SharedPtr to Base class to SharedPtr to Derived class
- ep1 = utils::SharedPtr<CMockObject>::dynamic_pointer_cast<CExtendedMockObject>(p1);
+ ep1 =
+ utils::SharedPtr<CMockObject>::dynamic_pointer_cast<CExtendedMockObject>(
+ p1);
// Checks
ASSERT_EQ(NULL, ep1);
@@ -539,6 +539,7 @@ TEST(SharedPtrTest, StressTest) {
}
}
}
- printf("%zu objects created, %zu pointers copied\n", objectCreated,
+ printf("%zu objects created, %zu pointers copied\n",
+ objectCreated,
pointersCopied);
}
diff --git a/src/components/utils/test/singleton_test.cc b/src/components/utils/test/singleton_test.cc
index 8a9e6b31e1..3bad45a7d7 100644
--- a/src/components/utils/test/singleton_test.cc
+++ b/src/components/utils/test/singleton_test.cc
@@ -42,7 +42,6 @@ using ::utils::Singleton;
class SingletonTest : public ::utils::Singleton<SingletonTest> {
public:
-
void SetValue(int value) {
test_value = value;
}
@@ -50,128 +49,129 @@ class SingletonTest : public ::utils::Singleton<SingletonTest> {
return test_value;
}
- FRIEND_BASE_SINGLETON_CLASS (SingletonTest);
+ FRIEND_BASE_SINGLETON_CLASS(SingletonTest);
+
private:
int test_value;
};
TEST(SingletonTest, CreateAndDestroySingleton) {
- //assert
+ // assert
ASSERT_EQ(SingletonTest::instance(), SingletonTest::instance());
ASSERT_EQ(0, SingletonTest::instance()->GetValue());
ASSERT_TRUE(SingletonTest::exists());
SingletonTest::instance()->SetValue(5);
ASSERT_EQ(5, SingletonTest::instance()->GetValue());
- //act
+ // act
SingletonTest::destroy();
- //assert
+ // assert
ASSERT_FALSE(SingletonTest::exists());
}
TEST(SingletonTest, DestroySingletonTwice) {
- //assert
+ // assert
ASSERT_EQ(0, SingletonTest::instance()->GetValue());
ASSERT_TRUE(SingletonTest::exists());
- //act
+ // act
SingletonTest::destroy();
- //assert
+ // assert
ASSERT_FALSE(SingletonTest::exists());
- //act
+ // act
SingletonTest::destroy();
- //assert
+ // assert
ASSERT_FALSE(SingletonTest::exists());
}
TEST(SingletonTest, DeleteSingletonCreateAnother) {
- //arrange
+ // arrange
SingletonTest::instance()->SetValue(10);
- //assert
+ // assert
ASSERT_TRUE(SingletonTest::exists());
ASSERT_EQ(10, SingletonTest::instance()->GetValue());
- //act
+ // act
SingletonTest::destroy();
- //assert
+ // assert
ASSERT_FALSE(SingletonTest::exists());
- //act
+ // act
SingletonTest::instance();
- //assert
+ // assert
ASSERT_EQ(0, SingletonTest::instance()->GetValue());
ASSERT_TRUE(SingletonTest::exists());
SingletonTest::destroy();
}
void* func_pthread1(void*) {
- SingletonTest* singleton_in_other_thread = SingletonTest::instance();
+ SingletonTest* singleton_in_other_thread = SingletonTest::instance();
pthread_exit(singleton_in_other_thread);
return NULL;
}
-void* func_pthread2(void * value) {
- SingletonTest * instance = reinterpret_cast<SingletonTest *>(value);
+void* func_pthread2(void* value) {
+ SingletonTest* instance = reinterpret_cast<SingletonTest*>(value);
instance->destroy();
- pthread_exit (NULL);
+ pthread_exit(NULL);
return NULL;
}
TEST(SingletonTest, CreateSingletonInDifferentThreads) {
- //arrange
+ // arrange
SingletonTest::instance();
ASSERT_TRUE(SingletonTest::exists());
pthread_t thread1;
pthread_create(&thread1, NULL, func_pthread1, NULL);
- void *instance2;
+ void* instance2;
pthread_join(thread1, &instance2);
- SingletonTest * instance_2 = reinterpret_cast<SingletonTest *>(instance2);
+ SingletonTest* instance_2 = reinterpret_cast<SingletonTest*>(instance2);
- //assert
+ // assert
ASSERT_EQ(SingletonTest::instance(), instance_2);
- //act
+ // act
SingletonTest::destroy();
- //assert
+ // assert
ASSERT_FALSE(SingletonTest::exists());
}
TEST(SingletonTest, CreateDeleteSingletonInDifferentThreads) {
- //arrange
+ // arrange
pthread_t thread1;
pthread_create(&thread1, NULL, func_pthread1, NULL);
pthread_t thread2;
pthread_create(&thread2, NULL, func_pthread1, NULL);
- void *instance1;
+ void* instance1;
pthread_join(thread1, &instance1);
- SingletonTest * instance_1 = reinterpret_cast<SingletonTest *>(instance1);
+ SingletonTest* instance_1 = reinterpret_cast<SingletonTest*>(instance1);
- void *instance2;
+ void* instance2;
pthread_join(thread2, &instance2);
- SingletonTest * instance_2 = reinterpret_cast<SingletonTest *>(instance2);
+ SingletonTest* instance_2 = reinterpret_cast<SingletonTest*>(instance2);
- //assert
+ // assert
ASSERT_TRUE(instance_1->exists());
ASSERT_TRUE(instance_2->exists());
ASSERT_EQ(instance_1, instance_2);
- //act
+ // act
SingletonTest::destroy();
- //assert
+ // assert
ASSERT_FALSE(instance_1->exists());
ASSERT_FALSE(instance_2->exists());
}
TEST(SingletonTest, DeleteSingletonInDifferentThread) {
- //arrange
+ // arrange
SingletonTest::instance();
ASSERT_TRUE(SingletonTest::exists());
@@ -180,7 +180,7 @@ TEST(SingletonTest, DeleteSingletonInDifferentThread) {
pthread_join(thread1, NULL);
- //assert
+ // assert
ASSERT_FALSE(SingletonTest::exists());
}
diff --git a/src/components/utils/test/smartDeviceLink.ini b/src/components/utils/test/smartDeviceLink.ini
new file mode 100644
index 0000000000..8172b3dea6
--- /dev/null
+++ b/src/components/utils/test/smartDeviceLink.ini
@@ -0,0 +1,19 @@
+; The INI-file consists of different chapters.
+; Each chapter begins with the line containing
+; the name in square brackets. Syntax:
+; [chapter]
+; The chapters consists of a set of items with a
+; assigned value. The syntax is:
+; item=value
+; All white spaces an second encounters of chapters
+; or items will be ignored.
+; Remarks start with semicolon or star as first character.
+; It is allowed for names of chapters and items to
+; contain semicolon and star. Possible syntax is:
+; [ chapter ] ;Remark
+; item = value ;Remark
+
+[MAIN]
+
+; All logging event could be dropped by setting $LogsEnabled to false
+LogsEnabled = true
diff --git a/src/components/utils/test/sqlite_wrapper/sql_database_test.cc b/src/components/utils/test/sqlite_wrapper/sql_database_test.cc
new file mode 100644
index 0000000000..bd278a863f
--- /dev/null
+++ b/src/components/utils/test/sqlite_wrapper/sql_database_test.cc
@@ -0,0 +1,223 @@
+/* Copyright (c) 2014, Ford Motor Company
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of the Ford Motor Company nor the names of its contributors
+* may be used to endorse or promote products derived from this software
+* without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "gtest/gtest.h"
+#include "utils/sqlite_wrapper/sql_error.h"
+#include "utils/sqlite_wrapper/sql_database.h"
+
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
+
+namespace test {
+namespace components {
+namespace utils {
+namespace dbms {
+
+::testing::AssertionResult IsError(SQLError error) {
+ if (error.number() != ::utils::dbms::OK) {
+ return ::testing::AssertionSuccess() << error.text();
+ } else {
+ return ::testing::AssertionFailure() << error.text();
+ }
+}
+
+TEST(SQLDatabaseTest, OpenCloseMemory_OpenAndCloseDB_ActsWithoutError) {
+ // arrange
+ SQLDatabase db;
+ bool ret = db.Open();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+
+ // act
+ db.Close();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+}
+
+TEST(SQLDatabaseTest, OpenCloseFile_OpenAndCloseSpecifiedDB_ActsWithoutError) {
+ // arrange
+ SQLDatabase db("test-database");
+ bool ret = db.Open();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+
+ // act
+ db.Close();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+
+ remove("test-database.sqlite");
+}
+
+TEST(SQLDatabaseTest, OpenDBTwice_NoError) {
+ // arrange
+ SQLDatabase db;
+ bool ret = db.Open();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+
+ // act
+ ret = db.Open();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+
+ db.Close();
+}
+
+TEST(SQLDatabaseTest, CloseDBTwice_NoError) {
+ // arrange
+ SQLDatabase db;
+ bool ret = db.Open();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+ ASSERT_TRUE(ret);
+
+ // act
+ db.Close();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+
+ // act
+ db.Close();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+}
+
+TEST(SQLDatabaseTest, Close_DBWasNotOpened_NoError) {
+ // act
+ SQLDatabase db;
+ db.Close();
+
+ // assert
+ EXPECT_FALSE(IsError(db.LastError()));
+}
+
+TEST(SQLDatabaseTest,
+ CommitTransaction_StartAndCommitTransaction_ExpectActsWithoutError) {
+ // arrange
+ SQLDatabase db;
+
+ // assert
+ ASSERT_TRUE(db.Open());
+ EXPECT_TRUE(db.BeginTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+ EXPECT_TRUE(db.CommitTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+
+ db.Close();
+}
+
+TEST(SQLDatabaseTest,
+ RollbackTransaction_StartAndRollbackTransaction_ExpectActsWithoutError) {
+ // arrange
+ SQLDatabase db;
+
+ // assert
+ ASSERT_TRUE(db.Open());
+ EXPECT_TRUE(db.BeginTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+ EXPECT_TRUE(db.RollbackTransaction());
+ EXPECT_FALSE(IsError(db.LastError()));
+
+ db.Close();
+}
+
+TEST(SQLDatabaseTest,
+ FailedCommitTransaction_CommitTransactionWithoutBeginning_ExpectError) {
+ // arrange
+ SQLDatabase db;
+
+ // assert
+ ASSERT_TRUE(db.Open());
+ EXPECT_FALSE(db.CommitTransaction());
+ EXPECT_TRUE(IsError(db.LastError()));
+
+ db.Close();
+}
+
+TEST(
+ SQLDatabaseTest,
+ FailedRollbackTransaction_RollbackTransactionWithoutBeginning_ExpectError) {
+ // arrange
+ SQLDatabase db;
+
+ // assert
+ ASSERT_TRUE(db.Open());
+ EXPECT_FALSE(db.RollbackTransaction());
+ EXPECT_TRUE(IsError(db.LastError()));
+
+ db.Close();
+}
+
+TEST(SQLDatabaseTest, BadTransaction_BeginTransitionWithoutOpenDB_ExpectError) {
+ // arrange
+ SQLDatabase db;
+
+ // assert
+ EXPECT_FALSE(db.BeginTransaction());
+ EXPECT_TRUE(IsError(db.LastError()));
+}
+
+TEST(SQLDatabaseTest, IsReadWrite_FirstOpenDBIsRWSecondIsNot) {
+ // arrange
+ SQLDatabase db("test-database");
+
+ // assert
+ ASSERT_TRUE(db.Open());
+ EXPECT_TRUE(db.IsReadWrite());
+ db.Close();
+ chmod("test-database.sqlite", S_IRUSR);
+
+ // assert
+ ASSERT_TRUE(db.Open());
+ EXPECT_FALSE(db.IsReadWrite());
+
+ db.Close();
+ remove("test-database.sqlite");
+}
+
+} // namespace dbms
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/sqlite_wrapper/sql_query_test.cc b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc
new file mode 100644
index 0000000000..958fed93fa
--- /dev/null
+++ b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc
@@ -0,0 +1,380 @@
+/* Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string>
+#include <sqlite3.h>
+
+#include "gtest/gtest.h"
+
+#include "utils/sqlite_wrapper/sql_error.h"
+#include "utils/sqlite_wrapper/sql_database.h"
+#include "utils/sqlite_wrapper/sql_query.h"
+
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLQuery;
+
+namespace test {
+namespace components {
+namespace utils {
+namespace dbms {
+
+class SQLQueryTest : public ::testing::Test {
+ protected:
+ static sqlite3* conn;
+ static const std::string kDatabaseName;
+
+ static void SetUpTestCase() {
+ sqlite3_open((kDatabaseName + ".sqlite").c_str(), &conn);
+ sqlite3_exec(conn,
+ "CREATE TABLE testTable (integerValue INTEGER,"
+ " doubleValue REAL, stringValue TEXT)",
+ NULL,
+ NULL,
+ NULL);
+ }
+
+ static void TearDownTestCase() {
+ sqlite3_close(conn);
+ remove((kDatabaseName + ".sqlite").c_str());
+ }
+
+ void SetUp() {
+ sqlite3_exec(conn, "DELETE FROM testTable", NULL, NULL, NULL);
+ }
+
+ ::testing::AssertionResult IsError(SQLError error) {
+ if (error.number() != ::utils::dbms::OK) {
+ return ::testing::AssertionSuccess() << error.text();
+ } else {
+ return ::testing::AssertionFailure() << error.text();
+ }
+ }
+
+ ::testing::AssertionResult IsDone(SQLError error) {
+ if (error.number() == ::utils::dbms::DONE) {
+ return ::testing::AssertionSuccess() << error.text();
+ } else {
+ return ::testing::AssertionFailure() << error.text();
+ }
+ }
+
+ ::testing::AssertionResult IsRow(SQLError error) {
+ if (error.number() == ::utils::dbms::ROW) {
+ return ::testing::AssertionSuccess() << error.text();
+ } else {
+ return ::testing::AssertionFailure() << error.text();
+ }
+ }
+};
+
+sqlite3* SQLQueryTest::conn = 0;
+const std::string SQLQueryTest::kDatabaseName = "test-query";
+
+TEST_F(SQLQueryTest, Query_CreateQuery_QueryInDBEqualCreated) {
+ // arrange
+ const std::string kSelect("SELECT * FROM testTable WHERE integerValue = ?");
+ SQLDatabase db(kDatabaseName);
+
+ // assert
+ ASSERT_TRUE(db.Open());
+
+ // act
+ SQLQuery query(&db);
+ query.Prepare(kSelect);
+
+ // assert
+ EXPECT_STREQ(kSelect.c_str(), query.query().c_str());
+}
+
+TEST_F(SQLQueryTest, ExecString_ExecuteQuery_ActWithoutError) {
+ // arrange
+ const std::string kInsert(
+ "INSERT INTO testTable"
+ " (integerValue, doubleValue, stringValue)"
+ " VALUES(2, 3.4, 'five-пять')");
+ SQLDatabase db(kDatabaseName);
+ // assert
+ ASSERT_TRUE(db.Open());
+
+ // act
+ SQLQuery query(&db);
+
+ // assert
+ EXPECT_TRUE(query.Exec(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+TEST_F(SQLQueryTest,
+ Bind_BindSeveralQueries_ExpectExecutedQueriesWithoutErrors) {
+ // arrange
+ const std::string kInsert1("INSERT INTO testTable (integerValue) VALUES (?)");
+ const std::string kInsert2("INSERT INTO testTable (doubleValue) VALUES (?)");
+ const std::string kInsert3("INSERT INTO testTable (stringValue) VALUES (?)");
+ const std::string kInsert4(
+ "INSERT INTO testTable (integerValue, doubleValue,"
+ " stringValue) VALUES (?, ?, ?)");
+ const int kIntegerValue = 1;
+ const double kDoubleValue = 2.3;
+ const std::string kStringValue = "four";
+
+ SQLDatabase db(kDatabaseName);
+
+ // assert
+ ASSERT_TRUE(db.Open());
+
+ // act
+ SQLQuery query1(&db);
+
+ // assert
+ EXPECT_TRUE(query1.Prepare(kInsert1));
+ EXPECT_FALSE(IsError(query1.LastError()));
+ query1.Bind(0, kIntegerValue);
+
+ // assert
+ EXPECT_FALSE(IsError(query1.LastError()));
+ EXPECT_TRUE(query1.Exec());
+ EXPECT_TRUE(IsDone(query1.LastError()));
+
+ // act
+ SQLQuery query2(&db);
+ // assert
+ EXPECT_TRUE(query2.Prepare(kInsert2));
+ EXPECT_FALSE(IsError(query2.LastError()));
+ query2.Bind(0, kDoubleValue);
+ // assert
+ EXPECT_FALSE(IsError(query2.LastError()));
+ EXPECT_TRUE(query2.Exec());
+ EXPECT_TRUE(IsDone(query2.LastError()));
+
+ // act
+ SQLQuery query3(&db);
+ EXPECT_TRUE(query3.Prepare(kInsert3));
+ EXPECT_FALSE(IsError(query3.LastError()));
+ query3.Bind(0, kStringValue);
+ // assert
+ EXPECT_FALSE(IsError(query3.LastError()));
+ EXPECT_TRUE(query3.Exec());
+ EXPECT_TRUE(IsDone(query3.LastError()));
+
+ // act
+ SQLQuery query4(&db);
+ // assert
+ EXPECT_TRUE(query4.Prepare(kInsert4));
+ EXPECT_FALSE(IsError(query4.LastError()));
+ query4.Bind(0, kIntegerValue);
+ query4.Bind(1, kDoubleValue);
+ query4.Bind(2, kStringValue);
+ // assert
+ EXPECT_FALSE(IsError(query4.LastError()));
+ EXPECT_TRUE(query4.Exec());
+ EXPECT_TRUE(IsDone(query4.LastError()));
+}
+
+TEST_F(SQLQueryTest, SetValue_InsertValues_ExpectDBHasInsertedValues) {
+ // arrange
+ const char* insert =
+ "INSERT INTO testTable "
+ "(integerValue, doubleValue, stringValue) "
+ "VALUES (1, 2.3, 'four');";
+
+ // assert
+ ASSERT_EQ(SQLITE_OK, sqlite3_exec(conn, insert, NULL, NULL, NULL));
+
+ // act
+ const std::string kSelect(
+ "SELECT integerValue, doubleValue, stringValue"
+ " FROM testTable");
+ const int kIntegerValue = 1;
+ const double kDoubleValue = 2.3;
+ const std::string kStringValue = "four";
+
+ SQLDatabase db(kDatabaseName);
+
+ // assert
+ ASSERT_TRUE(db.Open());
+
+ // act
+ SQLQuery query(&db);
+
+ // assert
+ EXPECT_TRUE(query.Prepare(kSelect));
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_TRUE(IsRow(query.LastError()));
+ EXPECT_EQ(kIntegerValue, query.GetInteger(0));
+ EXPECT_EQ(kDoubleValue, query.GetDouble(1));
+ EXPECT_EQ(kStringValue, query.GetString(2));
+ EXPECT_FALSE(query.Next());
+ EXPECT_TRUE(IsDone(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, EmptySelect_SelectValuesEqual0_ExecWithoutErrors) {
+ // arrange
+ const std::string kSelect(
+ "SELECT integerValue, doubleValue, stringValue"
+ " FROM testTable WHERE 0");
+ SQLDatabase db(kDatabaseName);
+
+ // assert
+ ASSERT_TRUE(db.Open());
+
+ // act
+ SQLQuery query(&db);
+
+ // assert
+ EXPECT_TRUE(query.Prepare(kSelect));
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_TRUE(IsDone(query.LastError()));
+}
+
+TEST_F(
+ SQLQueryTest,
+ NextAndBind_InsertValuesAndBindQuery_ExecWithoutErrorsAndBindingQueryIsLast) {
+ // arrange
+ const char* insert =
+ "INSERT INTO testTable "
+ "(integerValue, doubleValue, stringValue) "
+ "VALUES (1, 2.3, 'four');";
+
+ // assert
+ ASSERT_EQ(SQLITE_OK, sqlite3_exec(conn, insert, NULL, NULL, NULL));
+
+ const std::string kSelect(
+ "SELECT integerValue, doubleValue, stringValue"
+ " FROM testTable WHERE stringValue = ?");
+
+ // act
+ const int kIntegerValue = 1;
+ const double kDoubleValue = 2.3;
+ const std::string kStringValue = "four";
+
+ SQLDatabase db(kDatabaseName);
+ ASSERT_TRUE(db.Open());
+
+ SQLQuery query(&db);
+
+ // assert
+ ASSERT_TRUE(query.Prepare(kSelect));
+ EXPECT_FALSE(IsError(query.LastError()));
+ // act
+ query.Bind(0, kStringValue);
+ // assert
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ ASSERT_TRUE(IsRow(query.LastError()));
+ EXPECT_EQ(kIntegerValue, query.GetInteger(0));
+ EXPECT_EQ(kDoubleValue, query.GetDouble(1));
+ EXPECT_EQ(kStringValue, query.GetString(2));
+ EXPECT_FALSE(query.Next());
+ EXPECT_TRUE(IsDone(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, LastInsertId_InsertValuesAndBindQuery_GetExpectedId) {
+ // arrange
+ const char* create =
+ "CREATE TABLE idTable ( "
+ "id INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "value TEXT)";
+
+ // assert
+ ASSERT_EQ(SQLITE_OK, sqlite3_exec(conn, create, NULL, NULL, NULL));
+
+ const int64_t kExpectId = 1;
+ const std::string kValue("Test last id of insert row");
+ const std::string kInsert("INSERT INTO idTable (value) VALUES(?)");
+
+ // act
+ SQLDatabase db(kDatabaseName);
+
+ // assert
+ ASSERT_TRUE(db.Open());
+
+ // act
+ SQLQuery query(&db);
+
+ // assert
+ ASSERT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+
+ // act
+ query.Bind(0, kValue);
+ // assert
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ ASSERT_TRUE(IsDone(query.LastError()));
+ EXPECT_EQ(kExpectId, query.LastInsertId());
+
+ ASSERT_EQ(SQLITE_OK,
+ sqlite3_exec(conn, "DROP TABLE idTable", NULL, NULL, NULL));
+}
+
+TEST_F(SQLQueryTest, BindNull_BindWithoutValue_ActWithoutErrors) {
+ // arrange
+ const std::string kInsert(
+ "INSERT INTO testTable (`integerValue`)"
+ " VALUES (?)");
+ SQLDatabase db(kDatabaseName);
+ // assert
+ ASSERT_TRUE(db.Open());
+
+ // act
+ SQLQuery query(&db);
+
+ // assert
+ ASSERT_TRUE(query.Prepare(kInsert));
+ EXPECT_FALSE(IsError(query.LastError()));
+ query.Bind(0);
+ // assert
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Exec());
+ ASSERT_TRUE(IsDone(query.LastError()));
+}
+
+TEST_F(SQLQueryTest, DoublePrepare_TwicePrepareQuery_ActWithoutErrors) {
+ // arrange
+ SQLDatabase db(kDatabaseName);
+ // assert
+ ASSERT_TRUE(db.Open());
+ // act
+ SQLQuery query(&db);
+ // assert
+ EXPECT_TRUE(query.Prepare("SELECT * FROM testTable"));
+ EXPECT_FALSE(IsError(query.LastError()));
+ EXPECT_TRUE(query.Prepare("SELECT * FROM testTable"));
+ EXPECT_FALSE(IsError(query.LastError()));
+}
+
+} // namespace dbms
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/stl_utils_test.cc b/src/components/utils/test/stl_utils_test.cc
index dfc00de982..1fbde052f1 100644
--- a/src/components/utils/test/stl_utils_test.cc
+++ b/src/components/utils/test/stl_utils_test.cc
@@ -44,8 +44,7 @@ using ::utils::StlMapDeleter;
class TestObject {
public:
- ~TestObject() {
- }
+ ~TestObject() {}
};
typedef std::map<int, TestObject*> TestMap;
@@ -56,9 +55,7 @@ TEST(StlDeleter, DestructMapWithOneElement) {
test_map[1] = new TestObject();
EXPECT_EQ(1u, test_map.size());
- {
- StlMapDeleter<TestMap> test_list_deleter_(&test_map);
- }
+ { StlMapDeleter<TestMap> test_list_deleter_(&test_map); }
EXPECT_EQ(1u, test_map.size());
EXPECT_EQ(NULL, test_map[1]);
}
@@ -69,9 +66,7 @@ TEST(StlDeleter, DestructMapWithSeveralElements) {
test_map[2] = new TestObject();
EXPECT_EQ(2u, test_map.size());
- {
- StlMapDeleter<TestMap> test_list_deleter_(&test_map);
- }
+ { StlMapDeleter<TestMap> test_list_deleter_(&test_map); }
EXPECT_EQ(2u, test_map.size());
EXPECT_EQ(NULL, test_map[1]);
EXPECT_EQ(NULL, test_map[2]);
@@ -82,9 +77,7 @@ TEST(StlDeleter, DestructVectorWithOneElement) {
test_vector.push_back(new TestObject());
EXPECT_EQ(1u, test_vector.size());
- {
- StlCollectionDeleter<TestVector> test_list_deleter_(&test_vector);
- }
+ { StlCollectionDeleter<TestVector> test_list_deleter_(&test_vector); }
EXPECT_EQ(1u, test_vector.size());
EXPECT_EQ(NULL, test_vector[0]);
}
@@ -95,9 +88,7 @@ TEST(StlDeleter, DestructVectorWithSeveralElements) {
test_vector.push_back(new TestObject());
EXPECT_EQ(2u, test_vector.size());
- {
- StlCollectionDeleter<TestVector> test_list_deleter_(&test_vector);
- }
+ { StlCollectionDeleter<TestVector> test_list_deleter_(&test_vector); }
EXPECT_EQ(2u, test_vector.size());
EXPECT_EQ(NULL, test_vector[0]);
EXPECT_EQ(NULL, test_vector[1]);
diff --git a/src/components/utils/test/system_test.cc b/src/components/utils/test/system_test.cc
index 42307998b4..aced77f849 100644
--- a/src/components/utils/test/system_test.cc
+++ b/src/components/utils/test/system_test.cc
@@ -62,7 +62,6 @@ TEST(SystemTest, Constructor_WithFileNameCommandName_ExpectArgsStored) {
// Check if actual number of arguments arec correct
int vec_size = object.argv().size();
ASSERT_EQ(vec_size, 1); // Correct number of arguments is 1
-
}
TEST(SystemTest, AddTwoArgsToCommand_ExpectTwoArgsAdded) {
@@ -93,33 +92,39 @@ TEST(SystemTest, AddTwoArgsToCommand_CheckOrder_ExpectOrderCorrect) {
EXPECT_STREQ(object.argv()[2].c_str(), args[1]);
}
-
-
TEST(SystemTest, SynchronousInvokeWithExistingCommand_ExpectSuccessfull) {
const std::string test_command("./testscript.sh");
System object(test_command);
- // Check if Execute() method is working properly with synchronous command invoke
+ // Check if Execute() method is working properly with synchronous command
+ // invoke
ASSERT_TRUE(object.Execute(true));
}
-TEST(SystemTest, SynchronousInvokeWithEmptyCommand_IncorrectCommand_ExpectFailed) {
+TEST(SystemTest,
+ SynchronousInvokeWithEmptyCommand_IncorrectCommand_ExpectFailed) {
const std::string test_command(""); // any incorrect command
System object(test_command);
- // Check if Execute() method will fail with not correct command (synchronous command invoke)
+ // Check if Execute() method will fail with not correct command (synchronous
+ // command invoke)
ASSERT_FALSE(object.Execute(true));
}
TEST(SystemTest, ASynchronousInvokeEmptyCommand_InvokeSuccessfull) {
- const std::string test_command(""); // Possible to put here any command (existing or incorrect)
- const std::string test_list_args("anything"); // as command will never be executed from child process
- System object(test_command, test_list_args); // as parrent process does not wait for child process to be finished
-
- // Check if Execute() method is working properly with asynchronous command invoke
+ const std::string test_command(
+ ""); // Possible to put here any command (existing or incorrect)
+ const std::string test_list_args(
+ "anything"); // as command will never be executed from child process
+ System object(test_command, test_list_args); // as parrent process does not
+ // wait for child process to be
+ // finished
+
+ // Check if Execute() method is working properly with asynchronous command
+ // invoke
ASSERT_TRUE(object.Execute());
}
-} // namespace utils
-} // namespace components
-} // namespace test
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/test_generator/CMakeLists.txt b/src/components/utils/test/test_generator/CMakeLists.txt
new file mode 100644
index 0000000000..170fb3f10b
--- /dev/null
+++ b/src/components/utils/test/test_generator/CMakeLists.txt
@@ -0,0 +1,65 @@
+# Copyright (c) 2015, Ford Motor Company
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided with the
+# distribution.
+#
+# Neither the name of the Ford Motor Company nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+if(BUILD_TESTS)
+
+include_directories (
+ ${JSONCPP_INCLUDE_DIRECTORY}
+ ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include
+ ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include
+ ${CMAKE_SOURCE_DIR}/tools/interfaceGenerator
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${COMPONENTS_DIR}/utils/include/utils
+ ${COMPONENTS_DIR}/include/utils
+)
+
+set(full_xml_name "${CMAKE_CURRENT_SOURCE_DIR}/MOBILE_API.xml")
+
+add_custom_target( generate_version
+ COMMAND ${INTEFRACE_GENERATOR_CMD} ${full_xml_name} "mobile_apis"
+ ${CMAKE_CURRENT_BINARY_DIR} "--parser-type" "sdlrpcv2"
+ DEPENDS ${INTERFACE_GENERATOR_DEPENDENCIES} ${full_xml_name}
+ VERBATIM
+ )
+
+set(testLibraries
+ gmock
+ Utils
+)
+
+set(testSources
+ generated_msg_version_test.cc
+)
+
+file(COPY MOBILE_API.xml DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+create_test("generator_test" "${testSources}" "${testLibraries}")
+add_dependencies("generator_test" generate_version)
+
+endif()
diff --git a/src/components/utils/test/test_generator/MOBILE_API.xml b/src/components/utils/test/test_generator/MOBILE_API.xml
new file mode 100644
index 0000000000..01ea48dce9
--- /dev/null
+++ b/src/components/utils/test/test_generator/MOBILE_API.xml
@@ -0,0 +1,4999 @@
+<?xml version="1.0" standalone="no"?>
+<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>
+
+<interface name="Ford Sync RAPI" version="3.1" date="2015-11-13">
+
+ <enum name="Result" internal_scope="base">
+ <element name="SUCCESS">
+ <description>The request succeeded</description>
+ </element>
+ <element name="UNSUPPORTED_REQUEST">
+ <description>The request is not supported by Sync</description>
+ </element>
+ <element name="UNSUPPORTED_RESOURCE">
+ <description>
+ A button that was requested for subscription is not supported under the current system.
+ NOTE: could become a more generic UNSUPPORTED_RESOURCE by merging with VEHIVLE_DATA_NOT_AVAILABLE.
+ </description>
+ </element>
+ <element name="DISALLOWED">
+ <description>RPC is not authorized in local policy table.</description>
+ </element>
+ <element name="REJECTED">
+ <description>
+ The requested command was rejected, e.g. because mobile app is in background and cannot perform any HMI commands.
+ Or an HMI command (e.g. Speak) is rejected because a higher priority HMI command (e.g. Alert) is playing.
+ </description>
+ </element>
+ <element name="ABORTED">
+ <description>
+ A command was aborted, for example due to user interaction (e.g. user pressed button).
+ Or an HMI command (e.g. Speak) is aborted because a higher priority HMI command (e.g. Alert) was requested.
+ </description>
+ </element>
+ <element name="IGNORED">
+ <description>
+ A command was ignored, because the intended result is already in effect.
+ For example, SetMediaClockTimer was used to pause the media clock although the clock is paused already.
+ NOTE: potentially replaces SUBSCRIBED_ALREADY
+ </description>
+ </element>
+ <element name="RETRY">
+ <description>The user interrupted the RPC (e.g. PerformAudioPassThru) and indicated to start over. Note, the app must issue the new RPC.</description>
+ </element>
+ <element name="IN_USE">
+ <description>
+ The data may not be changed, because it is currently in use.
+ For example when trying to delete a command set that is currently involved in an interaction.
+ </description>
+ </element>
+ <element name="VEHICLE_DATA_NOT_AVAILABLE">
+ <description>The requested vehicle data is not available on this vehicle or is not published.</description>
+ </element>
+ <element name="TIMED_OUT">
+ <description>Overlay reached the maximum timeout and closed.</description>
+ </element>
+ <element name="INVALID_DATA">
+ <description>
+ The data sent is invalid. For example:
+ Invalid Json syntax
+ Parameters out of bounds (number or enum range)
+ Mandatory parameters not provided
+ Parameter provided with wrong type
+ Invalid characters
+ Empty string
+ </description>
+ </element>
+ <element name="CHAR_LIMIT_EXCEEDED"/>
+ <element name="INVALID_ID">
+ <description>
+ One of the provided IDs is not valid. For example
+ This applies to CorrelationID, SubscriptionID [@TODO if SubscriptionID is used], CommandID, MenuID, [@TODO: missed one?]
+ </description>
+ </element>
+ <element name="DUPLICATE_NAME">
+ <description>There was a conflict with an registered name (application or menu item) or vr command</description>
+ </element>
+ <element name="APPLICATION_NOT_REGISTERED">
+ <description>An command can not be executed because no application has been registered with RegisterApplication.</description>
+ </element>
+ <element name="WRONG_LANGUAGE">
+ <description>
+ The requested language is currently not supported.
+ Might be because of a mismatch of the currently active language on Sync and the requested language
+ </description>
+ </element>
+ <element name="OUT_OF_MEMORY">
+ <description>The system could not process the request because the necessary memory couldn't be allocated</description>
+ </element>
+ <element name="TOO_MANY_PENDING_REQUESTS">
+ <description>There are too many requests pending (means, that the response has not been delivered, yet).</description>
+ <designdescription>There may be a maximum of 1000 pending requests at a time.</designdescription>
+ </element>
+ <element name="TOO_MANY_APPLICATIONS">
+ <description>There are already too many registered applications</description>
+ </element>
+ <element name="APPLICATION_REGISTERED_ALREADY">
+ <description>RegisterApplication has been called again, after a RegisterApplication was successful before.</description>
+ </element>
+ <element name="WARNINGS">
+ <description>The RPC (e.g. SubscribeVehicleData) executed successfully but one or more items have a warning or failure.</description>
+ </element>
+ <element name="GENERIC_ERROR">
+ <description>Provided data is valid but something went wrong in the lower layers.</description>
+ </element>
+ <element name="USER_DISALLOWED">
+ <description>RPC is included in a functional group explicitly blocked by the user.</description>
+ </element>
+ <element name="UNSUPPORTED_VERSION">
+ <description>Sync doesn't support the protocol that is requested by the mobile application</description>
+ </element>
+ <element name="VEHICLE_DATA_NOT_ALLOWED">
+ <description>The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.</description>
+ </element>
+ <element name="FILE_NOT_FOUND">
+ <description>A specified file could not be found on Sync.</description>
+ </element>
+ <element name="CANCEL_ROUTE">
+ <description>User selected to Cancel Route.</description>
+ </element>
+ <element name="TRUNCATED_DATA">
+ <description>The RPC (e.g. ReadDID) executed successfully but the data exceeded the platform maximum threshold and thus, only part of the data is available.</description>
+ </element>
+ <element name="SAVED">
+ <description>The RPC (e.g. Slider) executed successfully and the user elected to save the current position / value.</description>
+ </element>
+ <element name="INVALID_CERT">
+ <description>The certificate provided during authentication is invalid.</description>
+ </element>
+ <element name="EXPIRED_CERT">
+ <description>The certificate provided during authentication is expired.</description>
+ </element>
+ <element name="RESUME_FAILED">
+ <description>The provided hash ID does not match the hash of the current set of registered data or the core could not resume the previous data.</description>
+ </element>
+ </enum>
+
+ <enum name="ButtonPressMode">
+ <element name="LONG">
+ <description>
+ A button was released, after it was pressed for a long time
+ Actual timing is defined by Sync and may vary
+ </description>
+ </element>
+ <element name="SHORT">
+ <description>
+ A button was released, after it was pressed for a short time
+ Actual timing is defined by Sync and may vary
+ </description>
+ </element>
+ </enum>
+
+ <enum name="ButtonEventMode">
+ <element name="BUTTONUP">
+ <description>A button has been released up</description>
+ </element>
+ <element name="BUTTONDOWN">
+ <description>A button has been pressed down</description>
+ </element>
+ </enum>
+
+ <enum name="Language">
+ <element name="EN-US" internal_name="EN_US">
+ <description>English - US</description>
+ </element>
+ <element name="ES-MX" internal_name="ES_MX">
+ <description>Spanish - Mexico</description>
+ </element>
+ <element name="FR-CA" internal_name="FR_CA">
+ <description>French - Canada</description>
+ </element>
+ <element name="DE-DE" internal_name="DE_DE">
+ <description>German - Germany</description>
+ </element>
+ <element name="ES-ES" internal_name="ES_ES">
+ <description>Spanish - Spain</description>
+ </element>
+ <element name="EN-GB" internal_name="EN_GB">
+ <description>English - GB</description>
+ </element>
+ <element name="RU-RU" internal_name="RU_RU">
+ <description>Russian - Russia</description>
+ </element>
+ <element name="TR-TR" internal_name="TR_TR">
+ <description>Turkish - Turkey</description>
+ </element>
+ <element name="PL-PL" internal_name="PL_PL">
+ <description>Polish - Poland</description>
+ </element>
+ <element name="FR-FR" internal_name="FR_FR">
+ <description>French - France</description>
+ </element>
+ <element name="IT-IT" internal_name="IT_IT">
+ <description>Italian - Italy</description>
+ </element>
+ <element name="SV-SE" internal_name="SV_SE">
+ <description>Swedish - Sweden</description>
+ </element>
+ <element name="PT-PT" internal_name="PT_PT">
+ <description>Portuguese - Portugal</description>
+ </element>
+ <element name="NL-NL" internal_name="NL_NL">
+ <description>Dutch (Standard) - Netherlands</description>
+ </element>
+ <element name="EN-AU" internal_name="EN_AU">
+ <description>English - Australia</description>
+ </element>
+ <element name="ZH-CN" internal_name="ZH_CN">
+ <description>Mandarin - China</description>
+ </element>
+ <element name="ZH-TW" internal_name="ZH_TW">
+ <description>Mandarin - Taiwan</description>
+ </element>
+ <element name="JA-JP" internal_name="JA_JP">
+ <description>Japanese - Japan</description>
+ </element>
+ <element name="AR-SA" internal_name="AR_SA">
+ <description>Arabic - Saudi Arabia</description>
+ </element>
+ <element name="KO-KR" internal_name="KO_KR">
+ <description>Korean - South Korea</description>
+ </element>
+ <element name="PT-BR" internal_name="PT_BR">
+ <description>Portuguese - Brazil</description>
+ </element>
+ <element name="CS-CZ" internal_name="CS_CZ">
+ <description>Czech - Czech Republic</description>
+ </element>
+ <element name="DA-DK" internal_name="DA_DK">
+ <description>Danish - Denmark</description>
+ </element>
+ <element name="NO-NO" internal_name="NO_NO">
+ <description>Norwegian - Norway</description>
+ </element>
+ <element name="NL-BE" internal_name="NL_BE">
+ <description>Dutch (Flemish) - Belgium</description>
+ </element>
+ <element name="EL-GR" internal_name="EL_GR">
+ <description>Greek - Greece</description>
+ </element>
+ <element name="HU-HU" internal_name="HU_HU">
+ <description>Hungarian - Hungary</description>
+ </element>
+ <element name="FI-FI" internal_name="FI_FI">
+ <description>Finnish - Finland</description>
+ </element>
+ <element name="SK-SK" internal_name="SK_SK">
+ <description>Slovak - Slovakia</description>
+ </element>
+</enum>
+
+ <enum name="UpdateMode">
+ <description>Describes how the media clock timer should behave on the platform</description>
+ <element name="COUNTUP" />
+ <description>Starts the media clock timer counting upwards, as in time elapsed.</description>
+ <element name="COUNTDOWN" />
+ <description>Starts the media clock timer counting downwards, as in time remaining.</description>
+ <element name="PAUSE" />
+ <description>Pauses the media clock timer</description>
+ <element name="RESUME" />
+ <description>Resume the media clock timer</description>
+ <element name="CLEAR" />
+ <description>Clears the media clock timer (previously done through Show->mediaClock)</description>
+ </enum>
+
+ <enum name="TimerMode">
+ <element name="UP" />
+ <description>Causes the media clock timer to update from 0:00 to a specified time</description>
+ <element name="DOWN" />
+ <description>Causes the media clock timer to update from a specified time to 0:00</description>
+ <element name="NONE" />
+ <description>Indicates to not use the media clock timer</description>
+ </enum>
+
+ <enum name="InteractionMode">
+ <description>For application-requested interactions, this mode indicates the method in which the user is notified and uses the interaction.</description>
+ <element name="MANUAL_ONLY" />
+ <description>
+ This mode causes the interaction to only occur on the display, meaning the choices are provided only via the display.
+ Selections are made with the OK and Seek Right and Left, Tune Up and Down buttons.
+ </description>
+ <element name="VR_ONLY" />
+ <description>
+ This mode causes the interaction to only occur using V4.
+ Selections are made by saying the command.
+ </description>
+ <element name="BOTH" />
+ <description>
+ This mode causes both a VR and display selection option for an interaction.
+ Selections can be made either from the menu display or by speaking the command.
+ </description>
+ </enum>
+
+ <enum name="LayoutMode">
+ <description>For touchscreen interactions, the mode of how the choices are presented.</description>
+ <element name="ICON_ONLY" />
+ <description>
+ This mode causes the interaction to display the previous set of choices as icons.
+ </description>
+ <element name="ICON_WITH_SEARCH" />
+ <description>
+ This mode causes the interaction to display the previous set of choices as icons along with a search field in the HMI.
+ </description>
+ <element name="LIST_ONLY" />
+ <description>
+ This mode causes the interaction to display the previous set of choices as a list.
+ </description>
+ <element name="LIST_WITH_SEARCH" />
+ <description>
+ This mode causes the interaction to display the previous set of choices as a list along with a search field in the HMI.
+ </description>
+ <element name="KEYBOARD" />
+ <description>
+ This mode causes the interaction to immediately display a keyboard entry through the HMI.
+ </description>
+ </enum>
+
+ <enum name="HMILevel">
+ <description>Enumeraction that describes current levels of HMI.</description>
+ <element name="FULL" internal_name="HMI_FULL" />
+ <element name="LIMITED" internal_name="HMI_LIMITED" />
+ <element name="BACKGROUND" internal_name="HMI_BACKGROUND" />
+ <element name="NONE" internal_name="HMI_NONE" />
+ </enum>
+
+ <enum name="AudioStreamingState">
+ <description>Enumeraction that describes possible states of audio streaming.</description>
+ <element name="AUDIBLE" />
+ <element name="ATTENUATED" />
+ <element name="NOT_AUDIBLE" />
+ </enum>
+
+ <enum name="SystemAction">
+ <description>Enumeration that describes system actions that can be triggered.</description>
+ <element name="DEFAULT_ACTION">
+ <description>Default action occurs. Standard behavior (e.g. SoftButton clears overlay).</description>
+ </element>
+ <element name="STEAL_FOCUS">
+ <description>App is brought into HMI_FULL.</description>
+ </element>
+ <element name="KEEP_CONTEXT">
+ <description>Current system context is maintained. An overlay is persisted even though a SoftButton has been pressed and the notification sent.</description>
+ </element>
+ </enum>
+
+ <enum name="SystemContext">
+ <description>Enumeration that describes possible contexts an app's HMI might be in.</description>
+ <description>Communicated to whichever app is in HMI FULL, except Alert.</description>
+ <element name="MAIN" internal_name="SYSCTXT_MAIN">
+ <description>The app's persistent display (whether media/non-media/navigation) is fully visible onscreen.</description>
+ </element>
+ <element name="VRSESSION" internal_name="SYSCTXT_VRSESSION">
+ <description>The system is currently in a VR session (with whatever dedicated VR screen being overlaid onscreen).</description>
+ </element>
+ <element name="MENU" internal_name="SYSCTXT_MENU">
+ <description>The system is currently displaying an in-App menu onscreen.</description>
+ </element>
+ <element name="HMI_OBSCURED" internal_name="SYSCTXT_HMI_OBSCURED">
+ <description>The app's display HMI is currently being obscured by either a system or other app's overlay.</description>
+ </element>
+ <element name="ALERT" internal_name="SYSCTXT_ALERT">
+ <description>Broadcast only to whichever app has an alert currently being displayed.</description>
+ </element>
+ </enum>
+
+ <enum name="SoftButtonType">
+ <description>Contains information about the SoftButton capabilities.</description>
+ <element name="TEXT" internal_name="SBT_TEXT"/>
+ <element name="IMAGE" internal_name="SBT_IMAGE"/>
+ <element name="BOTH" internal_name="SBT_BOTH"/>
+ </enum>
+
+ <enum name="AppInterfaceUnregisteredReason">
+ <description>Error code, which comes from sync side.</description>
+ <element name="USER_EXIT" />
+ <element name="IGNITION_OFF" />
+ <element name="BLUETOOTH_OFF" />
+ <element name="USB_DISCONNECTED" />
+ <element name="REQUEST_WHILE_IN_NONE_HMI_LEVEL" />
+ <element name="TOO_MANY_REQUESTS" />
+ <element name="DRIVER_DISTRACTION_VIOLATION" />
+ <element name="LANGUAGE_CHANGE" />
+ <element name="MASTER_RESET" />
+ <element name="FACTORY_DEFAULTS" />
+ <element name="APP_UNAUTHORIZED" />
+ <element name="PROTOCOL_VIOLATION" />
+ </enum>
+
+ <enum name="TriggerSource">
+ <description>Indicates the source from where the command was triggered.</description>
+ <element name="MENU" internal_name="TS_MENU" />
+ <element name="VR" internal_name="TS_VR" />
+ <element name="KEYBOARD" internal_name="TS_KEYBOARD" />
+ </enum>
+
+ <enum name="HmiZoneCapabilities">
+ <description>Contains information about the HMI zone capabilities.</description>
+ <description>For future use.</description>
+ <element name="FRONT" />
+ <element name="BACK" />
+ </enum>
+
+ <enum name="SpeechCapabilities">
+ <description>Contains information about the TTS capabilities.</description>
+ <element name="TEXT" internal_name="SC_TEXT"/>
+ <element name="SAPI_PHONEMES" />
+ <element name="LHPLUS_PHONEMES" />
+ <element name="PRE_RECORDED" />
+ <element name="SILENCE" />
+ </enum>
+
+ <enum name="VrCapabilities">
+ <description>Contains information about the VR capabilities.</description>
+ <element name="TEXT" internal_name="VR_TEXT"/>
+ </enum>
+
+ <enum name="PrerecordedSpeech">
+ <description>Contains a list of prerecorded speech items present on the platform.</description>
+ <element name="HELP_JINGLE" />
+ <element name="INITIAL_JINGLE" />
+ <element name="LISTEN_JINGLE" />
+ <element name="POSITIVE_JINGLE" />
+ <element name="NEGATIVE_JINGLE" />
+ </enum>
+
+ <enum name="SamplingRate">
+ <description>Describes different sampling options for PerformAudioPassThru.</description>
+ <element name="8KHZ" internal_name="SamplingRate_8KHZ"/>
+ <element name="16KHZ" internal_name="SamplingRate_16KHZ"/>
+ <element name="22KHZ" internal_name="SamplingRate_22KHZ"/>
+ <element name="44KHZ" internal_name="SamplingRate_44KHZ"/>
+ </enum>
+
+ <enum name="BitsPerSample">
+ <description>Describes different quality options for PerformAudioPassThru.</description>
+ <element name="8_BIT" internal_name="BitsPerSample_8_BIT"/>
+ <element name="16_BIT" internal_name="BitsPerSample_16_BIT"/>
+ </enum>
+
+ <enum name="AudioType">
+ <description>Describes different audio type options for PerformAudioPassThru.</description>
+ <element name="PCM" />
+ </enum>
+
+ <struct name="HMICapabilities">
+ <param name="navigation" type="Boolean" mandatory="false">
+ <description>Availability of build in Nav. True: Available, False: Not Available</description>
+ </param>
+ <param name="phoneCall" type="Boolean" mandatory="false">
+ <description>Availability of build in phone. True: Available, False: Not Available</description>
+ </param>
+ </struct>
+
+ <struct name="AudioPassThruCapabilities">
+ <description>Describes different audio type configurations for PerformAudioPassThru.</description>
+ <description>e.g. {8kHz,8-bit,PCM}</description>
+ <param name="samplingRate" type="SamplingRate"/>
+ <param name="bitsPerSample" type="BitsPerSample"/>
+ <param name="audioType" type="AudioType"/>
+ </struct>
+
+ <enum name="VehicleDataType">
+ <description>Defines the data types that can be published and subscribed to.</description>
+ <element name="VEHICLEDATA_GPS">
+ <description>Notifies GPSData may be subscribed</description>
+ </element>
+ <element name="VEHICLEDATA_SPEED" />
+ <element name="VEHICLEDATA_RPM" />
+ <element name="VEHICLEDATA_FUELLEVEL" />
+ <element name="VEHICLEDATA_FUELLEVEL_STATE" />
+ <element name="VEHICLEDATA_FUELCONSUMPTION" />
+ <element name="VEHICLEDATA_EXTERNTEMP" />
+ <element name="VEHICLEDATA_VIN" />
+ <element name="VEHICLEDATA_PRNDL" />
+ <element name="VEHICLEDATA_TIREPRESSURE" />
+ <element name="VEHICLEDATA_ODOMETER" />
+ <element name="VEHICLEDATA_BELTSTATUS" />
+ <element name="VEHICLEDATA_BODYINFO" />
+ <element name="VEHICLEDATA_DEVICESTATUS" />
+ <element name="VEHICLEDATA_ECALLINFO" />
+ <element name="VEHICLEDATA_AIRBAGSTATUS" />
+ <element name="VEHICLEDATA_EMERGENCYEVENT" />
+ <element name="VEHICLEDATA_CLUSTERMODESTATUS" />
+ <element name="VEHICLEDATA_MYKEY" />
+ <element name="VEHICLEDATA_BRAKING" />
+ <element name="VEHICLEDATA_WIPERSTATUS" />
+ <element name="VEHICLEDATA_HEADLAMPSTATUS" />
+ <element name="VEHICLEDATA_BATTVOLTAGE" />
+ <element name="VEHICLEDATA_ENGINETORQUE" />
+ <element name="VEHICLEDATA_ACCPEDAL" />
+ <element name="VEHICLEDATA_STEERINGWHEEL" />
+ </enum>
+
+ <enum name="ButtonName">
+ <description>Defines the hard (physical) and soft (touchscreen) buttons available from SYNC</description>
+ <element name="OK" />
+ <element name="SEEKLEFT" />
+ <element name="SEEKRIGHT" />
+ <element name="TUNEUP" />
+ <element name="TUNEDOWN" />
+ <element name="PRESET_0" />
+ <element name="PRESET_1" />
+ <element name="PRESET_2" />
+ <element name="PRESET_3" />
+ <element name="PRESET_4" />
+ <element name="PRESET_5" />
+ <element name="PRESET_6" />
+ <element name="PRESET_7" />
+ <element name="PRESET_8" />
+ <element name="PRESET_9" />
+ <element name="CUSTOM_BUTTON" />
+ <element name="SEARCH" />
+ </enum>
+
+ <enum name="MediaClockFormat">
+ <element name="CLOCK1">
+ <description>
+ minutesFieldWidth = 2;minutesFieldMax = 19;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 19;maxMinutes = 59;maxSeconds = 59;
+ used for Type II and CID headunits
+ </description>
+ </element>
+ <element name="CLOCK2">
+ <description>
+ minutesFieldWidth = 3;minutesFieldMax = 199;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 59;maxMinutes = 59;maxSeconds = 59;
+ used for Type V headunit
+ </description>
+ </element>
+ <element name="CLOCK3">
+ <description>
+ minutesFieldWidth = 2;minutesFieldMax = 59;secondsFieldWidth = 2;secondsFieldMax = 59;maxHours = 9;maxMinutes = 59;maxSeconds = 59;
+ used for GEN1.1 MFD3/4/5 headunits
+ </description>
+ </element>
+ <element name="CLOCKTEXT1">
+ <description>
+ 5 characters possible
+ Format: 1|sp c :|sp c c
+ 1|sp : digit "1" or space
+ c : character out of following character set: sp|0-9|[letters, see TypeII column in XLS. See [@TODO: create file ref]]
+ :|sp : colon or space
+ used for Type II headunit
+ </description>
+ </element>
+ <element name="CLOCKTEXT2">
+ <description>
+ 5 chars possible
+ Format: 1|sp c :|sp c c
+ 1|sp : digit "1" or space
+ c : character out of following character set: sp|0-9|[letters, see CID column in XLS. See [@TODO: create file ref]]
+ :|sp : colon or space
+ used for CID headunit
+ NOTE: difference between CLOCKTEXT1 and CLOCKTEXT2 is the supported character set
+ </description>
+ </element>
+ <element name="CLOCKTEXT3">
+ <description>
+ 6 chars possible
+ Format: 1|sp c c :|sp c c
+ 1|sp : digit "1" or space
+ c : character out of following character set: sp|0-9|[letters, see Type 5 column in XLS]. See [@TODO: create file ref]
+ :|sp : colon or space
+ used for Type V headunit
+ </description>
+ </element>
+ <element name="CLOCKTEXT4">
+ <description>
+ 6 chars possible
+ Format: c :|sp c c : c c
+ :|sp : colon or space
+ c : character out of following character set: sp|0-9|[letters].
+ used for GEN1.1 MFD3/4/5 headunits
+ </description>
+ </element>
+ </enum>
+
+ <enum name="DisplayType">
+ <description>See DAES for further infos regarding the displays</description>
+ <element name="CID"/>
+ <element name="TYPE2" />
+ <element name="TYPE5" />
+ <element name="NGN" />
+ <element name="GEN2_8_DMA" />
+ <element name="GEN2_6_DMA" />
+ <element name="MFD3" />
+ <element name="MFD4" />
+ <element name="MFD5" />
+ <element name="GEN3_8-INCH" internal_name="GEN3_8_INCH" />
+ </enum>
+
+ <enum name="TextFieldName">
+ <element name="mainField1">
+ <description>The first line of first set of main fields of the persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="mainField2">
+ <description>The second line of first set of main fields of the persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="mainField3">
+ <description>The first line of second set of main fields of persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="mainField4">
+ <description>The second line of second set of main fields of the persistent display; applies to "Show"</description>
+ </element>
+
+ <element name="statusBar">
+ <description>The status bar on NGN; applies to "Show"</description>
+ </element>
+
+ <element name="mediaClock">
+ <description>Text value for MediaClock field; applies to "Show"</description>
+ </element>
+
+ <element name="mediaTrack">
+ <description>The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"</description>
+ </element>
+
+ <element name="alertText1">
+ <description>The first line of the alert text field; applies to "Alert"</description>
+ </element>
+
+ <element name="alertText2">
+ <description>The second line of the alert text field; applies to "Alert"</description>
+ </element>
+
+ <element name="alertText3">
+ <description>The third line of the alert text field; applies to "Alert"</description>
+ </element>
+
+ <element name="scrollableMessageBody">
+ <description>Long form body of text that can include newlines and tabs; applies to "ScrollableMessage"</description>
+ </element>
+
+ <element name="initialInteractionText">
+ <description> First line suggestion for a user response (in the case of VR enabled interaction)</description>
+ </element>
+
+ <element name="navigationText1">
+ <description> First line of navigation text</description>
+ </element>
+
+ <element name="navigationText2">
+ <description> Second line of navigation text</description>
+ </element>
+
+ <element name="ETA">
+ <description> Estimated Time of Arrival time for navigation</description>
+ </element>
+
+ <element name="totalDistance">
+ <description> Total distance to destination for navigation</description>
+ </element>
+
+ <element name="audioPassThruDisplayText1">
+ <description> First line of text for audio pass thru</description>
+ </element>
+
+ <element name="audioPassThruDisplayText2">
+ <description> Second line of text for audio pass thru</description>
+ </element>
+
+ <element name="sliderHeader">
+ <description> Header text for slider</description>
+ </element>
+
+ <element name="sliderFooter">
+ <description> Footer text for slider</description>
+ </element>
+
+ <element name="menuName">
+ <description> Primary text for Choice</description>
+ </element>
+
+ <element name="secondaryText">
+ <description> Secondary text for Choice</description>
+ </element>
+
+ <element name="tertiaryText">
+ <description> Tertiary text for Choice</description>
+ </element>
+
+ <element name="menuTitle">
+ <description> Optional text to label an app menu button (for certain touchscreen platforms).</description>
+ </element>
+
+ <element name="timeToDestination">
+ <description> Time to destination</description>
+ </element>
+
+ <element name="navigationText">
+ <description>Navigation text for UpdateTurnList.</description>
+ </element>
+
+ <element name="notificationText">
+ <description> Footer text for slider</description>
+ </element>
+
+ <element name="locationName">
+ <description> Optional name / title of intended location for SendLocation.</description>
+ </element>
+
+ <element name="locationDescription">
+ <description> Optional description of intended location / establishment (if applicable) for SendLocation.</description>
+ </element>
+
+ <element name="addressLines">
+ <description> Optional location address (if applicable) for SendLocation.</description>
+ </element>
+
+ <element name="phoneNumber">
+ <description> Optional hone number of intended location / establishment (if applicable) for SendLocation.</description>
+ </element>
+
+ <element name="turnText">
+ <description> Turn text</description>
+ </element>
+
+ </enum>
+
+ <enum name="ImageFieldName">
+ <element name="softButtonImage">
+ <description>The image field for SoftButton</description>
+ </element>
+
+ <element name="choiceImage">
+ <description>The first image field for Choice</description>
+ </element>
+
+ <element name="choiceSecondaryImage">
+ <description>The secondary image field for Choice</description>
+ </element>
+
+ <element name="vrHelpItem">
+ <description>The image field for vrHelpItem</description>
+ </element>
+
+ <element name="turnIcon">
+ <description>The image field for Turn</description>
+ </element>
+
+ <element name="menuIcon">
+ <description>The image field for the menu icon in SetGlobalProperties</description>
+ </element>
+
+ <element name="cmdIcon">
+ <description>The image field for AddCommand</description>
+ </element>
+
+ <element name="appIcon">
+ <description>The image field for the app icon (set by setAppIcon)</description>
+ </element>
+
+ <element name="graphic">
+ <description>The image field for Show</description>
+ </element>
+
+ <element name="showConstantTBTIcon">
+ <description>The primary image field for ShowConstantTBT</description>
+ </element>
+
+ <element name="showConstantTBTNextTurnIcon">
+ <description>The secondary image field for ShowConstantTBT</description>
+ </element>
+
+ <element name="locationImage">
+ <description>The optional image of a destination / location</description>
+ </element>
+ </enum>
+
+ <enum name="PredefinedLayout" platform="documentation">
+ <description>Predefined screen layout.</description>
+
+ <element name="DEFAULT" rootscreen="true">
+ <description>
+ Default media / non-media screen.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="MEDIA" rootscreen="true">
+ <description>
+ Default Media screen.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NON-MEDIA" internal_name="NON_MEDIA" rootscreen="true">
+ <description>
+ Default Non-media screen.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="ONSCREEN_PRESETS" rootscreen="true">
+ <description>
+ Custom root media screen containing app-defined onscreen presets.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NAV_FULLSCREEN_MAP" rootscreen="true">
+ <description>
+ Custom root template screen containing full screen map with navigation controls.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NAV_LIST" rootscreen="true">
+ <description>
+ Custom root template screen containing video represented list.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="NAV_KEYBOARD" rootscreen="true">
+ <description>
+ Custom root template screen containing video represented keyboard.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TEXT" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with lines of text.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXT_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing lines of text with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TILES_ONLY" rootscreen="true">
+ <description>
+ Custom root template screen containing only tiled SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXTBUTTONS_ONLY" rootscreen="true">
+ <description>
+ Custom root template screen containing only text SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TILES" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with tiled SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TILES_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing tiled SoftButtons with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with text and SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing text and SoftButtons with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="GRAPHIC_WITH_TEXTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing half-screen graphic with text only SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="TEXTBUTTONS_WITH_GRAPHIC" rootscreen="true">
+ <description>
+ Custom root template screen containing text only SoftButtons with half-screen graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="LARGE_GRAPHIC_WITH_SOFTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing a large graphic and SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="DOUBLE_GRAPHIC_WITH_SOFTBUTTONS" rootscreen="true">
+ <description>
+ Custom root template screen containing two graphics and SoftButtons.
+ Can be set as a root screen.
+ </description>
+ </element>
+ <element name="LARGE_GRAPHIC_ONLY" rootscreen="true">
+ <description>
+ Custom root template screen containing only a large graphic.
+ Can be set as a root screen.
+ </description>
+ </element>
+ </enum>
+
+ <enum name="CharacterSet">
+ <description>The list of potential character sets</description>
+ <element name="TYPE2SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ <element name="TYPE5SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ <element name="CID1SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ <element name="CID2SET">
+ <description>See [@TODO: create file ref]</description>
+ </element>
+ </enum>
+
+ <enum name="TextAlignment">
+ <description>The list of possible alignments, left, right, or centered</description>
+ <element name="LEFT_ALIGNED" />
+ <element name="RIGHT_ALIGNED" />
+ <element name="CENTERED" />
+ </enum>
+
+ <enum name="TBTState">
+ <description>Enumeration that describes possible states of turn-by-turn client or AppLink app.</description>
+ <element name="ROUTE_UPDATE_REQUEST" />
+ <element name="ROUTE_ACCEPTED" />
+ <element name="ROUTE_REFUSED" />
+ <element name="ROUTE_CANCELLED" />
+ <element name="ETA_REQUEST" />
+ <element name="NEXT_TURN_REQUEST" />
+ <element name="ROUTE_STATUS_REQUEST" />
+ <element name="ROUTE_SUMMARY_REQUEST" />
+ <element name="TRIP_STATUS_REQUEST" />
+ <element name="ROUTE_UPDATE_REQUEST_TIMEOUT" />
+ </enum>
+
+ <enum name="DriverDistractionState">
+ <description>Enumeration that describes possible states of driver distraction.</description>
+ <element name="DD_ON" />
+ <element name="DD_OFF" />
+ </enum>
+
+ <enum name="ImageType">
+ <description>Contains information about the type of image.</description>
+ <element name="STATIC" />
+ <element name="DYNAMIC" />
+ </enum>
+
+ <struct name="Image">
+ <param name="value" minlength="0" maxlength="65535" type="String">
+ <description>Either the static hex icon value or the binary image file name identifier (sent by PutFile).</description>
+ </param>
+ <param name="imageType" type="ImageType">
+ <description>Describes, whether it is a static or dynamic image.</description>
+ </param>
+ </struct>
+
+ <struct name="SoftButton">
+ <param name="type" type="SoftButtonType">
+ <description>Describes, whether it is text, highlighted text, icon, or dynamic image. See softButtonType</description>
+ </param>
+ <param name="text" minlength="0" maxlength="500" type="String" mandatory="false">
+ <description>Optional text to display (if defined as TEXT or BOTH)</description>
+ </param>
+ <param name="image" type="Image" mandatory="false">
+ <description>Optional image struct for SoftButton (if defined as IMAGE or BOTH)</description>
+ </param>
+ <param name="isHighlighted" type="Boolean" defvalue="false" mandatory="false">
+ <description>
+ True, if highlighted
+ False, if not highlighted
+ </description>
+ </param>
+ <param name="softButtonID" type="Integer" minvalue="0" maxvalue="65535">
+ <description>Value which is returned via OnButtonPress / OnButtonEvent</description>
+ </param>
+ <param name="systemAction" type="SystemAction" defvalue="DEFAULT_ACTION" mandatory="false">
+ <description>Parameter indicating whether selecting a SoftButton shall call a specific system action. This is intended to allow Notifications to bring the callee into full / focus; or in the case of persistent overlays, the overlay can persist when a SoftButton is pressed.</description>
+ </param>
+ </struct>
+
+ <struct name="Choice">
+ <description>A choice is an option given to the user, which can be selected either by menu, or through voice recognition system.</description>
+ <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" />
+ <param name="menuName" type="String" maxlength="500" />
+ <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" />
+ <param name="image" type="Image" mandatory="false"/>
+ <param name="secondaryText" maxlength="500" type="String" mandatory="false">
+ <description>Optional secondary text to display; e.g. address of POI in a search result entry</description>
+ </param>
+ <param name="tertiaryText" maxlength="500" type="String" mandatory="false">
+ <description>Optional tertiary text to display; e.g. distance to POI for a search result entry</description>
+ </param>
+ <param name="secondaryImage" type="Image" mandatory="false">
+ <description>Optional secondary image struct for choice</description>
+ </param>
+ </struct>
+
+ <struct name="VrHelpItem">
+ <param name="text" maxlength="500" type="String">
+ <description>Text to display for VR Help item</description>
+ </param>
+ <param name="image" type="Image" mandatory="false">
+ <description>Image struct for VR Help item</description>
+ </param>
+ <param name="position" type="Integer" minvalue="1" maxvalue="100">
+ <description>Position to display item in VR Help list</description>
+ </param>
+ </struct>
+
+ <struct name="SyncMsgVersion">
+ <description>Specifies the version number of the SYNC V4 protocol, that is supported by the mobile application</description>
+
+ <param name="majorVersion" type="Integer" minvalue="1" maxvalue="10">
+ <description>The major version indicates versions that is not-compatible to previous versions.</description>
+ </param>
+ <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000">
+ <description>The minor version indicates a change to a previous version that should still allow to be run on an older version (with limited functionality)</description>
+ </param>
+ </struct>
+
+ <enum name="GlobalProperty">
+ <description>The different global properties.</description>
+ <element name="HELPPROMPT">
+ <description>The property helpPrompt of setGlobalProperties</description>
+ </element>
+ <element name="TIMEOUTPROMPT">
+ <description>The property timeoutPrompt of setGlobalProperties</description>
+ </element>
+ <element name="VRHELPTITLE">
+ <description>The property vrHelpTitle of setGlobalProperties</description>
+ </element>
+ <element name="VRHELPITEMS">
+ <description>The property array of vrHelp of setGlobalProperties</description>
+ </element>
+ <element name="MENUNAME">
+ <description>The property in-app menu name of setGlobalProperties</description>
+ </element>
+ <element name="MENUICON">
+ <description>The property in-app menu icon of setGlobalProperties</description>
+ </element>
+ <element name="KEYBOARDPROPERTIES">
+ <description>The on-screen keyboard configuration of setGlobalProperties</description>
+ </element>
+ </enum>
+
+ <enum name="CompassDirection">
+ <description>The list of potential compass directions</description>
+ <element name="NORTH">
+ </element>
+ <element name="NORTHWEST">
+ </element>
+ <element name="WEST">
+ </element>
+ <element name="SOUTHWEST">
+ </element>
+ <element name="SOUTH">
+ </element>
+ <element name="SOUTHEAST">
+ </element>
+ <element name="EAST">
+ </element>
+ <element name="NORTHEAST">
+ </element>
+ </enum>
+
+ <enum name="Dimension">
+ <description>The supported dimensions of the GPS</description>
+ <element name="NO_FIX" internal_name="Dimension_NO_FIX">
+ <description>No GPS at all</description>
+ </element>
+ <element name="2D" internal_name="Dimension_2D">
+ <description>Longitude and lattitude</description>
+ </element>
+ <element name="3D" internal_name="Dimension_3D">
+ <description>Longitude and lattitude and altitude</description>
+ </element>
+ </enum>
+
+ <enum name="PRNDL">
+ <description>The selected gear.</description>
+ <element name="PARK">
+ <description>Parking</description>
+ </element>
+ <element name="REVERSE">
+ <description>Reverse gear</description>
+ </element>
+ <element name="NEUTRAL">
+ <description>No gear</description>
+ </element>
+ <element name="DRIVE">
+ </element>
+ <element name="SPORT">
+ <description>Drive Sport mode</description>
+ </element>
+ <element name="LOWGEAR">
+ <description>1st gear hold</description>
+ </element>
+ <element name="FIRST">
+ </element>
+ <element name="SECOND">
+ </element>
+ <element name="THIRD">
+ </element>
+ <element name="FOURTH">
+ </element>
+ <element name="FIFTH">
+ </element>
+ <element name="SIXTH">
+ </element>
+ <element name="SEVENTH">
+ </element>
+ <element name="EIGHTH">
+ </element>
+ <element name="UNKNOWN">
+ </element>
+ <element name="FAULT">
+ </element>
+ </enum>
+
+ <enum name="ComponentVolumeStatus">
+ <description>The volume status of a vehicle component.</description>
+ <element name="UNKNOWN" internal_name="CVS_UNKNOWN">
+ </element>
+ <element name="NORMAL" internal_name="CVS_NORMAL">
+ </element>
+ <element name="LOW" internal_name="CVS_LOW">
+ </element>
+ <element name="FAULT" internal_name="CVS_FAULT">
+ </element>
+ <element name="ALERT" internal_name="CVS_ALERT">
+ </element>
+ <element name="NOT_SUPPORTED" internal_name="CVS_NOT_SUPPORTED">
+ </element>
+ </enum>
+
+ <struct name="SingleTireStatus">
+ <param name="status" type="ComponentVolumeStatus">
+ <description>See ComponentVolumeStatus.</description>
+ </param>
+ </struct>
+
+ <enum name="WarningLightStatus">
+ <description>Reflects the status of a cluster instrument warning light.</description>
+ <element name="OFF" internal_name="WLS_OFF">
+ </element>
+ <element name="ON" internal_name="WLS_ON">
+ </element>
+ <element name="FLASH" internal_name="WLS_FLASH">
+ </element>
+ <element name="NOT_USED" internal_name="WLS_NOT_USED">
+ </element>
+ </enum>
+
+ <enum name="VehicleDataNotificationStatus">
+ <description>Reflects the status of a vehicle data notification.</description>
+ <element name="NOT_SUPPORTED" internal_name="VDNS_NOT_SUPPORTED">
+ </element>
+ <element name="NORMAL" internal_name="VDNS_NORMAL">
+ </element>
+ <element name="ACTIVE" internal_name="VDNS_ACTIVE">
+ </element>
+ <element name="NOT_USED" internal_name="VDNS_NOT_USED">
+ </element>
+ </enum>
+
+ <enum name="IgnitionStableStatus">
+ <description>Reflects the ignition switch stability.</description>
+ <element name="IGNITION_SWITCH_NOT_STABLE">
+ </element>
+ <element name="IGNITION_SWITCH_STABLE">
+ </element>
+ <element name="MISSING_FROM_TRANSMITTER">
+ </element>
+ </enum>
+
+ <enum name="IgnitionStatus">
+ <description>Reflects the status of ignition.</description>
+ <element name="UNKNOWN" internal_name="IS_UNKNOWN">
+ </element>
+ <element name="OFF" internal_name="IS_OFF">
+ </element>
+ <element name="ACCESSORY" internal_name="IS_ACCESSORY">
+ </element>
+ <element name="RUN" internal_name="IS_RUN">
+ </element>
+ <element name="START" internal_name="IS_START">
+ </element>
+ <element name="INVALID" internal_name="IS_INVALID">
+ </element>
+ </enum>
+
+ <enum name="VehicleDataEventStatus">
+ <description>Reflects the status of a vehicle data event; e.g. a seat belt event status.</description>
+ <element name="NO_EVENT" internal_name="VDES_NO_EVENT">
+ </element>
+ <element name="NO" internal_name="VDES_NO">
+ </element>
+ <element name="YES" internal_name="VDES_YES">
+ </element>
+ <element name="NOT_SUPPORTED" internal_name="VDES_NOT_SUPPORTED">
+ </element>
+ <element name="FAULT" internal_name="VDES_FAULT">
+ </element>
+ </enum>
+
+ <enum name="DeviceLevelStatus">
+ <description>Reflects the reported battery status of the connected device, if reported.</description>
+ <element name="ZERO_LEVEL_BARS">
+ </element>
+ <element name="ONE_LEVEL_BARS">
+ </element>
+ <element name="TWO_LEVEL_BARS">
+ </element>
+ <element name="THREE_LEVEL_BARS">
+ </element>
+ <element name="FOUR_LEVEL_BARS">
+ </element>
+ <element name="NOT_PROVIDED">
+ </element>
+ </enum>
+
+ <enum name="PrimaryAudioSource">
+ <description>Reflects the current primary audio source (if selected).</description>
+ <element name="NO_SOURCE_SELECTED">
+ </element>
+ <element name="USB">
+ </element>
+ <element name="USB2">
+ </element>
+ <element name="BLUETOOTH_STEREO_BTST">
+ </element>
+ <element name="LINE_IN">
+ </element>
+ <element name="IPOD">
+ </element>
+ <element name="MOBILE_APP">
+ </element>
+ </enum>
+
+ <enum name="WiperStatus">
+ <description>Reflects the status of the wipers.</description>
+ <element name="OFF" />
+ <element name="AUTO_OFF" />
+ <element name="OFF_MOVING" />
+ <element name="MAN_INT_OFF" />
+ <element name="MAN_INT_ON" />
+ <element name="MAN_LOW" />
+ <element name="MAN_HIGH" />
+ <element name="MAN_FLICK" />
+ <element name="WASH" />
+ <element name="AUTO_LOW" />
+ <element name="AUTO_HIGH" />
+ <element name="COURTESYWIPE" />
+ <element name="AUTO_ADJUST" />
+ <element name="STALLED" />
+ <element name="NO_DATA_EXISTS" />
+ </enum>
+
+ <enum name="VehicleDataStatus">
+ <description>Reflects the status of a binary vehicle data item.</description>
+ <element name="NO_DATA_EXISTS" internal_name="VDS_NO_DATA_EXISTS">
+ </element>
+ <element name="OFF" internal_name="VDS_OFF">
+ </element>
+ <element name="ON" internal_name="VDS_ON">
+ </element>
+ </enum>
+
+ <enum name="MaintenanceModeStatus">
+ <description>Reflects the status of a vehicle maintenance mode.</description>
+ <element name="NORMAL" internal_name="MMS_NORMAL">
+ </element>
+ <element name="NEAR" internal_name="MMS_NEAR">
+ </element>
+ <element name="ACTIVE" internal_name="MMS_ACTIVE">
+ </element>
+ <element name="FEATURE_NOT_PRESENT" internal_name="MMS_FEATURE_NOT_PRESENT">
+ </element>
+ </enum>
+
+ <enum name="VehicleDataActiveStatus">
+ <description>Reflects the status of given vehicle component.</description>
+ <element name="INACTIVE_NOT_CONFIRMED" internal_name="VDAS_INACTIVE_NOT_CONFIRMED">
+ </element>
+ <element name="INACTIVE_CONFIRMED" internal_name="VDAS_INACTIVE_CONFIRMED">
+ </element>
+ <element name="ACTIVE_NOT_CONFIRMED" internal_name="VDAS_ACTIVE_NOT_CONFIRMED">
+ </element>
+ <element name="ACTIVE_CONFIRMED" internal_name="VDAS_ACTIVE_CONFIRMED">
+ </element>
+ <element name="FAULT" internal_name="VDAS_FAULT">
+ </element>
+ </enum>
+
+ <enum name="AmbientLightStatus">
+ <description>Reflects the status of the ambient light sensor.</description>
+ <element name="NIGHT" />
+ <element name="TWILIGHT_1" />
+ <element name="TWILIGHT_2" />
+ <element name="TWILIGHT_3" />
+ <element name="TWILIGHT_4" />
+ <element name="DAY" />
+ <element name="UNKNOWN" />
+ <element name="INVALID" />
+ </enum>
+
+ <struct name="BeltStatus">
+ <param name="driverBeltDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsDrvBelt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerBeltDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsPasBelt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerBuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw1PasBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverBuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw1DrvBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="leftRow2BuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw2lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerChildDetected" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw1PasChld_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="rightRow2BuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw2rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow2BuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw2mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow3BuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw3mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="leftRow3BuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw3lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="rightRow3BuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw3rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="leftRearInflatableBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw2lRib_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="rightRearInflatableBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw2rRib_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow1BeltDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw1mBelt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="middleRow1BuckleBelted" type="VehicleDataEventStatus">
+ <description>References signal "VedsRw1mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="BodyInformation">
+ <param name="parkBrakeActive" type="Boolean">
+ <description>References signal "PrkBrkActv_B_Actl".</description>
+ </param>
+ <param name="ignitionStableStatus" type="IgnitionStableStatus">
+ <description>References signal "Ignition_Switch_Stable". See IgnitionStableStatus.</description>
+ </param>
+ <param name="ignitionStatus" type="IgnitionStatus">
+ <description>References signal "Ignition_status". See IgnitionStatus.</description>
+ </param>
+ <param name="driverDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatDrv_B_Actl".</description>
+ </param>
+ <param name="passengerDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatPsngr_B_Actl".</description>
+ </param>
+ <param name="rearLeftDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatRl_B_Actl".</description>
+ </param>
+ <param name="rearRightDoorAjar" type="Boolean" mandatory="false">
+ <description>References signal "DrStatRr_B_Actl".</description>
+ </param>
+ </struct>
+
+ <struct name="DeviceStatus">
+ <param name="voiceRecOn" type="Boolean">
+ <description>References signal "CPM_VoiceRec_STAT".</description>
+ </param>
+ <param name="btIconOn" type="Boolean">
+ <description>References signal "BT_ICON".</description>
+ </param>
+ <param name="callActive" type="Boolean">
+ <description>References signal "CPM_Call_Active_STAT".</description>
+ </param>
+ <param name="phoneRoaming" type="Boolean">
+ <description>References signal "CPM_Phone_Roaming_STAT".</description>
+ </param>
+ <param name="textMsgAvailable" type="Boolean">
+ <description>References signal "CPM_TextMsg_AVAL".</description>
+ </param>
+ <param name="battLevelStatus" type="DeviceLevelStatus">
+ <description>Device battery level status. References signal "CPM_Batt_Level_STAT". See DeviceLevelStatus.</description>
+ </param>
+ <param name="stereoAudioOutputMuted" type="Boolean">
+ <description>References signal "CPM_Stereo_Audio_Output".</description>
+ </param>
+ <param name="monoAudioOutputMuted" type="Boolean">
+ <description>References signal "CPM_Mono_Audio_Output".</description>
+ </param>
+ <param name="signalLevelStatus" type="DeviceLevelStatus">
+ <description>Device signal level status. References signal "CPM_Signal_Strength_STAT". See DeviceLevelStatus.</description>
+ </param>
+ <param name="primaryAudioSource" type="PrimaryAudioSource">
+ <description>References signal "CPM_Stereo_PAS_Source". See PrimaryAudioSource.</description>
+ </param>
+ <param name="eCallEventActive" type="Boolean">
+ <description>References signal "eCall_Event".</description>
+ </param>
+ </struct>
+
+ <struct name="HeadLampStatus">
+ <param name="lowBeamsOn" type="Boolean">
+ <description>Status of the low beam lamps. References signal "HeadLampLoActv_B_Stat".</description>
+ </param>
+ <param name="highBeamsOn" type="Boolean">
+ <description>Status of the high beam lamps. References signal "HeadLghtHiOn_B_Stat".</description>
+ </param>
+ <param name="ambientLightSensorStatus" type="AmbientLightStatus">
+ <description>Status of the ambient light sensor.</description>
+ </param>
+ </struct>
+
+ <struct name="engineInfo">
+ <param name="electricFuelConsumption" type="Float" minvalue="0" maxvalue="30000">
+ <description>
+ Indicates the electric fuel consumption in terms of gasoline equivalent volume to support fuel economy equivalent calculations.
+ Note:Plug-in vehicle use only!
+ References signal "ElFuelFlw_Vl_Dsply".
+ </description>
+ </param>
+ <param name="stateOfCharge" type="Float" minvalue="0" maxvalue="100">
+ <description>Percent state of charge for the high voltage battery. References signal "BattTracSoc_Pc_Dsply".</description>
+ </param>
+ <param name="fuelMaintenanceMode" type="MaintenanceModeStatus">
+ <description>Current status of fuel maintenance mode (if present on hybrid vehicles). References signal "FuelMaintMde_D_Dsply".</description>
+ </param>
+ <param name="distanceToEmpty" type="Float" minvalue="0" maxvalue="1000">
+ <description>
+ Electric range (DTE) in km. References signal "VehElRnge_L_Dsply".
+ 0xFFE = No Data Exists
+ 0xFFF = Fault
+ </description>
+ </param>
+ </struct>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
+<!-- Ford Specific Data Items -->
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <enum name="FuelCutoffStatus">
+ <description>Reflects the status of the RCM fuel cutoff.</description>
+ <element name="TERMINATE_FUEL" internal_name="FCS_TERMINATE_FUEL">
+ </element>
+ <element name="NORMAL_OPERATION" internal_name="FCS_NORMAL_OPERATION">
+ </element>
+ <element name="FAULT" internal_name="FCS_FAULT">
+ </element>
+ </enum>
+
+ <enum name="EmergencyEventType">
+ <description>Reflects the emergency event status of the vehicle.</description>
+ <element name="NO_EVENT" internal_name="EET_NO_EVENT">
+ </element>
+ <element name="FRONTAL" internal_name="EET_FRONTAL">
+ </element>
+ <element name="SIDE" internal_name="EET_SIDE">
+ </element>
+ <element name="REAR" internal_name="EET_REAR">
+ </element>
+ <element name="ROLLOVER" internal_name="EET_ROLLOVER">
+ </element>
+ <element name="NOT_SUPPORTED" internal_name="EET_NOT_SUPPORTED">
+ </element>
+ <element name="FAULT" internal_name="EET_FAULT">
+ </element>
+ </enum>
+
+ <enum name="ECallConfirmationStatus">
+ <description>Reflects the status of the eCall Notification.</description>
+ <element name="NORMAL" internal_name="ECCS_NORMAL">
+ </element>
+ <element name="CALL_IN_PROGRESS" internal_name="ECCS_CALL_IN_PROGRESS">
+ </element>
+ <element name="CALL_CANCELLED" internal_name="ECCS_CALL_CANCELLED">
+ </element>
+ <element name="CALL_COMPLETED">
+ </element>
+ <element name="CALL_UNSUCCESSFUL" internal_name="ECCS_CALL_UNSUCCESSFUL">
+ </element>
+ <element name="ECALL_CONFIGURED_OFF" internal_name="ECCS_ECALL_CONFIGURED_OFF">
+ </element>
+ <element name="CALL_COMPLETE_DTMF_TIMEOUT" internal_name="ECCS_CALL_COMPLETE_DTMF_TIMEOUT">
+ </element>
+ </enum>
+
+ <struct name="DeviceInfo">
+ <description>Various information abount connecting device.</description>
+
+ <param name="hardware" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device model</description>
+ </param>
+ <param name="firmwareRev" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device firmware revision</description>
+ </param>
+ <param name="os" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device OS</description>
+ </param>
+ <param name="osVersion" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device OS version</description>
+ </param>
+ <param name="carrier" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Device mobile carrier (if applicable)</description>
+ </param>
+ <param name="maxNumberRFCOMMPorts" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Omitted if connected not via BT.</description>
+ </param>
+
+ </struct>
+
+ <enum name="FileType">
+ <description>Enumeration listing possible file types.</description>
+ <element name="GRAPHIC_BMP" />
+ <element name="GRAPHIC_JPEG" />
+ <element name="GRAPHIC_PNG" />
+ <element name="AUDIO_WAVE" />
+ <element name="AUDIO_MP3" />
+ <element name="AUDIO_AAC" />
+ <element name="BINARY" />
+ <element name="JSON" />
+ </enum>
+
+ <enum name="PowerModeQualificationStatus">
+ <description>Reflects the status of the current power mode qualification.</description>
+ <element name="POWER_MODE_UNDEFINED">
+ </element>
+ <element name="POWER_MODE_EVALUATION_IN_PROGRESS">
+ </element>
+ <element name="NOT_DEFINED">
+ </element>
+ <element name="POWER_MODE_OK">
+ </element>
+ </enum>
+
+ <enum name="PowerModeStatus">
+ <description>Reflects the status of the current power mode.</description>
+ <element name="KEY_OUT">
+ </element>
+ <element name="KEY_RECENTLY_OUT">
+ </element>
+ <element name="KEY_APPROVED_0">
+ </element>
+ <element name="POST_ACCESORY_0">
+ </element>
+ <element name="ACCESORY_1">
+ </element>
+ <element name="POST_IGNITION_1">
+ </element>
+ <element name="IGNITION_ON_2">
+ </element>
+ <element name="RUNNING_2">
+ </element>
+ <element name="CRANK_3">
+ </element>
+ </enum>
+
+ <enum name="CarModeStatus">
+ <description>Reflects the status of the current car mode.</description>
+ <element name="NORMAL" internal_name="CMS_NORMAL">
+ </element>
+ <element name="FACTORY" internal_name="CMS_FACTORY">
+ </element>
+ <element name="TRANSPORT" internal_name="CMS_TRANSPORT">
+ </element>
+ <element name="CRASH" internal_name="CMS_CRASH">
+ </element>
+ </enum>
+
+ <struct name="ECallInfo">
+ <param name="eCallNotificationStatus" type="VehicleDataNotificationStatus">
+ <description>References signal "eCallNotification_4A". See VehicleDataNotificationStatus.</description>
+ </param>
+ <param name="auxECallNotificationStatus" type="VehicleDataNotificationStatus">
+ <description>References signal "eCallNotification". See VehicleDataNotificationStatus.</description>
+ </param>
+ <param name="eCallConfirmationStatus" type="ECallConfirmationStatus">
+ <description>References signal "eCallConfirmation". See ECallConfirmationStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="AirbagStatus">
+ <param name="driverAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverSideAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsDrvSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverCurtainAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsDrvCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsPasBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerCurtainAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsPasCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="driverKneeAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsKneeDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerSideAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsPasSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ <param name="passengerKneeAirbagDeployed" type="VehicleDataEventStatus">
+ <description>References signal "VedsKneePasBag_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="EmergencyEvent">
+ <param name="emergencyEventType" type="EmergencyEventType">
+ <description>References signal "VedsEvntType_D_Ltchd". See EmergencyEventType.</description>
+ </param>
+ <param name="fuelCutoffStatus" type="FuelCutoffStatus">
+ <description>References signal "RCM_FuelCutoff". See FuelCutoffStatus.</description>
+ </param>
+ <param name="rolloverEvent" type="VehicleDataEventStatus">
+ <description>References signal "VedsEvntRoll_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+
+ <param name="maximumChangeVelocity" type="Integer" minvalue="0" maxvalue="255">
+ <description>References signal "VedsMaxDeltaV_D_Ltchd". Change in velocity in KPH. Additional reserved values:
+ 0x00 No event
+ 0xFE Not supported
+ 0xFF Fault
+ </description>
+ </param>
+ <param name="multipleEvents" type="VehicleDataEventStatus">
+ <description>References signal "VedsMultiEvnt_D_Ltchd". See VehicleDataEventStatus.</description>
+ </param>
+ </struct>
+
+ <struct name="ClusterModeStatus">
+ <param name="powerModeActive" type="Boolean">
+ <description>References signal "PowerMode_UB".</description>
+ </param>
+ <param name="powerModeQualificationStatus" type="PowerModeQualificationStatus">
+ <description>References signal "PowerModeQF". See PowerModeQualificationStatus.</description>
+ </param>
+ <param name="carModeStatus" type="CarModeStatus">
+ <description>References signal "CarMode". See CarMode.</description>
+ </param>
+ <param name="powerModeStatus" type="PowerModeStatus">
+ <description>References signal "PowerMode". See PowerMode.</description>
+ </param>
+ </struct>
+
+ <struct name="MyKey">
+ <param name="e911Override" type="VehicleDataStatus">
+ <description>Indicates whether e911 override is on. References signal "MyKey_e911Override_St". See VehicleDataStatus.</description>
+ </param>
+ </struct>
+
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+<!-- / Ford Specific Data Items -->
+<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+ <enum name="VehicleDataResultCode">
+ <description>Enumeration that describes possible result codes of a vehicle data entry request.</description>
+ <element name="SUCCESS" internal_name="VDRC_SUCCESS"/>
+ <element name="TRUNCATED_DATA" internal_name="VDRC_TRUNCATED_DATA"/>
+ <element name="DISALLOWED" internal_name="VDRC_DISALLOWED"/>
+ <element name="USER_DISALLOWED" internal_name="VDRC_USER_DISALLOWED"/>
+ <element name="INVALID_ID" internal_name="VDRC_INVALID_ID"/>
+ <element name="VEHICLE_DATA_NOT_AVAILABLE" internal_name="VDRC_DATA_NOT_AVAILABLE"/>
+ <element name="DATA_ALREADY_SUBSCRIBED" internal_name="VDRC_DATA_ALREADY_SUBSCRIBED"/>
+ <element name="DATA_NOT_SUBSCRIBED" internal_name="VDRC_DATA_NOT_SUBSCRIBED"/>
+ <element name="IGNORED" internal_name="VDRC_IGNORED"/>
+ </enum>
+
+ <struct name="TireStatus">
+ <description>The status and pressure of the tires.</description>
+
+ <param name="pressureTelltale" type="WarningLightStatus">
+ <description>Status of the Tire Pressure Telltale. See WarningLightStatus.</description>
+ </param>
+ <param name="leftFront" type="SingleTireStatus">
+ <description>The status of the left front tire.</description>
+ </param>
+ <param name="rightFront" type="SingleTireStatus">
+ <description>The status of the right front tire.</description>
+ </param>
+ <param name="leftRear" type="SingleTireStatus">
+ <description>The status of the left rear tire.</description>
+ </param>
+ <param name="rightRear" type="SingleTireStatus">
+ <description>The status of the right rear tire.</description>
+ </param>
+ <param name="innerLeftRear" type="SingleTireStatus">
+ <description>The status of the inner left rear.</description>
+ </param>
+ <param name="innerRightRear" type="SingleTireStatus">
+ <description>The status of the inner right rear.</description>
+ </param>
+ </struct>
+
+ <struct name="GPSData">
+ <description>Struct with the GPS data.</description>
+ <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180">
+ </param>
+ <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90">
+ </param>
+ <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100">
+ <description>The current UTC year.</description>
+ </param>
+ <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12">
+ <description>The current UTC month.</description>
+ </param>
+ <param name="utcDay" type="Integer" minvalue="1" maxvalue="31">
+ <description>The current UTC day.</description>
+ </param>
+ <param name="utcHours" type="Integer" minvalue="0" maxvalue="23">
+ <description>The current UTC hour.</description>
+ </param>
+ <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59">
+ <description>The current UTC minute.</description>
+ </param>
+ <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59">
+ <description>The current UTC second.</description>
+ </param>
+ <param name="compassDirection" type="CompassDirection">
+ <description>See CompassDirection.</description>
+ </param>
+ <param name="pdop" type="Float" minvalue="0" maxvalue="10" defvalue="0">
+ <description>PDOP. If undefined or unavailable, then value shall be set to 0.</description>
+ </param>
+ <param name="hdop" type="Float" minvalue="0" maxvalue="10" defvalue="0">
+ <description>HDOP. If value is unknown, value shall be set to 0.</description>
+ </param>
+ <param name="vdop" type="Float" minvalue="0" maxvalue="10" defvalue="0">
+ <description>VDOP. If value is unknown, value shall be set to 0.</description>
+ </param>
+ <param name="actual" type="Boolean">
+ <description>
+ True, if actual.
+ False, if infered.
+ </description>
+ </param>
+ <param name="satellites" type="Integer" minvalue="0" maxvalue="31">
+ <description>Number of satellites in view</description>
+ </param>
+ <param name="dimension" type="Dimension">
+ <description>See Dimension</description>
+ </param>
+ <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000">
+ <description>Altitude in meters</description>
+ </param>
+ <param name="heading" type="Float" minvalue="0" maxvalue="359.99">
+ <description>The heading. North is 0. Resolution is 0.01</description>
+ </param>
+ <param name="speed" type="Float" minvalue="0" maxvalue="500">
+ <description>The speed in KPH</description>
+ </param>
+ </struct>
+
+ <struct name="VehicleDataResult">
+ <description>Individual published data request result</description>
+ <param name="dataType" type="VehicleDataType">
+ <description>Defined published data element type.</description>
+ </param>
+ <param name="resultCode" type="VehicleDataResultCode">
+ <description>Published data result code.</description>
+ </param>
+ </struct>
+
+ <struct name="DIDResult">
+ <description>Individual requested DID result and data</description>
+ <param name="resultCode" type="VehicleDataResultCode">
+ <description>Individual DID result code.</description>
+ </param>
+ <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Location of raw data from vehicle data DID</description>
+ </param>
+ <param name="data" type="String" maxlength="5000" mandatory="false">
+ <description>Raw DID-based data returned for requested element.</description>
+ </param>
+ </struct>
+
+ <struct name="StartTime">
+ <param name="hours" type="Integer" minvalue="0" maxvalue="59">
+ <description>
+ The hour of the media clock.
+ Some radios only support a max of 19 hours. If out of range, it will be rejected.
+ </description>
+ </param>
+ <param name="minutes" type="Integer" minvalue="0" maxvalue="59" />
+ <param name="seconds" type="Integer" minvalue="0" maxvalue="59" />
+ </struct>
+
+ <struct name="TextField">
+ <param name="name" type="TextFieldName">
+ <description>The name that identifies the field. See TextFieldName.</description>
+ </param>
+ <param name="characterSet" type="CharacterSet">
+ <description>The character set that is supported in this field. See CharacterSet.</description>
+ </param>
+ <param name="width" type="Integer" minvalue="1" maxvalue="500">
+ <description>The number of characters in one row of this field.</description>
+ </param>
+ <param name="rows" type="Integer" minvalue="1" maxvalue="8">
+ <description>The number of rows of this field.</description>
+ </param>
+ </struct>
+
+ <struct name="ImageResolution">
+ <param name="resolutionWidth" type="Integer" minvalue="1" maxvalue="10000">
+ <description>The image resolution width.</description>
+ </param>
+ <param name="resolutionHeight" type="Integer" minvalue="1" maxvalue="10000">
+ <description>The image resolution height.</description>
+ </param>
+ </struct>
+
+ <struct name="ImageField">
+ <param name="name" type="ImageFieldName">
+ <description>The name that identifies the field. See ImageFieldName.</description>
+ </param>
+ <param name="imageTypeSupported" type="FileType" array="true">
+ <description>The image types that are supported in this field. See FileType.</description>
+ </param>
+ <param name="imageResolution" type="ImageResolution">
+ <description>The image resolution of this field.</description>
+ </param>
+ </struct>
+
+ <struct name="TouchCoord">
+ <param name="x" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
+ <description>The x coordinate of the touch.</description>
+ </param>
+ <param name="y" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
+ <description>The y coordinate of the touch.</description>
+ </param>
+ </struct>
+
+ <enum name="TouchType">
+ <element name="BEGIN"/>
+ <element name="MOVE"/>
+ <element name="END"/>
+ </enum>
+
+ <struct name="TouchEvent">
+ <param name="id" type="Integer" mandatory="true" minvalue="0" maxvalue="9">
+ <description>
+ A touch's unique identifier. The application can track the current touch events by id.
+ If a touch event has type begin, the id should be added to the set of touches.
+ If a touch event has type end, the id should be removed from the set of touches.
+ </description>
+ </param>
+ <param name="ts" type="Integer" mandatory="true" array="true" minvalue="0" maxvalue="2147483647" minsize="1" maxsize="1000">
+ <description>
+ The time that the touch was recorded. This number can the time since the beginning of the session or something else as long as the units are in milliseconds.
+ The timestamp is used to determined the rate of change of position of a touch.
+ The application also uses the time to verify whether two touches, with different ids, are part of a single action by the user.
+ If there is only a single timestamp in this array, it is the same for every coordinate in the coordinates array.
+ </description>
+ </param>
+ <param name="c" type="TouchCoord" mandatory="true" array="true" minsize="1" maxsize="1000">
+ </param>
+ </struct>
+
+ <struct name="Coordinate">
+ <param name="xCoord" type="Integer" mandatory="true">
+ </param>
+ <param name="yCoord" type="Integer" mandatory="true">
+ </param>
+ </struct>
+
+ <struct name="TouchArea">
+ <param name="rotationAngle" type="Float" mandatory="false" minvalue="0" maxvalue="360">
+ </param>
+ <param name="radiusCoord" type="Coordinate" mandatory="true">
+ </param>
+ </struct>
+
+ <struct name="TouchEventCapabilities">
+ <param name="pressAvailable" type="Boolean" mandatory="true">
+ </param>
+ <param name="multiTouchAvailable" type="Boolean" mandatory="true">
+ </param>
+ <param name="doublePressAvailable" type="Boolean" mandatory="true">
+ </param>
+ </struct>
+
+ <struct name="ScreenParams">
+ <param name="resolution" type="ImageResolution" mandatory="true">
+ <description>The resolution of the prescribed screen area.</description>
+ </param>
+ <param name="touchEventAvailable" type="TouchEventCapabilities" mandatory="false">
+ <description>Types of screen touch events available in screen area.</description>
+ </param>
+ </struct>
+
+ <enum name="PermissionStatus">
+ <description>Enumeration that describes possible permission states of a policy table entry.</description>
+ <element name="ALLOWED" internal_name="PS_ALLOWED"/>
+ <element name="DISALLOWED" internal_name="PS_DISALLOWED"/>
+ <element name="USER_DISALLOWED" internal_name="PS_USER_DISALLOWED"/>
+ <element name="USER_CONSENT_PENDING" internal_name="PS_USER_CONSENT_PENDING"/>
+ </enum>
+
+ <struct name="HMIPermissions">
+ <param name="allowed" type="HMILevel" minsize="0" maxsize="100" array="true">
+ <description>A set of all HMI levels that are permitted for this given RPC.</description>
+ </param>
+ <param name="userDisallowed" type="HMILevel" minsize="0" maxsize="100" array="true">
+ <description>A set of all HMI levels that are prohibited for this given RPC.</description>
+ </param>
+ </struct>
+
+ <struct name="ParameterPermissions">
+ <param name="allowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true">
+ <description>A set of all parameters that are permitted for this given RPC.</description>
+ </param>
+ <param name="userDisallowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true">
+ <description>A set of all parameters that are prohibited for this given RPC.</description>
+ </param>
+ </struct>
+
+ <struct name="PermissionItem">
+ <param name="rpcName" type="String" maxlength="100">
+ <description>Name of the individual RPC in the policy table.</description>
+ </param>
+ <param name="hmiPermissions" type="HMIPermissions" />
+ <param name="parameterPermissions" type="ParameterPermissions" />
+ </struct>
+
+ <struct name="DisplayCapabilities">
+ <description>Contains information about the display capabilities.</description>
+ <param name="displayType" type="DisplayType">
+ <description>The type of the display. See DisplayType</description>
+ </param>
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true">
+ <description>A set of all fields that support text data. See TextField</description>
+ </param>
+ <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true">
+ <description>A set of all fields that support images. See ImageField</description>
+ </param>
+ <param name="mediaClockFormats" type="MediaClockFormat" minsize="0" maxsize="100" array="true">
+ <description>A set of all supported formats of the media clock. See MediaClockFormat</description>
+ </param>
+ <param name="graphicSupported" type="Boolean">
+ <description>The display's persistent screen supports referencing a static or dynamic image.</description>
+ </param>
+ <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true">
+ <description>A set of all predefined persistent display templates available on headunit. To be referenced in SetDisplayLayout.</description>
+ </param>
+ <param name="screenParams" type="ScreenParams" mandatory="false">
+ <description>A set of all parameters related to a prescribed screen area (e.g. for video / touch input).</description>
+ </param>
+ <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
+ <description>The number of on-screen custom presets available (if any); otherwise omitted.</description>
+ </param>
+ </struct>
+
+ <struct name="ButtonCapabilities">
+ <description>Contains information about a button's capabilities.</description>
+ <param name="name" type="ButtonName">
+ <description>The name of the button. See ButtonName.</description>
+ </param>
+ <param name="shortPressAvailable" type="Boolean">
+ <description>
+ The button supports a short press.
+ Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
+ </description>
+ </param>
+ <param name="longPressAvailable" type="Boolean">
+ <description>
+ The button supports a LONG press.
+ Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
+ </description>
+ </param>
+ <param name="upDownAvailable" type="Boolean">
+ <description>
+ The button supports "button down" and "button up".
+ Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.
+ Whenever the button is released, onButtonEvent( UP) will be invoked.
+ </description>
+ </param>
+ </struct>
+
+ <struct name="SoftButtonCapabilities">
+ <description>Contains information about a SoftButton's capabilities.</description>
+ <param name="shortPressAvailable" type="Boolean">
+ <description>
+ The button supports a short press.
+ Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
+ </description>
+ </param>
+ <param name="longPressAvailable" type="Boolean">
+ <description>
+ The button supports a LONG press.
+ Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
+ </description>
+ </param>
+ <param name="upDownAvailable" type="Boolean">
+ <description>
+ The button supports "button down" and "button up".
+ Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.
+ Whenever the button is released, onButtonEvent( UP) will be invoked.
+ </description>
+ </param>
+ <param name="imageSupported" type="Boolean">
+ <description>The button supports referencing a static or dynamic image.</description>
+ </param>
+ </struct>
+
+ <struct name="PresetBankCapabilities">
+ <description>Contains information about on-screen preset capabilities.</description>
+ <param name="onScreenPresetsAvailable" type="Boolean">
+ <description>Onscreen custom presets are available.</description>
+ </param>
+ </struct>
+
+ <struct name="MenuParams">
+ <param name="parentID" type="Integer" minvalue="0" maxvalue="2000000000" defvalue="0" mandatory="false">
+ <description>
+ unique ID of the sub menu, the command will be added to.
+ If not provided, it will be provided to the top level of the in application menu.
+ </description>
+ </param>
+
+ <param name="position" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>
+ Position within the items that are are at top level of the in application menu.
+ 0 will insert at the front.
+ 1 will insert at the second position.
+ if position is greater or equal than the number of items on top level, the sub menu will be appended to the end.
+ If this param was omitted the entry will be added at the end.
+ </description>
+ </param>
+
+ <param name="menuName" type="String" maxlength="500">
+ <description>Text to show in the menu for this sub menu.</description>
+ </param>
+ </struct>
+
+ <struct name="TTSChunk">
+ <description>A TTS chunk, that consists of the text/phonemes to speak and the type (like text or SAPI)</description>
+ <param name="text" minlength="0" maxlength="500" type="String">
+ <description>
+ The text or phonemes to speak.
+ May not be empty.
+ </description>
+ </param>
+ <param name="type" type="SpeechCapabilities">
+ <description>Describes, whether it is text or a specific phoneme set. See SpeechCapabilities</description>
+ </param>
+ </struct>
+
+ <struct name="Turn">
+ <param name="navigationText" type="String" maxlength="500" mandatory="false">
+ </param>
+ <param name="turnIcon" type="Image" mandatory="false">
+ </param>
+ </struct>
+
+ <struct name="VehicleType">
+ <param name="make" type="String" maxlength="500" mandatory="false">
+ <description>Make of the vehicle, e.g. Ford</description>
+ </param>
+ <param name="model" type="String" maxlength="500" mandatory="false">
+ <description>Model of the vehicle, e.g. Fiesta</description>
+ </param>
+ <param name="modelYear" type="String" maxlength="500" mandatory="false">
+ <description>Model Year of the vehicle, e.g. 2013</description>
+ </param>
+ <param name="trim" type="String" maxlength="500" mandatory="false">
+ <description>Trim of the vehicle, e.g. SE</description>
+ </param>
+ </struct>
+
+ <enum name="KeyboardLayout">
+ <description>Enumeration listing possible keyboard layouts.</description>
+ <element name="QWERTY" />
+ <element name="QWERTZ" />
+ <element name="AZERTY" />
+ </enum>
+
+ <enum name="KeyboardEvent" platform="MobileNav">
+ <description>Enumeration listing possible keyboard events.</description>
+ <element name="KEYPRESS" />
+ <element name="ENTRY_SUBMITTED" />
+ <element name="ENTRY_VOICE" />
+ <element name="ENTRY_CANCELLED" />
+ <element name="ENTRY_ABORTED" />
+ </enum>
+
+ <enum name="KeypressMode">
+ <description>Enumeration listing possible keyboard events.</description>
+ <element name="SINGLE_KEYPRESS">
+ <description>Each keypress is individually sent as the user presses the keyboard keys.</description>
+ </element>
+ <element name="QUEUE_KEYPRESSES">
+ <description>The keypresses are queued and a string is eventually sent once the user chooses to submit their entry.</description>
+ </element>
+ <element name="RESEND_CURRENT_ENTRY">
+ <description>The keypresses are queue and a string is sent each time the user presses a keyboard key; the string contains the entire current entry.</description>
+ </element>
+ </enum>
+
+ <struct name="KeyboardProperties">
+ <description>Configuration of on-screen keyboard (if available).</description>
+
+ <param name="language" type="Language" mandatory="false">
+ <description>The keyboard language.</description>
+ </param>
+
+ <param name="keyboardLayout" type="KeyboardLayout" mandatory="false" >
+ <description>Desired keyboard layout.</description>
+ </param>
+
+ <param name="keypressMode" type="KeypressMode" mandatory="false" >
+ <description>
+ Desired keypress mode.
+ If omitted, this value will be set to RESEND_CURRENT_ENTRY.
+ </description>
+ </param>
+
+ <param name="limitedCharacterList" type="String" maxlength="1" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>Array of keyboard characters to enable.</description>
+ <description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
+ <description>If omitted, the entire keyboard will be enabled.</description>
+ </param>
+
+ <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
+ <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
+ </param>
+ </struct>
+
+ <enum name="RequestType">
+ <description>Enumeration listing possible asynchronous requests.</description>
+ <element name="HTTP" />
+ <element name="FILE_RESUME" />
+ <element name="AUTH_REQUEST" />
+ <element name="AUTH_CHALLENGE" />
+ <element name="AUTH_ACK" />
+ <element name="PROPRIETARY" />
+ <element name="QUERY_APPS" />
+ <element name="LAUNCH_APP" />
+ <element name="LOCK_SCREEN_ICON_URL" />
+ <element name="TRAFFIC_MESSAGE_CHANNEL" />
+ <element name="DRIVER_PROFILE" />
+ <element name="VOICE_SEARCH" />
+ <element name="NAVIGATION" />
+ <element name="PHONE" />
+ <element name="CLIMATE" />
+ <element name="SETTINGS" />
+ <element name="VEHICLE_DIAGNOSTICS" />
+ <element name="EMERGENCY" />
+ <element name="MEDIA" />
+ <element name="FOTA" />
+ </enum>
+
+ <enum name="AppHMIType">
+ <description>Enumeration listing possible app types.</description>
+ <element name="DEFAULT" />
+ <element name="COMMUNICATION" />
+ <element name="MEDIA" />
+ <element name="MESSAGING" />
+ <element name="NAVIGATION" />
+ <element name="INFORMATION" />
+ <element name="SOCIAL" />
+ <element name="BACKGROUND_PROCESS" />
+ <element name="TESTING" />
+ <element name="SYSTEM" />
+ </enum>
+
+ <enum name="FunctionID" internal_scope="base">
+ <description>Enumeration linking function names with function IDs in AppLink protocol.</description>
+ <description>Assumes enumeration starts at value 0.</description>
+ <element name="RESERVED" value="0" />
+<!--
+ Base Request / Response RPCs
+ Range = 0x 0000 0001 - 0x 0000 7FFF
+-->
+ <element name="RegisterAppInterfaceID" value="1" hexvalue="1" />
+ <element name="UnregisterAppInterfaceID" value="2" hexvalue="2" />
+ <element name="SetGlobalPropertiesID" value="3" hexvalue="3" />
+ <element name="ResetGlobalPropertiesID" value="4" hexvalue="4" />
+ <element name="AddCommandID" value="5" hexvalue="5" />
+ <element name="DeleteCommandID" value="6" hexvalue="6" />
+ <element name="AddSubMenuID" value="7" hexvalue="7" />
+ <element name="DeleteSubMenuID" value="8" hexvalue="8" />
+ <element name="CreateInteractionChoiceSetID" value="9" hexvalue="9" />
+ <element name="PerformInteractionID" value="10" hexvalue="A" />
+ <element name="DeleteInteractionChoiceSetID" value="11" hexvalue="B" />
+ <element name="AlertID" value="12" hexvalue="C" />
+ <element name="ShowID" value="13" hexvalue="D" />
+ <element name="SpeakID" value="14" hexvalue="E" />
+ <element name="SetMediaClockTimerID" value="15" hexvalue="F" />
+ <element name="PerformAudioPassThruID" value="16" hexvalue="10" />
+ <element name="EndAudioPassThruID" value="17" hexvalue="11" />
+ <element name="SubscribeButtonID" value="18" hexvalue="12" />
+ <element name="UnsubscribeButtonID" value="19" hexvalue="13" />
+ <element name="SubscribeVehicleDataID" value="20" hexvalue="14" />
+ <element name="UnsubscribeVehicleDataID" value="21" hexvalue="15" />
+ <element name="GetVehicleDataID" value="22" hexvalue="16" />
+ <element name="ReadDIDID" value="23" hexvalue="17" />
+ <element name="GetDTCsID" value="24" hexvalue="18" />
+ <element name="ScrollableMessageID" value="25" hexvalue="19" />
+ <element name="SliderID" value="26" hexvalue="1A" />
+ <element name="ShowConstantTBTID" value="27" hexvalue="1B" />
+ <element name="AlertManeuverID" value="28" hexvalue="1C" />
+ <element name="UpdateTurnListID" value="29" hexvalue="1D" />
+ <element name="ChangeRegistrationID" value="30" hexvalue="1E" />
+ <element name="GenericResponseID" value="31" hexvalue="1F" />
+ <element name="PutFileID" value="32" hexvalue="20" />
+ <element name="DeleteFileID" value="33" hexvalue="21" />
+ <element name="ListFilesID" value="34" hexvalue="22" />
+ <element name="SetAppIconID" value="35" hexvalue="23" />
+ <element name="SetDisplayLayoutID" value="36" hexvalue="24" />
+ <element name="DiagnosticMessageID" value="37" hexvalue="25" />
+ <element name="SystemRequestID" value="38" hexvalue="26" />
+ <element name="SendLocationID" value="39" hexvalue="27" />
+ <element name="DialNumberID" value="40" hexvalue="28" />
+
+
+
+<!--
+ Base Notifications
+ Range = 0x 0000 8000 - 0x 0000 FFFF
+-->
+
+ <element name="OnHMIStatusID" value="32768" hexvalue="8000" />
+ <element name="OnAppInterfaceUnregisteredID" value="32769" hexvalue="8001" />
+ <element name="OnButtonEventID" value="32770" hexvalue="8002" />
+ <element name="OnButtonPressID" value="32771" hexvalue="8003" />
+ <element name="OnVehicleDataID" value="32772" hexvalue="8004" />
+ <element name="OnCommandID" value="32773" hexvalue="8005" />
+ <element name="OnTBTClientStateID" value="32774" hexvalue="8006" />
+ <element name="OnDriverDistractionID" value="32775" hexvalue="8007" />
+ <element name="OnPermissionsChangeID" value="32776" hexvalue="8008" />
+ <element name="OnAudioPassThruID" value="32777" hexvalue="8009" />
+ <element name="OnLanguageChangeID" value="32778" hexvalue="800A" />
+ <element name="OnKeyboardInputID" value="32779" hexvalue="800B" />
+ <element name="OnTouchEventID" value="32780" hexvalue="800C" />
+ <element name="OnSystemRequestID" value="32781" hexvalue="800D" />
+ <element name="OnHashChangeID" value="32782" hexvalue="800E" />
+<!--
+ Ford Specific Request / Response RPCs
+ Range = 0x 0001 0000 - 0x 0001 7FFF
+-->
+
+
+<!--
+ Ford Specific Notifications
+ Range = 0x 0001 8000 - 0x 0001 FFFF
+-->
+
+ </enum>
+
+ <enum name="messageType">
+ <description>
+ Enumeration linking message types with function types in WiPro protocol.
+ Assumes enumeration starts at value 0.
+ </description>
+ <element name="request" value="0" />
+ <element name="response" value="1" />
+ <element name="notification" value="2" />
+ </enum>
+
+ <!-- Requests/Responses -->
+
+ <function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="request">
+ <description>
+ Establishes an interface with a mobile application.
+ Before registerAppInterface no other commands will be accepted/executed.
+ </description>
+
+ <param name="syncMsgVersion" type="SyncMsgVersion">
+ <description>See SyncMsgVersion</description>
+ </param>
+
+ <param name="appName" type="String" maxlength="100">
+ <description>
+ The mobile application name, e.g. "Ford Drive Green".
+ Needs to be unique over all applications.
+ May not be empty.
+ May not start with a new line character.
+ May not interfere with any name or synonym of previously registered applications and any predefined blacklist of words (global commands)
+ Needs to be unique over all applications. Applications with the same name will be rejected.
+ Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
+ </description>
+ </param>
+
+ <param name="ttsName" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>
+ TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green".
+ Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.
+ Needs to be unique over all applications.
+ May not be empty.
+ May not start with a new line character.
+ </description>
+ </param>
+
+ <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
+ <description>
+ Provides an abbreviated version of the app name (if needed), that will be displayed on the NGN media screen.
+ If not provided, the appName is used instead (and will be truncated if too long)
+ Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
+ </description>
+ </param>
+
+ <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Defines an additional voice recognition command.
+ May not interfere with any app name of previously registered applications and any predefined blacklist of words
+ (global commands)
+ Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
+ </description>
+ </param>
+
+ <param name="isMediaApplication" type="Boolean">
+ <description>
+ Indicates if the application is a media or a non-media application.
+ Only media applications will be able to stream audio to Sync that is audible outside of the BT media source.
+ </description>
+ </param>
+ <param name="languageDesired" type="Language" mandatory="true">
+ <description>
+ See Language
+ Current app’s expected VR+TTS language
+ If there is a mismatch with SYNC, the app will be able to change this registration with changeRegistration prior to app being brought into focus.
+ </description>
+ </param>
+ <param name="hmiDisplayLanguageDesired" type="Language" mandatory="true">
+ <description>
+ See Language
+ Current app’s expected display language
+ If there is a mismatch with SYNC, the app will be able to change this registration with changeRegistration prior to app being brought into focus.
+ </description>
+ </param>
+ <param name="appHMIType" type="AppHMIType" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ See AppHMIType
+ List of all applicable app HMI types stating which HMI classifications to be given to the app.
+ e.g. for platforms like GEN2, this will determine which "corner(s)" the app can populate.
+ </description>
+ </param>
+ <param name="hashID" type="String" maxlength="100" mandatory="false">
+ <description>
+ ID used to uniquely identify current state of all app data that can persist through connection cycles (e.g. ignition cycles).
+ This registered data (commands, submenus, choice sets, etc.) can be reestablished without needing to explicitly reregister each piece.
+ If omitted, then the previous state of an app's commands, etc. will not be restored.
+ </description>
+ </param>
+ <param name="deviceInfo" type="DeviceInfo" mandatory="false">
+ <description>
+ See DeviceInfo.
+ </description>
+ </param>
+ <param name="appID" type="String" maxlength="100" mandatory="true">
+ <description>ID used to validate app with policy table entries</description>
+ </param>
+ </function>
+
+ <function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="response">
+ <description>The response to registerAppInterface</description>
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="TOO_MANY_APPLICATIONS"/>
+ <element name="APPLICATION_REGISTERED_ALREADY"/>
+ <element name="UNSUPPORTED_VERSION"/>
+ <element name="WRONG_LANGUAGE"/>
+ <element name="DISALLOWED"/>
+ <element name="WARNINGS"/>
+ <element name="RESUME_FAILED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="syncMsgVersion" type="SyncMsgVersion" mandatory="false">
+ <description>See SyncMsgVersion</description>
+ </param>
+
+ <param name="language" type="Language" mandatory="false">
+ <description>The currently active VR+TTS language on Sync. See "Language" for options.</description>
+ </param>
+
+ <param name="hmiDisplayLanguage" type="Language" mandatory="false">
+ <description>The currently active display language on Sync. See "Language" for options.</description>
+ </param>
+
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
+ <description>See DisplayCapabilities</description>
+ </param>
+
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See ButtonCapabilities</description >
+ </param>
+
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+ </param>
+
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false">
+ <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+ </param>
+
+ <param name="hmiZoneCapabilities" type="HmiZoneCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <issue creator="rs">If not used yet => remove</issue>
+ <description>See HmiZoneCapabilities</description>
+ </param>
+
+ <param name="speechCapabilities" type="SpeechCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See SpeechCapabilities</description>
+ </param>
+
+ <param name="vrCapabilities" type="VrCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See VrCapabilities</description>
+ </param>
+
+ <param name="audioPassThruCapabilities" type="AudioPassThruCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See AudioPassThruCapability</description>
+ </param>
+
+ <param name="vehicleType" type="VehicleType" mandatory="false">
+ <description>Specifies the vehicle's type. See VehicleType.</description>
+ </param>
+
+ <param name="prerecordedSpeech" type="PrerecordedSpeech" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See PrerecordedSpeech</description>
+ </param>
+
+ <param name="supportedDiagModes" type="Integer" minvalue="0" maxvalue="255" array="true" minsize="1" maxsize="100" mandatory="false">
+ <description>
+ Specifies the white-list of supported diagnostic modes (0x00-0xFF) capable for DiagnosticMessage requests.
+ If a mode outside this list is requested, it will be rejected.
+ </description>
+ </param>
+ <param name="hmiCapabilities" type="HMICapabilities" mandatory="false">
+ <description>Specifies the HMI’s capabilities. See HMICapabilities.</description>
+ </param>
+ <param name="sdlVersion" type="String" maxlength="100" mandatory="false" platform="documentation">
+ <description>The SmartDeviceLink version.</description>
+ </param>
+ <param name="systemSoftwareVersion" type="String" maxlength="100" mandatory="false" platform="documentation">
+ <description>The software version of the system that implements the SmartDeviceLink core.</description>
+ </param>
+ </function>
+
+ <function name="UnregisterAppInterface" functionID="UnregisterAppInterfaceID" messagetype="request">
+ <description>
+ Closes an interface from a mobile application.
+ After unregisterAppInterface, no commands other than registerAppInterface will be accepted/executed.
+ Will fail, if no registerAppInterface was completed successfully before.
+ </description>
+ </function>
+
+ <function name="UnregisterAppInterface" functionID="UnregisterAppInterfaceID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="request">
+ <description>Allows setting global properties.</description>
+
+ <param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>
+ The help prompt.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="timeoutPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>
+ Help text for a wait timeout.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="vrHelpTitle" type="String" maxlength="500" mandatory="false">
+ <description>
+ VR Help Title text.
+ If omitted on supported displays, the default SYNC help title shall be used.
+ If omitted and one or more vrHelp items are provided, the request will be rejected.
+ </description>
+ </param>
+
+ <param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ VR Help Items.
+ If omitted on supported displays, the default AppLink VR help / What Can I Say? screen shall be used.
+ If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC shall be rejected.
+ If omitted and a vrHelpTitle is provided, the request will be rejected.
+ </description>
+ </param>
+ <param name="menuTitle" maxlength="500" type="String" mandatory="false">
+ <description>Optional text to label an app menu button (for certain touchscreen platforms).</description>
+ </param>
+
+ <param name="menuIcon" type="Image" mandatory="false">
+ <description>>Optional icon to draw on an app menu button (for certain touchscreen platforms).</description>
+ </param>
+
+ <param name="keyboardProperties" type="KeyboardProperties" mandatory="false">
+ <description>On-screen keybaord configuration (if available).</description>
+ </param>
+ </function>
+
+ <function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="request">
+ <description>Allows resetting global properties.</description>
+
+ <param name="properties" type="GlobalProperty" minsize="1" maxsize="100" array="true" >
+ <description>Contains the names of all global properties (like timeoutPrompt) that should be unset. Resetting means, that they have the same value as at start up (default)</description>
+ </param>
+ </function>
+
+ <function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="AddCommand" functionID="AddCommandID" messagetype="request">
+ <description>
+ Adds a command to the in application menu.
+ Either menuParams or vrCommands must be provided.
+ </description>
+
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
+ <description>unique ID of the command to add.</description>
+ </param>
+
+ <param name="menuParams" type="MenuParams" mandatory="false">
+ <description>Optional sub value containing menu parameters</description>
+ </param>
+
+ <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" mandatory="false">
+ <description>
+ An array of strings to be used as VR synonyms for this command.
+ If this array is provided, it may not be empty.
+ </description>
+ </param>
+
+ <param name="cmdIcon" type="Image" mandatory="false">
+ <description>
+ Image struct determining whether static or dynamic icon.
+ If omitted on supported displays, no (or the default if applicable) icon shall be displayed.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="AddCommand" functionID="AddCommandID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteCommand" functionID="DeleteCommandID" messagetype="request">
+ <description>Deletes all commands from the in-application menu with the specified command id.</description>
+
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <description>ID of the command(s) to delete.</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteCommand" functionID="DeleteCommandID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="IN_USE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="AddSubMenu" functionID="AddSubMenuID" messagetype="request">
+ <description>Adds a sub menu to the in-application menu.</description>
+
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000">
+ <description>unique ID of the sub menu to add.</description>
+ </param>
+
+ <param name="position" type="Integer" minvalue="0" maxvalue="1000" defvalue="1000" mandatory="false">
+ <description>
+ Position within the items that are are at top level of the in application menu.
+ 0 will insert at the front.
+ 1 will insert at the second position.
+ If position is greater or equal than the number of items on top level, the sub menu will be appended to the end.
+ Position of any submenu will always be located before the return and exit options
+ If this param was omitted the entry will be added at the end.
+ </description>
+ </param>
+
+ <param name="menuName" maxlength="500" type="String">
+ <description>Text to show in the menu for this sub menu.</description>
+ </param>
+ </function>
+
+ <function name="AddSubMenu" functionID="AddSubMenuID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="request">
+ <description>Deletes a submenu from the in-application menu.</description>
+
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000">
+ <description>The "menuID" of the submenu to delete. (See addSubMenu.menuID)</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="IN_USE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="request">
+ <description>creates interaction choice set to be used later by performInteraction</description>
+
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <description>Unique ID used for this interaction choice set.</description>
+ </param>
+
+ <param name="choiceSet" type="Choice" minsize="1" maxsize="100" array="true" />
+ </function>
+
+ <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="request">
+ <description>Triggers an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description>
+
+ <param name="initialText" type="String" maxlength="500" >
+ <description>Text to be displayed first.</description>
+ </param>
+
+ <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ This is the intial prompt spoken to the user at the start of an interaction.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="interactionMode" type="InteractionMode">
+ <description>See InteractionMode.</description>
+ </param>
+
+ <param name="interactionChoiceSetIDList" type="Integer" minsize="0" maxsize="100" minvalue="0" maxvalue="2000000000" array="true">
+ <description>List of interaction choice set IDs to use with an interaction.</description>
+ </param>
+
+ <param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Help text. This is the spoken string when a user speaks "help" when the interaction is occuring.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="timeoutPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Timeout text. This text is spoken when a VR interaction times out.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="timeout" type="Integer" minvalue="5000" maxvalue="100000" defvalue="10000" mandatory="false">
+ <description>
+ Timeout in milliseconds.
+ If omitted a standard value of 10000 milliseconds is used.
+ Applies only to the menu portion of the interaction. The VR timeout will be handled by the platform.
+ </description>
+ </param>
+
+ <param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Ability to send suggested VR Help Items to display on-screen during Perform Interaction.
+ If omitted on supported displays, the default SYNC generated list of suggested choices shall be displayed.
+ </description>
+ </param>
+
+ <param name="interactionLayout" type="LayoutMode" mandatory="false">
+ <description>See LayoutMode.</description>
+ </param>
+
+ </function>
+
+ <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="TIMED_OUT"/>
+ <element name="ABORTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ ID of the choice that was selected in response to PerformInteraction.
+ Only is valid if resultCode is SUCCESS.
+ </description>
+ </param>
+
+ <param name="manualTextEntry" type="String" maxlength="500" mandatory="false">
+ <description>
+ Manually entered text selection, e.g. through keyboard
+ Can be returned in lieu of choiceID, depending on trigger source
+ </description>
+ </param>
+
+ <param name="triggerSource" type="TriggerSource" mandatory="false">
+ <description>
+ See TriggerSource
+ Only is valid if resultCode is SUCCESS.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="DeleteInteractionChoiceSet" functionID="DeleteInteractionChoiceSetID" messagetype="request">
+ <description>Deletes interaction choice set that has been created with "CreateInteractionChoiceSet".</description>
+ <description>The interaction may only be deleted when not currently in use by a "performInteraction".</description>
+
+ <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <description>ID of the interaction choice set to delete.</description>
+ </param>
+ </function>
+
+ <function name="DeleteInteractionChoiceSet" functionID="DeleteInteractionChoiceSetID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_ID"/>
+ <element name="IN_USE"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="Alert" functionID="AlertID" messagetype="request">
+ <description>Shows an alert which typically consists of text-to-speech message and text on the display. At least either alertText1, alertText2 or TTSChunks need to be provided.</description>
+
+ <param name="alertText1" type="String" maxlength="500" mandatory="false">
+ <description>The first line of the alert text field</description>
+ </param>
+
+ <param name="alertText2" type="String" maxlength="500" mandatory="false">
+ <description>The second line of the alert text field</description>
+ </param>
+
+ <param name="alertText3" type="String" maxlength="500" mandatory="false">
+ <description>The optional third line of the alert text field</description>
+ </param>
+
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ <param name="duration" type="Integer" minvalue="3000" maxvalue="10000" defvalue="5000" mandatory="false">
+ <description>
+ Timeout in milliseconds.
+ Typical timeouts are 3-5 seconds.
+ If omitted, timeout is set to 5s.
+ </description>
+ </param>
+
+ <param name="playTone" type="Boolean" mandatory="false">
+ <description>
+ Defines if tone should be played. Tone is played before TTS.
+ If omitted, no tone is played.
+ </description>
+ </param>
+
+ <param name="progressIndicator" type="Boolean" mandatory="false" platform="MobileNav">
+ <description>
+ If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
+ </description>
+ </param>
+
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="4" array="true" mandatory="false">
+ <description>
+ App defined SoftButtons.
+ If omitted on supported displays, the displayed alert shall not have any SoftButtons.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="Alert" functionID="AlertID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="tryAgainTime" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ Amount of time (in seconds) that an app must wait before resending an alert.
+ If provided, another system event or overlay currently has a higher priority than this alert.
+ An app must not send an alert without waiting at least the amount of time dictated.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="Show" functionID="ShowID" messagetype="request">
+ <description>Updates the persistent display. Supported fields depend on display capabilities.</description>
+
+ <param name="mainField1" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed in a single or upper display line.
+ If this text is not set, the text of mainField1 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="mainField2" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed on the second display line.
+ If this text is not set, the text of mainField2 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="mainField3" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed on the second "page" first display line.
+ If this text is not set, the text of mainField3 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="mainField4" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed on the second "page" second display line.
+ If this text is not set, the text of mainField4 stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="alignment" type="TextAlignment" mandatory="false">
+ <description>
+ Specifies how mainField1 and mainField2 texts should be aligned on display.
+ If omitted, texts will be centered.
+ </description>
+ </param>
+
+ <param name="statusBar" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>Requires investigation regarding the nav display capabilities. Potentially lower lowerStatusBar, upperStatusBar, titleBar, etc.</description>
+ </param>
+
+ <param name="mediaClock" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ Text value for MediaClock field. Has to be properly formatted by Mobile App according to Sync capabilities.
+ If this text is set, any automatic media clock updates previously set with SetMediaClockTimer will be stopped.
+ </description>
+ </param>
+
+ <param name="mediaTrack" type="String" minlength="0" maxlength="500" mandatory="false">
+ <description>
+ The text that should be displayed in the track field.
+ This field is only valid for media applications on NGN type ACMs.
+ If this text is not set, the text of mediaTrack stays unchanged.
+ If this text is empty "", the field will be cleared.
+ </description>
+ </param>
+
+ <param name="graphic" type="Image" mandatory="false">
+ <description>
+ Image struct determining whether static or dynamic image to display in app.
+ If omitted on supported displays, the displayed graphic shall not change.
+ </description>
+ </param>
+
+ <param name="secondaryGraphic" type="Image" mandatory="false">
+ <description>
+ Image struct determining whether static or dynamic secondary image to display in app.
+ If omitted on supported displays, the displayed secondary graphic shall not change.
+ </description>
+ </param>
+
+
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
+ <description>
+ App defined SoftButtons.
+ If omitted on supported displays, the currently displayed SoftButton values will not change.
+ </description>
+ </param>
+
+ <param name="customPresets" type="String" maxlength="500" minsize="0" maxsize="10" array="true" mandatory="false">
+ <description>
+ App labeled on-screen presets (i.e. GEN2).
+ If omitted on supported displays, the presets will be shown as not defined.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="Show" functionID="ShowID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="ABORTED"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="Speak" functionID="SpeakID" messagetype="request">
+ <description>Speaks a text.</description>
+
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true">
+ <description>
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="Speak" functionID="SpeakID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="ABORTED"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SetMediaClockTimer" functionID="SetMediaClockTimerID" messagetype="request">
+ <description>Sets the initial media clock value and automatic update method.</description>
+
+ <param name="startTime" type="StartTime" mandatory="false">
+ <description>
+ See StartTime.
+ startTime must be provided for "COUNTUP" and "COUNTDOWN".
+ startTime will be ignored for "PAUSE", "RESUME", and "CLEAR"
+ </description>
+ </param>
+
+ <param name="endTime" type="StartTime" mandatory="false">
+ <description>
+ See StartTime.
+ endTime can be provided for "COUNTUP" and "COUNTDOWN"; to be used to calculate any visual progress bar (if not provided, this feature is ignored)
+ If endTime is greater then startTime for COUNTDOWN or less than startTime for COUNTUP, then the request will return an INVALID_DATA.
+ endTime will be ignored for "PAUSE", "RESUME", and "CLEAR"
+ </description>
+ </param>
+
+ <param name="updateMode" type="UpdateMode" mandatory="true">
+ <description>
+ Enumeration to control the media clock.
+ In case of pause, resume, or clear, the start time value is ignored and shall be left out. For resume, the time continues with the same value as it was when paused.
+ </description>
+ </param>
+ </function>
+
+ <function name="SetMediaClockTimer" functionID="SetMediaClockTimerID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="PerformAudioPassThru" functionID="PerformAudioPassThruID" messagetype="request">
+ <description>Starts audio pass thru session </description>
+ <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ SYNC will speak this prompt before opening the audio pass thru session.
+ An array of text chunks of type TTSChunk. See TTSChunk.
+ The array must have at least one item.
+ If omitted, then no initial prompt is spoken.
+ </description>
+ </param>
+ <param name="audioPassThruDisplayText1" type="String" mandatory="false" maxlength="500">
+ <description>First line of text displayed during audio capture.</description>
+ </param>
+ <param name="audioPassThruDisplayText2" type="String" mandatory="false" maxlength="500">
+ <description>Second line of text displayed during audio capture.</description>
+ </param>
+ <param name="samplingRate" type="SamplingRate" mandatory="true">
+ <description> This value shall be allowed at 8 khz or 16 or 22 or 44 khz.</description>
+ </param>
+ <param name="maxDuration" type="Integer" minvalue="1" maxvalue="1000000" mandatory="true">
+ <description>The maximum duration of audio recording in milliseconds. </description>
+ </param>
+ <param name="bitsPerSample" type="BitsPerSample" mandatory="true">
+ <description>Specifies the quality the audio is recorded. Currently 8 bit or 16 bit.</description>
+ </param>
+ <param name="audioType" type="AudioType" mandatory="true">
+ <description>Specifies the type of audio data being requested.</description>
+ </param>
+ <param name="muteAudio" type="Boolean" mandatory="false">
+ <description>
+ Defines if the current audio source should be muted during the APT session. If not, the audio source will play without interruption.
+ If omitted, the value is set to true.
+ </description>
+ </param>
+ </function>
+
+ <function name="PerformAudioPassThru" functionID="PerformAudioPassThruID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ <element name="RETRY"/>
+ <element name="WARNINGS"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="EndAudioPassThru" functionID="EndAudioPassThruID" messagetype="request">
+ <description>When this request is invoked, the audio capture stops.</description>
+ </function>
+
+ <function name="EndAudioPassThru" functionID="EndAudioPassThruID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="SubscribeButton" functionID="SubscribeButtonID" messagetype="request">
+ <description>
+ Subscribes to built-in HMI buttons.
+ The application will be notified by the OnButtonEvent and OnButtonPress.
+ To unsubscribe the notifications, use unsubscribeButton.
+ </description>
+
+ <param name="buttonName" type="ButtonName">
+ <description>Name of the button to subscribe.</description>
+ </param>
+ </function>
+
+ <function name="SubscribeButton" functionID="SubscribeButtonID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="UNSUPPORTED_RESOURCE" />
+ <element name="IGNORED" />
+ <element name="REJECTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="request">
+ <description>Unsubscribes from built-in HMI buttons.</description>
+
+ <param name="buttonName" type="ButtonName">
+ <description>Name of the button to unsubscribe.</description>
+ </param>
+ </function>
+
+ <function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="UNSUPPORTED_RESOURCE" />
+ <element name="IGNORED" />
+ <element name="REJECTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="SubscribeVehicleData" functionID="SubscribeVehicleDataID" messagetype="request">
+ <description>
+ Subscribes for specific published data items.
+ The data will be only sent if it has changed.
+ The application will be notified by the onVehicleData notification whenever new data is available.
+ To unsubscribe the notifications, use unsubscribe with the same subscriptionType.
+ </description>
+
+ <param name="gps" type="Boolean" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Boolean" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="SubscribeVehicleData" functionID="SubscribeVehicleDataID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="WARNINGS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="IGNORED" />
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="gps" type="VehicleDataResult" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="VehicleDataResult" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="VehicleDataResult" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="VehicleDataResult" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="VehicleDataResult" mandatory="false">
+ <description>The external temperature in degrees celsius.</description>
+ </param>
+ <param name="prndl" type="VehicleDataResult" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="VehicleDataResult" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="VehicleDataResult" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="VehicleDataResult" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="VehicleDataResult" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataResult" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="VehicleDataResult" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="VehicleDataResult" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="VehicleDataResult" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="VehicleDataResult" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="VehicleDataResult" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="VehicleDataResult" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModes" type="VehicleDataResult" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="VehicleDataResult" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="request">
+ <description>This function is used to unsubscribe the notifications from the subscribeVehicleData function.</description>
+
+ <param name="gps" type="Boolean" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius.</description>
+ </param>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Boolean" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="WARNINGS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="IGNORED" />
+ <element name="DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="gps" type="VehicleDataResult" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="VehicleDataResult" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="VehicleDataResult" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="VehicleDataResult" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="VehicleDataResult" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="VehicleDataResult" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="prndl" type="VehicleDataResult" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="VehicleDataResult" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="VehicleDataResult" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="VehicleDataResult" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="VehicleDataResult" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataResult" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="VehicleDataResult" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="VehicleDataResult" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="VehicleDataResult" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="VehicleDataResult" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="VehicleDataResult" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="VehicleDataResult" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="VehicleDataResult" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModes" type="VehicleDataResult" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="VehicleDataResult" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="request">
+ <description>Non periodic vehicle data read request.</description>
+
+ <param name="gps" type="Boolean" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="vin" type="Boolean" mandatory="false">
+ <description>Vehicle identification number</description>
+ </param>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including ignition status and internal temp</description>
+ </param>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Boolean" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="VEHICLE_DATA_NOT_ALLOWED"/>
+ <element name="VEHICLE_DATA_NOT_AVAILABLE"/>
+ <element name="USER_DISALLOWED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="gps" type="GPSData" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="ComponentVolumeStatus" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="vin" type="String" maxlength="17" mandatory="false">
+ <description>Vehicle identification number</description>
+ </param>
+ <param name="prndl" type="PRNDL" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="TireStatus" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="BeltStatus" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="BodyInformation" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="DeviceStatus" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataEventStatus" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="WiperStatus" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="HeadLampStatus" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="ECallInfo" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="AirbagStatus" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="EmergencyEvent" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="ClusterModeStatus" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="MyKey" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Data Items -->
+
+ </function>
+
+ <function name="ReadDID" functionID="ReadDIDID" messagetype="request">
+ <description>Non periodic vehicle data read request</description>
+
+ <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Name of ECU.</description>
+ </param>
+ <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" minsize="1" maxsize="1000" array="true" mandatory="true">
+ <description>Get raw data from vehicle data DID location(s)</description>
+ </param>
+ </function>
+
+ <function name="ReadDID" functionID="ReadDIDID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="TRUNCATED_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="didResult" type="DIDResult" minsize="0" maxsize="1000" array="true" mandatory="false">
+ <description>Array of requested DID results (with data if available).</description>
+ </param>
+
+ </function>
+
+ <function name="GetDTCs" functionID="GetDTCsID" messagetype="request">
+ <description>Vehicle module diagnostic trouble code request.</description>
+
+ <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Name of ECU.</description>
+ </param>
+
+ <param name="dtcMask" type="Integer" minvalue="0" maxvalue="255" mandatory="false">
+ <description>DTC Mask Byte to be sent in diagnostic request to module .</description>
+ </param>
+
+ </function>
+
+ <function name="GetDTCs" functionID="GetDTCsID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="TRUNCATED_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="ecuHeader" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>2 byte ECU Header for DTC response (as defined in VHR_Layout_Specification_DTCs.pdf)</description>
+ </param>
+
+ <param name="dtc" type="String" mandatory="false" minsize="1" maxsize="15" maxlength="10" array="true">
+ <description>
+ Array of all reported DTCs on module (ecuHeader contains information if list is truncated).
+ Each DTC is represented by 4 bytes (3 bytes of data and 1 byte status as defined in VHR_Layout_Specification_DTCs.pdf).
+ </description>
+ </param>
+
+ </function>
+
+ <function name="DiagnosticMessage" functionID="DiagnosticMessageID" messagetype="request">
+ <description>Non periodic vehicle diagnostic request</description>
+
+ <param name="targetID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Name of target ECU.</description>
+ </param>
+
+ <param name="messageLength" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
+ <description>Length of message (in bytes).</description>
+ </param>
+
+ <param name="messageData" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
+ <description>
+ Array of bytes comprising CAN message.
+ </description>
+ </param>
+ </function>
+
+ <function name="DiagnosticMessage" functionID="DiagnosticMessageID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="USER_DISALLOWED"/>
+ <element name="TRUNCATED_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="messageDataResult" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
+ <description>
+ Array of bytes comprising CAN message result.
+ </description>
+ </param>
+
+ </function>
+
+ <function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="request">
+ <description>Creates a full screen overlay containing a large block of formatted text that can be scrolled with up to 8 SoftButtons defined</description>
+ <param name="scrollableMessageBody" type="String" maxlength="500">
+ <description>Body of text that can include newlines and tabs.</description>
+ </param>
+ <param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" defvalue="30000" mandatory="false">
+ <description>App defined timeout. Indicates how long of a timeout from the last action (i.e. scrolling message resets timeout).</description>
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
+ <description>
+ App defined SoftButtons.
+ If omitted on supported displays, only the system defined "Close" SoftButton will be displayed.
+ </description>
+ </param>
+ </function>
+
+ <function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="CHAR_LIMIT_EXCEEDED"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="Slider" functionID="SliderID" messagetype="request">
+ <description>Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.</description>
+ <param name="numTicks" type="Integer" minvalue="2" maxvalue="26" mandatory="true">
+ <description>Number of selectable items on a horizontal axis</description>
+ </param>
+ <param name="position" type="Integer" minvalue="1" maxvalue="26" mandatory="true">
+ <description>Initial position of slider control (cannot exceed numTicks)</description>
+ </param>
+ <param name="sliderHeader" type="String" maxlength="500" mandatory="true">
+ <description>Text header to display</description>
+ </param>
+ <param name="sliderFooter" type="String" maxlength="500" minsize="1" maxsize="26" array="true" mandatory="false">
+ <description>
+ Text footer to display (meant to display min/max threshold descriptors).
+ For a static text footer, only one footer string shall be provided in the array.
+ For a dynamic text footer, the number of footer text string in the array must match the numTicks value.
+ For a dynamic text footer, text array string should correlate with potential slider position index.
+ If omitted on supported displays, no footer text shall be displayed.
+ </description>
+ </param>
+ <param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" defvalue="10000" mandatory="false">
+ <description>
+ App defined timeout. Indicates how long of a timeout from the last action (i.e. sliding control resets timeout).
+ If omitted, the value is set to 10000.
+ </description>
+ </param>
+ </function>
+
+ <function name="Slider" functionID="SliderID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="SAVED"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="REJECTED"/>
+ <element name="ABORTED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="sliderPosition" type="Integer" minvalue="1" maxvalue="26" mandatory="false">
+ <description>
+ Current slider value returned when saved or canceled (aborted)
+ This value is only returned for resultCodes "SAVED" or "ABORTED"
+ </description>
+ </param>
+ </function>
+
+ <function name="ShowConstantTBT" functionID="ShowConstantTBTID" messagetype="request">
+ <param name="navigationText1" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="navigationText2" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="eta" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="timeToDestination" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="totalDistance" type="String" minlength="0" maxlength="500" mandatory="false">
+ </param>
+ <param name="turnIcon" type="Image" mandatory="false">
+ </param>
+ <param name="nextTurnIcon" type="Image" mandatory="false">
+ </param>
+ <param name="distanceToManeuver" type="Float" minvalue="0" maxvalue="1000000000" mandatory="false">
+ <description>
+ Fraction of distance till next maneuver (starting from when AlertManeuver is triggered).
+ Used to calculate progress bar.
+ </description>
+ </param>
+ <param name="distanceToManeuverScale" type="Float" minvalue="0" maxvalue="1000000000" mandatory="false">
+ <description>
+ Distance till next maneuver (starting from) from previous maneuver.
+ Used to calculate progress bar.
+ </description>
+ </param>
+ <param name="maneuverComplete" type="Boolean" mandatory="false">
+ <description>
+ If and when a maneuver has completed while an AlertManeuver is active, the app must send this value set to TRUE in order to clear the AlertManeuver overlay.
+ If omitted the value will be assumed as FALSE.
+ </description>
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
+ <description>
+ Three dynamic SoftButtons available (first SoftButton is fixed to "Turns").
+ If omitted on supported displays, the currently displayed SoftButton values will not change.
+ </description>
+ </param>
+ </function>
+
+ <function name="ShowConstantTBT" functionID="ShowConstantTBTID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="AlertManeuver" functionID="AlertManeuverID" messagetype="request">
+ <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>An array of text chunks of type TTSChunk. See TTSChunk</description>
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
+ <description>If omitted on supported displays, only the system defined "Close" SoftButton shall be displayed.</description>
+ </param>
+ </function>
+
+ <function name="AlertManeuver" functionID="AlertManeuverID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="IGNORED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="ABORTED"/>
+ <element name="WARNINGS"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="UpdateTurnList" functionID="UpdateTurnListID" messagetype="request">
+ <param name="turnList" type="Turn" minsize="1" maxsize="100" array="true" mandatory="false">
+ </param>
+ <param name="softButtons" type="SoftButton" minsize="0" maxsize="1" array="true" mandatory="false">
+ <description>If omitted on supported displays, app-defined SoftButton will be left blank.</description>
+ </param>
+ </function>
+
+ <function name="UpdateTurnList" functionID="UpdateTurnListID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="ChangeRegistration" functionID="ChangeRegistrationID" messagetype="request">
+ <param name="language" type="Language" mandatory="true">
+ <description>Requested voice engine (VR+TTS) language registration</description>
+ </param>
+ <param name="hmiDisplayLanguage" type="Language" mandatory="true">
+ <description>Request display language registration</description>
+ </param>
+ <param name="appName" type="String" maxlength="100" mandatory="false">
+ <description>Request new app name registration</description>
+ </param>
+ <param name="ttsName" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <description>Request new ttsName registration</description>
+ </param>
+ <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
+ <description>Request new app short name registration</description>
+ </param>
+ <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>Request new VR synonyms registration</description>
+ </param>
+
+</function>
+
+
+
+ <function name="ChangeRegistration" functionID="ChangeRegistrationID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description>
+ true, if successful
+ false, if failed
+ </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="DUPLICATE_NAME"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="GenericResponse" functionID="GenericResponseID" messagetype="response">
+ <description>
+ Generic Response is sent, when the name of a received msg cannot be retrieved. Only used in case of an error.
+ Currently, only resultCode INVALID_DATA is used.
+ </description>
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="INVALID_DATA"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="PutFile" functionID="PutFileID" messagetype="request">
+ <description>
+ Used to push a binary data onto the SYNC module from a mobile device, such as icons and album art
+ Not supported on first generation SYNC vehicles.
+ Binary data is in binary part of hybrid msg.
+ </description>
+
+ <param name="syncFileName" type="String" maxlength="255" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+
+ <param name="fileType" type="FileType" mandatory="true">
+ <description>Selected file type.</description>
+ </param>
+
+ <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false">
+ <description>
+ Indicates if the file is meant to persist between sessions / ignition cycles.
+ If set to TRUE, then the system will aim to persist this file through session / cycles.
+ While files with this designation will have priority over others, they are subject to deletion by the system at any time.
+ In the event of automatic deletion by the system, the app will receive a rejection and have to resend the file.
+ If omitted, the value will be set to false.
+ </description>
+ </param>
+
+ <param name="systemFile" type="Boolean" defvalue="false" mandatory="false">
+ <description>Indicates if the file is meant to be passed thru core to elsewhere on the system.
+ If set to TRUE, then the system will instead pass the data thru as it arrives to a predetermined area outside of core. If omitted, the value will be set to false.</description>
+ </param>
+
+ <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+
+ <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional length in bytes for resuming partial data chunks</description>
+ </param>
+
+ </function>
+
+ <function name="PutFile" functionID="PutFileID" messagetype="response">
+ <description>Response is sent, when the file data was copied (success case). Or when an error occured.</description>
+ <description>Not supported on First generation SYNC vehicles. </description>
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000">
+ <description>
+ Provides the total local space available on SYNC for the registered app.
+ If the transfer has systemFile enabled, then the value will be set to 0 automatically.
+ </description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="DeleteFile" functionID="DeleteFileID" messagetype="request">
+ <description>
+ Used to delete a file resident on the SYNC module in the app's local cache.
+ Not supported on first generation SYNC vehicles.
+ </description>
+
+ <param name="syncFileName" type="String" maxlength="255" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+
+ </function>
+
+ <function name="DeleteFile" functionID="DeleteFileID" messagetype="response">
+ <description>
+ Response is sent, when the file data was deleted (success case). Or when an error occured.
+ Not supported on First generation SYNC vehicles.
+ </description>
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000">
+ <description>Provides the total local space available on SYNC for the registered app.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="ListFiles" functionID="ListFilesID" messagetype="request">
+ <description>
+ Requests the current list of resident filenames for the registered app.
+ Not supported on first generation SYNC vehicles.
+ </description>
+ </function>
+
+ <function name="ListFiles" functionID="ListFilesID" messagetype="response">
+ <description>
+ Returns the current list of resident filenames for the registered app along with the current space available
+ Not supported on First generation SYNC vehicles.
+ </description>
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="filenames" type="String" maxlength="500" minsize="0" maxsize="1000" array="true" mandatory="false">
+ <description>
+ An array of all filenames resident on SYNC for the given registered app.
+ If omitted, then no files currently reside on the system.
+ </description>
+ </param>
+
+ <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000">
+ <description>Provides the total local space available on SYNC for the registered app.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <function name="SetAppIcon" functionID="SetAppIconID" messagetype="request">
+ <description>
+ Used to set existing local file on SYNC as the app's icon
+ Not supported on first generation SYNC vehicles.
+ </description>
+
+ <param name="syncFileName" type="String" maxlength="255" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+
+ </function>
+
+ <function name="SetAppIcon" functionID="SetAppIconID" messagetype="response">
+ <description>
+ Response is sent, when the file data was copied (success case). Or when an error occured.
+ Not supported on First generation SYNC vehicles.
+ </description>
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request">
+ <description>
+ Used to set an alternate display layout.
+ If not sent, default screen for given platform will be shown
+ </description>
+
+ <param name="displayLayout" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created screen layout.
+ Currently only predefined screen layouts are defined.
+ </description>
+ </param>
+ </function>
+
+ <function name="OnHashChange" functionID="OnHashChangeID" messagetype="notification">
+ <description>
+ Notification containing an updated hashID which can be used over connection cycles (i.e. loss of connection, ignition cycles, etc.).
+ Sent after initial registration and subsequently after any change in the calculated hash of all persisted app data.
+ </description>
+
+ <param name="hashID" type="String" maxlength="100" mandatory="true">
+ <description>Calculated hash ID to be referenced during RegisterAppInterface.</description>
+ </param>
+ </function>
+
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response">
+
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ </param>
+
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
+ <description>See DisplayCapabilities</description>
+ </param>
+
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See ButtonCapabilities</description >
+ </param>
+
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+ </param>
+
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false">
+ <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ </function>
+
+ <function name="SystemRequest" functionID="SystemRequestID" messagetype="request">
+ <description>An asynchronous request from the device; binary data can be included in hybrid part of message for some requests (such as Authentication requests)</description>
+ <param name="requestType" type="RequestType" mandatory="true">
+ <description>The type of system request.</description>
+ </param>
+ <param name="fileName" type="String" maxlength="255" mandatory="false">
+ <description>The name of file.</description>
+ </param>
+ </function>
+
+ <function name="SystemRequest" functionID="SystemRequestID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_CERT"/>
+ <element name="EXPIRED_CERT"/>
+ <element name="UNSUPPORTED_REQUEST"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="DISALLOWED"/>
+ <element name="ABORTED"/>
+ <element name="WARNINGS"/>
+ <element name="TIMED_OUT"/>
+ <element name="IGNORED"/>
+ </param>
+ </function>
+
+ <function name="SendLocation" functionID="SendLocationID" messagetype="request">
+ <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="true">
+ </param>
+ <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="true">
+ </param>
+ <param name="locationName" type="String" maxlength="500" mandatory="false">
+ <description>
+ Name / title of intended location
+ </description>
+ </param>
+ <param name="locationDescription" type="String" maxlength="500" mandatory="false">
+ <description>
+ Description intended location / establishment (if applicable)
+ </description>
+ </param>
+ <param name="addressLines" type="String" maxlength="500" minsize="0" maxsize="4" array="true" mandatory="false">
+ <description>
+ Location address (if applicable)
+ </description>
+ </param>
+ <param name="phoneNumber" type="String" maxlength="500" mandatory="false">
+ <description>
+ Phone number of intended location / establishment (if applicable)
+ </description>
+ </param>
+ <param name="locationImage" type="Image" mandatory="false">
+ <description>
+ Image / icon of intended location (if applicable and supported)
+ </description>
+ </param>
+ </function>
+
+ <function name="SendLocation" functionID="SendLocationID" messagetype="response" >
+ <param name="success" type="Boolean" platform="documentation">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ <element name="UNSUPPORTED_RESOURCE"/>
+ <element name="DISALLOWED"/>
+ </param>
+ </function>
+
+ <function name="DialNumber" functionID="DialNumberID" messagetype="request">
+ <description>Dials a phone number and switches to phone application.</description>
+ <param name="number" type="String" maxlength="40">
+ <description>Phone number is a string, which can be up to 40 chars.</description>
+ </param>
+ </function>
+
+ <function name="DialNumber" functionID="DialNumberID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description>true, if successful</description>
+ <description>false, if failed</description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
+ <!-- Notifications -->
+
+ <function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification">
+ <param name="hmiLevel" type="HMILevel">
+ <description>See HMILevel</description>
+ </param>
+
+ <param name="audioStreamingState" type="AudioStreamingState">
+ <description>See AudioStreamingState</description>
+ </param>
+
+ <param name="systemContext" type="SystemContext">
+ <description>See SystemContext</description>
+ </param>
+ </function>
+
+ <function name="OnAppInterfaceUnregistered" functionID="OnAppInterfaceUnregisteredID" messagetype="notification">
+ <param name="reason" type="AppInterfaceUnregisteredReason">
+ <description>See AppInterfaceUnregisteredReason</description>
+ </param>
+ </function>
+
+ <function name="OnButtonEvent" functionID="OnButtonEventID" messagetype="notification">
+ <description>Notifies application of UP/DOWN events for buttons to which the application is subscribed.</description>
+ <param name="buttonName" type="ButtonName"/>
+ <param name="buttonEventMode" type="ButtonEventMode">
+ <description>Indicates whether this is an UP or DOWN event.</description>
+ </param>
+ <param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
+ <description>If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)</description>
+ </param>
+ </function>
+
+ <function name="OnButtonPress" functionID="OnButtonPressID" messagetype="notification">
+ <description>Notifies application of LONG/SHORT press events for buttons to which the application is subscribed.</description>
+ <param name="buttonName" type="ButtonName"/>
+ <param name="buttonPressMode" type="ButtonPressMode">
+ <description>Indicates whether this is a LONG or SHORT button press event.</description>
+ </param>
+ <param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
+ <description>If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)</description>
+ </param>
+ </function>
+
+ <function name="OnVehicleData" functionID="OnVehicleDataID" messagetype="notification">
+ <description>Callback for the periodic and non periodic vehicle data read function.</description>
+ <param name="gps" type="GPSData" mandatory="false">
+ <description>See GPSData</description>
+ </param>
+ <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
+ </param>
+ <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
+ </param>
+ <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
+ </param>
+ <param name="fuelLevel_State" type="ComponentVolumeStatus" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="vin" type="String" maxlength="17" mandatory="false">
+ <description>Vehicle identification number.</description>
+ </param>
+ <param name="prndl" type="PRNDL" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="TireStatus" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="BeltStatus" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="BodyInformation" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="DeviceStatus" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="VehicleDataEventStatus" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="WiperStatus" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="HeadLampStatus" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+
+ <!-- Ford Specific Vehicle Data -->
+ <param name="eCallInfo" type="ECallInfo" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="AirbagStatus" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="EmergencyEvent" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="ClusterModeStatus" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="MyKey" mandatory="false">
+ <description>Information related to the MyKey feature</description>
+ </param>
+ <!-- / Ford Specific Vehicle Data -->
+
+ </function>
+
+ <function name="OnCommand" functionID="OnCommandID" messagetype="notification">
+ <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000">
+ <description>Command ID, which is related to a specific menu entry</description>
+ </param>
+
+ <param name="triggerSource" type="TriggerSource">
+ <description>See TriggerSource</description>
+ </param>
+ </function>
+
+ <function name="OnTBTClientState" functionID="OnTBTClientStateID" messagetype="notification" >
+ <description>Provides applications with notifications specific to the current TBT client status on the module</description>
+ <param name="state" type="TBTState">
+ <description>Current State of TBT client</description>
+ </param>
+ </function>
+
+ <function name="OnDriverDistraction" functionID="OnDriverDistractionID" messagetype="notification" >
+ <description>Provides driver distraction state to mobile applications</description>
+ <param name="state" type="DriverDistractionState">
+ <description>Current State of Driver Distraction</description>
+ </param>
+ </function>
+
+ <function name="OnPermissionsChange" functionID="OnPermissionsChangeID" messagetype="notification" >
+ <description>Provides update to app of which policy-table-enabled functions are available</description>
+ <param name="permissionItem" type="PermissionItem" minsize="0" maxsize="500" array="true">
+ <description>Change in permissions for a given set of RPCs</description>
+ </param>
+ </function>
+
+ <function name="OnAudioPassThru" functionID="OnAudioPassThruID" messagetype="notification">
+ <description>Binary data is in binary part of hybrid msg</description>
+ </function>
+
+ <function name="OnLanguageChange" functionID="OnLanguageChangeID" messagetype="notification">
+ <param name="language" type="Language">
+ <description>Current SYNC voice engine (VR+TTS) language</description>
+ </param>
+ <param name="hmiDisplayLanguage" type="Language">
+ <description>Current display language</description>
+ </param>
+ </function>
+
+ <function name="OnKeyboardInput" functionID="OnKeyboardInputID" messagetype="notification" platform="MobileNav">
+
+ <description>On-screen keyboard event.</description>
+ <description>Can be full string or individual keypresses depending on keyboard mode.</description>
+
+ <param name="event" type="KeyboardEvent" mandatory="true">
+ <description>On-screen keyboard input data.</description>
+ </param>
+
+ <param name="data" type="String" maxlength="500" mandatory="false">
+ <description>On-screen keyboard input data.</description>
+ <description>For dynamic keypress events, this will be the current compounded string of entry text.</description>
+ <description>For entry submission events, this will be the full text entry (this will always return regardless of the mode).</description>
+ <description>For entry cancelled and entry aborted events, this data param will be omitted.</description>
+ </param>
+
+ </function>
+
+
+ <function name="OnTouchEvent" functionID="OnTouchEventID" messagetype="notification" platform="MobileNav">
+ <description>Notifies about touch events on the screen's prescribed area</description>
+ <param name="type" type="TouchType" mandatory="true">
+ <description>The type of touch event.</description>
+ </param>
+ <param name="event" type="TouchEvent" mandatory="true" minsize="1" maxsize="10" array="true">
+ <description>List of all individual touches involved in this event.</description>
+ </param>
+ </function>
+
+ <function name="OnSystemRequest" functionID="OnSystemRequestID" messagetype="notification">
+ <description>
+ An asynchronous request from the system for specific data from the device or the cloud or response
+ to a request from the device or cloud Binary data can be included in hybrid part of message for some requests
+ (such as Authentication request responses)
+ </description>
+ <param name="requestType" type="RequestType" mandatory="true">
+ <description>The type of system request.</description>
+ </param>
+ <param name="url" type="String" maxlength="1000" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>
+ Optional array of URL(s) for HTTP requests.
+ If blank, the binary data shall be forwarded to the app.
+ If not blank, the binary data shall be forwarded to the url(s) with a provided timeout in seconds.
+ </description>
+ </param>
+ <param name="timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
+ <description>
+ Optional timeout for HTTP requests
+ Required if a URL is provided
+ </description>
+ </param>
+ <param name="fileType" type="FileType" mandatory="false">
+ <description>Optional file type (meant for HTTP file requests).</description>
+ </param>
+ <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+ <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional length in bytes for resuming partial data chunks</description>
+ </param>
+ </function>
+
+<!-- ~~~~~~~~~~~~~~~~~~ -->
+<!-- Ford Specific APIs -->
+<!-- ~~~~~~~~~~~~~~~~~~ -->
+</interface>
diff --git a/src/components/utils/test/test_generator/generated_msg_version_test.cc b/src/components/utils/test/test_generator/generated_msg_version_test.cc
new file mode 100644
index 0000000000..e5a295ee96
--- /dev/null
+++ b/src/components/utils/test/test_generator/generated_msg_version_test.cc
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include "gtest/gtest.h"
+#include "generated_msg_version.h"
+#include "utils/file_system.h"
+
+using namespace std;
+
+namespace test {
+namespace components {
+namespace utils {
+
+void get_version_from_file(int& first_version, int& second_version) {
+ // Supposed that major and minor version include one number
+ const std::string& absolute_current_path =
+ file_system::CurrentWorkingDirectory();
+ std::ifstream xml_file(absolute_current_path + "/MOBILE_API.xml");
+
+ std::string str;
+
+ ASSERT_TRUE(xml_file.is_open());
+ while (getline(xml_file, str)) {
+ std::size_t isfound = str.find("interface name");
+ if (isfound != std::string::npos) {
+ std::size_t snd = str.find(".");
+ ASSERT_TRUE(snd != std::string::npos);
+ first_version = str[snd - 1] - 48;
+ second_version = str[snd + 1] - 48;
+ break;
+ }
+ }
+}
+
+TEST(GeneratorTool, GetCorrectVersion) {
+ int first_version = 0;
+ int second_version = 0;
+ get_version_from_file(first_version, second_version);
+ EXPECT_EQ(first_version, application_manager::major_version);
+ EXPECT_EQ(second_version, application_manager::minor_version);
+}
+
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/thread_validator_test.cc b/src/components/utils/test/thread_validator_test.cc
index 16d9d12874..b6e21d7157 100644
--- a/src/components/utils/test/thread_validator_test.cc
+++ b/src/components/utils/test/thread_validator_test.cc
@@ -45,9 +45,8 @@ using namespace ::threads;
TEST(ThreadValidatorTest, CompareID_CurrentThreadAndPthread_AreEqual) {
SingleThreadSimpleValidator object;
ASSERT_EQ(object.creation_thread_id(), pthread_self());
-
}
-} // namespace utils
-} // namespace components
-} // namespace test
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/timer_test.cc b/src/components/utils/test/timer_test.cc
new file mode 100644
index 0000000000..63b3c663c3
--- /dev/null
+++ b/src/components/utils/test/timer_test.cc
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+#include "utils/timer.h"
+#include "utils/mock_timer_task.h"
+#include "utils/conditional_variable.h"
+#include "utils/lock.h"
+#include "utils/macro.h"
+#include "utils/timer_task_impl.h"
+
+namespace test {
+namespace components {
+namespace timer_test {
+namespace {
+
+sync_primitives::Lock shot_lock;
+sync_primitives::ConditionalVariable shot_condition;
+
+const std::string kTimerName = "TestTimer";
+const bool kSingleShot = true;
+
+/*
+ * Default timeout used during timer testing.
+ * Value should be greater than at least 30 ms
+ * to avoid timer firing beetwen two sequental Start/Stop calls
+ */
+const uint32_t kDefaultTimeoutMs = 30u;
+const uint32_t kDefaultTimeoutRestartMs = 45u;
+
+class TestTask : public timer::TimerTask {
+ public:
+ TestTask() : timer_(NULL), calls_count_(0u) {}
+
+ void set_timer(timer::Timer* timer) {
+ timer_ = timer;
+ }
+
+ virtual void PerformTimer() const {}
+
+ void run() const OVERRIDE {
+ sync_primitives::AutoLock auto_lock(shot_lock);
+ ++calls_count_;
+ shot_condition.NotifyOne();
+ PerformTimer();
+ }
+
+ size_t calls_count() const {
+ return calls_count_;
+ }
+
+ protected:
+ mutable timer::Timer* timer_;
+ mutable size_t calls_count_;
+};
+
+class TestTaskWithStart : public TestTask {
+ public:
+ void PerformTimer() const OVERRIDE {
+ if (timer_) {
+ timer_->Start(kDefaultTimeoutRestartMs, !kSingleShot);
+ }
+ }
+};
+
+class TestTaskWithStop : public TestTask {
+ public:
+ void PerformTimer() const OVERRIDE {
+ if (timer_) {
+ timer_->Stop();
+ }
+ }
+};
+
+} // namespace
+
+// Start - Stop
+
+TEST(TimerTest, Start_Stop_NoLoop_NoCall) {
+ MockTimerTask* mock_task = new MockTimerTask();
+ EXPECT_CALL(*mock_task, run()).Times(0);
+
+ timer::Timer timer(kTimerName, mock_task);
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+
+ timer.Start(kDefaultTimeoutMs, kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ timer.Stop();
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+}
+
+TEST(TimerTest, Start_Stop_Loop_NoCall) {
+ MockTimerTask* mock_task = new MockTimerTask();
+ EXPECT_CALL(*mock_task, run()).Times(0);
+
+ timer::Timer timer(kTimerName, mock_task);
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+
+ timer.Start(kDefaultTimeoutMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ timer.Stop();
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+}
+
+TEST(TimerTest, Start_Stop_NoLoop_OneCall) {
+ sync_primitives::AutoLock auto_lock(shot_lock);
+ TestTask* task = new TestTask();
+
+ timer::Timer timer(kTimerName, task);
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+
+ timer.Start(kDefaultTimeoutMs, kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ // Wait for 1 call
+ shot_condition.Wait(shot_lock);
+ EXPECT_FALSE(timer.is_running());
+
+ timer.Stop();
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+
+ EXPECT_EQ(1u, task->calls_count());
+}
+
+TEST(TimerTest, Start_Stop_Loop_3Calls) {
+ const size_t loops_count = 3u;
+
+ sync_primitives::AutoLock auto_lock(shot_lock);
+ TestTask* task = new TestTask();
+
+ timer::Timer timer(kTimerName, task);
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+
+ timer.Start(kDefaultTimeoutMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ // Wait for 3 calls
+ for (size_t i = 0; i < loops_count; ++i) {
+ shot_condition.Wait(shot_lock);
+ EXPECT_TRUE(timer.is_running());
+ }
+
+ timer.Stop();
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+
+ EXPECT_EQ(loops_count, task->calls_count());
+}
+
+// Restart
+
+TEST(TimerTest, Restart_NoLoop_NoCall) {
+ MockTimerTask* mock_task = new MockTimerTask();
+ EXPECT_CALL(*mock_task, run()).Times(0);
+
+ timer::Timer timer(kTimerName, mock_task);
+
+ timer.Start(kDefaultTimeoutMs, kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ timer.Start(kDefaultTimeoutRestartMs, kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutRestartMs, timer.timeout());
+}
+
+TEST(TimerTest, Restart_Loop_NoCall) {
+ MockTimerTask* mock_task = new MockTimerTask();
+ EXPECT_CALL(*mock_task, run()).Times(0);
+
+ timer::Timer timer(kTimerName, mock_task);
+
+ timer.Start(kDefaultTimeoutMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ timer.Start(kDefaultTimeoutRestartMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutRestartMs, timer.timeout());
+}
+
+TEST(TimerTest, Restart_Loop_3Calls) {
+ const size_t loops_count = 3u;
+
+ sync_primitives::AutoLock auto_lock(shot_lock);
+ TestTask* task = new TestTask();
+ timer::Timer timer(kTimerName, task);
+
+ timer.Start(kDefaultTimeoutMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ // Wait for 3 calls
+ for (size_t i = 0; i < loops_count; ++i) {
+ shot_condition.Wait(shot_lock);
+ }
+ timer.Start(kDefaultTimeoutRestartMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutRestartMs, timer.timeout());
+
+ EXPECT_EQ(loops_count, task->calls_count());
+}
+
+// Restart from call
+
+TEST(TimerTest, Restart_NoLoop_FromCall) {
+ sync_primitives::AutoLock auto_lock(shot_lock);
+ TestTask* task = new TestTaskWithStart();
+ timer::Timer timer(kTimerName, task);
+ task->set_timer(&timer);
+
+ timer.Start(kDefaultTimeoutMs, kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ // Wait for 1 calls
+ shot_condition.Wait(shot_lock);
+
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutRestartMs, timer.timeout());
+
+ EXPECT_EQ(1u, task->calls_count());
+}
+
+TEST(TimerTest, Restart_Loop_FromCall) {
+ sync_primitives::AutoLock auto_lock(shot_lock);
+ TestTask* task = new TestTaskWithStart();
+ timer::Timer timer(kTimerName, task);
+ task->set_timer(&timer);
+
+ timer.Start(kDefaultTimeoutMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ // Wait for 1 calls
+ shot_condition.Wait(shot_lock);
+
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutRestartMs, timer.timeout());
+
+ EXPECT_EQ(1u, task->calls_count());
+}
+
+// Stop from call
+
+TEST(TimerTest, Stop_Loop_FromCall) {
+ sync_primitives::AutoLock auto_lock(shot_lock);
+ TestTask* task = new TestTaskWithStop();
+ timer::Timer timer(kTimerName, task);
+ task->set_timer(&timer);
+
+ timer.Start(kDefaultTimeoutMs, !kSingleShot);
+ EXPECT_TRUE(timer.is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer.timeout());
+
+ // Wait for 1 calls
+ shot_condition.Wait(shot_lock);
+
+ EXPECT_FALSE(timer.is_running());
+ EXPECT_EQ(0u, timer.timeout());
+
+ EXPECT_EQ(1u, task->calls_count());
+}
+
+// Delete running
+
+TEST(TimerTest, Delete_Running_NoLoop) {
+ MockTimerTask* mock_task = new MockTimerTask();
+ EXPECT_CALL(*mock_task, run()).Times(0);
+
+ timer::Timer* timer = new timer::Timer(kTimerName, mock_task);
+ EXPECT_FALSE(timer->is_running());
+ EXPECT_EQ(0u, timer->timeout());
+
+ timer->Start(kDefaultTimeoutMs, kSingleShot);
+ EXPECT_TRUE(timer->is_running());
+ EXPECT_EQ(kDefaultTimeoutMs, timer->timeout());
+
+ delete timer;
+}
+
+} // namespace timer_test
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/timer_thread_test.cc b/src/components/utils/test/timer_thread_test.cc
deleted file mode 100644
index 6a758873f4..0000000000
--- a/src/components/utils/test/timer_thread_test.cc
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <iostream>
-
-#include "lock.h"
-#include "macro.h"
-
-#include "gtest/gtest.h"
-#include "utils/conditional_variable.h"
-#include "utils/timer_thread.h"
-
-namespace test {
-namespace components {
-namespace utils {
-
-using namespace timer;
-using namespace sync_primitives;
-
-class TimerThreadTest : public ::testing::Test {
- public:
- TimerThreadTest()
- : check_val(0),
- val1(3),
- val2(4),
- wait_val(3000) {
- }
-
- void function() {
- AutoLock alock(lock_);
- ++check_val;
- condvar_.NotifyOne();
- }
-
- protected:
- uint32_t check_val;
- Lock lock_;
- ConditionalVariable condvar_;
- const uint32_t val1;
- const uint32_t val2;
- const uint32_t wait_val;
-};
-
-TEST_F(TimerThreadTest, StartTimerThreadWithTimeoutOneSec_ExpectSuccessfullInvokeCallbackFuncOnTimeout) {
- // Create Timer with TimerDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- false);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- condvar_.WaitFor(alock, wait_val);
- EXPECT_EQ(1u, check_val);
-}
-
-TEST_F(TimerThreadTest, StartTimerThreadWithTimeoutOneSecInLoop_ExpectSuccessfullInvokeCallbackFuncOnEveryTimeout) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- while (check_val < val2) {
- condvar_.WaitFor(alock, wait_val);
- }
- // Check callback function was called 4 times
- EXPECT_EQ(val2, check_val);
-}
-
-TEST_F(TimerThreadTest, StopStartedTimerThreadWithTimeoutOneSecInLoop_ExpectSuccessfullStop) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- // Stop timer on 3rd second
- while (check_val < val2) {
- if (check_val == val1) {
- timer.stop();
- break;
- }
- condvar_.WaitFor(alock, wait_val);
- }
- EXPECT_EQ(val1, check_val);
-}
-
-TEST_F(TimerThreadTest, ChangeTimeoutForStartedTimerThreadWithTimeoutOneSecInLoop_ExpectSuccessfullStop) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- // Change timer timeout
- while (check_val < val2) {
- if (check_val == val1) {
- timer.updateTimeOut(200);
- }
- condvar_.WaitFor(alock, wait_val);
- }
- EXPECT_EQ(val2, check_val);
-}
-
-TEST_F(TimerThreadTest, CheckStartedTimerIsRunning_ExpectTrue) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- // Change timer timeout on 3rd second
- while (check_val < val1) {
- condvar_.WaitFor(alock, wait_val);
- // Check start is running
- EXPECT_TRUE(timer.isRunning());
- }
- EXPECT_EQ(val1, check_val);
-}
-
-} // namespace utils
-} // namespace components
-} // namespace test
-