diff options
author | Justin Dickow <jjdickow@gmail.com> | 2014-07-09 14:40:18 -0400 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2014-07-09 14:40:18 -0400 |
commit | 65dbc5e1d8b44551046f436b6840d7dae61c20bc (patch) | |
tree | c434987fbc284b02532a6caa08769a8e167e62cb | |
parent | 40185d66eeb496a10e616186158dabc6357eb5a7 (diff) | |
download | smartdevicelink-65dbc5e1d8b44551046f436b6840d7dae61c20bc.tar.gz |
lots of cmakelists and component fixes
Signed-off-by: Justin Dickow <jjdickow@gmail.com>
75 files changed, 1109 insertions, 765 deletions
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt index d99379100..3460e6ca4 100644 --- a/src/appMain/CMakeLists.txt +++ b/src/appMain/CMakeLists.txt @@ -1,10 +1,16 @@ -IF (${WEB_HMI}) +IF (HMIADAPTER STREQUAL "messagebroker") set (BROKER_LIBRARIES MessageBrokerClient MessageBrokerServer ) -ENDIF (${WEB_HMI}) +ENDIF () +cmake_policy(PUSH) +# make link_directories() treat paths relative to the source dir +# info: cmake --help-policy CMP0015 +cmake_policy(SET CMP0015 NEW) +link_directories(../thirdPartyLibs/libusbx) +cmake_policy(POP) if (EXTENDED_MEDIA_MODE) set(default_media_inc @@ -51,12 +57,6 @@ if (BUILD_AVAHI_SUPPORT) list(APPEND LIBRARIES avahi-client avahi-common) endif() if (BUILD_USB_SUPPORT) - cmake_policy(PUSH) - # make link_directories() treat paths relative to the source dir - # info: cmake --help-policy CMP0015 - cmake_policy(SET CMP0015 NEW) - link_directories(../thirdPartyLibs/libusbx) - cmake_policy(POP) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND LIBRARIES Libusb-1.0.16) endif() diff --git a/src/appMain/life_cycle.h b/src/appMain/life_cycle.h index 91ca0a4c2..095bc9341 100644 --- a/src/appMain/life_cycle.h +++ b/src/appMain/life_cycle.h @@ -36,12 +36,15 @@ #define SRC_APPMAIN_LIFE_CYCLE_H_ #include "hmi_message_handler/hmi_message_handler_impl.h" -#ifdef QT_HMI +#ifdef DBUS_HMIADAPTER # include "hmi_message_handler/dbus_message_adapter.h" -#endif // QT_HMI -#ifdef WEB_HMI +#endif // DBUS_HMIADAPTER +#ifdef MESSAGEBROKER_HMIADAPTER # include "hmi_message_handler/messagebroker_adapter.h" -#endif // WEB_HMI +#endif // MESSAGEBROKER_HMIADAPTER +#ifdef MQUEUE_HMIADAPTER +# include "hmi_message_handler/mqueue_adapter.h" +#endif // MQUEUE_HMIADAPTER #include "application_manager/application_manager_impl.h" #include "connection_handler/connection_handler_impl.h" #include "protocol_handler/protocol_handler_impl.h" @@ -50,11 +53,11 @@ #include "media_manager/media_manager_impl.h" #include "utils/singleton.h" -#ifdef WEB_HMI +#ifdef MESSAGEBROKER_HMIADAPTER # include "CMessageBroker.hpp" # include "mb_tcpserver.hpp" # include "networking.h" // cpplint: Include the directory when naming .h files -#endif // WEB_HMI +#endif // MESSAGEBROKER_HMIADAPTER #include "system.h" // cpplint: Include the directory when naming .h files namespace main_namespace { @@ -77,24 +80,25 @@ class LifeCycle : public utils::Singleton<LifeCycle> { connection_handler::ConnectionHandlerImpl* connection_handler_; application_manager::ApplicationManagerImpl* app_manager_; hmi_message_handler::HMIMessageHandlerImpl* hmi_handler_; -#ifdef QT_HMI +#ifdef DBUS_HMIADAPTER hmi_message_handler::DBusMessageAdapter* dbus_adapter_; -#endif // QT_HMI -#ifdef WEB_HMI +#endif // DBUS_HMIADAPTER +#ifdef MESSAGEBROKER_HMIADAPTER hmi_message_handler::MessageBrokerAdapter* mb_adapter_; -#endif // WEB_HMI +#endif // MESSAGEBROKER_HMIADAPTER + hmi_message_handler::HMIMessageAdapter* hmi_message_adapter_; media_manager::MediaManagerImpl* media_manager_; -#ifdef WEB_HMI +#ifdef MESSAGEBROKER_HMIADAPTER NsMessageBroker::CMessageBroker* message_broker_; NsMessageBroker::TcpServer* message_broker_server_; System::Thread* mb_thread_; System::Thread* mb_server_thread_; System::Thread* mb_adapter_thread_; -#endif // WEB_HMI -#ifdef QT_HMI +#endif // MESSAGEBROKER_HMIADAPTER +#ifdef DBUS_HMIADAPTER System::Thread* dbus_adapter_thread_; -#endif // QT_HMI +#endif // DBUS_HMIADAPTER # ifdef ENABLE_LOG static log4cxx::LoggerPtr logger_; diff --git a/src/appMain/log4cxx.properties b/src/appMain/log4cxx.properties index 5301ba3fb..5a3c37c3c 100644 --- a/src/appMain/log4cxx.properties +++ b/src/appMain/log4cxx.properties @@ -47,7 +47,7 @@ log4j.appender.HmiFrameworkPluginLogFile.layout=org.apache.log4j.PatternLayout log4j.appender.HmiFrameworkPluginLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n # All SmartDeviceLinkCore logs -log4j.rootLogger=ALL, SmartDeviceLinkCoreLogFile, SmartDeviceLinkCoreSocketHub +log4j.rootLogger=ALL, Console, SmartDeviceLinkCoreLogFile, SmartDeviceLinkCoreSocketHub # TransportManager logs log4j.logger.TransportManager=ALL, TransportManagerLogFile diff --git a/src/appMain/policy_table.json b/src/appMain/policy_table.json index b0474395f..33e32407b 100644 --- a/src/appMain/policy_table.json +++ b/src/appMain/policy_table.json @@ -1,393 +1,393 @@ -{
- "rpcs":{
- "GetDTCs":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "DiagnosticMessage":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "SystemRequest":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ReadDID":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "AlertManeuver":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ShowConstantTBT":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "UpdateTurnList":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "UnsubscribeVehicleData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "SubscribeVehicleData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "GetVehicleData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnVehicleData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "GenericResponse":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "DeleteCommand":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "PerformInteraction":{
- "hmi_levels":[
- "FULL"
- ]
- },
- "Speak":{
- "hmi_levels":[
- "FULL",
- "LIMITED"
- ]
- },
- "OnAppInterfaceUnregistered":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnButtonPress":{
- "hmi_levels":[
- "FULL",
- "LIMITED"
- ]
- },
- "OnEncodedSyncPData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetMediaClockTimer":{
- "hmi_levels":[
- "FULL",
- "LIMITED"
- ]
- },
- "AddSubMenu":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "RegisterAppInterface":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "UnregisterAppInterface":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "DeleteSubMenu":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "Alert":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "EncodedSyncPData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnButtonEvent":{
- "hmi_levels":[
- "FULL",
- "LIMITED"
- ]
- },
- "DeleteInteractionChoiceSet":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnPermissionsChange":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetGlobalProperties":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnCommand":{
- "hmi_levels":[
- "FULL",
- "LIMITED"
- ]
- },
- "Show":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "AddCommand":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ChangeRegistration":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "CreateInteractionChoiceSet":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "Slider":{
- "hmi_levels":[
- "FULL"
- ]
- },
- "ResetGlobalProperties":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnDriverDistraction":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnHMIStatus":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SubscribeButton":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "UnsubscribeButton":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnTBTClientState":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnAudioPassThru":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "PerformAudioPassThru":{
- "hmi_levels":[
- "FULL",
- "LIMITED"
- ]
- },
- "EndAudioPassThru":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ScrollableMessage":{
- "hmi_levels":[
- "FULL"
- ]
- },
- "OnLanguageChange":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetDisplayLayout":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SyncPData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
-"DialNumber":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
-
-"PutFile":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
-
-"DeleteFile":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
-
-"ListFiles":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
-
-"SetAppIcon":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
-
-
- "OnSyncPData":{
- "hmi_levels":[
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- }
- }
- }
+{ + "rpcs":{ + "GetDTCs":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "DiagnosticMessage":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "SystemRequest":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "ReadDID":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "AlertManeuver":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "ShowConstantTBT":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "UpdateTurnList":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "UnsubscribeVehicleData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "SubscribeVehicleData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "GetVehicleData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "OnVehicleData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "GenericResponse":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "DeleteCommand":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "PerformInteraction":{ + "hmi_levels":[ + "FULL" + ] + }, + "Speak":{ + "hmi_levels":[ + "FULL", + "LIMITED" + ] + }, + "OnAppInterfaceUnregistered":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "OnButtonPress":{ + "hmi_levels":[ + "FULL", + "LIMITED" + ] + }, + "OnEncodedSyncPData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "SetMediaClockTimer":{ + "hmi_levels":[ + "FULL", + "LIMITED" + ] + }, + "AddSubMenu":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "RegisterAppInterface":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "UnregisterAppInterface":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "DeleteSubMenu":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "Alert":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "EncodedSyncPData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "OnButtonEvent":{ + "hmi_levels":[ + "FULL", + "LIMITED" + ] + }, + "DeleteInteractionChoiceSet":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "OnPermissionsChange":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "SetGlobalProperties":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "OnCommand":{ + "hmi_levels":[ + "FULL", + "LIMITED" + ] + }, + "Show":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "AddCommand":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "ChangeRegistration":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "CreateInteractionChoiceSet":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "Slider":{ + "hmi_levels":[ + "FULL" + ] + }, + "ResetGlobalProperties":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "OnDriverDistraction":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "OnHMIStatus":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "SubscribeButton":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "UnsubscribeButton":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "OnTBTClientState":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "OnAudioPassThru":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "PerformAudioPassThru":{ + "hmi_levels":[ + "FULL", + "LIMITED" + ] + }, + "EndAudioPassThru":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED" + ] + }, + "ScrollableMessage":{ + "hmi_levels":[ + "FULL" + ] + }, + "OnLanguageChange":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "SetDisplayLayout":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + "SyncPData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, +"DialNumber":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + +"PutFile":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + +"DeleteFile":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + +"ListFiles":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + +"SetAppIcon":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + }, + + + "OnSyncPData":{ + "hmi_levels":[ + "BACKGROUND", + "FULL", + "LIMITED", + "NONE" + ] + } + } + } diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index 169db32cb..f3393a1c1 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -39,7 +39,7 @@ AppHMILevelNoneRequestsTimeScale = 10 AppTimeScaleMaxRequests = 100 AppRequestsTimeScale = 10 PendingRequestsAmount = 1000 -HeartBeatTimeout = 0 +HeartBeatTimeout = 7 SupportedDiagModes = 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x09, 0x0A, 0x18, 0x19, 0x22, 0x3E SystemFilesPath = /tmp/fs/mp/images/ivsu_cache UseLastState = true @@ -85,3 +85,4 @@ AppInfoStorage = app_info.dat [Policy] PoliciesTable = policy_table.json PreloadedPT = sdl_preloaded_pt.json +PathToSnapshot = sdl_snapshot.json diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt index 3566e0550..4cd4ab50f 100644 --- a/src/components/CMakeLists.txt +++ b/src/components/CMakeLists.txt @@ -74,9 +74,11 @@ add_subdirectory(./config_profile) add_subdirectory(./media_manager) -if (${QT_HMI}) +if (${HMI_DBUS_API}) # --- DBus add_subdirectory(./dbus) +endif () +if (${QT_HMI}) # --- Qt HMI add_subdirectory(./qt_hmi) endif () diff --git a/src/components/HMI/app/StateManager.js b/src/components/HMI/app/StateManager.js index 44f1715a7..7b8857836 100644 --- a/src/components/HMI/app/StateManager.js +++ b/src/components/HMI/app/StateManager.js @@ -180,6 +180,19 @@ var StateManager = Em.StateManager.extend({ this._super();
SDL.DeviceConfigView.showDeviceList();
}
+ }),
+
+ appPermissionsList: Em.State.create({
+
+ enter: function () {
+
+ this._super();
+
+ }
+ }),
+
+ appPermissions: Em.State.create({
+
})
})
}),
diff --git a/src/components/HMI/app/controller/SettingsController.js b/src/components/HMI/app/controller/SettingsController.js index 9bc83eb93..1f78af7a9 100644 --- a/src/components/HMI/app/controller/SettingsController.js +++ b/src/components/HMI/app/controller/SettingsController.js @@ -114,6 +114,28 @@ SDL.SettingsController = Em.Object.create( { }
},
+ changeAppPermission: function(event) {
+
+ var allowance = SDL.SDLController.getApplicationModel(event.appID).allowedFunctions;
+
+ for (var i = 0; i < allowance.length; ++i) {
+
+ if (allowance[i].name == event.name) {
+
+ if (allowance[i].allowed) {
+
+ allowance[i].allowed = false;
+ event.set('text', event.name + " - Not allowed");
+ } else {
+
+ allowance[i].allowed = true;
+ event.set('text', event.name + " - Allowed");
+ }
+ break;
+ }
+ }
+ },
+
/**
* Method to update array with app permissions which came from SDL
*
@@ -158,6 +180,62 @@ SDL.SettingsController = Em.Object.create( { }
},
+ /**
+ * Method to send request to update array with app permissions
+ *
+ * @param {Object} element
+ *
+ */
+ GetListOfPermissions: function(element) {
+ FFW.BasicCommunication.GetListOfPermissions(element.appID);
+ },
+
+ /**
+ * Method to update array with app permissions which came from SDL
+ *
+ * @param {Object} message
+ *
+ */
+ GetListOfPermissionsResponse: function(message) {
+
+ if (message.id in SDL.SDLModel.getListOfPermissionsPull) {
+
+ var appID = SDL.SDLModel.getListOfPermissionsPull[message.id],
+ messageCodes = [];
+
+ SDL.SDLController.getApplicationModel(appID).allowedFunctions = message.result.allowedFunctions;
+
+ for (var i = 0; i < message.result.allowedFunctions.length; i++) {
+ messageCodes.push(message.result.allowedFunctions[i].name);
+ }
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.permissionsFriendlyMessageUpdate, appID, messageCodes);
+
+ SDL.SettingsController.userFriendlyMessagePopUp();
+
+ SDL.SDLModel.getListOfPermissionsPull.remove(message.id);
+ }
+ },
+
+ /**
+ * Method to update array with app permissions with UserFriendlyMessage from SDL
+ *
+ * @param {Object} message
+ *
+ */
+ permissionsFriendlyMessageUpdate: function(message, appID) {
+ var len = SDL.SDLController.getApplicationModel(appID).allowedFunctions.length;
+
+ for (var i = 0; i < len; i++) {
+
+ SDL.SDLController.getApplicationModel(appID).allowedFunctions[i].text = message.label;
+ }
+
+ SDL.AppPermissionsView.update(appID);
+
+ this.onState('policies.appPermissions');
+ },
+
updateSDL: function() {
FFW.BasicCommunication.UpdateSDL();
},
diff --git a/src/components/HMI/app/controller/sdl/Controller.js b/src/components/HMI/app/controller/sdl/Controller.js index 4902698f8..8c9fb5e4a 100644 --- a/src/components/HMI/app/controller/sdl/Controller.js +++ b/src/components/HMI/app/controller/sdl/Controller.js @@ -48,8 +48,7 @@ SDL.SDLController = Em.Object if ( SDL.SliderView.active || SDL.InteractionChoicesView.active || SDL.ScrollableMessage.active - || SDL.AudioPassThruPopUp.activate - || SDL.VRHelpListView.active) { + || SDL.AudioPassThruPopUp.activate) { return 'HMI_OBSCURED'; } @@ -583,6 +582,11 @@ SDL.SDLController = Em.Object SDL.SDLModel.VRCommands.splice(i, 1); } } + + SDL.VRPopUp.DeleteActivateApp(appID); + if (SDL.SDLModel.stateLimited == appID) { + SDL.SDLModel.set('stateLimited', null); + } SDL.SDLAppController.set('model', null); }, /** @@ -609,7 +613,7 @@ SDL.SDLController = Em.Object if (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) { switch (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) { case 'SINGLE_KEYPRESS':{ - FFW.UI.OnKeyboardInput(str.charAt( str.length-1 )); + FFW.UI.OnKeyboardInput(str.charAt( str.length-1 ), "KEYPRESS"); break; } case 'QUEUE_KEYPRESS':{ diff --git a/src/components/HMI/app/model/sdl/Model.js b/src/components/HMI/app/model/sdl/Model.js index 550eeee7e..23a9bf69b 100644 --- a/src/components/HMI/app/model/sdl/Model.js +++ b/src/components/HMI/app/model/sdl/Model.js @@ -910,19 +910,21 @@ SDL.SDLModel = Em.Object.create({ for (var i in params) { if (i === "keyboardProperties") { if (params[i].language) { - SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.language', params[i].language) + SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.language', params[i].language); } if (params[i].keyboardLayout) { SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.keyboardLayout', params[i].keyboardLayout); } if (params[i].keypressMode) { - SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.keypressMode', params[i].keypressMode) + SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.keypressMode', params[i].keypressMode); } if (params[i].limitedCharacterList) { - SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.limitedCharacterList', params[i].limitedCharacterList) + SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.limitedCharacterList', params[i].limitedCharacterList); + } else { + SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.limitedCharacterList', []); } if (params[i].autoCompleteText) { - SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.autoCompleteText', params[i].autoCompleteText) + SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.autoCompleteText', params[i].autoCompleteText); } } else { SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.' + i, params[i]); diff --git a/src/components/HMI/app/view/sdl/AlertPopUp.js b/src/components/HMI/app/view/sdl/AlertPopUp.js index de4502974..76de5fad2 100644 --- a/src/components/HMI/app/view/sdl/AlertPopUp.js +++ b/src/components/HMI/app/view/sdl/AlertPopUp.js @@ -61,9 +61,11 @@ SDL.AlertPopUp = Em.ContainerView.create({ */ alertRequestId: null, - content1: 'Title', + content1: '', - content2: 'Text', + content2: '', + + content3: '', active: false, @@ -134,6 +136,10 @@ SDL.AlertPopUp = Em.ContainerView.create({ this.set('active', false); clearTimeout(this.timer); + this.set('content1', ''); + this.set('content2', ''); + this.set('content3', ''); + SDL.SDLController.alertResponse(SDL.SDLModel.resultCode['SUCCESS'], this.alertRequestId); SDL.SDLController.onSystemContextChange(); diff --git a/src/components/HMI/app/view/sdl/PopUp.js b/src/components/HMI/app/view/sdl/PopUp.js index f71fb6255..c877d8114 100644 --- a/src/components/HMI/app/view/sdl/PopUp.js +++ b/src/components/HMI/app/view/sdl/PopUp.js @@ -67,7 +67,7 @@ SDL.PopUp = Em.ContainerView.create({ target: 'parentView', buttonAction: true, onDown: false, - disabledBinding: this.buttons + disabledBinding: 'parentView.buttons' }), buttonCancel: SDL.Button.extend( { @@ -77,7 +77,7 @@ SDL.PopUp = Em.ContainerView.create({ target: 'parentView', buttonAction: false, onDown: false, - disabledBinding: this.buttons + disabledBinding: 'parentView.buttons' }), message: SDL.Label.extend({ @@ -95,11 +95,10 @@ SDL.PopUp = Em.ContainerView.create({ deactivate: function(event) { this.set('active', false); - if (event) { + if (this.callback) { this.callback(event.buttonAction); } - SDL.SDLController.onSystemContextChange(); this.set('callback', null); }, @@ -109,9 +108,9 @@ SDL.PopUp = Em.ContainerView.create({ if (callback) { this.set('callback', callback); - this.set('buttons', true); - } else { this.set('buttons', false); + } else { + this.set('buttons', true); setTimeout(function(){ SDL.PopUp.deactivate() }, @@ -119,6 +118,5 @@ SDL.PopUp = Em.ContainerView.create({ } this.set('content', message); - SDL.SDLController.onSystemContextChange(); } });
\ No newline at end of file diff --git a/src/components/HMI/app/view/sdl/VRHelpListView.js b/src/components/HMI/app/view/sdl/VRHelpListView.js index 32e156a7c..4e6dd6ec6 100644 --- a/src/components/HMI/app/view/sdl/VRHelpListView.js +++ b/src/components/HMI/app/view/sdl/VRHelpListView.js @@ -58,7 +58,6 @@ SDL.VRHelpListView = SDL.SDLAbstractView.create( { } SDL.SDLController.VRMove(); - SDL.SDLController.onSystemContextChange(); }, /** @@ -104,6 +103,5 @@ SDL.VRHelpListView = SDL.SDLAbstractView.create( { } this.helpList.list.refresh(); - SDL.SDLController.onSystemContextChange(); } }); diff --git a/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js b/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js index 64b9384ff..35499a541 100644 --- a/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js +++ b/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js @@ -68,6 +68,7 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create({ SDL.SDLModel.uiShowKeyboard(this); }, search: function(){ + FFW.UI.OnKeyboardInput(SDL.SDLModel.keyboardInputValue, "ENTRY_SUBMITTED"); this.get('parentView').deactivate("SUCCESS"); } }), diff --git a/src/components/HMI/app/view/sdl/shared/keyboard.js b/src/components/HMI/app/view/sdl/shared/keyboard.js index 9d71efd59..7d8a39af2 100644 --- a/src/components/HMI/app/view/sdl/shared/keyboard.js +++ b/src/components/HMI/app/view/sdl/shared/keyboard.js @@ -67,6 +67,7 @@ SDL.Keyboard = SDL.SDLAbstractView.create({ action: function() { if (SDL.SDLAppController.model && SDL.SDLAppController.model.activeRequests.uiPerformInteraction && !SDL.InteractionChoicesView.active) { + FFW.UI.OnKeyboardInput("", "ENTRY_CANCELLED"); SDL.InteractionChoicesView.deactivate("ABORTED"); } SDL.Keyboard.deactivate(); diff --git a/src/components/HMI/app/view/settings/policiesView.js b/src/components/HMI/app/view/settings/policiesView.js index 0c0ce1a17..2c44751a9 100644 --- a/src/components/HMI/app/view/settings/policiesView.js +++ b/src/components/HMI/app/view/settings/policiesView.js @@ -31,72 +31,90 @@ * @version 1.0 */ -SDL.PoliciesView = Em.ContainerView - .create( { +SDL.PoliciesView = Em.ContainerView.create( { - elementId: 'policies_settings', + elementId: 'policies_settings', - classNames: 'in_settings_view', + classNames: 'in_settings_view', - classNameBindings: [ - 'SDL.States.settings.policies.active:active_state:inactive_state' - ], + classNameBindings: [ + 'SDL.States.settings.policies.active:active_state:inactive_state' + ], - childViews: [ - 'allowSDLFunctionality', - 'updateSDLButton', - 'getStatusUpdate', - 'getURLS', - 'statisticsInfo' - ], + childViews: [ + 'SettingsList' + ], - allowSDLFunctionality: SDL.Button.extend( { - goToState: 'policies.deviceConfig', - classNames: 'button allowSDLFunctionality settingsButton', - text: 'Allow SDL Functionality', - elementId: 'allowSDLFunctionality', - arrow: true, - action: 'onState', - target: 'SDL.SettingsController', - templateName: 'arrow', - onDown: false - }), + SettingsList: SDL.List.extend( { - updateSDLButton: SDL.Button.extend( { - classNames: 'button updateSDLButton settingsButton', - text: 'Update SDL', - elementId: 'updateSDLButton', - action: 'updateSDL', - target: 'SDL.SettingsController', - onDown: false - }), + elementId: 'policies_settings_list', - getStatusUpdate: SDL.Button.extend( { - classNames: 'button getStatusUpdate settingsButton', - text: 'Policy table update status', - elementId: 'getStatusUpdate', - action: 'getStatusUpdate', - target: 'SDL.SettingsController', - onDown: false - }), + classNames: 'policies_settings_list', - getURLS: SDL.Button.extend( { - classNames: 'button getURLS settingsButton', - text: 'Send request GetURLS', - elementId: 'getURLS', - action: 'getURLS', - target: 'SDL.SettingsController', - onDown: false - }), + itemsOnPage: 5, - statisticsInfo: SDL.Button.extend( { - classNames: 'button statisticsInfo settingsButton', - text: 'Statistics Info settings', - elementId: 'statisticsInfo', - action: 'onState', - target: 'SDL.SettingsController', - templateName: 'arrow', - goToState: 'policies.statisticsInfo', - onDown: false - }) - });
\ No newline at end of file + /** Items */ + items: [ + { + type: SDL.Button, + params: { + goToState: 'policies.deviceConfig', + text: 'Allow SDL Functionality', + action: 'onState', + target: 'SDL.SettingsController', + templateName: 'arrow', + onDown: false + } + }, + { + type: SDL.Button, + params: { + text: 'Update SDL', + action: 'updateSDL', + target: 'SDL.SettingsController', + onDown: false + } + }, + { + type: SDL.Button, + params: { + text: 'Policy table update status', + action: 'getStatusUpdate', + target: 'SDL.SettingsController', + onDown: false + } + }, + { + type: SDL.Button, + params: { + text: 'Send request GetURLS', + action: 'getURLS', + target: 'SDL.SettingsController', + onDown: false + } + }, + { + type: SDL.Button, + params: { + text: 'Statistics Info settings', + action: 'onState', + target: 'SDL.SettingsController', + templateName: 'arrow', + goToState: 'policies.statisticsInfo', + onDown: false + } + }, + { + type: SDL.Button, + params: { + text: 'App permissions', + action: 'onState', + target: 'SDL.SettingsController', + templateName: 'arrow', + goToState: 'policies.appPermissionsList', + onDown: false + } + } + ] + }) +});
\ No newline at end of file diff --git a/src/components/HMI/app/view/settingsView.js b/src/components/HMI/app/view/settingsView.js index 1a2252433..2afb895f5 100644 --- a/src/components/HMI/app/view/settingsView.js +++ b/src/components/HMI/app/view/settingsView.js @@ -44,6 +44,8 @@ SDL.SettingsView = Em.ContainerView.create( { [ 'leftMenu', SDL.PoliciesView, + SDL.AppPermissionsListView, + SDL.AppPermissionsView, SDL.DeviceConfigView, SDL.StatisticsInfoView ], diff --git a/src/components/HMI/css/buttonControls.css b/src/components/HMI/css/buttonControls.css index a3c9b9448..dae5c32ac 100644 --- a/src/components/HMI/css/buttonControls.css +++ b/src/components/HMI/css/buttonControls.css @@ -389,7 +389,7 @@ #app_controlButtons .systemRequest { top: 252px !important; left: 1059px !important; - width: 80px !important; + width: 135px !important; font-size: 16px !important; text-align: center; line-height: 48px; diff --git a/src/components/HMI/css/general.css b/src/components/HMI/css/general.css index ebc15d2df..b1326c567 100644 --- a/src/components/HMI/css/general.css +++ b/src/components/HMI/css/general.css @@ -545,6 +545,7 @@ div { .inactive_state { -webkit-transform: translateX(-2000px); -moz-transform: translateX(-2000px); + overflow: hidden; } .active_state { diff --git a/src/components/HMI/css/settings.css b/src/components/HMI/css/settings.css index f7ddb0da9..0aff5fea0 100644 --- a/src/components/HMI/css/settings.css +++ b/src/components/HMI/css/settings.css @@ -93,34 +93,28 @@ margin-top: 70px;
}
-#settingsView .settingsButton{
+#settingsView .policies_settings_list{
+ height: 251px;
+ width: 598px;
+ left: 10px;
+}
+#policies_settings_list .list-content .ffw-button{
+ width: 537px;
+ padding-left: 10px;
+}
+
+#settingsView .settingsButton{
float: left;
- width: 615px;
+ width: 536px;
margin-right: 10px;
- height: 51px;
+ height: 48px;
font-size: 20px;
line-height: 50px;
border: 1px solid #393939;
cursor: pointer;
- left: 10px;
padding-left: 10px;
-}
-
-#settingsView .updateSDLButton{
- top: 52px;
-}
-
-#settingsView .getStatusUpdate{
- top: 104px;
-}
-
-#settingsView .getURLS{
- top: 156px;
-}
-
-#settingsView .statisticsInfo{
- top: 208px;
+ position: relative;
}
#policies_settings_status_info .listSelect{
diff --git a/src/components/HMI/ffw/BasicCommunicationRPC.js b/src/components/HMI/ffw/BasicCommunicationRPC.js index 9905a2819..5c8c3cbf0 100644 --- a/src/components/HMI/ffw/BasicCommunicationRPC.js +++ b/src/components/HMI/ffw/BasicCommunicationRPC.js @@ -1,6 +1,6 @@ /* * 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 @@ -10,7 +10,7 @@ * 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 @@ -45,7 +45,7 @@ FFW.BasicCommunication = FFW.RPCObserver onPutFileSubscribeRequestID: -1, - allowSDLFunctionalityRequestID: -1, +allowSDLFunctionalityRequestID: -1, onSystemErrorSubscribeRequestID: -1, onStatusUpdateSubscribeRequestID: -1, @@ -55,10 +55,10 @@ FFW.BasicCommunication = FFW.RPCObserver onAppUnregisteredSubscribeRequestID: -1, onPlayToneSubscribeRequestID: -1, onSDLCloseSubscribeRequestID: -1, - onSDLConsentNeededSubscribeRequestID: -1, +onSDLConsentNeededSubscribeRequestID: -1, onPutFileUnsubscribeRequestID: -1, - onSystemErrorUnsubscribeRequestID: -1, +onSystemErrorUnsubscribeRequestID: -1, onStatusUpdateUnsubscribeRequestID: -1, onAppPermissionChangedUnsubscribeRequestID: -1, onFileRemovedUnsubscribeRequestID: -1, @@ -66,7 +66,7 @@ FFW.BasicCommunication = FFW.RPCObserver onAppUnregisteredUnsubscribeRequestID: -1, onPlayToneUnsubscribeRequestID: -1, onSDLCloseUnsubscribeRequestID: -1, - onSDLConsentNeededUnsubscribeRequestID: -1, +onSDLConsentNeededUnsubscribeRequestID: -1, // const onSystemErrorNotification: "SDL.OnSystemError", @@ -78,7 +78,7 @@ FFW.BasicCommunication = FFW.RPCObserver onAppUnregisteredNotification: "BasicCommunication.OnAppUnregistered", onPlayToneNotification: "BasicCommunication.PlayTone", onSDLCloseNotification: "BasicCommunication.OnSDLClose", - onSDLConsentNeededNotification: "SDL.OnSDLConsentNeeded", +onSDLConsentNeededNotification: "SDL.OnSDLConsentNeeded", /** * init object @@ -116,7 +116,7 @@ FFW.BasicCommunication = FFW.RPCObserver // subscribe to notifications this.onPutFileSubscribeRequestID = this.client .subscribeToNotification(this.onPutFileNotification); - this.onSystemErrorSubscribeRequestID = this.client +this.onSystemErrorSubscribeRequestID = this.client .subscribeToNotification(this.onSystemErrorNotification); this.onStatusUpdateSubscribeRequestID = this.client .subscribeToNotification(this.onStatusUpdateNotification); @@ -132,7 +132,7 @@ FFW.BasicCommunication = FFW.RPCObserver .subscribeToNotification(this.onPlayToneNotification); this.onSDLCloseSubscribeRequestID = this.client .subscribeToNotification(this.onSDLCloseNotification); - this.onSDLConsentNeededSubscribeRequestID = this.client +this.onSDLConsentNeededSubscribeRequestID = this.client .subscribeToNotification(this.onSDLConsentNeededNotification); }, @@ -149,7 +149,7 @@ FFW.BasicCommunication = FFW.RPCObserver this.onPutFileUnsubscribeRequestID = this.client .unsubscribeFromNotification(this.onPutFileNotification); - this.onSystemErrorUnsubscribeRequestID = this.client +this.onSystemErrorUnsubscribeRequestID = this.client .unsubscribeFromNotification(this.onSystemErrorNotification); this.onStatusUpdateUnsubscribeRequestID = this.client .unsubscribeFromNotification(this.onStatusUpdateNotification); @@ -165,7 +165,7 @@ FFW.BasicCommunication = FFW.RPCObserver .unsubscribeFromNotification(this.onPlayToneUpdatedNotification); this.onSDLCloseUnsubscribeRequestID = this.client .unsubscribeFromNotification(this.onSDLCloseNotification); - this.onSDLConsentNeededUnsubscribeRequestID = this.client +this.onSDLConsentNeededUnsubscribeRequestID = this.client .unsubscribeFromNotification(this.onSDLConsentNeededNotification); }, @@ -300,7 +300,7 @@ FFW.BasicCommunication = FFW.RPCObserver SDL.SDLModel.onFileRemoved(notification.params); } - if (notification.method == this.onSystemErrorNotification) { +if (notification.method == this.onSystemErrorNotification) { var message = "Undefined"; @@ -342,7 +342,7 @@ FFW.BasicCommunication = FFW.RPCObserver if (notification.method == this.onSDLCloseNotification) { //notification handler method } - if (notification.method == this.onSDLConsentNeededNotification) { +if (notification.method == this.onSDLConsentNeededNotification) { //Show popUp SDL.SettingsController.AllowSDLFunctionality(notification.params.device); @@ -408,7 +408,7 @@ FFW.BasicCommunication = FFW.RPCObserver SDL.SDLController.getApplicationModel(request.params.appID).turnOnSDL(request.params.appID); this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); } - if (request.method == "BasicCommunication.GetSystemInfo") { +if (request.method == "BasicCommunication.GetSystemInfo") { Em.Logger.log("BasicCommunication.GetSystemInfo Response"); @@ -435,7 +435,7 @@ FFW.BasicCommunication = FFW.RPCObserver this.GetURLS(7); //Service type for policies this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method); - } + } } }, @@ -580,7 +580,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * send response from onRPCRequest - * + * * @param {Number} * resultCode * @param {Number} @@ -717,7 +717,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * send response from onRPCRequest - * + * * @param {Number} * id * @param {String} @@ -776,7 +776,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Send request if application was activated - * + * * @param {number} appID */ OnAppActivated: function(appID) { @@ -855,7 +855,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Invoked by UI component when user switches to any functionality which * is not other mobile application. - * + * * @params {String} * @params {Number} */ @@ -895,7 +895,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Used by HMI when User chooses to exit application. - * + * * @params {Number} */ ExitApplication: function(appID) { @@ -916,7 +916,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Sent by HMI to SDL to close all registered applications. - * + * * @params {String} */ ExitAllApplications: function(reason) { @@ -938,7 +938,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Response with params of the last one supports mixing audio (ie * recording TTS command and playing audio). - * + * * @params {Number} */ MixingAudioSupported: function(attenuatedSupported) { @@ -962,7 +962,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Response with Results by user/HMI allowing SDL functionality or * disallowing access to all mobile apps. - * + * * @params {Number} */ AllowAllApps: function(allowed) { @@ -985,7 +985,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Response with result of allowed application - * + * * @params {Number} */ AllowApp: function(request) { @@ -1019,7 +1019,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Notifies if device was choosed - * + * * @param {String} * deviceName * @param {Number} @@ -1045,7 +1045,7 @@ FFW.BasicCommunication = FFW.RPCObserver /** * Send error response from onRPCRequest - * + * * @param {Number} * resultCode * @param {Number} diff --git a/src/components/HMI/ffw/UIRPC.js b/src/components/HMI/ffw/UIRPC.js index 4093d807e..143357bc3 100644 --- a/src/components/HMI/ffw/UIRPC.js +++ b/src/components/HMI/ffw/UIRPC.js @@ -1338,7 +1338,7 @@ FFW.UI = FFW.RPCObserver.create({ * @param {String} * */ - OnKeyboardInput: function (value) { + OnKeyboardInput: function (value, event) { Em.Logger.log("FFW.UI.OnKeyboardInput"); @@ -1348,7 +1348,7 @@ FFW.UI = FFW.RPCObserver.create({ "method": "UI.OnKeyboardInput", "params": { "data": value, - "event": "KEYPRESS" + "event": event } }; this.client.send(JSONMessage); diff --git a/src/components/HMI/index.html b/src/components/HMI/index.html index 784ae9ccb..f28a949d7 100644 --- a/src/components/HMI/index.html +++ b/src/components/HMI/index.html @@ -121,6 +121,9 @@ <script type="text/javascript" src="app/view/info/nonMediaView.js"></script>
<!-- settings views -->
+
+ <script type="text/javascript" src="app/view/settings/policies/appPermissionsListView.js"></script>
+ <script type="text/javascript" src="app/view/settings/policies/appPermissionsView.js"></script>
<script type="text/javascript" src="app/view/settings/policies/deviceConfigView.js"></script>
<script type="text/javascript" src="app/view/settings/policies/statisticsInfoView.js"></script>
<script type="text/javascript" src="app/view/settings/policiesView.js"></script>
diff --git a/src/components/config_profile/CMakeLists.txt b/src/components/config_profile/CMakeLists.txt index 72863ee57..8df6e96e8 100644 --- a/src/components/config_profile/CMakeLists.txt +++ b/src/components/config_profile/CMakeLists.txt @@ -10,7 +10,3 @@ set (SOURCES add_library("ConfigProfile" ${SOURCES}) target_link_libraries ("ConfigProfile" Utils) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libConfigProfile.so DESTINATION lib) -endif() diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 35cfdce1f..3a90be2aa 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -280,6 +280,11 @@ class Profile : public utils::Singleton<Profile> { */ const std::vector<uint32_t>& supported_diag_modes() const; + /** + * @brief Returns system files folder path + */ + const std::string& system_files_path() const; + // Members section protected: @@ -403,10 +408,11 @@ class Profile : public utils::Singleton<Profile> { std::string app_info_storage_; int32_t heart_beat_timeout_; std::string preloaded_pt_file_; - std::string policy_shapshot_file_name_; + std::string policy_snapshot_file_name_; uint32_t transport_manager_disconnect_timeout_; bool use_last_state_; std::vector<uint32_t> supported_diag_modes_; + std::string system_files_path_; DISALLOW_COPY_AND_ASSIGN(Profile); diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 8b0890b76..f6ed0b971 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -42,6 +42,9 @@ namespace { const char* kMainSection = "MAIN"; +const char* kPolicySection = "Policy"; + +const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json"; // Heartbeat is disabled by default const uint32_t kDefaultHeartBeatTimeout = 0; } @@ -80,6 +83,7 @@ Profile::Profile() list_files_in_none_(5), app_info_storage_("app_info.dat"), heart_beat_timeout_(kDefaultHeartBeatTimeout), + policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName), transport_manager_disconnect_timeout_(0), use_last_state_(false), supported_diag_modes_(), @@ -250,6 +254,10 @@ const std::string& Profile::preloaded_pt_file() const { return preloaded_pt_file_; } +const std::string& Profile::policies_snapshot_file_name() const{ + return policy_snapshot_file_name_; +} + uint32_t Profile::transport_manager_disconnect_timeout() const { return transport_manager_disconnect_timeout_; } @@ -324,27 +332,33 @@ void Profile::UpdateValues() { *value = '\0'; if ((0 != ini_read_value(config_file_name_.c_str(), - "Policy", "PoliciesTable", value)) + kPolicySection, "PoliciesTable", value)) && ('\0' != *value)) { - policies_file_name_ = app_config_folder_ + value; + policies_file_name_ = app_config_folder_ + '/' + value; LOG4CXX_INFO(logger_, "Set policy file to " << policies_file_name_); } *value = '\0'; if ((0 != ini_read_value(config_file_name_.c_str(), - "Policy", "PreloadedPT", value)) + kPolicySection, "PreloadedPT", value)) && ('\0' != *value)) { preloaded_pt_file_ = app_config_folder_ + '/' + value; LOG4CXX_INFO(logger_, "Set preloaded policy file to " << preloaded_pt_file_); } + (void) ReadStringValue(&policy_snapshot_file_name_, + kDefaultPoliciesSnapshotFileName, + kPolicySection, "PathToSnapshot"); + policy_snapshot_file_name_ = app_config_folder_ + + '/' + policy_snapshot_file_name_; + if ((0 != ini_read_value(config_file_name_.c_str(), "MAIN", "HMICapabilities", value)) && ('\0' != *value)) { hmi_capabilities_file_name_ = app_config_folder_ + "/" + value; LOG4CXX_INFO(logger_, - "Set hmi capabilities file to " << hmi_capabilities_file_name_); + "Set hmi capabilities file to " << hmi_capabilities_file_name_); } *value = '\0'; diff --git a/src/components/connection_handler/CMakeLists.txt b/src/components/connection_handler/CMakeLists.txt index 9d4f96454..568960444 100644 --- a/src/components/connection_handler/CMakeLists.txt +++ b/src/components/connection_handler/CMakeLists.txt @@ -18,7 +18,3 @@ set(LIBRARIES ) add_library("connectionHandler" ${SOURCES}) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libconnectionHandler.so DESTINATION lib) -endif() diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index aef4c45a6..45f7502ba 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -248,24 +248,6 @@ class ConnectionHandlerImpl : public ConnectionHandler, ConnectionHandlerImpl(); /** - * \brief Checks does device exist in list from TransportManager - * \param DeviceHandle Handle of device for checking. - * \param DeviceHandle Handle of device for checking. - * \return True if device exists. - */ - bool DoesDeviceExistInTMList( - const std::vector<transport_manager::DeviceInfo>& device_list, - const connection_handler::DeviceHandle device_handle); - - /** - * \brief Checks does device exist in list and adds if not - * \param DeviceHandle Handle of device for checking. - * \return True if device was added - */ - bool AddDeviceInDeviceListIfNotExist( - const transport_manager::DeviceInfo& device); - - /** * \brief Disconnect application. * * \param device_handle DeviceHandle of disconnected device. diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index 1dc39344b..7be9d977c 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -90,41 +90,6 @@ void ConnectionHandlerImpl::set_connection_handler_observer( void ConnectionHandlerImpl::OnDeviceListUpdated( const std::vector<transport_manager::DeviceInfo>& device_info_list) { LOG4CXX_INFO(logger_, "ConnectionHandlerImpl::OnDeviceListUpdated()"); - - bool list_actually_changed = false; - - DeviceListIterator itr = device_list_.begin(); - while (itr != device_list_.end()) { - if (!DoesDeviceExistInTMList(device_info_list, (*itr).first)) { - // Device has been removed. Perform all needed actions. - // 1. Delete all the connections and sessions of this device - // 2. Delete device from a list - // 3. Let observer know that device has been deleted. - DeviceHandle device_for_remove_handle = (*itr).first; - for (ConnectionListIterator it = connection_list_.begin(); - it != connection_list_.end(); ++it) { - if (device_for_remove_handle - == (*it).second->connection_device_handle()) { - RemoveConnection((*it).first); - } - } - itr = device_list_.erase(itr); - list_actually_changed = true; - if (connection_handler_observer_) { - connection_handler_observer_->RemoveDevice(device_for_remove_handle); - } - } - else { - ++itr; - } - } - for (std::vector<transport_manager::DeviceInfo>::const_iterator it_in = - device_info_list.begin(); it_in != device_info_list.end(); ++it_in) { - list_actually_changed |= AddDeviceInDeviceListIfNotExist((*it_in)); - } - if (connection_handler_observer_ && list_actually_changed) { - connection_handler_observer_->OnDeviceListUpdated(device_list_); - } } void ConnectionHandlerImpl::OnDeviceFound( @@ -135,42 +100,34 @@ void ConnectionHandlerImpl::OnDeviceFound( void ConnectionHandlerImpl::OnDeviceAdded( const transport_manager::DeviceInfo& device_info) { LOG4CXX_INFO(logger_, "ConnectionHandlerImpl::OnDeviceAdded()"); + device_list_.insert(DeviceList::value_type( + device_info.device_handle(), + Device(device_info.device_handle(), device_info.name(), + device_info.mac_address()))); + if (connection_handler_observer_) { + connection_handler_observer_->OnDeviceListUpdated(device_list_); + } } void ConnectionHandlerImpl::OnDeviceRemoved( const transport_manager::DeviceInfo& device_info) { LOG4CXX_INFO(logger_, "ConnectionHandlerImpl::OnDeviceRemoved()"); -} - -bool ConnectionHandlerImpl::DoesDeviceExistInTMList( - const std::vector<transport_manager::DeviceInfo>& device_list, - const connection_handler::DeviceHandle device_handle) { - bool result = false; - for (std::vector<transport_manager::DeviceInfo>::const_iterator it_in = - device_list.begin(); - it_in != device_list.end(); - ++it_in) { - if (it_in->device_handle() == device_handle) { - result = true; - break; + // Device has been removed. Perform all needed actions. + // 1. Delete all the connections and sessions of this device + // 2. Delete device from a list + // 3. Let observer know that device has been deleted. + for (ConnectionListIterator it = connection_list_.begin(); + it != connection_list_.end(); ++it) { + if (device_info.device_handle() == + (*it).second->connection_device_handle()) { + RemoveConnection((*it).first); } } - return result; -} - -bool ConnectionHandlerImpl::AddDeviceInDeviceListIfNotExist( - const transport_manager::DeviceInfo& device_info) { - DeviceListIterator it = device_list_.find(device_info.device_handle()); - if (device_list_.end() == it) { - LOG4CXX_INFO(logger_, "Adding new device!"); - device_list_.insert( - DeviceList::value_type( - device_info.device_handle(), - Device(device_info.device_handle(), device_info.name(), - device_info.mac_address()))); - return true; + device_list_.erase(device_info.device_handle()); + if (connection_handler_observer_) { + connection_handler_observer_->RemoveDevice(device_info.device_handle()); + connection_handler_observer_->OnDeviceListUpdated(device_list_); } - return false; } void ConnectionHandlerImpl::OnScanDevicesFinished() { diff --git a/src/components/dbus/CMakeLists.txt b/src/components/dbus/CMakeLists.txt index 48bd05e3f..d9320c800 100644 --- a/src/components/dbus/CMakeLists.txt +++ b/src/components/dbus/CMakeLists.txt @@ -41,7 +41,3 @@ add_custom_command( add_library("DBus" ${SOURCES}) target_link_libraries("DBus" "${LIBRARIES}") - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libDBus.so DESTINATION lib) -endif() diff --git a/src/components/formatters/CMakeLists.txt b/src/components/formatters/CMakeLists.txt index 102f005c2..31016ee70 100644 --- a/src/components/formatters/CMakeLists.txt +++ b/src/components/formatters/CMakeLists.txt @@ -23,7 +23,3 @@ set (FORMATTER_SOURCES add_library("formatters" ${SOURCES} ${FORMATTER_SOURCES} ) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libformatters.so DESTINATION lib) -endif() diff --git a/src/components/hmi_message_handler/CMakeLists.txt b/src/components/hmi_message_handler/CMakeLists.txt index 5432ab1e3..186b0c9df 100644 --- a/src/components/hmi_message_handler/CMakeLists.txt +++ b/src/components/hmi_message_handler/CMakeLists.txt @@ -16,28 +16,24 @@ include_directories ( ${CMAKE_SOURCE_DIR}/ ) -IF (${QT_HMI}) +IF (HMIADAPTER STREQUAL "dbus") set (DBUS_SOURCE ./src/dbus_message_adapter.cc) set (DBUS_ADAPTER DBus) - set (MESSAGE_BROKER MessageBrokerClient MessageBrokerServer) -ENDIF (${QT_HMI}) +ENDIF () set (SOURCES ./src/hmi_message_handler_impl.cc ./src/messagebroker_adapter.cc ./src/hmi_message_adapter.cc + ./src/mqueue_adapter.cc ${DBUS_SOURCE} ) set (LIBRARIES + Utils log4cxx ${DBUS_ADAPTER} - ${MESSAGE_BROKER} ) add_library("HMIMessageHandler" ${SOURCES}) target_link_libraries ("HMIMessageHandler" ${LIBRARIES}) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libHMIMessageHandler.so DESTINATION lib) -endif() diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h new file mode 100644 index 000000000..b0fb01662 --- /dev/null +++ b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h @@ -0,0 +1,63 @@ +/* +* 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. +*/ + +#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_MQUEUE_ADAPTER_H_ +#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_MQUEUE_ADAPTER_H_ + +#include <memory> +#include <mqueue.h> +#include "utils/threads/thread.h" +#include "hmi_message_handler/hmi_message_adapter.h" + +namespace hmi_message_handler { + +/** + * \brief HMI message adapter for mqueue + */ +class MqueueAdapter : public HMIMessageAdapter { + public: + MqueueAdapter(HMIMessageHandler* hmi_message_handler); + virtual ~MqueueAdapter(); + + protected: + virtual void SendMessageToHMI(MessageSharedPointer message); + virtual void SubscribeTo(); + + private: + mqd_t sdl_to_hmi_mqueue_; + mqd_t hmi_to_sdl_mqueue_; + std::auto_ptr<threads::Thread> receiver_thread_; +}; + +} // namespace hmi_message_handler + +#endif // SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_MQUEUE_ADAPTER_H_ diff --git a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc index 48dcbf703..2062b210f 100644 --- a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc +++ b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc @@ -95,8 +95,9 @@ void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) { void HMIMessageHandlerImpl::RemoveHMIMessageAdapter( HMIMessageAdapter* adapter) { LOG4CXX_INFO(logger_, "HMIMessageHandlerImpl::RemoveHMIMessageAdapter()"); - DCHECK(adapter != NULL); - message_adapters_.erase(adapter); + if (adapter != NULL) { + message_adapters_.erase(adapter); + } } void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi& message) { diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc index 5b395ef9b..841ee1541 100644 --- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc +++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc @@ -127,6 +127,8 @@ void MessageBrokerAdapter::SubscribeTo() { MessageBrokerController::subscribeTo("BasicCommunication.OnSystemInfoChanged"); MessageBrokerController::subscribeTo("SDL.OnAppPermissionConsent"); MessageBrokerController::subscribeTo("SDL.OnAllowSDLFunctionality"); + MessageBrokerController::subscribeTo("SDL.OnSystemError"); + MessageBrokerController::subscribeTo("SDL.AddStatisticsInfo"); LOG4CXX_INFO(logger_, "Subscribed to notifications."); } diff --git a/src/components/hmi_message_handler/src/mqueue_adapter.cc b/src/components/hmi_message_handler/src/mqueue_adapter.cc new file mode 100644 index 000000000..d57ebfa02 --- /dev/null +++ b/src/components/hmi_message_handler/src/mqueue_adapter.cc @@ -0,0 +1,139 @@ +/* +* 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 "hmi_message_handler/mqueue_adapter.h" +#include "hmi_message_handler/hmi_message_handler.h" + +namespace hmi_message_handler { + +const int kMqueueSize = 100; +const int kMqueueMessageSize = 65536; +const char* kSdlToHmiQueue = "/sdl_to_hmi"; +const char* kHmiToSdlQueue = "/hmi_to_sdl"; + +log4cxx::LoggerPtr logger = + log4cxx::LoggerPtr(log4cxx::Logger::getLogger("HMIMessageHandler")); + +class ReceiverThreadDelegate : public threads::ThreadDelegate { + public: + ReceiverThreadDelegate(mqd_t mqueue_descriptor, + HMIMessageHandler* hmi_message_handler) + : mqueue_descriptor_(mqueue_descriptor), + hmi_message_handler_(hmi_message_handler) {} + + private: + virtual void threadMain() { + while (true) { + static char buffer[kMqueueMessageSize]; + const ssize_t size = + mq_receive(mqueue_descriptor_, buffer, kMqueueMessageSize, NULL); + if (-1 == size) { + LOG4CXX_ERROR(logger, "Message queue receive failed, error " << errno); + continue; + } + const std::string message_string(buffer, buffer + size); + LOG4CXX_INFO(logger, "Message: " << message_string); + MessageSharedPointer message(new application_manager::Message( + protocol_handler::MessagePriority::kDefault)); + message->set_json_message(message_string); + message->set_protocol_version(application_manager::ProtocolVersion::kHMI); + hmi_message_handler_->OnMessageReceived(message); + } + } + + const mqd_t mqueue_descriptor_; + HMIMessageHandler* hmi_message_handler_; +}; + +MqueueAdapter::MqueueAdapter(HMIMessageHandler* hmi_message_handler) + : HMIMessageAdapter(hmi_message_handler), + sdl_to_hmi_mqueue_(-1), + hmi_to_sdl_mqueue_(-1), + receiver_thread_() { + mq_attr mq_attributes; + mq_attributes.mq_maxmsg = kMqueueSize; + mq_attributes.mq_msgsize = kMqueueMessageSize; + sdl_to_hmi_mqueue_ = + mq_open(kSdlToHmiQueue, O_CREAT | O_RDWR, S_IRWXU, &mq_attributes); + if (-1 == sdl_to_hmi_mqueue_) { + LOG4CXX_ERROR(logger, "Could not open message queue " + << kSdlToHmiQueue << ", error " << errno); + return; + } + hmi_to_sdl_mqueue_ = + mq_open(kHmiToSdlQueue, O_CREAT | O_RDWR, S_IRWXU, &mq_attributes); + if (-1 == hmi_to_sdl_mqueue_) { + LOG4CXX_ERROR(logger, "Could not open message queue " + << kHmiToSdlQueue << ", error " << errno); + return; + } + ReceiverThreadDelegate* receiver_thread_delegate = + new ReceiverThreadDelegate(hmi_to_sdl_mqueue_, hmi_message_handler); + receiver_thread_.reset( + new threads::Thread("mqueue receiver", receiver_thread_delegate)); + receiver_thread_->start(); +} + +MqueueAdapter::~MqueueAdapter() { + if (receiver_thread_.get()) receiver_thread_->stop(); + if (-1 != hmi_to_sdl_mqueue_) mq_close(hmi_to_sdl_mqueue_); + if (-1 != sdl_to_hmi_mqueue_) mq_close(sdl_to_hmi_mqueue_); + mq_unlink(kHmiToSdlQueue); + mq_unlink(kSdlToHmiQueue); +} + +void MqueueAdapter::SendMessageToHMI(const MessageSharedPointer message) { + LOG4CXX_TRACE_ENTER(logger); + + if (-1 == sdl_to_hmi_mqueue_) { + LOG4CXX_ERROR(logger, "Message queue is not opened"); + return; + } + const std::string& json = message->json_message(); + if (json.size() > kMqueueMessageSize) { + LOG4CXX_ERROR(logger, "Message size " << json.size() << " is too big"); + return; + } + const int rc = mq_send(sdl_to_hmi_mqueue_, json.c_str(), json.size(), 0); + if (0 != rc) { + LOG4CXX_ERROR(logger, "Could not send message, error " << errno); + return; + } + + LOG4CXX_TRACE_EXIT(logger); +} + +void MqueueAdapter::SubscribeTo() { + // empty implementation of pure virtual method, actually it's not called +} + +} // namespace hmi_message_handler diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt index d7beed6a3..9365019d0 100644 --- a/src/components/media_manager/CMakeLists.txt +++ b/src/components/media_manager/CMakeLists.txt @@ -61,6 +61,7 @@ include_directories ( ../../thirdPartyLibs/jsoncpp/include/ ${CMAKE_BINARY_DIR}/src/components/ ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/include/ + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/usage_statistics/include/ ${default_includes} ) diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc index 2a91845b5..46dcd652b 100644 --- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc +++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc @@ -38,7 +38,6 @@ #include <string> -#include <unistd.h> #include "application_manager/application_manager_impl.h" #include "application_manager/mobile_command_factory.h" #include "application_manager/application_impl.h" @@ -125,7 +124,7 @@ void AudioStreamSenderThread::sendAudioChunkToMobile() { std::vector<uint8_t>(from, to)); binaryData.clear(); } -#if !defined(EXTENDED_MEDIA) +#if !defined(EXTENDED_MEDIA_MODE) // without recording stream restart reading 1-sec file offset_ = 0; #endif diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc index ed4a7cf5f..914b184f0 100644 --- a/src/components/media_manager/src/socket_streamer_adapter.cc +++ b/src/components/media_manager/src/socket_streamer_adapter.cc @@ -305,22 +305,15 @@ bool SocketStreamerAdapter::Streamer::send( "Server: SDL\r\n" "Content-Type: video/mp4\r\n\r\n" }; -#ifdef OS_MACOSX - if (-1 == ::send(new_socket_fd_, hdr, strlen(hdr), SO_NOSIGPIPE)) { -#else + if (-1 == ::send(new_socket_fd_, hdr, strlen(hdr), MSG_NOSIGNAL)) { -#endif LOG4CXX_ERROR_EXT(logger, " Unable to send"); return false; } } -#ifdef OS_MACOSX - if (-1 == ::send(new_socket_fd_, (*msg).data(), - (*msg).data_size(), SO_NOSIGPIPE)) { -#else + if (-1 == ::send(new_socket_fd_, (*msg).data(), (*msg).data_size(), MSG_NOSIGNAL)) { -#endif LOG4CXX_ERROR_EXT(logger, " Unable to send"); return false; } diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt index c60774dfb..2ca4de0e5 100644 --- a/src/components/protocol_handler/CMakeLists.txt +++ b/src/components/protocol_handler/CMakeLists.txt @@ -18,7 +18,3 @@ set (SOURCES ) add_library("ProtocolHandler" ${SOURCES}) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libProtocolHandler.so DESTINATION lib) -endif() diff --git a/src/components/qt_hmi/References/Look/.DS_Store b/src/components/qt_hmi/References/Look/.DS_Store Binary files differnew file mode 100644 index 000000000..c84f3ca96 --- /dev/null +++ b/src/components/qt_hmi/References/Look/.DS_Store diff --git a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeue FinalDeliveryCorrect_13112011.zip b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeue FinalDeliveryCorrect_13112011.zip Binary files differnew file mode 100644 index 000000000..3cc135251 --- /dev/null +++ b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeue FinalDeliveryCorrect_13112011.zip diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll Binary files differnew file mode 100644 index 000000000..52506bb13 --- /dev/null +++ b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll Binary files differnew file mode 100644 index 000000000..4d811bed1 --- /dev/null +++ b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll diff --git a/src/components/request_watchdog/CMakeLists.txt b/src/components/request_watchdog/CMakeLists.txt index ad9c3da47..fe885605b 100644 --- a/src/components/request_watchdog/CMakeLists.txt +++ b/src/components/request_watchdog/CMakeLists.txt @@ -13,7 +13,3 @@ set (SOURCES add_library("RequestWatchdog" ${SOURCES}) target_link_libraries ("RequestWatchdog" Utils) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libRequestWatchdog.so DESTINATION lib) -endif() diff --git a/src/components/resumption/CMakeLists.txt b/src/components/resumption/CMakeLists.txt index 93752a9bc..390d14939 100644 --- a/src/components/resumption/CMakeLists.txt +++ b/src/components/resumption/CMakeLists.txt @@ -10,7 +10,3 @@ set (SOURCES ) add_library("Resumption" ${SOURCES}) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libResumption.so DESTINATION lib) -endif() diff --git a/src/components/smart_objects/CMakeLists.txt b/src/components/smart_objects/CMakeLists.txt index b1c58f98a..02d4797e0 100644 --- a/src/components/smart_objects/CMakeLists.txt +++ b/src/components/smart_objects/CMakeLists.txt @@ -20,7 +20,3 @@ set (SOURCES add_library("SmartObjects" ${SOURCES}) target_link_libraries ("SmartObjects" log4cxx) - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libSmartObjects.so DESTINATION lib) -endif() diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt index e06d3001f..e03a355e7 100644 --- a/src/components/utils/CMakeLists.txt +++ b/src/components/utils/CMakeLists.txt @@ -33,12 +33,6 @@ add_library("Utils" ${SOURCES}) IF(${CMAKE_SYSTEM_NAME} MATCHES "QNX") target_link_libraries ("Utils" log4cxx apr-1 aprutil-1) -ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +else() target_link_libraries ("Utils" log4cxx apr-1 aprutil-1 rt) -ELSE() - target_link_libraries ("Utils" log4cxx apr-1 aprutil-1) -endif() - -if( BUILD_SHARED_LIBS ) - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libUtils.so DESTINATION lib) endif() diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h index fb55b97cd..49441ec9f 100644 --- a/src/components/utils/include/utils/file_system.h +++ b/src/components/utils/include/utils/file_system.h @@ -74,6 +74,13 @@ uint32_t FileSize(const std::string& path); std::string CreateDirectory(const std::string& name); /** + * @brief Creates directory recursively + * @param path - full path to directory + * @return return true if directory was created or already exist + */ +bool CreateDirectoryRecursively(const std::string& path); + +/** * @brief Checks the file to see whether the file is a directory * @param name path to file * @return returns true if file is directory. diff --git a/src/components/utils/src/conditional_variable_posix.cc b/src/components/utils/src/conditional_variable_posix.cc index c11b063d0..46b31ee7c 100644 --- a/src/components/utils/src/conditional_variable_posix.cc +++ b/src/components/utils/src/conditional_variable_posix.cc @@ -54,9 +54,7 @@ ConditionalVariable::ConditionalVariable() { if (initialized != 0) LOG4CXX_ERROR(g_logger, "Failed to initialize " "conditional variable attributes"); -#ifdef __linux__ - pthread_condattr_setclock(&attrs, CLOCK_MONOTONIC); // Default (non linux) will use the CPU clock -#endif + pthread_condattr_setclock(&attrs, CLOCK_MONOTONIC); initialized = pthread_cond_init(&cond_var_, &attrs); if (initialized != 0) LOG4CXX_ERROR(g_logger, "Failed to initialize " @@ -96,28 +94,10 @@ void ConditionalVariable::Wait(AutoLock& auto_lock) { LOG4CXX_ERROR(g_logger, "Failed to wait for conditional variable"); } -#ifdef OS_LINUX -static void current_time(struct timespec *ts) { - clock_gettime(CLOCK_MONOTONIC, ts); -} -#elif OS_MACOSX -#include <mach/clock.h> -#include <mach/mach.h> -static void current_time(struct timespec *ts) { - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - ts->tv_sec = mts.tv_sec; - ts->tv_nsec = mts.tv_nsec; -} -#endif - ConditionalVariable::WaitStatus ConditionalVariable::WaitFor( AutoLock& auto_lock, int32_t milliseconds){ struct timespec now; - current_time(&now); + clock_gettime(CLOCK_MONOTONIC, &now); timespec wait_interval; wait_interval.tv_sec = now.tv_sec + (milliseconds / kMillisecondsPerSecond); diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc index b0cc8ba42..4648f8c0d 100644 --- a/src/components/utils/src/file_system.cc +++ b/src/components/utils/src/file_system.cc @@ -113,6 +113,22 @@ std::string file_system::CreateDirectory(const std::string& name) { return name; } +bool file_system::CreateDirectoryRecursively(const std::string& path) { + size_t pos = 0; + bool ret_val = true; + + while (ret_val == true && pos <= path.length()) { + pos = path.find('/', pos + 1); + if (!DirectoryExists(path.substr(0, pos))) { + if (0 != mkdir(path.substr(0, pos).c_str(), S_IRWXU)) { + ret_val = false; + } + } + } + + return ret_val; +} + bool file_system::IsDirectory(const std::string& name) { struct stat status; memset(&status, 0, sizeof(status)); diff --git a/src/components/utils/src/threads/posix_thread.cc b/src/components/utils/src/threads/posix_thread.cc index bc43d4a52..3bbdec853 100644 --- a/src/components/utils/src/threads/posix_thread.cc +++ b/src/components/utils/src/threads/posix_thread.cc @@ -131,11 +131,7 @@ bool Thread::startWithOptions(const ThreadOptions& options) { success = !pthread_create(&thread_handle_, &attributes, threadFunc, delegate_); if (success) { -#ifdef __linux__ pthread_result = pthread_setname_np(thread_handle_, name_.c_str()); -#elif OS_MACOSX - pthread_result = pthread_setname_np(name_.c_str()); -#endif # ifdef __QNXNTO__ if (pthread_result != EOK) { LOG4CXX_INFO(logger_,"Couldn't set pthread name" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3d51830cc..1a5b0aca3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,7 +9,7 @@ find_package(LibXML2 REQUIRED) add_subdirectory(./components) add_subdirectory(./thirdPartyLibs) add_subdirectory(${CMAKE_SOURCE_DIR}/src/components/policy/test/policy ./policy) -#add_subdirectory(./tools) +add_subdirectory(./tools) include_directories ( diff --git a/test/components/CMakeLists.txt b/test/components/CMakeLists.txt index 8e65bea35..8ce31131b 100644 --- a/test/components/CMakeLists.txt +++ b/test/components/CMakeLists.txt @@ -20,6 +20,8 @@ add_subdirectory(./protocol_handler) # --- ProtocolHandler add_subdirectory(./connection_handler) +add_subdirectory(./hmi_message_handler) + # --- Utils add_subdirectory(./utils) diff --git a/test/components/application_manager/CMakeLists.txt b/test/components/application_manager/CMakeLists.txt index e50bb7fa5..d8334d181 100644 --- a/test/components/application_manager/CMakeLists.txt +++ b/test/components/application_manager/CMakeLists.txt @@ -9,8 +9,8 @@ endif() ############################################################################### include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/application_manager/include ../../../src/components/smart_objects/include ../../../src/components/formatters/include/ @@ -30,6 +30,8 @@ set(LIBRARIES MOBILE_API HMI_API SmartObjects + apr-1 + aprutil-1 ) #create_test("test_APIVersionConverterV1Test" "./api_converter_v1_test.cpp" "${LIBRARIES}") diff --git a/test/components/application_manager/rpc/CMakeLists.txt b/test/components/application_manager/rpc/CMakeLists.txt index 59e862e40..e7f3a35cf 100644 --- a/test/components/application_manager/rpc/CMakeLists.txt +++ b/test/components/application_manager/rpc/CMakeLists.txt @@ -9,8 +9,8 @@ add_definitions(${GLIB2_CFLAGS}) include_directories ( ./include - ../../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../../src/thirdPartyLibs/MessageBroker/include ../../../../src/thirdPartyLibs/jsoncpp/include ../../../../src/appMain diff --git a/test/components/connection_handler/CMakeLists.txt b/test/components/connection_handler/CMakeLists.txt index c8db94fb1..dcffa5e73 100644 --- a/test/components/connection_handler/CMakeLists.txt +++ b/test/components/connection_handler/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/transport_manager/include ../../../src/components/utils/include ../../../src/components/protocol_handler/include @@ -17,7 +17,6 @@ set (LIBRARIES connectionHandler TransportManager Utils - bluetooth ) set (SOURCES diff --git a/test/components/dbus/CMakeLists.txt b/test/components/dbus/CMakeLists.txt index 2a7e7cbe3..0f4a31d7d 100644 --- a/test/components/dbus/CMakeLists.txt +++ b/test/components/dbus/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/include - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/gtest/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/gtest/include ${CMAKE_SOURCE_DIR}/src/components/ ${CMAKE_BINARY_DIR}/src/components/ ${CMAKE_SOURCE_DIR}/src/components/dbus/include/ diff --git a/test/components/formatters/CMakeLists.txt b/test/components/formatters/CMakeLists.txt index 451775354..47d6af5e3 100644 --- a/test/components/formatters/CMakeLists.txt +++ b/test/components/formatters/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/smart_objects/include ../../../src/components/formatters/include ../../../src/components/utils/include diff --git a/test/components/hmi_message_handler/CMakeLists.txt b/test/components/hmi_message_handler/CMakeLists.txt index 1ccd388ab..1a558f493 100644 --- a/test/components/hmi_message_handler/CMakeLists.txt +++ b/test/components/hmi_message_handler/CMakeLists.txt @@ -1,10 +1,12 @@ include_directories ( - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/include - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/gtest/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/gtest/include ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/jsoncpp/include/ ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/logger/include/ ${CMAKE_SOURCE_DIR}/src/components/utils/include/ + ${CMAKE_SOURCE_DIR}/src/components/application_manager/include/ ${CMAKE_SOURCE_DIR}/src/components/hmi_message_handler/include/ + ${CMAKE_SOURCE_DIR}/src/components/protocol_handler/include/ ${CMAKE_SOURCE_DIR}/src/components/smart_objects/include/ ${CMAKE_SOURCE_DIR}/test/components/hmi_message_handler/include/ ${CMAKE_BINARY_DIR}/src/components/ @@ -16,6 +18,9 @@ set (LIBRARIES gmock gmock_main Utils + ProtocolHandler + ApplicationManager + SmartObjects jsoncpp HMIMessageHandler ) @@ -25,4 +30,6 @@ set (SOURCES #./src/test_dbus_message_adapter.cc ) -#create_test("test_DBusMessageAdapter" "${SOURCES}" "${LIBRARIES}")
\ No newline at end of file +#create_test("test_DBusMessageAdapter" "${SOURCES}" "${LIBRARIES}") +create_test("test_mqueue_adapter" "./src/test_mqueue_adapter.cc" "${LIBRARIES}") + diff --git a/test/components/hmi_message_handler/src/test_mqueue_adapter.cc b/test/components/hmi_message_handler/src/test_mqueue_adapter.cc new file mode 100644 index 000000000..c30b3aa7b --- /dev/null +++ b/test/components/hmi_message_handler/src/test_mqueue_adapter.cc @@ -0,0 +1,92 @@ +/* + * 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 <gmock/gmock.h> + +#include "hmi_message_handler/hmi_message_handler.h" +#include "hmi_message_handler/mqueue_adapter.h" + +using hmi_message_handler::MessageSharedPointer; +using hmi_message_handler::HMIMessageHandler; +using hmi_message_handler::HMIMessageAdapter; +using hmi_message_handler::MqueueAdapter; +using application_manager::Message; + +class MockHandler : public HMIMessageHandler { + public: + MOCK_METHOD1(OnMessageReceived, void(MessageSharedPointer message)); + virtual void AddHMIMessageAdapter(HMIMessageAdapter* adapter) {} + virtual void RemoveHMIMessageAdapter(HMIMessageAdapter* adapter) {} + virtual void OnErrorSending(MessageSharedPointer message) {} + virtual void SendMessageToHMI(MessageSharedPointer message) {} +}; + +TEST(MqueueAdapter, Send) { + MockHandler handler; + HMIMessageAdapter* adapter = new MqueueAdapter(&handler); + + MessageSharedPointer message( + new Message(protocol_handler::MessagePriority::kDefault)); + message->set_json_message("{}"); + adapter->SendMessageToHMI(message); + + mqd_t mqd = mq_open("/sdl_to_hmi", O_RDONLY); + ASSERT_NE(-1, mqd); + static char buf[65536]; + ssize_t sz = mq_receive(mqd, buf, 65536, NULL); + ASSERT_EQ(2, sz); + EXPECT_STREQ("{}", buf); + + delete adapter; +} + +TEST(MqueueAdapter, Receive) { + MockHandler handler; + HMIMessageAdapter* adapter = new MqueueAdapter(&handler); + + using ::testing::Property; + using ::testing::Pointee; + EXPECT_CALL( + handler, + OnMessageReceived(Property( + &MessageSharedPointer::get, + Pointee(Property(&Message::json_message, std::string("()")))))); + + mqd_t mqd = mq_open("/hmi_to_sdl", O_WRONLY); + ASSERT_NE(-1, mqd); + const char buf[] = "()"; + int rc = mq_send(mqd, buf, sizeof(buf) - 1, 0); + ASSERT_EQ(0, rc); + + delete adapter; +} diff --git a/test/components/json_handler/CMakeLists.txt b/test/components/json_handler/CMakeLists.txt index ae069a006..ef28e8c40 100644 --- a/test/components/json_handler/CMakeLists.txt +++ b/test/components/json_handler/CMakeLists.txt @@ -6,8 +6,8 @@ GenerateInterface("test_JSONHandler_v4_protocol_v1_2_no_extra.xml" "Gen::test::c include_directories ( ${CMAKE_SOURCE_DIR}/src//thirdPartyLibs/jsoncpp/include/ - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/include - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/gtest/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/gtest/include ${CMAKE_SOURCE_DIR}/src/components/utils/include ${CMAKE_SOURCE_DIR}/src/components/smart_objects/include diff --git a/test/components/media_manager/CMakeLists.txt b/test/components/media_manager/CMakeLists.txt index df51801a7..61b12a263 100644 --- a/test/components/media_manager/CMakeLists.txt +++ b/test/components/media_manager/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/media_manager/include ../../../src/components/utils/include/ ../../../src/components/protocol_handler/include/ diff --git a/test/components/mobile_message_handler/CMakeLists.txt b/test/components/mobile_message_handler/CMakeLists.txt index 23f480ebb..d5b8e16d1 100644 --- a/test/components/mobile_message_handler/CMakeLists.txt +++ b/test/components/mobile_message_handler/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/application_manager/include ../../../src/components/protocol_handler/include ../../../src/components/mobile_message_handler/include/ diff --git a/test/components/protocol_handler/CMakeLists.txt b/test/components/protocol_handler/CMakeLists.txt index 0756d510a..ed4ca5066 100644 --- a/test/components/protocol_handler/CMakeLists.txt +++ b/test/components/protocol_handler/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/transport_manager/include ../../../src/components/utils/include ../../../src/components/protocol_handler/include @@ -17,7 +17,6 @@ set (LIBRARIES connectionHandler TransportManager Utils - bluetooth ) set (SOURCES diff --git a/test/components/request_watchdog/CMakeLists.txt b/test/components/request_watchdog/CMakeLists.txt index c333d37ce..e4d8bdff5 100644 --- a/test/components/request_watchdog/CMakeLists.txt +++ b/test/components/request_watchdog/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/request_watchdog/include ../../../src/components/utils/include/ ../../../test/components/request_watchdog/include diff --git a/test/components/smart_objects/CMakeLists.txt b/test/components/smart_objects/CMakeLists.txt index 47d2da959..bd2029ae9 100644 --- a/test/components/smart_objects/CMakeLists.txt +++ b/test/components/smart_objects/CMakeLists.txt @@ -5,8 +5,8 @@ add_subdirectory(./SchemaItem) include_directories ( ${CMAKE_SOURCE_DIR}/src/components/utils/include - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/smart_objects/include ../../../src/components/formatters/include/ ../../../src//thirdPartyLibs/jsoncpp/include/ diff --git a/test/components/smart_objects/SchemaItem/CMakeLists.txt b/test/components/smart_objects/SchemaItem/CMakeLists.txt index 901d1649c..65f87b6c4 100644 --- a/test/components/smart_objects/SchemaItem/CMakeLists.txt +++ b/test/components/smart_objects/SchemaItem/CMakeLists.txt @@ -1,7 +1,7 @@ include_directories ( ../../../../src/components/utils/include - ../../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../../src/components/smart_objects/include ../../../../src/components/formatters/include/ ../../../../src//thirdPartyLibs/jsoncpp/include/ diff --git a/test/components/transport_manager/CMakeLists.txt b/test/components/transport_manager/CMakeLists.txt index 48d230df4..9696c09f6 100644 --- a/test/components/transport_manager/CMakeLists.txt +++ b/test/components/transport_manager/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/include - ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.6.0/gtest/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/include + ${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/gmock-1.7.0/gtest/include ${CMAKE_SOURCE_DIR}/src/components/transport_manager/include ${CMAKE_SOURCE_DIR}/src/components/utils/include/ ${CMAKE_SOURCE_DIR}/src/components/config_profile/include/ diff --git a/test/components/utils/CMakeLists.txt b/test/components/utils/CMakeLists.txt index 8796cb54c..0d417ae27 100644 --- a/test/components/utils/CMakeLists.txt +++ b/test/components/utils/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/components/utils/include ../../../test/components/utils/include ) diff --git a/test/components/utils/include/utils/prioritized_queue_tests.h b/test/components/utils/include/utils/prioritized_queue_tests.h index 86eef1060..22c3cecc6 100644 --- a/test/components/utils/include/utils/prioritized_queue_tests.h +++ b/test/components/utils/include/utils/prioritized_queue_tests.h @@ -9,14 +9,14 @@ namespace test { namespace components { namespace utils { - TEST(PrioritizedQueueTest, CommonTests) { - ASSERT_TRUE(true); struct TestMessage { int order; int priority; int PriorityOrder() const { return priority; } }; + TEST(PrioritizedQueueTest, CommonTests) { + ASSERT_TRUE(true); const size_t kSequenceLength = 8; TestMessage input[kSequenceLength] = { {0, 0}, {1, 0}, {2, 2}, {3, 0}, {4, 2}, {5, 0}, {6, 9}, {7, 1} diff --git a/test/gtest-example/CMakeLists.txt b/test/gtest-example/CMakeLists.txt index 8e0cfa0a3..4cec48969 100644 --- a/test/gtest-example/CMakeLists.txt +++ b/test/gtest-example/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../src/thirdPartyLibs/gmock-1.6.0/include - ../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../src/thirdPartyLibs/gmock-1.7.0/include + ../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ) set (SOURCES diff --git a/test/thirdPartyLibs/jsoncpp/CMakeLists.txt b/test/thirdPartyLibs/jsoncpp/CMakeLists.txt index 0d8754c0d..a017707c5 100644 --- a/test/thirdPartyLibs/jsoncpp/CMakeLists.txt +++ b/test/thirdPartyLibs/jsoncpp/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories ( - ../../../src/thirdPartyLibs/gmock-1.6.0/include - ../../../src/thirdPartyLibs/gmock-1.6.0/gtest/include + ../../../src/thirdPartyLibs/gmock-1.7.0/include + ../../../src/thirdPartyLibs/gmock-1.7.0/gtest/include ../../../src/thirdPartyLibs/jsoncpp/include/ ../../../test/thirdPartyLibs/jsoncpp/include/ ) diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py index 1fc5824d0..a4f41cba2 100755 --- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py +++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py @@ -1428,19 +1428,22 @@ class CodeGenerator(object): u'''const std::map<${namespace}::${enum}::eType, ''' u'''std::string> &TEnumSchemaItem<${namespace}::${enum}::eType>::''' u'''getEnumElementsStringRepresentation() {\n''' + u''' static bool is_initialized = false;\n''' u''' static std::map<${namespace}::${enum}::eType, ''' - u'''std::string> enum_string_representation {\n''' + u'''std::string> enum_string_representation;\n''' u'''\n''' + u''' if (false == is_initialized) {\n''' u'''${mapping}''' u'''\n''' - u''' };\n''' + u''' is_initialized = true;\n''' + u''' }\n''' u'''\n''' u''' return enum_string_representation;\n''' u'''}\n''') _enum_to_str_mapping_template = string.Template( - u'''{${namespace}::''' - u'''${enum_name}::${enum_value}, "${string}"},''') + u'''enum_string_representation.insert(std::make_pair(${namespace}::''' + u'''${enum_name}::${enum_value}, "${string}"));''') _struct_schema_item_template = string.Template( u'''utils::SharedPtr<ISchemaItem> struct_schema_item_${name} = ''' diff --git a/tools/intergen/utils/include/utils/common_types.h b/tools/intergen/utils/include/utils/common_types.h index 384e94f38..aff817b63 100644 --- a/tools/intergen/utils/include/utils/common_types.h +++ b/tools/intergen/utils/include/utils/common_types.h @@ -90,10 +90,10 @@ class BasicRange { BasicRange(const std::string& min_str, const std::string& max_str) : min_(0), max_(0) { - bool valid_min = StringToNumber(min(), &min_) - && Fraction::FromFloatPointString(min(), &min_fract_); - bool valid_max = StringToNumber(max(), &max_) - && Fraction::FromFloatPointString(max(), &max_fract_); + bool valid_min = StringToNumber(min, &min_) + && Fraction::FromFloatPointString(min, &min_fract_); + bool valid_max = StringToNumber(max, &max_) + && Fraction::FromFloatPointString(max, &max_fract_); assert(valid_min && valid_max); } // Tells if |value| belongs to current range (boundaries are included) |