Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
ApplicationMessenger.h File Reference
#include "guilib/WindowIDs.h"
#include "messaging/ThreadMessage.h"
#include "threads/Thread.h"
#include <map>
#include <memory>
#include <queue>
#include <string>
#include <vector>

Classes

struct  KODI::MESSAGING::ThreadMessageCallback
 
class  KODI::MESSAGING::CApplicationMessenger
 This implements a simple message dispatcher/router for Kodi. More...
 

Namespaces

namespace  KODI
 
namespace  KODI::MESSAGING
 

Macros

#define TMSG_MASK_MESSAGE   0xFFFF0000
 
#define TMSG_MASK_APPLICATION   (1<<30)
 
#define TMSG_MASK_PLAYLISTPLAYER   (1<<29)
 
#define TMSG_MASK_GUIINFOMANAGER   (1<<28)
 
#define TMSG_MASK_WINDOWMANAGER   (1<<27)
 
#define TMSG_MASK_PERIPHERALS   (1<<26)
 
#define TMSG_PLAYLISTPLAYER_PLAY   TMSG_MASK_PLAYLISTPLAYER + 0
 
#define TMSG_PLAYLISTPLAYER_NEXT   TMSG_MASK_PLAYLISTPLAYER + 1
 
#define TMSG_PLAYLISTPLAYER_PREV   TMSG_MASK_PLAYLISTPLAYER + 2
 
#define TMSG_PLAYLISTPLAYER_ADD   TMSG_MASK_PLAYLISTPLAYER + 3
 
#define TMSG_PLAYLISTPLAYER_CLEAR   TMSG_MASK_PLAYLISTPLAYER + 4
 
#define TMSG_PLAYLISTPLAYER_SHUFFLE   TMSG_MASK_PLAYLISTPLAYER + 5
 
#define TMSG_PLAYLISTPLAYER_GET_ITEMS   TMSG_MASK_PLAYLISTPLAYER + 6
 
#define TMSG_PLAYLISTPLAYER_PLAY_ITEM_ID   TMSG_MASK_PLAYLISTPLAYER + 7
 
#define TMSG_PLAYLISTPLAYER_INSERT   TMSG_MASK_PLAYLISTPLAYER + 8
 
#define TMSG_PLAYLISTPLAYER_REMOVE   TMSG_MASK_PLAYLISTPLAYER + 9
 
#define TMSG_PLAYLISTPLAYER_SWAP   TMSG_MASK_PLAYLISTPLAYER + 10
 
#define TMSG_PLAYLISTPLAYER_REPEAT   TMSG_MASK_PLAYLISTPLAYER + 11
 
#define TMSG_MEDIA_PLAY   TMSG_MASK_PLAYLISTPLAYER + 12
 
#define TMSG_MEDIA_STOP   TMSG_MASK_PLAYLISTPLAYER + 13
 
#define TMSG_MEDIA_PAUSE   TMSG_MASK_PLAYLISTPLAYER + 14
 
#define TMSG_MEDIA_RESTART   TMSG_MASK_PLAYLISTPLAYER + 15
 
#define TMSG_MEDIA_UNPAUSE   TMSG_MASK_PLAYLISTPLAYER + 16
 
#define TMSG_MEDIA_PAUSE_IF_PLAYING   TMSG_MASK_PLAYLISTPLAYER + 17
 
#define TMSG_MEDIA_SEEK_TIME   TMSG_MASK_PLAYLISTPLAYER + 18
 
#define TMSG_SHUTDOWN   TMSG_MASK_APPLICATION + 0
 
#define TMSG_POWERDOWN   TMSG_MASK_APPLICATION + 1
 
#define TMSG_QUIT   TMSG_MASK_APPLICATION + 2
 
#define TMSG_HIBERNATE   TMSG_MASK_APPLICATION + 3
 
#define TMSG_SUSPEND   TMSG_MASK_APPLICATION + 4
 
#define TMSG_RESTART   TMSG_MASK_APPLICATION + 5
 
#define TMSG_RESET   TMSG_MASK_APPLICATION + 6
 
#define TMSG_RESTARTAPP   TMSG_MASK_APPLICATION + 7
 
#define TMSG_ACTIVATESCREENSAVER   TMSG_MASK_APPLICATION + 8
 
#define TMSG_NETWORKMESSAGE   TMSG_MASK_APPLICATION + 9
 
#define TMSG_RESETSCREENSAVER   TMSG_MASK_APPLICATION + 10
 
#define TMSG_VOLUME_SHOW   TMSG_MASK_APPLICATION + 11
 
#define TMSG_DISPLAY_SETUP   TMSG_MASK_APPLICATION + 12
 
#define TMSG_DISPLAY_DESTROY   TMSG_MASK_APPLICATION + 13
 
#define TMSG_SETVIDEORESOLUTION   TMSG_MASK_APPLICATION + 14
 
#define TMSG_SWITCHTOFULLSCREEN   TMSG_MASK_APPLICATION + 15
 
#define TMSG_MINIMIZE   TMSG_MASK_APPLICATION + 16
 
#define TMSG_TOGGLEFULLSCREEN   TMSG_MASK_APPLICATION + 17
 
#define TMSG_SETLANGUAGE   TMSG_MASK_APPLICATION + 18
 
#define TMSG_RENDERER_FLUSH   TMSG_MASK_APPLICATION + 19
 
#define TMSG_INHIBITIDLESHUTDOWN   TMSG_MASK_APPLICATION + 20
 
#define TMSG_START_ANDROID_ACTIVITY   TMSG_MASK_APPLICATION + 21
 
#define TMSG_EXECUTE_SCRIPT   TMSG_MASK_APPLICATION + 22
 
#define TMSG_EXECUTE_BUILT_IN   TMSG_MASK_APPLICATION + 23
 
#define TMSG_EXECUTE_OS   TMSG_MASK_APPLICATION + 24
 
#define TMSG_PICTURE_SHOW   TMSG_MASK_APPLICATION + 25
 
#define TMSG_PICTURE_SLIDESHOW   TMSG_MASK_APPLICATION + 26
 
#define TMSG_LOADPROFILE   TMSG_MASK_APPLICATION + 27
 
#define TMSG_VIDEORESIZE   TMSG_MASK_APPLICATION + 28
 
#define TMSG_INHIBITSCREENSAVER   TMSG_MASK_APPLICATION + 29
 
#define TMSG_SYSTEM_POWERDOWN   TMSG_MASK_APPLICATION + 30
 
#define TMSG_RENDERER_PREINIT   TMSG_MASK_APPLICATION + 31
 
#define TMSG_RENDERER_UNINIT   TMSG_MASK_APPLICATION + 32
 
#define TMSG_EVENT   TMSG_MASK_APPLICATION + 33
 
#define TMSG_MOVETOSCREEN   TMSG_MASK_APPLICATION + 34
 
#define TMSG_UPDATE_PLAYER_ITEM   TMSG_MASK_APPLICATION + 35
 Called from the player when its current item is updated.
 
#define TMSG_SET_VOLUME   TMSG_MASK_APPLICATION + 36
 
#define TMSG_SET_MUTE   TMSG_MASK_APPLICATION + 37
 
#define TMSG_GUI_INFOLABEL   TMSG_MASK_GUIINFOMANAGER + 0
 
#define TMSG_GUI_INFOBOOL   TMSG_MASK_GUIINFOMANAGER + 1
 
#define TMSG_UPDATE_CURRENT_ITEM   TMSG_MASK_GUIINFOMANAGER + 2
 
#define TMSG_CECTOGGLESTATE   TMSG_MASK_PERIPHERALS + 1
 
#define TMSG_CECACTIVATESOURCE   TMSG_MASK_PERIPHERALS + 2
 
#define TMSG_CECSTANDBY   TMSG_MASK_PERIPHERALS + 3
 
#define TMSG_GUI_DIALOG_OPEN   TMSG_MASK_WINDOWMANAGER + 1
 
#define TMSG_GUI_ACTIVATE_WINDOW   TMSG_MASK_WINDOWMANAGER + 2
 
#define TMSG_GUI_PYTHON_DIALOG   TMSG_MASK_WINDOWMANAGER + 3
 
#define TMSG_GUI_WINDOW_CLOSE   TMSG_MASK_WINDOWMANAGER + 4
 
#define TMSG_GUI_ACTION   TMSG_MASK_WINDOWMANAGER + 5
 
#define TMSG_GUI_ADDON_DIALOG   TMSG_MASK_WINDOWMANAGER + 6
 
#define TMSG_GUI_MESSAGE   TMSG_MASK_WINDOWMANAGER + 7
 
#define TMSG_GUI_DIALOG_YESNO   TMSG_MASK_WINDOWMANAGER + 8
 Message sent through CApplicationMessenger to open a yes/no dialog box.
 
#define TMSG_GUI_DIALOG_OK   TMSG_MASK_WINDOWMANAGER + 9
 
#define TMSG_GUI_PREVIOUS_WINDOW   TMSG_MASK_WINDOWMANAGER + 10
 Message sent through CApplicationMessenger to go back to the previous window.
 
#define TMSG_CALLBACK   800
 

Macro Definition Documentation

◆ TMSG_ACTIVATESCREENSAVER

#define TMSG_ACTIVATESCREENSAVER   TMSG_MASK_APPLICATION + 8

◆ TMSG_CALLBACK

#define TMSG_CALLBACK   800

◆ TMSG_CECACTIVATESOURCE

#define TMSG_CECACTIVATESOURCE   TMSG_MASK_PERIPHERALS + 2

◆ TMSG_CECSTANDBY

#define TMSG_CECSTANDBY   TMSG_MASK_PERIPHERALS + 3

◆ TMSG_CECTOGGLESTATE

#define TMSG_CECTOGGLESTATE   TMSG_MASK_PERIPHERALS + 1

◆ TMSG_DISPLAY_DESTROY

#define TMSG_DISPLAY_DESTROY   TMSG_MASK_APPLICATION + 13

◆ TMSG_DISPLAY_SETUP

#define TMSG_DISPLAY_SETUP   TMSG_MASK_APPLICATION + 12

◆ TMSG_EVENT

#define TMSG_EVENT   TMSG_MASK_APPLICATION + 33

◆ TMSG_EXECUTE_BUILT_IN

#define TMSG_EXECUTE_BUILT_IN   TMSG_MASK_APPLICATION + 23

◆ TMSG_EXECUTE_OS

#define TMSG_EXECUTE_OS   TMSG_MASK_APPLICATION + 24

◆ TMSG_EXECUTE_SCRIPT

#define TMSG_EXECUTE_SCRIPT   TMSG_MASK_APPLICATION + 22

◆ TMSG_GUI_ACTION

#define TMSG_GUI_ACTION   TMSG_MASK_WINDOWMANAGER + 5

◆ TMSG_GUI_ACTIVATE_WINDOW

#define TMSG_GUI_ACTIVATE_WINDOW   TMSG_MASK_WINDOWMANAGER + 2

◆ TMSG_GUI_ADDON_DIALOG

#define TMSG_GUI_ADDON_DIALOG   TMSG_MASK_WINDOWMANAGER + 6

◆ TMSG_GUI_DIALOG_OK

#define TMSG_GUI_DIALOG_OK   TMSG_MASK_WINDOWMANAGER + 9

◆ TMSG_GUI_DIALOG_OPEN

#define TMSG_GUI_DIALOG_OPEN   TMSG_MASK_WINDOWMANAGER + 1

◆ TMSG_GUI_DIALOG_YESNO

#define TMSG_GUI_DIALOG_YESNO   TMSG_MASK_WINDOWMANAGER + 8

Message sent through CApplicationMessenger to open a yes/no dialog box.

There's two ways to send this message, a short and concise way and a more flexible way allowing more customization.

Option 1: CApplicationMessenger::Get().SendMsg(TMSG_GUI_DIALOG_YESNO, 123, 456); 123: This is the string id for the heading 456: This is the string id for the text

Option 2: HELPERS::DialogYesNoMessage options. Fill in options CApplicationMessenger::Get().SendMsg(TMSG_GUI_DIALOG_YESNO, -1, -1, static_cast<void*>(&options));

Returns
-1 for cancelled, 0 for No and 1 for Yes
See also
HELPERS::DialogYesNoMessage

◆ TMSG_GUI_INFOBOOL

#define TMSG_GUI_INFOBOOL   TMSG_MASK_GUIINFOMANAGER + 1

◆ TMSG_GUI_INFOLABEL

#define TMSG_GUI_INFOLABEL   TMSG_MASK_GUIINFOMANAGER + 0

◆ TMSG_GUI_MESSAGE

#define TMSG_GUI_MESSAGE   TMSG_MASK_WINDOWMANAGER + 7

◆ TMSG_GUI_PREVIOUS_WINDOW

#define TMSG_GUI_PREVIOUS_WINDOW   TMSG_MASK_WINDOWMANAGER + 10

Message sent through CApplicationMessenger to go back to the previous window.

This is an alternative to TMSG_GUI_ACTIVATE_WINDOW, but it keeps all configured parameters, like startup directory.

◆ TMSG_GUI_PYTHON_DIALOG

#define TMSG_GUI_PYTHON_DIALOG   TMSG_MASK_WINDOWMANAGER + 3

◆ TMSG_GUI_WINDOW_CLOSE

#define TMSG_GUI_WINDOW_CLOSE   TMSG_MASK_WINDOWMANAGER + 4

◆ TMSG_HIBERNATE

#define TMSG_HIBERNATE   TMSG_MASK_APPLICATION + 3

◆ TMSG_INHIBITIDLESHUTDOWN

#define TMSG_INHIBITIDLESHUTDOWN   TMSG_MASK_APPLICATION + 20

◆ TMSG_INHIBITSCREENSAVER

#define TMSG_INHIBITSCREENSAVER   TMSG_MASK_APPLICATION + 29

◆ TMSG_LOADPROFILE

#define TMSG_LOADPROFILE   TMSG_MASK_APPLICATION + 27

◆ TMSG_MASK_APPLICATION

#define TMSG_MASK_APPLICATION   (1<<30)

◆ TMSG_MASK_GUIINFOMANAGER

#define TMSG_MASK_GUIINFOMANAGER   (1<<28)

◆ TMSG_MASK_MESSAGE

#define TMSG_MASK_MESSAGE   0xFFFF0000

◆ TMSG_MASK_PERIPHERALS

#define TMSG_MASK_PERIPHERALS   (1<<26)

◆ TMSG_MASK_PLAYLISTPLAYER

#define TMSG_MASK_PLAYLISTPLAYER   (1<<29)

◆ TMSG_MASK_WINDOWMANAGER

#define TMSG_MASK_WINDOWMANAGER   (1<<27)

◆ TMSG_MEDIA_PAUSE

#define TMSG_MEDIA_PAUSE   TMSG_MASK_PLAYLISTPLAYER + 14

◆ TMSG_MEDIA_PAUSE_IF_PLAYING

#define TMSG_MEDIA_PAUSE_IF_PLAYING   TMSG_MASK_PLAYLISTPLAYER + 17

◆ TMSG_MEDIA_PLAY

#define TMSG_MEDIA_PLAY   TMSG_MASK_PLAYLISTPLAYER + 12

◆ TMSG_MEDIA_RESTART

#define TMSG_MEDIA_RESTART   TMSG_MASK_PLAYLISTPLAYER + 15

◆ TMSG_MEDIA_SEEK_TIME

#define TMSG_MEDIA_SEEK_TIME   TMSG_MASK_PLAYLISTPLAYER + 18

◆ TMSG_MEDIA_STOP

#define TMSG_MEDIA_STOP   TMSG_MASK_PLAYLISTPLAYER + 13

◆ TMSG_MEDIA_UNPAUSE

#define TMSG_MEDIA_UNPAUSE   TMSG_MASK_PLAYLISTPLAYER + 16

◆ TMSG_MINIMIZE

#define TMSG_MINIMIZE   TMSG_MASK_APPLICATION + 16

◆ TMSG_MOVETOSCREEN

#define TMSG_MOVETOSCREEN   TMSG_MASK_APPLICATION + 34

◆ TMSG_NETWORKMESSAGE

#define TMSG_NETWORKMESSAGE   TMSG_MASK_APPLICATION + 9

◆ TMSG_PICTURE_SHOW

#define TMSG_PICTURE_SHOW   TMSG_MASK_APPLICATION + 25

◆ TMSG_PICTURE_SLIDESHOW

#define TMSG_PICTURE_SLIDESHOW   TMSG_MASK_APPLICATION + 26

◆ TMSG_PLAYLISTPLAYER_ADD

#define TMSG_PLAYLISTPLAYER_ADD   TMSG_MASK_PLAYLISTPLAYER + 3

◆ TMSG_PLAYLISTPLAYER_CLEAR

#define TMSG_PLAYLISTPLAYER_CLEAR   TMSG_MASK_PLAYLISTPLAYER + 4

◆ TMSG_PLAYLISTPLAYER_GET_ITEMS

#define TMSG_PLAYLISTPLAYER_GET_ITEMS   TMSG_MASK_PLAYLISTPLAYER + 6

◆ TMSG_PLAYLISTPLAYER_INSERT

#define TMSG_PLAYLISTPLAYER_INSERT   TMSG_MASK_PLAYLISTPLAYER + 8

◆ TMSG_PLAYLISTPLAYER_NEXT

#define TMSG_PLAYLISTPLAYER_NEXT   TMSG_MASK_PLAYLISTPLAYER + 1

◆ TMSG_PLAYLISTPLAYER_PLAY

#define TMSG_PLAYLISTPLAYER_PLAY   TMSG_MASK_PLAYLISTPLAYER + 0

◆ TMSG_PLAYLISTPLAYER_PLAY_ITEM_ID

#define TMSG_PLAYLISTPLAYER_PLAY_ITEM_ID   TMSG_MASK_PLAYLISTPLAYER + 7

◆ TMSG_PLAYLISTPLAYER_PREV

#define TMSG_PLAYLISTPLAYER_PREV   TMSG_MASK_PLAYLISTPLAYER + 2

◆ TMSG_PLAYLISTPLAYER_REMOVE

#define TMSG_PLAYLISTPLAYER_REMOVE   TMSG_MASK_PLAYLISTPLAYER + 9

◆ TMSG_PLAYLISTPLAYER_REPEAT

#define TMSG_PLAYLISTPLAYER_REPEAT   TMSG_MASK_PLAYLISTPLAYER + 11

◆ TMSG_PLAYLISTPLAYER_SHUFFLE

#define TMSG_PLAYLISTPLAYER_SHUFFLE   TMSG_MASK_PLAYLISTPLAYER + 5

◆ TMSG_PLAYLISTPLAYER_SWAP

#define TMSG_PLAYLISTPLAYER_SWAP   TMSG_MASK_PLAYLISTPLAYER + 10

◆ TMSG_POWERDOWN

#define TMSG_POWERDOWN   TMSG_MASK_APPLICATION + 1

◆ TMSG_QUIT

#define TMSG_QUIT   TMSG_MASK_APPLICATION + 2

◆ TMSG_RENDERER_FLUSH

#define TMSG_RENDERER_FLUSH   TMSG_MASK_APPLICATION + 19

◆ TMSG_RENDERER_PREINIT

#define TMSG_RENDERER_PREINIT   TMSG_MASK_APPLICATION + 31

◆ TMSG_RENDERER_UNINIT

#define TMSG_RENDERER_UNINIT   TMSG_MASK_APPLICATION + 32

◆ TMSG_RESET

#define TMSG_RESET   TMSG_MASK_APPLICATION + 6

◆ TMSG_RESETSCREENSAVER

#define TMSG_RESETSCREENSAVER   TMSG_MASK_APPLICATION + 10

◆ TMSG_RESTART

#define TMSG_RESTART   TMSG_MASK_APPLICATION + 5

◆ TMSG_RESTARTAPP

#define TMSG_RESTARTAPP   TMSG_MASK_APPLICATION + 7

◆ TMSG_SET_MUTE

#define TMSG_SET_MUTE   TMSG_MASK_APPLICATION + 37

◆ TMSG_SET_VOLUME

#define TMSG_SET_VOLUME   TMSG_MASK_APPLICATION + 36

◆ TMSG_SETLANGUAGE

#define TMSG_SETLANGUAGE   TMSG_MASK_APPLICATION + 18

◆ TMSG_SETVIDEORESOLUTION

#define TMSG_SETVIDEORESOLUTION   TMSG_MASK_APPLICATION + 14

◆ TMSG_SHUTDOWN

#define TMSG_SHUTDOWN   TMSG_MASK_APPLICATION + 0

◆ TMSG_START_ANDROID_ACTIVITY

#define TMSG_START_ANDROID_ACTIVITY   TMSG_MASK_APPLICATION + 21

◆ TMSG_SUSPEND

#define TMSG_SUSPEND   TMSG_MASK_APPLICATION + 4

◆ TMSG_SWITCHTOFULLSCREEN

#define TMSG_SWITCHTOFULLSCREEN   TMSG_MASK_APPLICATION + 15

◆ TMSG_SYSTEM_POWERDOWN

#define TMSG_SYSTEM_POWERDOWN   TMSG_MASK_APPLICATION + 30

◆ TMSG_TOGGLEFULLSCREEN

#define TMSG_TOGGLEFULLSCREEN   TMSG_MASK_APPLICATION + 17

◆ TMSG_UPDATE_CURRENT_ITEM

#define TMSG_UPDATE_CURRENT_ITEM   TMSG_MASK_GUIINFOMANAGER + 2

◆ TMSG_UPDATE_PLAYER_ITEM

#define TMSG_UPDATE_PLAYER_ITEM   TMSG_MASK_APPLICATION + 35

Called from the player when its current item is updated.

◆ TMSG_VIDEORESIZE

#define TMSG_VIDEORESIZE   TMSG_MASK_APPLICATION + 28

◆ TMSG_VOLUME_SHOW

#define TMSG_VOLUME_SHOW   TMSG_MASK_APPLICATION + 11