aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormontellese <montellese@xbmc.org>2012-07-08 23:56:20 +0200
committermontellese <montellese@xbmc.org>2012-07-10 15:45:53 +0200
commit1c9f8320c5712531065b79a9dee6a5f9ddd643db (patch)
tree9c153b28c85fa459531a60a7e0ce2794cf81e676
parent68e03471f6e746ae4c1740d6048327df76cd0dac (diff)
jsonrpc: add Input.OnInputRequested and Input.OnInputFinished notifications
-rw-r--r--xbmc/dialogs/GUIDialogKeyboard.cpp8
-rw-r--r--xbmc/interfaces/IAnnouncer.h19
-rw-r--r--xbmc/interfaces/json-rpc/ServiceDescription.h23
-rw-r--r--xbmc/interfaces/json-rpc/notifications.json23
4 files changed, 65 insertions, 8 deletions
diff --git a/xbmc/dialogs/GUIDialogKeyboard.cpp b/xbmc/dialogs/GUIDialogKeyboard.cpp
index 7012989026..594de64796 100644
--- a/xbmc/dialogs/GUIDialogKeyboard.cpp
+++ b/xbmc/dialogs/GUIDialogKeyboard.cpp
@@ -34,6 +34,7 @@
#include "Application.h"
#include "settings/AdvancedSettings.h"
#include "guilib/LocalizeStrings.h"
+#include "interfaces/AnnouncementManager.h"
// Symbol mapping (based on MS virtual keyboard - may need improving)
static char symbol_map[37] = ")!@#$%^&*([]{}-_=+;:\'\",.<>/?\\|`~ ";
@@ -98,6 +99,11 @@ void CGUIDialogKeyboard::OnInitWindow()
{
SET_CONTROL_HIDDEN(CTL_LABEL_HEADING);
}
+
+ CVariant data;
+ data["title"] = m_strHeading;
+ data["type"] = "keyboard";
+ ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
}
bool CGUIDialogKeyboard::OnAction(const CAction &action)
@@ -672,6 +678,8 @@ void CGUIDialogKeyboard::OnDeinitWindow(int nextWindowID)
CGUIDialog::OnDeinitWindow(nextWindowID);
// reset the heading (we don't always have this)
m_strHeading = "";
+
+ ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputFinished");
}
void CGUIDialogKeyboard::MoveCursor(int iAmount)
diff --git a/xbmc/interfaces/IAnnouncer.h b/xbmc/interfaces/IAnnouncer.h
index 35360a6db4..64e76eb233 100644
--- a/xbmc/interfaces/IAnnouncer.h
+++ b/xbmc/interfaces/IAnnouncer.h
@@ -25,16 +25,17 @@ namespace ANNOUNCEMENT
{
enum AnnouncementFlag
{
- Player = 0x1,
- GUI = 0x2,
- System = 0x4,
- VideoLibrary = 0x8,
- AudioLibrary = 0x10,
- Application = 0x20,
- Other = 0x40
+ Player = 0x01,
+ GUI = 0x02,
+ System = 0x04,
+ VideoLibrary = 0x08,
+ AudioLibrary = 0x10,
+ Application = 0x20,
+ Input = 0x40,
+ Other = 0x80
};
- #define ANNOUNCE_ALL (Player | GUI | System | VideoLibrary | AudioLibrary | Application | Other)
+ #define ANNOUNCE_ALL (Player | GUI | System | VideoLibrary | AudioLibrary | Application | Input | Other)
/*!
\brief Returns a string representation for the
@@ -58,6 +59,8 @@ namespace ANNOUNCEMENT
return "AudioLibrary";
case Application:
return "Application";
+ case Input:
+ return "Input";
case Other:
return "Other";
default:
diff --git a/xbmc/interfaces/json-rpc/ServiceDescription.h b/xbmc/interfaces/json-rpc/ServiceDescription.h
index 5bfe2986c9..adf6a0ab8e 100644
--- a/xbmc/interfaces/json-rpc/ServiceDescription.h
+++ b/xbmc/interfaces/json-rpc/ServiceDescription.h
@@ -2697,6 +2697,29 @@ namespace JSONRPC
"}"
"],"
"\"returns\": null"
+ "}",
+ "\"Input.OnInputRequested\": {"
+ "\"type\": \"notification\","
+ "\"description\": \"The user is requested to provide some information.\","
+ "\"params\": ["
+ "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true },"
+ "{ \"name\": \"data\", \"type\": \"object\", \"required\": true,"
+ "\"properties\": {"
+ "\"type\": { \"type\": \"string\", \"enum\": [ \"keyboard\", \"time\", \"date\", \"ip\", \"password\", \"number\", \"seconds\" ], \"required\": true },"
+ "\"title\": { \"type\": \"string\" }"
+ "}"
+ "}"
+ "],"
+ "\"returns\": null"
+ "}",
+ "\"Input.OnInputFinished\": {"
+ "\"type\": \"notification\","
+ "\"description\": \"The user has provided the requested input.\","
+ "\"params\": ["
+ "{ \"name\": \"sender\", \"type\": \"string\", \"required\": true },"
+ "{ \"name\": \"data\", \"type\": \"null\", \"required\": true }"
+ "],"
+ "\"returns\": null"
"}"
};
}
diff --git a/xbmc/interfaces/json-rpc/notifications.json b/xbmc/interfaces/json-rpc/notifications.json
index f4bf7927f7..372122941b 100644
--- a/xbmc/interfaces/json-rpc/notifications.json
+++ b/xbmc/interfaces/json-rpc/notifications.json
@@ -187,5 +187,28 @@
}
],
"returns": null
+ },
+ "Input.OnInputRequested": {
+ "type": "notification",
+ "description": "The user is requested to provide some information.",
+ "params": [
+ { "name": "sender", "type": "string", "required": true },
+ { "name": "data", "type": "object", "required": true,
+ "properties": {
+ "type": { "type": "string", "enum": [ "keyboard", "time", "date", "ip", "password", "number", "seconds" ], "required": true },
+ "title": { "type": "string" }
+ }
+ }
+ ],
+ "returns": null
+ },
+ "Input.OnInputFinished": {
+ "type": "notification",
+ "description": "The user has provided the requested input.",
+ "params": [
+ { "name": "sender", "type": "string", "required": true },
+ { "name": "data", "type": "null", "required": true }
+ ],
+ "returns": null
}
} \ No newline at end of file