diff options
Diffstat (limited to 'src/components/remote_control/include')
23 files changed, 0 insertions, 2698 deletions
diff --git a/src/components/remote_control/include/remote_control/commands/base_command_notification.h b/src/components/remote_control/include/remote_control/commands/base_command_notification.h deleted file mode 100644 index 578afad67b..0000000000 --- a/src/components/remote_control/include/remote_control/commands/base_command_notification.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_ - -#include "remote_control/commands/command.h" -#include "application_manager/message.h" -#include "application_manager/service.h" -#include "remote_control/rc_app_extension.h" -#include "remote_control/remote_plugin_interface.h" -#include "utils/logger.h" - -namespace Json { -class Value; -} - -namespace remote_control { - -namespace commands { - -/** - * @brief Base command class for notifications - */ -class BaseCommandNotification : public Command { - public: - /** - * @brief BaseCommandNotification class constructor - * - * @param message Message from mobile - **/ - BaseCommandNotification(const application_manager::MessagePtr& message, - RemotePluginInterface& rc_module); - - /** - * @brief BaseCommandNotification class destructor - */ - virtual ~BaseCommandNotification(); - - /** - * \brief BaseCommandNotification on timeout reaction - */ - virtual void OnTimeout() {} - - void Run(); - - protected: - application_manager::MessagePtr message() { - return message_; - } - application_manager::ServicePtr service_; - - RCAppExtensionPtr GetAppExtension( - application_manager::ApplicationSharedPtr app) const; - - /** - * @brief executes specific logic of children classes - */ - virtual void Execute() = 0; - - /** - * @brief Validates notification by xml schema - */ - virtual bool Validate(); - - virtual std::string ModuleType(const Json::Value& message); - virtual std::vector<std::string> ControlData(const Json::Value& message); - - void NotifyOneApplication(application_manager::MessagePtr message); - - private: - void NotifyApplications(); - bool CheckPolicy(application_manager::MessagePtr message); - application_manager::MessagePtr message_; -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_NOTIFICATION_H_ diff --git a/src/components/remote_control/include/remote_control/commands/base_command_request.h b/src/components/remote_control/include/remote_control/commands/base_command_request.h deleted file mode 100644 index 64128b971e..0000000000 --- a/src/components/remote_control/include/remote_control/commands/base_command_request.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_ - -#include "remote_control/commands/command.h" -#include "remote_control/event_engine/event_observer.h" -#include "application_manager/message.h" -#include "application_manager/service.h" -#include "utils/logger.h" -#include "interfaces/HMI_API.h" -#include "remote_control/rc_app_extension.h" -#include "json/json.h" -#include "remote_control/remote_plugin_interface.h" - -namespace remote_control { - -namespace commands { - -// Forward declaration to make this struct friend to BaseCommandRequest -struct OnDriverAnswerCallback; - -/** - * @brief Base command class for requests - */ -class BaseCommandRequest - : public Command, - public rc_event_engine::EventObserver<application_manager::MessagePtr, - std::string> { - public: - /** - * @brief BaseCommandRequest class constructor - * - * @param message Message from mobile - **/ - BaseCommandRequest(const application_manager::MessagePtr& message, - RemotePluginInterface& rc_module); - - /** - * @brief BaseCommandRequest class destructor - */ - virtual ~BaseCommandRequest(); - - /** - * @brief BaseCommandRequest on timeout reaction - */ - virtual void OnTimeout(); - - void Run(); - void on_event(const rc_event_engine::Event<application_manager::MessagePtr, - std::string>& event); - - /** - * @brief Generates correct request to HMI - * @param function_id request ID - * @param msg_params json with message params - * @return generated request shared ptr - */ - application_manager::MessagePtr CreateHmiRequest( - const char* function_id, const Json::Value& message_params); - - /** - * @brief Prepares response for sending to mobile - * Adds necessary fields to message - * @param success true if successful; false, if failed - * @param result_code Mobile result code in string ("SUCCESS", "INVALID_DATA", - * e.t.c) - * @param info Provides additional human readable info regarding the - *result(may be empty) - */ - void PrepareResponse(const bool success, - const char* result_code, - const std::string& info); - - protected: - application_manager::MessagePtr message_; - Json::Value response_params_; - - /** - * @brief AcquireResource try to allocate resource for application - * In case if allocation of resource is not required, return ALLOWED by - * default. - * This method should be overrided in RPCs that requires resource allocation - * @return result of resource allocation, in case if allocation os not - * required, return ALLOWED - */ - virtual AcquireResult::eType AcquireResource(const Json::Value&) { - return AcquireResult::ALLOWED; - } - - /** - * @brief IsResourceFree check resource state - * This is default implementation which has to be redefined for RPCs which - * need to manage the resources - * @param module_type Resource name - * @return True if free, otherwise - false - */ - virtual bool IsResourceFree(const std::string& module_type) const { - UNUSED(module_type); - return true; - } - - /** - * @brief SetResourceState changes state of resource - * This is default implementation which has to be redefined for RPCs which - * need to manage the resources - * @param Message containing type of module to extract - * @param State to set for resource - */ - virtual void SetResourceState(const Json::Value&, - const ResourceState::eType) {} - - /** - * @brief Get extension for specified application. If extension doesn't exist, - * it will be created - * @param app pointer to application - * @return pointer to extension - */ - RCAppExtensionPtr GetAppExtension( - application_manager::ApplicationSharedPtr app) const; - - /** - * @brief Converts HMI result code to string with mobile result code - * - * @param hmi_code HMI result code - * @return String with mobile result code - */ - const char* GetMobileResultCode( - const hmi_apis::Common_Result::eType& hmi_code) const; - - /** - * @brief Sends Mobile response - * @param success true if successful; false, if failed - * @param result_code Mobile result code in string ("SUCCESS", "INVALID_DATA", - *e.t.c) - * @param info Provides additional human readable info regarding the - *result(may be empty) - */ - void SendResponse(const bool success, - const char* result_code, - const std::string& info); - - /** - * @brief Parse result code from response - * - * @param message Response from HMI or Can - * @param result_code Outgoing param with mobile result code in string - *("SUCCESS", "INVALID_DATA", e.t.c) - * @param info Outgoing param with additional human readable info regarding - *the result(may be empty) - * @return true if it is success response? otherwise false - */ - bool ParseResultCode(const Json::Value& value, - std::string& result_code, - std::string& info); - - /** - * @brief Sends request to HMI - * @param message_to_send to send - */ - void SendMessageToHMI(const application_manager::MessagePtr& message_to_send); - - /** - * @brief Sends request to CAN or HMI - * @param function_id request ID - * @param msg_params json with message params - */ - void SendRequest(const char* function_id, const Json::Value& message_params); - - application_manager::ApplicationSharedPtr app() { - DCHECK(app_); - return app_; - } - - /** - * @brief executes specific logic of children classes - */ - void virtual Execute() = 0; - - /** - * @brief Validates request by xml schema - */ - bool Validate(); - - /* - * @brief Parses incoming string into Json - * @param parsed_mgs Resulting json object (must be valid pointer) - * @returns True if json string was valid false otherwise. - */ - virtual bool ParseJsonString(Json::Value* parsed_msg); - - /** - * @brief Interface method that is called whenever new event received - * @param event The received event - */ - void virtual OnEvent( - const rc_event_engine::Event<application_manager::MessagePtr, - std::string>& event) = 0; - - virtual std::string ModuleType(const Json::Value& message); - virtual std::vector<std::string> ControlData(const Json::Value& message); - virtual application_manager::TypeAccess CheckModule( - const Json::Value& message); - - bool auto_allowed() const { - return auto_allowed_; - } - - void set_auto_allowed(bool value) { - auto_allowed_ = value; - } - - application_manager::ServicePtr service() { - return service_; - } - - void set_disallowed_info(const std::string& info) { - disallowed_info_ = info; - } - - private: - /** - * @brief CheckPolicyPermissions checks RPC permissions defined in policy - * table - * @return True if RPC is allowed, otherwise - false - */ - bool CheckPolicyPermissions(); - - /** - * @brief CheckDriverConsent checks driver consent defined in policy table - * @return True if no consent is required, otherwise - false - */ - bool CheckDriverConsent(); - - /** - * @brief AcquireResources checks whether resource status is busy or not and - * then tries to acquire this resource. In case driver consent is required - - * sends consent request to HMI. - * @return True in case of resource is free and successfully acquired, - * otherwise false - */ - bool AcquireResources(); - inline bool IsAutoAllowed(application_manager::TypeAccess access) const; - void SendDisallowed(application_manager::TypeAccess access); - void SendGetUserConsent(const Json::Value& value); - void ProcessAccessResponse( - const rc_event_engine::Event<application_manager::MessagePtr, - std::string>& event); - - const Json::Value msg_json_; - application_manager::ApplicationSharedPtr app_; - application_manager::ServicePtr service_; - bool auto_allowed_; - std::string disallowed_info_; - - friend struct OnDriverAnswerCallback; -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BASE_COMMAND_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/commands/button_press_request.h b/src/components/remote_control/include/remote_control/commands/button_press_request.h deleted file mode 100644 index 945f98bdc8..0000000000 --- a/src/components/remote_control/include/remote_control/commands/button_press_request.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_ - -#include "remote_control/commands/base_command_request.h" -#include "remote_control/event_engine/event.h" -#include "utils/macro.h" - -namespace remote_control { - -namespace commands { - -/** - * @brief ButtonPressRequest command class - */ -class ButtonPressRequest : public BaseCommandRequest { - public: - /** - * @brief ButtonPressRequest class constructor - * - * @param message Message from mobile - **/ - ButtonPressRequest(const application_manager::MessagePtr& message, - RemotePluginInterface& rc_module); - /** - * @brief Execute command - */ - void Execute() FINAL; - - /** - * @brief AcquireResource Tries to acquire specific resource - * @param message Incoming message containg the resource name - * @return Acquire result - */ - AcquireResult::eType AcquireResource( - const Json::Value& message) OVERRIDE FINAL; - - /** - * @brief IsResourceFree check resource state - * @param module_type Resource name - * @return True if free, otherwise - false - */ - bool IsResourceFree(const std::string& module_type) const FINAL; - - /** - * @brief SetResourceState changes state of resource - * @param state State to set for resource - */ - void SetResourceState(const Json::Value& message, - const ResourceState::eType state) FINAL; - - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr, - std::string>& event); - - /** - * @brief ButtonPressRequest class destructor - */ - virtual ~ButtonPressRequest(); - - protected: - std::string ModuleType(const Json::Value& message) FINAL; -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_BUTTON_PRESS_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/commands/command.h b/src/components/remote_control/include/remote_control/commands/command.h deleted file mode 100644 index 0e03f8b330..0000000000 --- a/src/components/remote_control/include/remote_control/commands/command.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_ - -#include "utils/shared_ptr.h" -#include "remote_control/remote_plugin_interface.h" -#include "remote_control/event_engine/event.h" - -namespace remote_control { - -class RemotePluginInterface; - -namespace commands { - -/** - * @brief Command interface - **/ -class Command { - public: - /** - * @brief Execute command - */ - virtual void Run() = 0; - - /** - * \brief Command class destructor - */ - virtual ~Command() {} - - /** - * \brief Command on timeout reaction - */ - virtual void OnTimeout() = 0; - - /** - * @brief Interface method that is called whenever new event received - * @param event The received event - */ - virtual void on_event( - const rc_event_engine::Event<application_manager::MessagePtr, - std::string>& event) {} - - protected: - Command(RemotePluginInterface& rc_module) : rc_module_(rc_module) {} - - RemotePluginInterface& rc_module_; -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_COMMAND_H_ diff --git a/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h b/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h deleted file mode 100644 index 220f7da979..0000000000 --- a/src/components/remote_control/include/remote_control/commands/get_interior_vehicle_data_request.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_ - -#include "remote_control/commands/base_command_request.h" -#include "remote_control/event_engine/event.h" -#include "utils/macro.h" - -namespace remote_control { - -namespace commands { - -/** - * @brief GetInteriorVehicleDataRequest command class - */ -class GetInteriorVehicleDataRequest : public BaseCommandRequest { - public: - /** - * @brief GetInteriorVehicleDataRequest class constructor - * - * @param message Message from mobile - **/ - explicit GetInteriorVehicleDataRequest( - const application_manager::MessagePtr& message, - RemotePluginInterface& rc_module); - - /** - * @brief Execute command - */ - void Execute() FINAL; - - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr, - std::string>& event); - - /** - * @brief Check if app wants to proceed with already setup subscription - * @param request_params request parameters to check - * @return true if app already subscribed(unsubsribed) for module type but - * wants to subscribe(unsubscribe) for the same module again - * otherwise - false - */ - bool HasRequestExcessiveSubscription(const Json::Value& request_params); - - protected: - virtual std::string ModuleType(const Json::Value& message); - - private: - /** - * @brief Handle subscription to vehicle data - * @param hmi_response json message with response from HMI - */ - void ProccessSubscription(const Json::Value& hmi_response); - - /** - * @brief Cuts off subscribe parameter - * @param request_params request parameters to handle - */ - void RemoveExcessiveSubscription(Json::Value& request_params); -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h b/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h deleted file mode 100644 index 4ee9ce4709..0000000000 --- a/src/components/remote_control/include/remote_control/commands/on_interior_vehicle_data_notification.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_ - -#include "utils/macro.h" -#include "remote_control/commands/base_command_notification.h" - -namespace remote_control { - -namespace commands { - -/** - * @brief OnInteriorVehicleDataNotification command class - */ -class OnInteriorVehicleDataNotification : public BaseCommandNotification { - public: - /** - * @brief OnInteriorVehicleDataNotification class constructor - * - * @param message Message with notification - **/ - OnInteriorVehicleDataNotification( - const application_manager::MessagePtr& message, - RemotePluginInterface& rc_module); - - /** - * @brief Execute command - */ - void Execute() FINAL; - - /** - * @brief OnInteriorVehicleDataNotification class destructor - */ - virtual ~OnInteriorVehicleDataNotification(); - - protected: - std::string ModuleType(const Json::Value& message) FINAL; -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_ diff --git a/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h b/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h deleted file mode 100644 index ef248a2b38..0000000000 --- a/src/components/remote_control/include/remote_control/commands/on_remote_control_settings_notification.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_ - -#include "utils/macro.h" -#include "remote_control/commands/base_command_notification.h" - -namespace remote_control { - -namespace commands { - -/** - * @brief OnRemoteControlSettingsNotification command class - */ -class OnRemoteControlSettingsNotification : public BaseCommandNotification { - public: - /** - * @brief OnRemoteControlSettingsNotification class constructor - * - * @param message Message with notification - * @param rc_module Module used for handling RC functionality - **/ - OnRemoteControlSettingsNotification( - const application_manager::MessagePtr& message, - RemotePluginInterface& rc_module); - - /** - * @brief Execute command - */ - void Execute() FINAL; - - private: - /** - * @brief Disalows RC functionality for all RC apps - * All registered apps with appHMIType REMOTE_CONTROL will be put to NONE hmi - * level - * OnHMIStatus (NONE) will be send to such apps - * All registered apps will be unsubsribed from OnInteriorVehicleData - * notifications - */ - void DisallowRCFunctionality(); -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_ diff --git a/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h b/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h deleted file mode 100644 index bc1e3942e5..0000000000 --- a/src/components/remote_control/include/remote_control/commands/set_interior_vehicle_data_request.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_ - -#include "remote_control/commands/base_command_request.h" -#include "remote_control/event_engine/event.h" -#include "utils/macro.h" - -namespace remote_control { - -namespace commands { - -/** - * @brief SetInteriorVehicleDataRequest command class - */ -class SetInteriorVehicleDataRequest : public BaseCommandRequest { - public: - /** - * @brief SetInteriorVehicleDataRequest class constructor - * - * @param message Message from mobile - * @param rc_module Module used for handling RC functionality - **/ - SetInteriorVehicleDataRequest(const application_manager::MessagePtr& message, - RemotePluginInterface& rc_module); - - /** - * @brief Execute command - */ - void Execute() FINAL; - - /** - * @brief AcquireResource proxy AcquireResource to Resource allocation manager - * @param message message of requires contatin module types - * @return result of acauiring resources - */ - AcquireResult::eType AcquireResource( - const Json::Value& message) OVERRIDE FINAL; - - /** - * @brief IsResourceFree check resource state - * @param module_type Resource name - * @return True if free, otherwise - false - */ - bool IsResourceFree(const std::string& module_type) const FINAL; - - /** - * @brief SetResourceState changes state of resource - * @param state State to set for resource - */ - void SetResourceState(const Json::Value& message, - const ResourceState::eType state) FINAL; - - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - void OnEvent(const rc_event_engine::Event<application_manager::MessagePtr, - std::string>& event) OVERRIDE; - /** - * @brief Method that check if READ_ONLY parameters present - * @param request_params params from received message - * @return true if present , false - otherwise - */ - bool AreReadOnlyParamsPresent(const Json::Value& request_params); - - /** - * @brief Method that check if all request parameters are READ_ONLY - * @param request_params params from received message - * @return true if all are read only , false - otherwise - */ - bool AreAllParamsReadOnly(const Json::Value& request_params); - - /** - * @brief Method that cuts-off READ_ONLY parameters - * @param request_params params to handle - */ - void CutOffReadOnlyParams(Json::Value& request_params); - - /** - * @brief SetInteriorVehicleDataRequest class destructor - */ - virtual ~SetInteriorVehicleDataRequest(); - - protected: - virtual std::string ModuleType(const Json::Value& message) FINAL; - virtual std::vector<std::string> ControlData( - const Json::Value& message) FINAL; -}; - -} // namespace commands - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_ diff --git a/src/components/remote_control/include/remote_control/event_engine/event.h b/src/components/remote_control/include/remote_control/event_engine/event.h deleted file mode 100644 index 0da248e5a7..0000000000 --- a/src/components/remote_control/include/remote_control/event_engine/event.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_ - -#include <string> -#include "remote_control/event_engine/event_dispatcher.h" -#include "utils/shared_ptr.h" -#include "application_manager/message.h" - -namespace rc_event_engine { - -template <typename EventMessage, typename EventID> -class EventDispatcher; - -template <typename EventMessage, typename EventID> -class Event { - public: - /* - * @brief Constructor with parameters - * - * @param id Event ID. - * @param message Message received in event - */ - Event(EventMessage& message, const EventID& id); - - /* - * @brief Destructor - */ - virtual ~Event() {} - - /* - * @brief Provides event ID - */ - inline const EventID& id() const; - - /* - * @brief Sets event message - * - * @param message The message received in event - */ - void set_event_message(EventMessage& message); - - /* - * @brief Retrieves event message - * - * @return The message received in event - */ - inline const EventMessage& event_message() const; - - /* - * @brief Retrieves event message request ID - */ - virtual int32_t event_message_function_id() const = 0; - - /* - * @brief Retrieves event message correlation ID - */ - virtual int32_t event_message_correlation_id() const = 0; - - /* - * @brief Retrieves event message response type - */ - virtual int32_t event_message_type() const = 0; - - void raise(EventDispatcher<EventMessage, EventID>& event_dispatcher); - - protected: - EventMessage event_message_; - - private: - EventID id_; -}; - -template <typename EventMessage, typename EventID> -const EventID& Event<EventMessage, EventID>::id() const { - return id_; -} - -template <typename EventMessage, typename EventID> -const EventMessage& Event<EventMessage, EventID>::event_message() const { - return event_message_; -} - -template <typename EventMessage, typename EventID> -Event<EventMessage, EventID>::Event(EventMessage& message, const EventID& id) - : event_message_(message), id_(id) {} - -template <typename EventMessage, typename EventID> -void Event<EventMessage, EventID>::raise( - EventDispatcher<EventMessage, EventID>& event_dispatcher) { - event_dispatcher.raise_event(*this); -} - -} // namespace event_engine - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_H_ diff --git a/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h b/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h deleted file mode 100644 index ddee6caccc..0000000000 --- a/src/components/remote_control/include/remote_control/event_engine/event_dispatcher.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_ - -#include <list> -#include <map> - -#include "utils/lock.h" - -#include "remote_control/event_engine/event.h" -#include "remote_control/event_engine/event_observer.h" - -#include "interfaces/HMI_API.h" - -namespace rc_event_engine { - -template <typename EventMessage, typename EventID> -class Event; - -template <typename EventMessage, typename EventID> -class EventObserver; - -template <typename EventMessage, typename EventID> -class EventDispatcher { - public: - /** - * @brief Default constructor - */ - EventDispatcher(); - - /** - * @brief Destructor - */ - virtual ~EventDispatcher(); - - /* - * @brief Delivers the event to all subscribers - * - * @param event Received event - */ - void raise_event(const Event<EventMessage, EventID>& event); - - /* - * @brief Subscribe the observer to event - * - * @param event_id The event ID to subscribe for - * @param hmi_correlation_id The event HMI correlation ID - * @param observer The observer to subscribe for event - */ - void add_observer(const EventID& event_id, - int32_t hmi_correlation_id, - EventObserver<EventMessage, EventID>* const observer); - - /* - * @brief Unsubscribes the observer from specific event - * - * @param event_id The event ID to unsubscribe from - * @param observer The observer to be unsubscribed - */ - void remove_observer( - const EventID& event_id, - const EventObserver<EventMessage, EventID>* const observer); - - /* - * @brief Unsubscribes the observer from all events - * - * @param observer The observer to be unsubscribed - */ - void remove_observer( - const EventObserver<EventMessage, EventID>* const observer); - - protected: - private: - DISALLOW_COPY_AND_ASSIGN(EventDispatcher); - - // Data types section - typedef std::list<EventObserver<EventMessage, EventID>*> ObserverList; - typedef std::map<int32_t, ObserverList> ObserversMap; - typedef std::map<EventID, ObserversMap> EventObserverMap; - - // Members section - sync_primitives::Lock state_lock_; - EventObserverMap observers_; -}; - -template <typename EventMessage, typename EventID> -EventDispatcher<EventMessage, EventID>::EventDispatcher() - : observers_() {} - -template <typename EventMessage, typename EventID> -EventDispatcher<EventMessage, EventID>::~EventDispatcher() {} - -template <typename EventMessage, typename EventID> -void EventDispatcher<EventMessage, EventID>::raise_event( - const Event<EventMessage, EventID>& event) { - // create local list - ObserverList list; - { - sync_primitives::AutoLock auto_lock(state_lock_); - // check if event is notification - if (hmi_apis::messageType::notification == event.event_message_type()) { - // ObserversMap iterator - typename ObserversMap::iterator it = observers_[event.id()].begin(); - for (; observers_[event.id()].end() != it; ++it) { - list = it->second; - } - } - - if ((hmi_apis::messageType::response == event.event_message_type()) || - (hmi_apis::messageType::error_response == event.event_message_type())) { - list = observers_[event.id()][event.event_message_correlation_id()]; - } - } - - // Call observers - typename ObserverList::iterator observers = list.begin(); - for (; list.end() != observers; ++observers) { - (*observers)->on_event(event); - } -} - -template <typename EventMessage, typename EventID> -void EventDispatcher<EventMessage, EventID>::add_observer( - const EventID& event_id, - int32_t hmi_correlation_id, - EventObserver<EventMessage, EventID>* const observer) { - sync_primitives::AutoLock auto_lock(state_lock_); - observers_[event_id][hmi_correlation_id].push_back(observer); -} - -template <typename EventMessage, typename EventID> -void EventDispatcher<EventMessage, EventID>::remove_observer( - const EventID& event_id, - const EventObserver<EventMessage, EventID>* const observer) { - sync_primitives::AutoLock auto_lock(state_lock_); - typename ObserversMap::iterator it = observers_[event_id].begin(); - for (; observers_[event_id].end() != it; ++it) { - // ObserverList iterator - typename ObserverList::iterator observer_it = it->second.begin(); - while (it->second.end() != observer_it) { - if (observer->id() == (*observer_it)->id()) { - observer_it = it->second.erase(observer_it); - } else { - ++observer_it; - } - } - } -} - -template <typename EventMessage, typename EventID> -void EventDispatcher<EventMessage, EventID>::remove_observer( - const EventObserver<EventMessage, EventID>* const observer) { - sync_primitives::AutoLock auto_lock(state_lock_); - typename EventObserverMap::iterator event_map = observers_.begin(); - for (; observers_.end() != event_map; ++event_map) { - typename ObserversMap::iterator it = event_map->second.begin(); - for (; event_map->second.end() != it; ++it) { - // ObserverList iterator - typename ObserverList::iterator observer_it = it->second.begin(); - while (it->second.end() != observer_it) { - if (observer->id() == (*observer_it)->id()) { - observer_it = it->second.erase(observer_it); - } else { - ++observer_it; - } - } - } - } -} -} - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_DISPATCHER_H_ diff --git a/src/components/remote_control/include/remote_control/event_engine/event_observer.h b/src/components/remote_control/include/remote_control/event_engine/event_observer.h deleted file mode 100644 index 66a38da88b..0000000000 --- a/src/components/remote_control/include/remote_control/event_engine/event_observer.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_ - -#include <string> -#include "remote_control/event_engine/event.h" - -namespace rc_event_engine { - -template <typename EventMessage, typename EventID> -class Event; - -template <typename EventMessage, typename EventID> -class EventObserver { - public: - // Typedef for possible Observer ID's from mobile_apis functionID enum - typedef unsigned long ObserverID; - - /* - * @brief Constructor - * - */ - EventObserver(); - - /* - * @brief Destructor - */ - virtual ~EventObserver(); - - /** - * @brief Retrieves observer unique id - * - * @return Unique Observer id - */ - const ObserverID& id() const { - return id_; - } - - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const Event<EventMessage, EventID>& event) = 0; - - private: - ObserverID id_; - - DISALLOW_COPY_AND_ASSIGN(EventObserver); -}; - -template <typename EventMessage, typename EventID> -EventObserver<EventMessage, EventID>::EventObserver() - : id_(0) { - // Get unique id based on this - id_ = reinterpret_cast<unsigned long>(this); -} - -template <typename EventMessage, typename EventID> -EventObserver<EventMessage, EventID>::~EventObserver() { - // unsubscribe_from_all_events(); -} -} - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_EVENT_ENGINE_EVENT_OBSERVER_H_ diff --git a/src/components/remote_control/include/remote_control/message_helper.h b/src/components/remote_control/include/remote_control/message_helper.h deleted file mode 100644 index 6358459da7..0000000000 --- a/src/components/remote_control/include/remote_control/message_helper.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_ - -#include <stdint.h> -#include <string> -#include <map> - -#include "utils/macro.h" -#include "json/json.h" -#include "interfaces/HMI_API.h" -#include "functional_module/function_ids.h" -#include "remote_control/remote_plugin_interface.h" -#include "application_manager/message.h" - -namespace remote_control { - -/** - * @brief MessageHelper class - **/ -class MessageHelper { - public: - static const std::string GetMobileAPIName( - functional_modules::RCFunctionID func_id); - - /** - * @brief Convert Json::Value to std::string - * - * @param value Value with json - * - * @return string with json - */ - static std::string ValueToString(const Json::Value& value); - - /** - * @brief Convert std::string to Json::Value - * - * @param string string with json - * - * @return Value created from string with json - */ - static Json::Value StringToValue(const std::string& string); - - /** - * Creates hmi request - * @param function_id - API function we create request for - * @param message_params - params in request - * @param rc_module - used module for requests handling - * @param hmi_app_id - app is used between SDL & HMI - * @return creted request - reqdy to be sent to hmi - */ - static application_manager::MessagePtr CreateHmiRequest( - const char* function_id, - const uint32_t hmi_app_id, - const Json::Value& message_params, - RemotePluginInterface& rc_module); - - /** @brief Converts string to hmi AccessMode enum value - * @param access_mode stringified value - * @return hmi AccessMode enum value if succedeed, otherwise - INVALID_ENUM - * value - */ - static hmi_apis::Common_RCAccessMode::eType AccessModeFromString( - const std::string& access_mode); - - /** - * @brief AccessModeToString converts enum values to string - * @param access_mode Access mode enum value - * @return Appropriate string value - */ - static std::string AccessModeToString( - const hmi_apis::Common_RCAccessMode::eType access_mode); - - private: - MessageHelper(); - - static const std::map<functional_modules::RCFunctionID, std::string> - kMobileAPINames; - DISALLOW_COPY_AND_ASSIGN(MessageHelper); -}; - -/** @brief Check for existence of specified key in Json::Value - * @param value Value with json - * @param key string with key name - * @return true if key exist - */ -bool IsMember(const Json::Value& value, const std::string& key); - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_MESSAGE_HELPER_H_ diff --git a/src/components/remote_control/include/remote_control/module_helper.h b/src/components/remote_control/include/remote_control/module_helper.h deleted file mode 100644 index e69de29bb2..0000000000 --- a/src/components/remote_control/include/remote_control/module_helper.h +++ /dev/null diff --git a/src/components/remote_control/include/remote_control/rc_app_extension.h b/src/components/remote_control/include/remote_control/rc_app_extension.h deleted file mode 100644 index 485514faba..0000000000 --- a/src/components/remote_control/include/remote_control/rc_app_extension.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_ - -#include <string> -#include <set> -#include "application_manager/service.h" -#include "application_manager/app_extension.h" -#include "remote_control/remote_control_plugin.h" -#include "json/json.h" - -namespace remote_control { - -class RCAppExtension : public application_manager::AppExtension { - public: - explicit RCAppExtension(application_manager::AppExtensionUID uid); - ~RCAppExtension(); - - /** - * @brief Subscribe to OnInteriorVehicleDataNotification - * @param module interior data specification(zone, data type) - */ - void SubscribeToInteriorVehicleData(const Json::Value& module_type); - - /** - * @brief Unsubscribe from OnInteriorVehicleDataNotification - * @param module interior data specification(zone, data type) - */ - void UnsubscribeFromInteriorVehicleData(const Json::Value& module_type); - - /** - * @brief UnsubscribeFromInteriorVehicleData removes all subscriptions for - * interior data - */ - void UnsubscribeFromInteriorVehicleData(); - - /** - * @brief Check if application subscribed to OnInteriorVehicleDataNotification - * @param module interior data specification(zone, data type) - */ - bool IsSubscibedToInteriorVehicleData(const Json::Value& module_type); - - private: - std::set<Json::Value> subscribed_interior_vehicle_data_; -}; - -typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr; - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_ diff --git a/src/components/remote_control/include/remote_control/rc_command_factory.h b/src/components/remote_control/include/remote_control/rc_command_factory.h deleted file mode 100644 index 9463c4b1ef..0000000000 --- a/src/components/remote_control/include/remote_control/rc_command_factory.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_ - -#include "utils/shared_ptr.h" -#include "remote_control/commands/command.h" -#include "remote_control/remote_control_plugin.h" -#include "application_manager/message.h" -#include "utils/macro.h" - -namespace remote_control { - -/** - * @brief Factory class for command creation - **/ -class RCCommandFactory { - public: - /** - * @brief Create command object and return pointer to it - * - * @param message Message shared pointer. - * @return Pointer to created command object. - **/ - static utils::SharedPtr<commands::Command> CreateCommand( - const application_manager::MessagePtr& msg, - RemotePluginInterface& rc_module); - - private: - RCCommandFactory(); - DISALLOW_COPY_AND_ASSIGN(RCCommandFactory); -}; - -} // namespace can_cooperaion - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_COMMAND_FACTORY_H_ diff --git a/src/components/remote_control/include/remote_control/rc_module_constants.h b/src/components/remote_control/include/remote_control/rc_module_constants.h deleted file mode 100644 index 021e3cd6f0..0000000000 --- a/src/components/remote_control/include/remote_control/rc_module_constants.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_ - -namespace remote_control { - -namespace strings { -// RemoteControlCapabilities constants -const char kclimateControlCapabilities[] = "climateControlCapabilities"; -const char kradioControlCapabilities[] = "radioControlCapabilities"; -const char kbuttonCapabilities[] = "buttonCapabilities"; -// RemoteControlCapabilities constants - -const char kRadioControlData[] = "radioControlData"; -const char kClimateControlData[] = "climateControlData"; -} // strings - -namespace result_codes { -const char kSuccess[] = "SUCCESS"; -const char kUnsupportedRequest[] = "UNSUPPORTED_REQUEST"; -const char kUnsupportedResource[] = "UNSUPPORTED_RESOURCE"; -const char kDisallowed[] = "DISALLOWED"; -const char kRejected[] = "REJECTED"; -const char kAborted[] = "ABORTED"; -const char kIgnored[] = "IGNORED"; -const char kRetry[] = "RETRY"; -const char kInUse[] = "IN_USE"; -const char kVehicleDataNotAvailable[] = "VEHICLE_DATA_NOT_AVAILABLE"; -const char kTimedOut[] = "TIMED_OUT"; -const char kInvalidData[] = "INVALID_DATA"; -const char kCharLimitExceeded[] = "CHAR_LIMIT_EXCEEDED"; -const char kInvalidId[] = "INVALID_ID"; -const char kDuplicateName[] = "DUPLICATE_NAME"; -const char kApplicationNotRegistered[] = "APPLICATION_NOT_REGISTERED"; -const char kOutOfMemory[] = "OUT_OF_MEMORY"; -const char kTooManyPendingRequests[] = "TOO_MANY_PENDING_REQUESTS"; -const char kWarnings[] = "WARNINGS"; -const char kWrongLanguage[] = "WRONG_LANGUAGE"; -const char kGenericError[] = "GENERIC_ERROR"; -const char kUserDisallowed[] = "USER_DISALLOWED"; -const char kReadOnly[] = "READ_ONLY"; -} // result_codes - -namespace json_keys { -const char kParams[] = "params"; -const char kSuccess[] = "success"; -const char kResultCode[] = "resultCode"; -const char kResult[] = "result"; -const char kInfo[] = "info"; -const char kId[] = "id"; -const char kJsonrpc[] = "jsonrpc"; -const char kMethod[] = "method"; -const char kError[] = "error"; -const char kMessage[] = "message"; -const char kData[] = "data"; -const char kAppId[] = "appID"; -const char kCode[] = "code"; -} // json_keys - -namespace message_params { -const char kName[] = "name"; - -// SetInteriorVehicleData request -const char kModuleData[] = "moduleData"; -// SetInteriorVehicleData request - -// GetInteriorVehicleData request -const char kSubscribe[] = "subscribe"; -// GetInteriorVehicleData request - -// GetInteriorVehicleData response -const char kIsSubscribed[] = "isSubscribed"; -// GetInteriorVehicleData response - -// OnRemoteControlSettings notification -const char kAccessMode[] = "accessMode"; -const char kAllowed[] = "allowed"; -// OnRemoteControlSettings notification - -// ButtonPress request -const char kModuleType[] = "moduleType"; -const char kButtonName[] = "buttonName"; -const char kButtonPressMode[] = "buttonPressMode"; -// ButtonPress request - -// RdsData struct -const char kPS[] = "PS"; -const char kRT[] = "RT"; -const char kCT[] = "CT"; -const char kPI[] = "PI"; -const char kPTY[] = "PTY"; -const char kTA[] = "TA"; -const char kTP[] = "TP"; -const char kREG[] = "REG"; -// RdsData struct - -// RadioControlData struct -const char kFrequencyInteger[] = "frequencyInteger"; -const char kFrequencyFraction[] = "frequencyFraction"; -const char kBand[] = "band"; -const char kRdsData[] = "rdsData"; -const char kAvailableHDs[] = "availableHDs"; -const char kHdChannel[] = "hdChannel"; -const char kSignalStrength[] = "signalStrength"; -const char kSignalChangeThreshold[] = "signalChangeThreshold"; -const char kRadioEnable[] = "radioEnable"; -const char kState[] = "state"; -// RadioControlData struct - -// ClimateControlData struct -const char kFanSpeed[] = "fanSpeed"; -const char kCurrentTemperature[] = "currentTemperature"; -const char kDesiredTemperature[] = "desiredTemperature"; -const char kTemperatureUnit[] = "temperatureUnit"; -const char kACEnable[] = "acEnable"; -const char kCirculateAirEnable[] = "circulateAirEnable"; -const char kAutoModeEnable[] = "autoModeEnable"; -const char kDefrostZone[] = "defrostZone"; -const char kDualModeEnable[] = "dualModeEnable"; -const char kACMaxEnable[] = "acMaxEnable"; -const char kVentilationMode[] = "ventilationMode"; -// ClimateControlData struct - -// ModuleData struct -const char kRadioControlData[] = "radioControlData"; -const char kClimateControlData[] = "climateControlData"; -// ModuleData struct - -const char kHMIAppID[] = "appID"; -const char kHmiLevel[] = "hmiLevel"; -const char kSysContext[] = "systemContext"; -const char kAudioState[] = "audioStreamingState"; -} // namespace message_params - -namespace enums_value { - -// ModuleType enum -const char kClimate[] = "CLIMATE"; -const char kRadio[] = "RADIO"; -// ModuleType enum - -// RadioBand enum -const char kAM[] = "AM"; -const char kFM[] = "FM"; -const char kXM[] = "XM"; -// RadioBand enum - -// RadioState enum -const char kAcquiring[] = "ACQUIRING"; -const char kAcquired[] = "ACQUIRED"; -const char kMulticast[] = "MULTICAST"; -const char kNotFound[] = "NOT_FOUND"; -// RadioState enum - -// DefrostZone enum -const char kFront[] = "FRONT"; -const char kRear[] = "REAR"; -const char kAll[] = "ALL"; -// DefrostZone enum - -// TemperatureUnit enum -const char kFahrenheit[] = "FAHRENHEIT"; -const char kCelsius[] = "CELSIUS"; -// TemperatureUnit enum - -// ButtonName enum -const char kACMax[] = "AC_MAX"; -const char kAC[] = "AC"; -const char kRecirculate[] = "RECIRCULATE"; -const char kFanUp[] = "FAN_UP"; -const char kFanDown[] = "FAN_DOWN"; -const char kTempUp[] = "TEMP_UP"; -const char kTempDown[] = "TEMP_DOWN"; -const char kDefrostMax[] = "DEFROST_MAX"; -const char kDefrost[] = "DEFROST"; -const char kDefrostRear[] = "DEFROST_REAR"; -const char kUpperVent[] = "UPPER_VENT"; -const char kLowerVent[] = "LOWER_VENT"; -const char kVolumeUp[] = "VOLUME_UP"; -const char kVolumeDown[] = "VOLUME_DOWN"; -const char kEject[] = "EJECT"; -const char kSource[] = "SOURCE"; -const char kShuffle[] = "SHUFFLE"; -const char kRepeat[] = "REPEAT"; -// ButtonName enum - -// ButtonPressMode enum -const char kLong[] = "LONG"; -const char kShort[] = "SHORT"; -// ButtonPressMode enum - -// Access mode enum -const char kAutoAllow[] = "AUTO_ALLOW"; -const char kAutoDeny[] = "AUTO_DENY"; -const char kAskDriver[] = "ASK_DRIVER"; -// Access mode enum - -} // namespace enums_value - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_ diff --git a/src/components/remote_control/include/remote_control/rc_module_timer.h b/src/components/remote_control/include/remote_control/rc_module_timer.h deleted file mode 100644 index 813f26a885..0000000000 --- a/src/components/remote_control/include/remote_control/rc_module_timer.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_ - -#include "functional_module/timer/module_timer.h" - -namespace remote_control { - -class TrackableMessage : public functional_modules::Trackable { - public: - TrackableMessage(uint32_t app_id, uint32_t correlation_id) - : custom_interval_(0), app_id_(app_id), correlation_id_(correlation_id) {} - - functional_modules::TimeUnit custom_interval() const { - return custom_interval_; - } - - uint32_t app_id() const { - return app_id_; - } - - uint32_t correlation_id() const { - return correlation_id_; - } - - bool operator==(const TrackableMessage& other) const { - return (other.app_id_ == app_id_ && - other.correlation_id_ == correlation_id_); - } - - private: - functional_modules::TimeUnit custom_interval_; - uint32_t app_id_; - uint32_t correlation_id_; -}; - -} // namesapce remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_TIMER_H_ diff --git a/src/components/remote_control/include/remote_control/remote_control_event.h b/src/components/remote_control/include/remote_control/remote_control_event.h deleted file mode 100644 index 3c98f971ac..0000000000 --- a/src/components/remote_control/include/remote_control/remote_control_event.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_ - -#include <string> - -#include "application_manager/message.h" - -#include "remote_control/event_engine/event.h" - -namespace remote_control { - -class RCPluginEvent - : public rc_event_engine::Event<application_manager::MessagePtr, - std::string> { - public: - /* - * @brief Constructor with parameters - * - * @param id Event ID. (HMI or CAN function name) - * @param message Message received in HMI or CAN response - */ - RCPluginEvent(application_manager::MessagePtr& message, - const std::string& id); - - /* - * @brief Destructor - */ - virtual ~RCPluginEvent(); - - /* - * @brief Retrieves event message request ID - */ - virtual int32_t event_message_function_id() const; - - /* - * @brief Retrieves event message correlation ID - */ - virtual int32_t event_message_correlation_id() const; - - /* - * @brief Retrieves event message response type - */ - virtual int32_t event_message_type() const; - - private: - DISALLOW_COPY_AND_ASSIGN(RCPluginEvent); -}; -} - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_EVENT_H_ diff --git a/src/components/remote_control/include/remote_control/remote_control_plugin.h b/src/components/remote_control/include/remote_control/remote_control_plugin.h deleted file mode 100644 index 1e7d49c18e..0000000000 --- a/src/components/remote_control/include/remote_control/remote_control_plugin.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_ - -#include <queue> -#include <string> - -#include "remote_control/remote_plugin_interface.h" -#include "functional_module/generic_module.h" -#include "remote_control/request_controller.h" -#include "utils/threads/message_loop_thread.h" -#include "remote_control/event_engine/event_dispatcher.h" -#include "remote_control/resource_allocation_manager_impl.h" - -namespace remote_control { -typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr, - std::string> RCEventDispatcher; - -class RemoteControlPlugin : public RemotePluginInterface { - public: - RemoteControlPlugin(); - ~RemoteControlPlugin(); - - functional_modules::PluginInfo GetPluginInfo() const; - virtual functional_modules::ProcessResult ProcessMessage( - application_manager::MessagePtr msg); - virtual functional_modules::ProcessResult ProcessHMIMessage( - application_manager::MessagePtr msg); - - /** - * @brief Sends response to mobile application - * @param msg response mesage - */ - void SendResponseToMobile(application_manager::MessagePtr msg); - - /** - * @brief Sends timeout response to mobile application - * @param msg response mesage - */ - void SendTimeoutResponseToMobile(application_manager::MessagePtr msg); - - /** - * @brief Remove extension created for specified application - * @param app_id application id - */ - virtual void RemoveAppExtension(uint32_t app_id); - - /** - * @brief Check registering app can be handled by plugin - * @param msg Registration message - * @param app Application basis already create by Core - */ - bool IsAppForPlugin(application_manager::ApplicationSharedPtr app); - - /** - * @brief Notify about change of HMILevel of plugin's app - * @param app App with new HMILevel - * @param old_level Old HMILevel of app - */ - void OnAppHMILevelChanged(application_manager::ApplicationSharedPtr app, - mobile_apis::HMILevel::eType old_level); - - /** - * @brief Sends HMI status notification to mobile - * @param app application with changed HMI status - **/ - void SendHmiStatusNotification( - application_manager::ApplicationSharedPtr app) OVERRIDE; - - /** - * @brief Getter for event_dispatcher - * @return reference to RCEventDispatcher instance - */ - RCEventDispatcher& event_dispatcher() OVERRIDE; - - /** - * @brief Getter for resource_allocation_manager - * @return reference to ResourceAllocationManager instance - */ - ResourceAllocationManager& resource_allocation_manager() OVERRIDE; - - /** - * @brief Overriden setter for service - * @param service pointer to new service instance - */ - void set_service(application_manager::ServicePtr service) OVERRIDE; - - /** - * @brief OnApplicationEvent Processes application related events - * @param event Event - * @param application Pointer to application struct - */ - void OnApplicationEvent( - functional_modules::ApplicationEvent event, - application_manager::ApplicationSharedPtr application) OVERRIDE; - - /** - * @brief OnPolicyEvent Processes policy related events - * @param event Policy event - */ - void OnPolicyEvent(functional_modules::PolicyEvent event) OVERRIDE; - - protected: - /** - * @brief Remove extension for all applications - */ - virtual void RemoveAppExtensions() OVERRIDE; - - private: - /** - * @brief Trigger actions which should be done after plugin service instance - * have been changed - */ - void OnPluginServiceChanged(); - - /** - * @brief Subscribes on all RC related functions - */ - void SubscribeOnFunctions(); - - functional_modules::PluginInfo plugin_info_; - bool is_scan_started_; - request_controller::RequestController request_controller_; - - RCEventDispatcher event_dispatcher_; - - ResourceAllocationManagerImpl resource_allocation_manager_; - DISALLOW_COPY_AND_ASSIGN(RemoteControlPlugin); -}; - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_CONTROL_PLUGIN_H_ diff --git a/src/components/remote_control/include/remote_control/remote_plugin_interface.h b/src/components/remote_control/include/remote_control/remote_plugin_interface.h deleted file mode 100644 index 51135d8a8a..0000000000 --- a/src/components/remote_control/include/remote_control/remote_plugin_interface.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_ - -#include <queue> -#include <string> -#include "functional_module/generic_module.h" -#include "remote_control/request_controller.h" -#include "remote_control/event_engine/event_dispatcher.h" -#include "utils/threads/message_loop_thread.h" -#include "utils/shared_ptr.h" - -namespace remote_control { - -class RCAppExtension; -class ResourceAllocationManager; - -typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr; - -class RemotePluginInterface : public functional_modules::GenericModule { - public: - RemotePluginInterface() : GenericModule(kCANModuleID) {} - virtual ~RemotePluginInterface() {} - virtual functional_modules::PluginInfo GetPluginInfo() const = 0; - virtual functional_modules::ProcessResult ProcessMessage( - application_manager::MessagePtr msg) = 0; - virtual functional_modules::ProcessResult ProcessHMIMessage( - application_manager::MessagePtr msg) = 0; - - /** - * @brief Sends response to mobile application - * @param msg response mesage - */ - virtual void SendResponseToMobile(application_manager::MessagePtr msg) = 0; - - /** - * @brief Sends timeout response to mobile application - * @param msg response mesage - */ - virtual void SendTimeoutResponseToMobile( - application_manager::MessagePtr msg) = 0; - - /** - * @brief Remove extension created for specified application - * @param app_id application id - */ - virtual void RemoveAppExtension(uint32_t app_id) = 0; - - /** - * @brief Check registering app can be handled by plugin - * @param msg Registration message - * @param app Application basis already create by Core - */ - virtual bool IsAppForPlugin( - application_manager::ApplicationSharedPtr app) = 0; - - /** - * @brief Notify about change of HMILevel of plugin's app - * @param app App with new HMILevel - * @param old_level Old HMILevel of app - */ - virtual void OnAppHMILevelChanged( - application_manager::ApplicationSharedPtr app, - mobile_apis::HMILevel::eType old_level) = 0; - - virtual void SendHmiStatusNotification( - application_manager::ApplicationSharedPtr app) = 0; - - typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr, - std::string> RCPluginEventDispatcher; - - virtual RCPluginEventDispatcher& event_dispatcher() = 0; - - virtual ResourceAllocationManager& resource_allocation_manager() = 0; - - protected: - /** - * @brief Remove extension for all applications - */ - virtual void RemoveAppExtensions() = 0; - - static const functional_modules::ModuleID kCANModuleID = 153; -}; - -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REMOTE_PLUGIN_INTERFACE_H_ diff --git a/src/components/remote_control/include/remote_control/request_controller.h b/src/components/remote_control/include/remote_control/request_controller.h deleted file mode 100644 index 8a79d9ebc4..0000000000 --- a/src/components/remote_control/include/remote_control/request_controller.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2017, 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_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_ -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_ - -#include <map> - -#include "remote_control/commands/command.h" -#include "remote_control/rc_module_timer.h" -#include "functional_module/timer/timer_director.h" -#include "utils/lock.h" - -namespace remote_control { - -namespace commands { -class Command; -} - -namespace request_controller { - -typedef utils::SharedPtr<commands::Command> MobileRequestPtr; -typedef uint32_t correlation_id; - -/** - * @brief RequestController class is used to manage mobile requests lifetime. - */ -class RequestController - : public functional_modules::TimerObserver<TrackableMessage> { - public: - /** - * @brief Class constructor - * - */ - RequestController(); - - /** - * @brief Class destructor - * - */ - virtual ~RequestController(); - - /** - * @brief Adds pointer to request. - * @param mobile_correlation_id mobile request correlation id - * @param command pointer to request created in mobile factory - */ - void AddRequest(const uint32_t mobile_correlation_id, - MobileRequestPtr request); - - /** - * @brief Removes request - * @param mobile_corellation_id mobile request correlation id - */ - void DeleteRequest(const uint32_t& mobile_correlation_id); - - /** - * @brief Sets timeout value for RC requests - * @param timeout_seconds new timeout value in seconds - */ - void SetRequestTimeout(const functional_modules::TimeUnit timeout_seconds); - - /** - * @brief Triggers actions when timeout for some request is expired - * @param expired reference to request which timeout was expired - */ - void OnTimeoutTriggered(const TrackableMessage& expired) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(RequestController); - - std::map<correlation_id, MobileRequestPtr> mobile_request_list_; - functional_modules::ModuleTimer<TrackableMessage> timer_; - functional_modules::TimerDirector time_director_; - sync_primitives::Lock mobile_request_lock_; -}; - -} // namespace request_controller -} // namespace remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_REQUEST_CONTROLLER_H_ diff --git a/src/components/remote_control/include/remote_control/resource_allocation_manager.h b/src/components/remote_control/include/remote_control/resource_allocation_manager.h deleted file mode 100644 index f789fe4af9..0000000000 --- a/src/components/remote_control/include/remote_control/resource_allocation_manager.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H -#include <string> -#include "utils/macro.h" -#include "utils/shared_ptr.h" -#include "interfaces/HMI_API.h" -#include "remote_control/event_engine/event.h" -#include "functional_module/generic_module.h" - -namespace remote_control { - -/** - * Enum for list of results of allocation resources - */ -namespace AcquireResult { -enum eType { ALLOWED = 0, IN_USE, ASK_DRIVER, REJECTED }; -} - -/** - * Defines states of acquired resource - */ -namespace ResourceState { -enum eType { FREE = 0, BUSY }; -} - -/** - * @brief Resources defines list of resources - */ -typedef std::vector<std::string> Resources; - -class ResourceAllocationManager { - public: - /** - * @brief AcquireResource acquires resource by application - * @param module_type resource to acquire - * @param app_id application that acquire resource - * @return ALLOWED if resource acquired \ - * IN_USE if subscription is not allowed - * ASK_DRIVER if driver confirmation is required - */ - virtual AcquireResult::eType AcquireResource(const std::string& module_type, - const uint32_t app_id) = 0; - - /** - * @brief SetResourceState changes resource state. Resource must be acquired - * beforehand. - * @param module_type Resource to change its state - * @param app_id Application aquired resource before - * @param state State to set for resource - */ - virtual void SetResourceState(const std::string& module_type, - const uint32_t app_id, - const ResourceState::eType state) = 0; - - /** - * @brief IsResourceFree check resource state - * @param module_type Resource name - * @return True if free, otherwise - false - */ - virtual bool IsResourceFree(const std::string& module_type) const = 0; - - /** - * @brief AcquireResource forces acquiring resource by application - * @param module_type resource to acquire - * @param app_id application that acquire resource - */ - virtual void ForceAcquireResource(const std::string& module_type, - const uint32_t app_id) = 0; - - /** - * @brief OnDriverDisallowed callback for rejecting acquiring resource - * @param module_type resource type - * @param app_id application id - */ - virtual void OnDriverDisallowed(const std::string& module_type, - const uint32_t app_id) = 0; - - /** - * @brief OnApplicationEvent Processes application related events - * @param event Event - * @param application Pointer to application struct - */ - virtual void OnApplicationEvent( - functional_modules::ApplicationEvent event, - application_manager::ApplicationSharedPtr application) = 0; - - /** - * @brief OnPolicyEvent Processes policy related events - * @param event Policy event - */ - virtual void OnPolicyEvent(functional_modules::PolicyEvent event) = 0; - - /** - * @brief Set current access mode for acquiring resource - * @param access_mode - */ - virtual void SetAccessMode( - const hmi_apis::Common_RCAccessMode::eType access_mode) = 0; - - /** - * @brief Get last set access mode for acquiring resource - * @param access_mode - */ - virtual hmi_apis::Common_RCAccessMode::eType GetAccessMode() const = 0; - - /** - * @brief Remove all information about all allocations - */ - virtual void ResetAllAllocations() = 0; - - virtual ~ResourceAllocationManager() {} -}; - -} // namespace remote_control -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H diff --git a/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h b/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h deleted file mode 100644 index 57c2a8f360..0000000000 --- a/src/components/remote_control/include/remote_control/resource_allocation_manager_impl.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H -#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H -#include "remote_control/resource_allocation_manager.h" -#include "remote_control/remote_plugin_interface.h" -#include "utils/macro.h" -#include "utils/lock.h" - -namespace remote_control { - -typedef rc_event_engine::EventDispatcher<application_manager::MessagePtr, - std::string> RCEventDispatcher; - -class ResourceAllocationManagerImpl : public ResourceAllocationManager { - public: - ResourceAllocationManagerImpl(RemotePluginInterface& rc_plugin); - - ~ResourceAllocationManagerImpl(); - - AcquireResult::eType AcquireResource(const std::string& module_type, - const uint32_t app_id) OVERRIDE FINAL; - - void SetResourceState(const std::string& module_type, - const uint32_t app_id, - const ResourceState::eType state) FINAL; - - bool IsResourceFree(const std::string& module_type) const FINAL; - - void SetAccessMode( - const hmi_apis::Common_RCAccessMode::eType access_mode) FINAL; - - hmi_apis::Common_RCAccessMode::eType GetAccessMode() const FINAL; - - void ForceAcquireResource(const std::string& module_type, - const uint32_t app_id) FINAL; - - void OnDriverDisallowed(const std::string& module_type, - const uint32_t app_id) FINAL; - - /** - * @brief OnApplicationEvent Notifies modules on certain application events - * @param event Event - * @param application Pointer to application struct - */ - void OnApplicationEvent( - functional_modules::ApplicationEvent event, - application_manager::ApplicationSharedPtr application) FINAL; - - /** - * @brief OnPolicyEvent Processes policy related events - * @param event Policy event - */ - void OnPolicyEvent(functional_modules::PolicyEvent event) FINAL; - - void ResetAllAllocations() FINAL; - - private: - typedef std::vector<application_manager::ApplicationSharedPtr> Apps; - - /** - * @brief IsModuleTypeRejected check if current resource was rejected by - * driver for current application - * @param module_type resource to check - * @param app_id application id - * @return true if current resource was rejected by driver for current - * application, otherwise - false - */ - bool IsModuleTypeRejected(const std::string& module_type, - const uint32_t app_id); - - /** - * @brief ReleaseResource Releases resource acquired by application - * @param module_type Module name - * @param application_id Application id - */ - void ReleaseResource(const std::string& module_type, - const uint32_t application_id); - - /** - * @brief GetAcquiredResources Provides resources acquired by particular - * application currently - * @param application_id Application id - * @return List of acquired resources by specific application - */ - Resources GetAcquiredResources(const uint32_t application_id) const; - - /** - * @brief ProcessApplicationPolicyUpdate Checks if allowed modules list is - * changed for registered RC applications and releases in case some modules - * now out of the list - */ - void ProcessApplicationPolicyUpdate(); - - /** - * @brief GetApplicationExtention Provides access to application RC extention - * @param application Application - * @return Pointer to RC extention of application or NULL if not available - */ - RCAppExtensionPtr GetApplicationExtention( - application_manager::ApplicationSharedPtr application); - - /** - * @brief RemoveAppsSubscriptions Removes subscriptions for interior data for - * applications in the list - * @param apps Application list - */ - void RemoveAppsSubscriptions(const Apps& apps); - - /** - * @brief AllocatedResources contains link between resource and application - * owning that resource - */ - typedef std::map<std::string, uint32_t> AllocatedResources; - AllocatedResources allocated_resources_; - mutable sync_primitives::Lock allocated_resources_lock_; - - /** - * @brief ResourcesState contains states of ALLOCATED resources - */ - typedef std::map<std::string, ResourceState::eType> ResourcesState; - ResourcesState resources_state_; - mutable sync_primitives::Lock resources_state_lock_; - - /** - * @brief RejectedResources type for connecting list of resources rejected by - * driver for application - * application_id : [vector of rejected resources] - */ - typedef std::map<uint32_t, std::vector<std::string> > RejectedResources; - RejectedResources rejected_resources_for_application_; - mutable sync_primitives::Lock rejected_resources_for_application_lock_; - - hmi_apis::Common_RCAccessMode::eType current_access_mode_; - RemotePluginInterface& rc_plugin_; -}; -} // remote_control - -#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H |