summaryrefslogtreecommitdiff
path: root/src/components/application_manager/include/application_manager/application.h
blob: 7835cae260395e9d1a3e22b05011d242555ec285 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
/*
 * Copyright (c) 2015, Ford Motor Company
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided with the
 * distribution.
 *
 * Neither the name of the Ford Motor Company nor the names of its contributors
 * may be used to endorse or promote products derived from this software
 * without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_H_

#include <string>
#include <map>
#include <set>
#include <list>
#include "utils/shared_ptr.h"
#include "utils/data_accessor.h"
#include "interfaces/MOBILE_API.h"
#include "connection_handler/device.h"
#include "application_manager/message.h"
#include "application_manager/hmi_state.h"
#include "protocol_handler/protocol_handler.h"

namespace NsSmartDeviceLink {
namespace NsSmartObjects {

class SmartObject;
}
}

namespace application_manager {

namespace mobile_api = mobile_apis;

namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
typedef int32_t ErrorCode;

class UsageStatistics;

enum APIVersion {
  kUnknownAPI = -1,
  kAPIV0 = 0,
  kAPIV1 = 1,
  kAPIV2 = 2,
  kAPIV3 = 3,
  kAPIV4 = 4
};

enum TLimitSource {
  POLICY_TABLE = 0,
  CONFIG_FILE
};


struct Version {
  APIVersion min_supported_api_version;
  APIVersion max_supported_api_version;

  Version()
    : min_supported_api_version(APIVersion::kUnknownAPI),
      max_supported_api_version(APIVersion::kUnknownAPI) {
  }
};

struct AppFile {
    // need to use in std::map;
    AppFile() {
    }
    AppFile(const std::string& name, bool persistent, bool download_complete,
          mobile_apis::FileType::eType type)
      : file_name(name),
        is_persistent(persistent),
        is_download_complete(download_complete),
        file_type(type){
  }
  std::string file_name;
  bool is_persistent;
  bool is_download_complete;
  mobile_apis::FileType::eType file_type;
};
typedef std::map<std::string, AppFile> AppFilesMap;
class InitialApplicationData {
  public:
    virtual ~InitialApplicationData() {
    }

    virtual const smart_objects::SmartObject* app_types() const = 0;
    virtual const smart_objects::SmartObject* vr_synonyms() const = 0;
    virtual std::string mobile_app_id() const = 0;
    virtual const smart_objects::SmartObject* tts_name() const = 0;
    virtual const smart_objects::SmartObject* ngn_media_screen_name() const = 0;
    virtual const mobile_api::Language::eType& language() const = 0;
    virtual const mobile_api::Language::eType& ui_language() const = 0;
    virtual void set_app_types(const smart_objects::SmartObject& app_types) = 0;
    virtual void set_vr_synonyms(
      const smart_objects::SmartObject& vr_synonyms) = 0;
    virtual void set_mobile_app_id(const std::string& mobile_app_id) = 0;
    virtual void set_tts_name(const smart_objects::SmartObject& tts_name) = 0;
    virtual void set_ngn_media_screen_name(
      const smart_objects::SmartObject& ngn_name) = 0;
    virtual void set_language(const mobile_api::Language::eType& language) = 0;
    virtual void set_ui_language(
      const mobile_api::Language::eType& ui_language) = 0;
};

/*
 * @brief Typedef for supported commands in application menu
 */
typedef std::map<uint32_t, smart_objects::SmartObject*> CommandsMap;

/*
 * @brief Typedef for supported sub menu in application menu
 */
typedef std::map<uint32_t, smart_objects::SmartObject*> SubMenuMap;

/*
 * @brief Typedef for interaction choice set
 */
typedef std::map<uint32_t, smart_objects::SmartObject*> ChoiceSetMap;

/*
 * @brief Typedef for perform interaction choice
 * @param choice id
 * @param SmartObject choice
 */
typedef std::map<uint32_t, smart_objects::SmartObject*> PerformChoice;

/*
 * @brief Typedef for perform interaction choice set
 * @param request corellation id
 * @param map of choices
 */
typedef std::map<uint32_t, PerformChoice> PerformChoiceSetMap;

/**
 * @brief Defines id of SoftButton
 */
typedef std::set<uint32_t> SoftButtonID;

class DynamicApplicationData {
  public:
    virtual ~DynamicApplicationData() {
    }
    virtual const smart_objects::SmartObject* help_prompt() const = 0;
    virtual const smart_objects::SmartObject* timeout_prompt() const = 0;
    virtual const smart_objects::SmartObject* vr_help_title() const = 0;
    virtual const smart_objects::SmartObject* vr_help() const = 0;
    virtual const mobile_api::TBTState::eType& tbt_state() const = 0;
    virtual const smart_objects::SmartObject* show_command() const = 0;
    virtual const smart_objects::SmartObject* tbt_show_command() const = 0;
    virtual const std::set<mobile_apis::ButtonName::eType>& SubscribedButtons() const = 0;
    virtual const std::set<uint32_t>& SubscribesIVI() const = 0;
    virtual const smart_objects::SmartObject* keyboard_props() const = 0;
    virtual const smart_objects::SmartObject* menu_title() const = 0;
    virtual const smart_objects::SmartObject* menu_icon() const = 0;

    virtual void load_global_properties(const smart_objects::SmartObject& so) = 0;
    virtual void set_help_prompt(
      const smart_objects::SmartObject& help_prompt) = 0;
    virtual void set_timeout_prompt(
      const smart_objects::SmartObject& timeout_prompt) = 0;
    virtual void set_vr_help_title(
      const smart_objects::SmartObject& vr_help_title) = 0;
    virtual void reset_vr_help_title() = 0;
    virtual void set_vr_help(const smart_objects::SmartObject& vr_help) = 0;
    virtual void reset_vr_help() = 0;
    virtual void set_tbt_state(const mobile_api::TBTState::eType& tbt_state) = 0;
    virtual void set_show_command(
      const smart_objects::SmartObject& show_command) = 0;
    virtual void set_tbt_show_command(
      const smart_objects::SmartObject& tbt_show) = 0;
    virtual void set_keyboard_props(
        const smart_objects::SmartObject& keyboard_props) = 0;
    virtual void set_menu_title(
        const smart_objects::SmartObject& menu_title) = 0;
    virtual void set_menu_icon(
        const smart_objects::SmartObject& menu_icon) = 0;
    /*
     * @brief Adds a command to the in application menu
     */
    virtual void AddCommand(uint32_t cmd_id,
                            const smart_objects::SmartObject& command) = 0;

    /*
     * @brief Deletes all commands from the application
     * menu with the specified command id
     */
    virtual void RemoveCommand(uint32_t cmd_id) = 0;

    /*
     * @brief Finds command with the specified command id
     */
    virtual smart_objects::SmartObject* FindCommand(uint32_t cmd_id) = 0;

    /*
     * @brief Adds a menu to the application
     */
    virtual void AddSubMenu(uint32_t menu_id,
                            const smart_objects::SmartObject& menu) = 0;

    /*
     * @brief Deletes menu from the application menu
     */
    virtual void RemoveSubMenu(uint32_t menu_id) = 0;

    /*
     * @brief Finds menu with the specified id
     */
    virtual smart_objects::SmartObject* FindSubMenu(
      uint32_t menu_id) const = 0;

    /*
     * @brief Returns true if sub menu with such name already exist
     */
    virtual bool IsSubMenuNameAlreadyExist(const std::string& name) = 0;

    /*
     * @brief Adds a interaction choice set to the application
     *
     * @param choice_set_id Unique ID used for this interaction choice set
     * @param choice_set SmartObject that represent choice set
     */
    virtual void AddChoiceSet(uint32_t choice_set_id,
                              const smart_objects::SmartObject& choice_set) = 0;

    /*
     * @brief Deletes choice set from the application
     *
     * @param choice_set_id Unique ID of the interaction choice set
     */
    virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0;

    /*
     * @brief Finds choice set with the specified choice_set_id id
     *
     * @param choice_set_id Unique ID of the interaction choice set
     */
    virtual smart_objects::SmartObject* FindChoiceSet(
      uint32_t choice_set_id) = 0;

    /*
     * @brief Adds perform interaction choice set to the application
     *
     * @param correlation_id Unique ID of the request that added this choice set
     * @param choice_set_id  Unique ID used for this interaction choice set
     * @param choice_set SmartObject that represents choice set
     */
    virtual void AddPerformInteractionChoiceSet(
      uint32_t correlation_id, uint32_t choice_set_id,
      const smart_objects::SmartObject& choice_set) = 0;

    /*
     * @brief Deletes entirely perform interaction choice set for request
     * @param correlation_id Unique ID of the request that added this choice set
     *
     */
    virtual void DeletePerformInteractionChoiceSet(uint32_t correlation_id) = 0;

    /*
     * @brief Retrieves entirely ChoiceSet - VR commands map
     *
     * @return ChoiceSet map that is currently in use
     */
    virtual DataAccessor<PerformChoiceSetMap>
    performinteraction_choice_set_map() const = 0;

    /*
     * @brief Retrieve application commands
     */
    virtual DataAccessor<CommandsMap> commands_map() const = 0;

    /*
     * @brief Retrieve application sub menus
     */
    virtual DataAccessor<SubMenuMap> sub_menu_map() const = 0;

    /*
     * @brief Retrieve application choice set map
     */
    virtual DataAccessor<ChoiceSetMap> choice_set_map() const = 0;

    /*
     * @brief Sets perform interaction state
     *
     * @param active Current state of the perform interaction
     */
    virtual void set_perform_interaction_active(uint32_t active) = 0;

    /*
     * @brief Retrieves perform interaction state
     *
     * @return TRUE if perform interaction active, otherwise FALSE
     */
    virtual uint32_t is_perform_interaction_active() const = 0;

    /*
     * @brief Sets the mode for perform interaction: UI/VR/BOTH
     *
     * @param mode Mode that was selected (MENU; VR; BOTH)
     */
    virtual void set_perform_interaction_mode(int32_t mode) = 0;

    /*
     * @brief Retrieve the mode that was PerformInteraction sent in
     *
     * @return mode of PerformInteraction
     */
    virtual int32_t perform_interaction_mode() const = 0;

    /*
     * @brief Sets reset global properties state
     *
     * @param active Current state of the reset global properties
     */
    virtual void set_reset_global_properties_active(bool active) = 0;

    /*
     * @brief Retrieves reset global properties state
     *
     * @return TRUE if perform interaction active, otherwise FALSE
     */
    virtual bool is_reset_global_properties_active() const = 0;
};

class Application : public virtual InitialApplicationData,
  public virtual DynamicApplicationData {

  public:
    enum ApplicationState {
      kRegistered = 0,
      kWaitingForRegistration
    };

  public:
    Application() :
      is_greyed_out_(false) {
    }

    virtual ~Application() {
    }

    /**
     * @brief Returns message belonging to the application
     * that is currently executed (i.e. on HMI).
     * @return smart_objects::SmartObject * Active message
     */
    virtual const smart_objects::SmartObject* active_message() const = 0;

    /**
     * @brief returns current hash value
     * @return current hash value
     */
    virtual const std::string& curHash() const = 0;

    /**
     * @brief Change Hash for current application
     * and send notification to mobile
     * @return updated_hash
     */
    virtual void UpdateHash() = 0;

    virtual void CloseActiveMessage() = 0;
    virtual bool IsFullscreen() const = 0;
    virtual void ChangeSupportingAppHMIType() = 0;

    virtual bool is_navi() const = 0;
    virtual void set_is_navi(bool allow) = 0;

    virtual bool video_streaming_started() const = 0;
    virtual void set_video_streaming_started(bool state) = 0;
    virtual bool audio_streaming_started() const = 0;
    virtual void set_audio_streaming_started(bool state) = 0;

    virtual bool video_streaming_allowed() const = 0;
    virtual void set_video_streaming_allowed(bool state) = 0;
    virtual bool audio_streaming_allowed() const = 0;
    virtual void set_audio_streaming_allowed(bool state) = 0;

    /**
     * @brief Starts streaming service for application
     * @param service_type Type of streaming service
     */
    virtual void StartStreaming(
        protocol_handler::ServiceType service_type) = 0;

    /**
     * @brief Stops streaming service for application
     * @param service_type Type of streaming service
     */
    virtual void StopStreaming(
        protocol_handler::ServiceType service_type) = 0;

    /**
     * @brief Suspends streaming process for application
     * @param service_type Type of streaming service
     */
    virtual void SuspendStreaming(
        protocol_handler::ServiceType service_type) = 0;

    /**
     * @brief Wakes up streaming process for application
     * @param service_type Type of streaming service
     */
    virtual void WakeUpStreaming(
        protocol_handler::ServiceType service_type) = 0;

    virtual bool is_voice_communication_supported() const = 0;
    virtual void set_voice_communication_supported(
        bool is_voice_communication_supported) = 0;
    virtual bool app_allowed() const = 0;
    virtual bool has_been_activated() const = 0;
    virtual bool set_activated(bool is_active) = 0;

    virtual const Version& version() const = 0;
    virtual void set_hmi_application_id(uint32_t hmi_app_id) = 0;
    virtual uint32_t hmi_app_id() const = 0;
    virtual uint32_t app_id() const = 0;
    virtual const std::string& name() const = 0;
    virtual const std::string folder_name() const = 0;
    virtual bool is_media_application() const = 0;
    virtual bool is_foreground() const = 0;
    virtual void set_foreground(bool is_foreground) = 0;
    virtual const mobile_api::HMILevel::eType hmi_level() const = 0;
    virtual const uint32_t put_file_in_none_count() const = 0;
    virtual const uint32_t delete_file_in_none_count() const = 0;
    virtual const uint32_t list_files_in_none_count() const = 0;
    virtual const mobile_api::SystemContext::eType system_context() const = 0;
    virtual const mobile_api::AudioStreamingState::eType
    audio_streaming_state() const = 0;
    virtual const std::string& app_icon_path() const = 0;
    virtual connection_handler::DeviceHandle device() const = 0;
    virtual bool tts_speak_state() = 0;

    /**
     * @brief Active states of application
     */
    DataAccessor<HmiStateList> GetHmiStateListAccessor() {
      DataAccessor<HmiStateList> hmi_states_da =
          DataAccessor<HmiStateList>(hmi_states_, hmi_states_lock_);
      return hmi_states_da;
    }

    /**
     * @brief Current hmi state
     */
    virtual const HmiStatePtr CurrentHmiState() const = 0;


    /**
     * @brief RegularHmiState of application without active events VR, TTS etc ...
     * @return HmiState of application
     */
    virtual const HmiStatePtr RegularHmiState() const = 0;

    /**
     * @brief sets true if application has sent TTS GlobalProperties
     * request with empty array help_prompt to HMI with level
     * NONE BACKGROUND
     * @param active contains state of sending TTS GlobalProperties
     */
    virtual void set_tts_properties_in_none(bool active) = 0;
    /**
     * @brief returns true if application has sent TTS GlobalProperties
     * otherwise return false
     * @return flag tts_properties_in_none
     */
    virtual bool tts_properties_in_none() = 0;
    /**
     * @brief sets true if application has sent TTS GlobalProperties
     * request with default array help_prompt to HMI with level
     * FULL LIMITED
     * @param active contains state of sending TTS GlobalProperties
     */
    virtual void set_tts_properties_in_full(
        bool active) = 0;
    /**
     * @brief  returns true if application has sent TTS GlobalProperties
     * otherwise return false
     * @return flag tts_properties_in_full
     */
    virtual bool tts_properties_in_full() = 0;
    virtual void set_version(const Version& version) = 0;
    virtual void set_name(const std::string& name) = 0;
    virtual void set_is_media_application(bool is_media) = 0;
    virtual void increment_put_file_in_none_count() = 0;
    virtual void increment_delete_file_in_none_count() = 0;
    virtual void increment_list_files_in_none_count() = 0;
    virtual bool set_app_icon_path(const std::string& file_name) = 0;
    virtual void set_app_allowed(const bool& allowed) = 0;
    virtual void set_device(connection_handler::DeviceHandle device) = 0;
    virtual uint32_t get_grammar_id() const = 0 ;
    virtual void set_grammar_id(uint32_t value) = 0;

    virtual void set_protocol_version(
        const ProtocolVersion& protocol_version) = 0;
    virtual ProtocolVersion protocol_version() const = 0;

    virtual bool AddFile(AppFile& file) = 0;
    virtual const AppFilesMap& getAppFiles() const = 0;

    /**
     * @brief Updates fields of existing file
     * @param file_name File name, that need to update
     * @param is_persistent Bollean describes is file persistent?
     * @param is_download_complete Bollean describes is file downloaded fully on need to finish downloading?
     * @return TRUE if file exist and updated sucsesfuly, othervise return false
     */
    virtual bool UpdateFile(AppFile& file) = 0;
    virtual bool DeleteFile(const std::string& file_name) = 0;
    virtual const AppFile* GetFile(const std::string& file_name) = 0;

    virtual bool SubscribeToButton(mobile_apis::ButtonName::eType btn_name) = 0;
    virtual bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name) = 0;
    virtual bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name) = 0;

    virtual bool SubscribeToIVI(uint32_t vehicle_info_type_) = 0;
    virtual bool IsSubscribedToIVI(uint32_t vehicle_info_type_) = 0;
    virtual bool UnsubscribeFromIVI(uint32_t vehicle_info_type_) = 0;

    /**
     * @brief ResetDataInNone reset data counters in NONE
     */
    virtual void ResetDataInNone() = 0;

    /**
     * @brief Check, if limits for command number per time is exceeded
     * @param cmd_id Unique command id from mobile API
     * @param source Limits source, e.g. policy table, config file etc.
     * @return true, if - excedeed, otherwise - false
     */
    virtual bool IsCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
                                         TLimitSource source) = 0;

    /**
     * Returns object for recording statistics
     * @return object for recording statistics
     */
    virtual UsageStatistics& usage_report() = 0;

    /**
     * @brief SetRegularState set permanent state of application
     * @param state state to setup
     */
    virtual void SetRegularState(HmiStatePtr state)  = 0;

    /**
     * @brief AddHMIState the function that will change application's
     * hmi state.
     *
     * @param app_id id of the application whose hmi level should be changed.
     *
     * @param state new hmi state for certain application.
     */
    virtual void AddHMIState(HmiStatePtr state) = 0;

    /**
     * @brief RemoveHMIState the function that will turn back hmi_level after end
     * of some event
     *
     * @param app_id id of the application whose hmi level should be changed.
     *
     * @param state_id that should be removed
     */
    virtual void RemoveHMIState(HmiState::StateID state_id) = 0;

    /**
     * @brief Keeps id of softbuttons which is created in commands:
     * Alert, Show, ScrollableMessage, ShowConstantTBT, AlertManeuver, UpdateTurnList
     * @param cmd_id Unique command id from mobile API
     * @param list of softbuttons were created by command.
     */
    virtual void SubscribeToSoftButtons(int32_t cmd_id,
                                       const SoftButtonID& softbuttons_id) = 0;

    /**
     * @brief Determine the existence of softbutton
     * @param Softbutton_id contains id of softbutton
     * @return Returns true if application contains softbutton id otherwise returns false.
     */
    virtual bool IsSubscribedToSoftButton(const uint32_t softbutton_id) = 0;

    /**
     * @brief Removes list of softbuttons which is created in commands
     * @param cmd_id Unique command id from mobile API
     */
    virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0;

    /**
     * @brief Check's if it is media, voice communication or navigation application
     *
     * @return true if application is media, voice communication or navigation
     */
    virtual bool IsAudioApplication() const = 0;

    /**
     * @brief IsRegistered allows to distinguish if this
     * application has been registered.
     *
     * @return true if registered, false otherwise.
     */
    bool IsRegistered() const { return app_state_ == kRegistered;}

    /**
     * @brief MarkRegistered allows to mark application as registered.
     */
    void MarkRegistered() {app_state_ = kRegistered;}

    /**
     * @brief MarkUnregistered allows to mark application as unregistered.
     */
    void MarkUnregistered() {app_state_ = kWaitingForRegistration;}

    /**
     * @brief schemaUrl contains application's url (for 4th protocol version)
     *
     * @return application's url.
     */
    std::string SchemaUrl() const {return url_;}

    /**
     * @brief SetShemaUrl allows to store schema url for application.
     *
     * @param url url to store.
     */
    void SetShemaUrl(const std::string& url) {url_ = url;}

    /**
     * @brief packagName allows to obtain application's package name.
     *
     * @return pakage name.
     */
    std::string PackageName() const {return package_name_;}

    /**
     * @brief SetPackageName allows to store package name for application.
     *
     * @param packageName package name to store.
     */
    void SetPackageName(const std::string& packageName) {
      package_name_ = packageName;
    }

    /**
     * @brief GetDeviceId allows to obtain device id which posseses
     * by this application.
     *
     * @return device the device id.
     */
    std::string GetDeviceId() const {return device_id_;}

    /**
     * @brief Returns is application should be greyed out on HMI
     */
    bool is_greyed_out() const {return is_greyed_out_;}

    /**
     * @brief Sets application as should be greyed out on HMI
     * @param is_greyed_out True, if should be greyed out on HMI,
     * otherwise - false
     */
    void set_greyed_out(bool is_greyed_out) {is_greyed_out_ = is_greyed_out;}

  protected:

    /**
     * @brief Active states of application
     */
    HmiStateList hmi_states_;
    mutable sync_primitives::Lock hmi_states_lock_;

    ApplicationState app_state_;
    std::string url_;
    std::string package_name_;
    std::string device_id_;
    ssize_t connection_id_;
    bool is_greyed_out_;
};

typedef utils::SharedPtr<Application> ApplicationSharedPtr;
typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr;

}  // namespace application_manager

#endif  // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_H_