-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
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()
#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"
#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 {
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_;
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
-{\r
- "rpcs":{\r
- "GetDTCs":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "DiagnosticMessage":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "SystemRequest":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "ReadDID":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "AlertManeuver":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "ShowConstantTBT":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "UpdateTurnList":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "UnsubscribeVehicleData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "SubscribeVehicleData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "GetVehicleData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnVehicleData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "GenericResponse":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "DeleteCommand":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "PerformInteraction":{\r
- "hmi_levels":[\r
- "FULL"\r
- ]\r
- },\r
- "Speak":{\r
- "hmi_levels":[\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnAppInterfaceUnregistered":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "OnButtonPress":{\r
- "hmi_levels":[\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnEncodedSyncPData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "SetMediaClockTimer":{\r
- "hmi_levels":[\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "AddSubMenu":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "RegisterAppInterface":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "UnregisterAppInterface":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "DeleteSubMenu":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "Alert":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "EncodedSyncPData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "OnButtonEvent":{\r
- "hmi_levels":[\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "DeleteInteractionChoiceSet":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnPermissionsChange":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "SetGlobalProperties":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnCommand":{\r
- "hmi_levels":[\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "Show":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "AddCommand":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "ChangeRegistration":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "CreateInteractionChoiceSet":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "Slider":{\r
- "hmi_levels":[\r
- "FULL"\r
- ]\r
- },\r
- "ResetGlobalProperties":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnDriverDistraction":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnHMIStatus":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "SubscribeButton":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "UnsubscribeButton":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnTBTClientState":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "OnAudioPassThru":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "PerformAudioPassThru":{\r
- "hmi_levels":[\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "EndAudioPassThru":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED"\r
- ]\r
- },\r
- "ScrollableMessage":{\r
- "hmi_levels":[\r
- "FULL"\r
- ]\r
- },\r
- "OnLanguageChange":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "SetDisplayLayout":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
- "SyncPData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
-"DialNumber":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
-\r
-"PutFile":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
-\r
-"DeleteFile":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
-\r
-"ListFiles":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
-\r
-"SetAppIcon":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- },\r
-\r
-\r
- "OnSyncPData":{\r
- "hmi_levels":[\r
- "BACKGROUND",\r
- "FULL",\r
- "LIMITED",\r
- "NONE"\r
- ]\r
- }\r
- }\r
- }\r
+{
+ "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"
+ ]
+ }
+ }
+ }
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
[Policy]
PoliciesTable = policy_table.json
PreloadedPT = sdl_preloaded_pt.json
+PathToSnapshot = sdl_snapshot.json
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 ()
this._super();\r
SDL.DeviceConfigView.showDeviceList();\r
}\r
+ }),\r
+\r
+ appPermissionsList: Em.State.create({\r
+\r
+ enter: function () {\r
+\r
+ this._super();\r
+\r
+ }\r
+ }),\r
+\r
+ appPermissions: Em.State.create({\r
+\r
})\r
})\r
}),\r
}\r
},\r
\r
+ changeAppPermission: function(event) {\r
+\r
+ var allowance = SDL.SDLController.getApplicationModel(event.appID).allowedFunctions;\r
+\r
+ for (var i = 0; i < allowance.length; ++i) {\r
+\r
+ if (allowance[i].name == event.name) {\r
+\r
+ if (allowance[i].allowed) {\r
+\r
+ allowance[i].allowed = false;\r
+ event.set('text', event.name + " - Not allowed");\r
+ } else {\r
+\r
+ allowance[i].allowed = true;\r
+ event.set('text', event.name + " - Allowed");\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ },\r
+\r
/**\r
* Method to update array with app permissions which came from SDL\r
*\r
}\r
},\r
\r
+ /**\r
+ * Method to send request to update array with app permissions\r
+ *\r
+ * @param {Object} element\r
+ *\r
+ */\r
+ GetListOfPermissions: function(element) {\r
+ FFW.BasicCommunication.GetListOfPermissions(element.appID);\r
+ },\r
+\r
+ /**\r
+ * Method to update array with app permissions which came from SDL\r
+ *\r
+ * @param {Object} message\r
+ *\r
+ */\r
+ GetListOfPermissionsResponse: function(message) {\r
+\r
+ if (message.id in SDL.SDLModel.getListOfPermissionsPull) {\r
+\r
+ var appID = SDL.SDLModel.getListOfPermissionsPull[message.id],\r
+ messageCodes = [];\r
+\r
+ SDL.SDLController.getApplicationModel(appID).allowedFunctions = message.result.allowedFunctions;\r
+\r
+ for (var i = 0; i < message.result.allowedFunctions.length; i++) {\r
+ messageCodes.push(message.result.allowedFunctions[i].name);\r
+ }\r
+\r
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.permissionsFriendlyMessageUpdate, appID, messageCodes);\r
+\r
+ SDL.SettingsController.userFriendlyMessagePopUp();\r
+\r
+ SDL.SDLModel.getListOfPermissionsPull.remove(message.id);\r
+ }\r
+ },\r
+\r
+ /**\r
+ * Method to update array with app permissions with UserFriendlyMessage from SDL\r
+ *\r
+ * @param {Object} message\r
+ *\r
+ */\r
+ permissionsFriendlyMessageUpdate: function(message, appID) {\r
+ var len = SDL.SDLController.getApplicationModel(appID).allowedFunctions.length;\r
+\r
+ for (var i = 0; i < len; i++) {\r
+\r
+ SDL.SDLController.getApplicationModel(appID).allowedFunctions[i].text = message.label;\r
+ }\r
+\r
+ SDL.AppPermissionsView.update(appID);\r
+\r
+ this.onState('policies.appPermissions');\r
+ },\r
+\r
updateSDL: function() {\r
FFW.BasicCommunication.UpdateSDL();\r
},\r
if ( SDL.SliderView.active
|| SDL.InteractionChoicesView.active
|| SDL.ScrollableMessage.active
- || SDL.AudioPassThruPopUp.activate
- || SDL.VRHelpListView.active) {
+ || SDL.AudioPassThruPopUp.activate) {
return 'HMI_OBSCURED';
}
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);
},
/**
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':{
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]);
*/
alertRequestId: null,
- content1: 'Title',
+ content1: '',
- content2: 'Text',
+ content2: '',
+
+ content3: '',
active: false,
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();
target: 'parentView',
buttonAction: true,
onDown: false,
- disabledBinding: this.buttons
+ disabledBinding: 'parentView.buttons'
}),
buttonCancel: SDL.Button.extend( {
target: 'parentView',
buttonAction: false,
onDown: false,
- disabledBinding: this.buttons
+ disabledBinding: 'parentView.buttons'
}),
message: SDL.Label.extend({
deactivate: function(event) {
this.set('active', false);
- if (event) {
+ if (this.callback) {
this.callback(event.buttonAction);
}
- SDL.SDLController.onSystemContextChange();
this.set('callback', null);
},
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()
},
}
this.set('content', message);
- SDL.SDLController.onSystemContextChange();
}
});
\ No newline at end of file
}
SDL.SDLController.VRMove();
- SDL.SDLController.onSystemContextChange();
},
/**
}
this.helpList.list.refresh();
- SDL.SDLController.onSystemContextChange();
}
});
SDL.SDLModel.uiShowKeyboard(this);
},
search: function(){
+ FFW.UI.OnKeyboardInput(SDL.SDLModel.keyboardInputValue, "ENTRY_SUBMITTED");
this.get('parentView').deactivate("SUCCESS");
}
}),
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();
* @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
[
'leftMenu',
SDL.PoliciesView,
+ SDL.AppPermissionsListView,
+ SDL.AppPermissionsView,
SDL.DeviceConfigView,
SDL.StatisticsInfoView
],
#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;
.inactive_state {
-webkit-transform: translateX(-2000px);
-moz-transform: translateX(-2000px);
+ overflow: hidden;
}
.active_state {
margin-top: 70px;\r
}\r
\r
-#settingsView .settingsButton{\r
+#settingsView .policies_settings_list{\r
+ height: 251px;\r
+ width: 598px;\r
+ left: 10px;\r
+}\r
\r
+#policies_settings_list .list-content .ffw-button{\r
+ width: 537px;\r
+ padding-left: 10px;\r
+}\r
+\r
+#settingsView .settingsButton{\r
float: left;\r
- width: 615px;\r
+ width: 536px;\r
margin-right: 10px;\r
- height: 51px;\r
+ height: 48px;\r
font-size: 20px;\r
line-height: 50px;\r
border: 1px solid #393939;\r
cursor: pointer;\r
- left: 10px;\r
padding-left: 10px;\r
-}\r
-\r
-#settingsView .updateSDLButton{\r
- top: 52px;\r
-}\r
-\r
-#settingsView .getStatusUpdate{\r
- top: 104px;\r
-}\r
-\r
-#settingsView .getURLS{\r
- top: 156px;\r
-}\r
-\r
-#settingsView .statisticsInfo{\r
- top: 208px;\r
+ position: relative;\r
}\r
\r
#policies_settings_status_info .listSelect{\r
/*
* 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
* 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
onPutFileSubscribeRequestID: -1,
- allowSDLFunctionalityRequestID: -1,
+allowSDLFunctionalityRequestID: -1,
onSystemErrorSubscribeRequestID: -1,
onStatusUpdateSubscribeRequestID: -1,
onAppUnregisteredSubscribeRequestID: -1,
onPlayToneSubscribeRequestID: -1,
onSDLCloseSubscribeRequestID: -1,
- onSDLConsentNeededSubscribeRequestID: -1,
+onSDLConsentNeededSubscribeRequestID: -1,
onPutFileUnsubscribeRequestID: -1,
- onSystemErrorUnsubscribeRequestID: -1,
+onSystemErrorUnsubscribeRequestID: -1,
onStatusUpdateUnsubscribeRequestID: -1,
onAppPermissionChangedUnsubscribeRequestID: -1,
onFileRemovedUnsubscribeRequestID: -1,
onAppUnregisteredUnsubscribeRequestID: -1,
onPlayToneUnsubscribeRequestID: -1,
onSDLCloseUnsubscribeRequestID: -1,
- onSDLConsentNeededUnsubscribeRequestID: -1,
+onSDLConsentNeededUnsubscribeRequestID: -1,
// const
onSystemErrorNotification: "SDL.OnSystemError",
onAppUnregisteredNotification: "BasicCommunication.OnAppUnregistered",
onPlayToneNotification: "BasicCommunication.PlayTone",
onSDLCloseNotification: "BasicCommunication.OnSDLClose",
- onSDLConsentNeededNotification: "SDL.OnSDLConsentNeeded",
+onSDLConsentNeededNotification: "SDL.OnSDLConsentNeeded",
/**
* init object
// 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);
.subscribeToNotification(this.onPlayToneNotification);
this.onSDLCloseSubscribeRequestID = this.client
.subscribeToNotification(this.onSDLCloseNotification);
- this.onSDLConsentNeededSubscribeRequestID = this.client
+this.onSDLConsentNeededSubscribeRequestID = this.client
.subscribeToNotification(this.onSDLConsentNeededNotification);
},
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);
.unsubscribeFromNotification(this.onPlayToneUpdatedNotification);
this.onSDLCloseUnsubscribeRequestID = this.client
.unsubscribeFromNotification(this.onSDLCloseNotification);
- this.onSDLConsentNeededUnsubscribeRequestID = this.client
+this.onSDLConsentNeededUnsubscribeRequestID = this.client
.unsubscribeFromNotification(this.onSDLConsentNeededNotification);
},
SDL.SDLModel.onFileRemoved(notification.params);
}
- if (notification.method == this.onSystemErrorNotification) {
+if (notification.method == this.onSystemErrorNotification) {
var message = "Undefined";
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);
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");
this.GetURLS(7); //Service type for policies
this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
- }
+ }
}
},
/**
* send response from onRPCRequest
- *
+ *
* @param {Number}
* resultCode
* @param {Number}
/**
* send response from onRPCRequest
- *
+ *
* @param {Number}
* id
* @param {String}
/**
* Send request if application was activated
- *
+ *
* @param {number} appID
*/
OnAppActivated: function(appID) {
/**
* Invoked by UI component when user switches to any functionality which
* is not other mobile application.
- *
+ *
* @params {String}
* @params {Number}
*/
/**
* Used by HMI when User chooses to exit application.
- *
+ *
* @params {Number}
*/
ExitApplication: function(appID) {
/**
* Sent by HMI to SDL to close all registered applications.
- *
+ *
* @params {String}
*/
ExitAllApplications: function(reason) {
/**
* Response with params of the last one supports mixing audio (ie
* recording TTS command and playing audio).
- *
+ *
* @params {Number}
*/
MixingAudioSupported: function(attenuatedSupported) {
/**
* Response with Results by user/HMI allowing SDL functionality or
* disallowing access to all mobile apps.
- *
+ *
* @params {Number}
*/
AllowAllApps: function(allowed) {
/**
* Response with result of allowed application
- *
+ *
* @params {Number}
*/
AllowApp: function(request) {
/**
* Notifies if device was choosed
- *
+ *
* @param {String}
* deviceName
* @param {Number}
/**
* Send error response from onRPCRequest
- *
+ *
* @param {Number}
* resultCode
* @param {Number}
* @param {String}
*
*/
- OnKeyboardInput: function (value) {
+ OnKeyboardInput: function (value, event) {
Em.Logger.log("FFW.UI.OnKeyboardInput");
"method": "UI.OnKeyboardInput",
"params": {
"data": value,
- "event": "KEYPRESS"
+ "event": event
}
};
this.client.send(JSONMessage);
<script type="text/javascript" src="app/view/info/nonMediaView.js"></script>\r
\r
<!-- settings views -->\r
+\r
+ <script type="text/javascript" src="app/view/settings/policies/appPermissionsListView.js"></script>\r
+ <script type="text/javascript" src="app/view/settings/policies/appPermissionsView.js"></script>\r
<script type="text/javascript" src="app/view/settings/policies/deviceConfigView.js"></script>\r
<script type="text/javascript" src="app/view/settings/policies/statisticsInfoView.js"></script>\r
<script type="text/javascript" src="app/view/settings/policiesView.js"></script>\r
add_library("ConfigProfile" ${SOURCES})
target_link_libraries ("ConfigProfile" Utils)
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libConfigProfile.so DESTINATION lib)
-endif()
*/
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:
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);
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;
}
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_(),
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_;
}
*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';
)
add_library("connectionHandler" ${SOURCES})
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libconnectionHandler.so DESTINATION lib)
-endif()
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.
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(
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() {
add_library("DBus" ${SOURCES})
target_link_libraries("DBus" "${LIBRARIES}")
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libDBus.so DESTINATION lib)
-endif()
add_library("formatters" ${SOURCES}
${FORMATTER_SOURCES}
)
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libformatters.so DESTINATION lib)
-endif()
${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()
--- /dev/null
+/*
+* 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_
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) {
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.");
}
--- /dev/null
+/*
+* 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
../../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}
)
#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"
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
"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;
}
)
add_library("ProtocolHandler" ${SOURCES})
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libProtocolHandler.so DESTINATION lib)
-endif()
add_library("RequestWatchdog" ${SOURCES})
target_link_libraries ("RequestWatchdog" Utils)
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libRequestWatchdog.so DESTINATION lib)
-endif()
)
add_library("Resumption" ${SOURCES})
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libResumption.so DESTINATION lib)
-endif()
add_library("SmartObjects" ${SOURCES})
target_link_libraries ("SmartObjects" log4cxx)
-
-if( BUILD_SHARED_LIBS )
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libSmartObjects.so DESTINATION lib)
-endif()
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()
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.
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 "
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);
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));
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"
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 (
# --- ProtocolHandler
add_subdirectory(./connection_handler)
+add_subdirectory(./hmi_message_handler)
+
# --- Utils
add_subdirectory(./utils)
###############################################################################
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/
MOBILE_API
HMI_API
SmartObjects
+ apr-1
+ aprutil-1
)
#create_test("test_APIVersionConverterV1Test" "./api_converter_v1_test.cpp" "${LIBRARIES}")
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
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
connectionHandler
TransportManager
Utils
- bluetooth
)
set (SOURCES
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/
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
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/
gmock
gmock_main
Utils
+ ProtocolHandler
+ ApplicationManager
+ SmartObjects
jsoncpp
HMIMessageHandler
)
#./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}")
+
--- /dev/null
+/*
+ * 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;
+}
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
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/
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/
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
connectionHandler
TransportManager
Utils
- bluetooth
)
set (SOURCES
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
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/
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/
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/
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
)
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}
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
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/
)
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} = '''
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)