summaryrefslogtreecommitdiff
path: root/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h
blob: 62fc10cf7ff1db6de022d29b02fe0649b3fd09c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_DEVICE_APPS_LAUNCHER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_DEVICE_APPS_LAUNCHER_H_
#include <stdint.h>
#include <vector>
#include <string>
#include <memory>
#include "application_manager/app_launch/app_launch_data.h"
#include "application_manager/application_manager.h"
#include "application_manager/app_launch_settings.h"

namespace app_launch {
class AppLaunchCtrlImpl;
class DeviceAppsLauncher;
class AppsLauncher;
class AppLaunchSettings;
class Launcher;
class LauncherGenerator;

// impl class must be defined for unique_ptr in DeviceAppsLauncher
class DeviceAppsLauncherImpl {
 public:
  DeviceAppsLauncherImpl(DeviceAppsLauncher& interface,
                         AppsLauncher& apps_launcher);

  bool LaunchAppsOnDevice(
      const std::string& device_mac,
      const std::vector<ApplicationDataPtr>& applications_to_launch);

  struct LauncherFinder {
    LauncherFinder(const std::string& device_mac) : device_mac_(device_mac) {}

    bool operator()(const utils::SharedPtr<Launcher>& launcher) const;

    std::string device_mac_;
  };

  bool StopLaunchingAppsOnDevice(const std::string& device_mac);

 private:
  sync_primitives::Lock launchers_lock_;
  std::vector<utils::SharedPtr<Launcher> > free_launchers_;
  std::vector<utils::SharedPtr<Launcher> > works_launchers_;
  DeviceAppsLauncher& interface_;
};

/**
 * @brief The MultipleAppsLauncher struct
 * should manage launching applications and gaps between launching application
 * on one device
 * When all apps launched it will notify AppLaunchCtrlImpl