Skip to content

Commit

Permalink
jsonrpc: add Input.OnInputRequested and Input.OnInputFinished notific…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
Montellese committed Jul 10, 2012
1 parent 68e0347 commit 1c9f832
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
8 changes: 8 additions & 0 deletions xbmc/dialogs/GUIDialogKeyboard.cpp
Expand Up @@ -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] = ")!@#$%^&*([]{}-_=+;:\'\",.<>/?\\|`~ ";
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
19 changes: 11 additions & 8 deletions xbmc/interfaces/IAnnouncer.h
Expand Up @@ -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
Expand All @@ -58,6 +59,8 @@ namespace ANNOUNCEMENT
return "AudioLibrary";
case Application:
return "Application";
case Input:
return "Input";
case Other:
return "Other";
default:
Expand Down
23 changes: 23 additions & 0 deletions xbmc/interfaces/json-rpc/ServiceDescription.h
Expand Up @@ -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"
"}"
};
}
23 changes: 23 additions & 0 deletions xbmc/interfaces/json-rpc/notifications.json
Expand Up @@ -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
}
}

0 comments on commit 1c9f832

Please sign in to comment.