Add support for the navigationpad interface
This commit is contained in:
parent
37909b1d2f
commit
8fd164427f
@ -242,24 +242,24 @@ Device::DeviceError DevicePluginKodi::executeAction(Device *device, const Action
|
|||||||
commandId = kodi->setVolume(action.param(kodiVolumeActionVolumeParamTypeId).value().toInt());
|
commandId = kodi->setVolume(action.param(kodiVolumeActionVolumeParamTypeId).value().toInt());
|
||||||
} else if (action.actionTypeId() == kodiMuteActionTypeId) {
|
} else if (action.actionTypeId() == kodiMuteActionTypeId) {
|
||||||
commandId = kodi->setMuted(action.param(kodiMuteActionMuteParamTypeId).value().toBool());
|
commandId = kodi->setMuted(action.param(kodiMuteActionMuteParamTypeId).value().toBool());
|
||||||
} else if (action.actionTypeId() == kodiPressButtonActionTypeId) {
|
} else if (action.actionTypeId() == kodiNavigateActionTypeId) {
|
||||||
commandId = kodi->pressButton(action.param(kodiPressButtonActionButtonParamTypeId).value().toString());
|
commandId = kodi->navigate(action.param(kodiNavigateActionToParamTypeId).value().toString());
|
||||||
} else if (action.actionTypeId() == kodiSystemActionTypeId) {
|
} else if (action.actionTypeId() == kodiSystemActionTypeId) {
|
||||||
commandId = kodi->systemCommand(action.param(kodiSystemActionSystemCommandParamTypeId).value().toString());
|
commandId = kodi->systemCommand(action.param(kodiSystemActionSystemCommandParamTypeId).value().toString());
|
||||||
} else if(action.actionTypeId() == kodiSkipBackActionTypeId) {
|
} else if(action.actionTypeId() == kodiSkipBackActionTypeId) {
|
||||||
commandId = kodi->pressButton("skipprevious");
|
commandId = kodi->navigate("skipprevious");
|
||||||
} else if(action.actionTypeId() == kodiFastRewindActionTypeId) {
|
} else if(action.actionTypeId() == kodiFastRewindActionTypeId) {
|
||||||
commandId = kodi->pressButton("rewind");
|
commandId = kodi->navigate("rewind");
|
||||||
} else if(action.actionTypeId() == kodiStopActionTypeId) {
|
} else if(action.actionTypeId() == kodiStopActionTypeId) {
|
||||||
commandId = kodi->pressButton("stop");
|
commandId = kodi->navigate("stop");
|
||||||
} else if(action.actionTypeId() == kodiPlayActionTypeId) {
|
} else if(action.actionTypeId() == kodiPlayActionTypeId) {
|
||||||
commandId = kodi->pressButton("play");
|
commandId = kodi->navigate("play");
|
||||||
} else if(action.actionTypeId() == kodiPauseActionTypeId) {
|
} else if(action.actionTypeId() == kodiPauseActionTypeId) {
|
||||||
commandId = kodi->pressButton("pause");
|
commandId = kodi->navigate("pause");
|
||||||
} else if(action.actionTypeId() == kodiFastForwardActionTypeId) {
|
} else if(action.actionTypeId() == kodiFastForwardActionTypeId) {
|
||||||
commandId = kodi->pressButton("fastforward");
|
commandId = kodi->navigate("fastforward");
|
||||||
} else if(action.actionTypeId() == kodiSkipNextActionTypeId) {
|
} else if(action.actionTypeId() == kodiSkipNextActionTypeId) {
|
||||||
commandId = kodi->pressButton("skipnext");
|
commandId = kodi->navigate("skipnext");
|
||||||
} else if (action.actionTypeId() == kodiShuffleActionTypeId) {
|
} else if (action.actionTypeId() == kodiShuffleActionTypeId) {
|
||||||
commandId = kodi->setShuffle(action.param(kodiShuffleActionShuffleParamTypeId).value().toBool());
|
commandId = kodi->setShuffle(action.param(kodiShuffleActionShuffleParamTypeId).value().toBool());
|
||||||
} else if (action.actionTypeId() == kodiRepeatActionTypeId) {
|
} else if (action.actionTypeId() == kodiRepeatActionTypeId) {
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"id": "d09953e3-c5bd-415b-973b-0d0bf2be3f69",
|
"id": "d09953e3-c5bd-415b-973b-0d0bf2be3f69",
|
||||||
"name": "kodi",
|
"name": "kodi",
|
||||||
"displayName": "Kodi",
|
"displayName": "Kodi",
|
||||||
"interfaces": ["mediaplayer", "extendedmediacontroller", "extendedvolumecontroller", "mediametadataprovider", "shufflerepeat", "notifications", "connectable"],
|
"interfaces": ["mediaplayer", "extendedmediacontroller", "extendedvolumecontroller", "mediametadataprovider", "shufflerepeat", "notifications", "extendednavigationpad", "connectable"],
|
||||||
"createMethods": ["user", "discovery"],
|
"createMethods": ["user", "discovery"],
|
||||||
"browsable": true,
|
"browsable": true,
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
@ -237,45 +237,24 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "28060803-aa85-44a4-9dec-ee669dfb629f",
|
"id": "28060803-aa85-44a4-9dec-ee669dfb629f",
|
||||||
"name": "pressButton",
|
"name": "navigate",
|
||||||
"displayName": "press button",
|
"displayName": "Navigate",
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
"id": "93861dac-0c24-4a3b-903d-d1be44eae611",
|
"id": "93861dac-0c24-4a3b-903d-d1be44eae611",
|
||||||
"name": "button",
|
"name": "to",
|
||||||
"displayName": "button",
|
"displayName": "to",
|
||||||
"type": "QString",
|
"type": "QString",
|
||||||
"allowedValues": [
|
"allowedValues": [
|
||||||
"left",
|
|
||||||
"right",
|
|
||||||
"up",
|
"up",
|
||||||
"down",
|
"down",
|
||||||
"pageup",
|
"left",
|
||||||
"pagedown",
|
"right",
|
||||||
"select",
|
"enter",
|
||||||
"back",
|
"back",
|
||||||
|
"menu",
|
||||||
"info",
|
"info",
|
||||||
"pause",
|
"home"
|
||||||
"stop",
|
|
||||||
"skipnext",
|
|
||||||
"skipprevious",
|
|
||||||
"stepforward",
|
|
||||||
"stepback",
|
|
||||||
"osd",
|
|
||||||
"play",
|
|
||||||
"playpause",
|
|
||||||
"fastforward",
|
|
||||||
"rewind",
|
|
||||||
"fullscreen",
|
|
||||||
"mute",
|
|
||||||
"volumeup",
|
|
||||||
"volumedown",
|
|
||||||
"channelup",
|
|
||||||
"channeldown",
|
|
||||||
"red",
|
|
||||||
"green",
|
|
||||||
"yellow",
|
|
||||||
"blue"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -236,10 +236,19 @@ int Kodi::showNotification(const QString &title, const QString &message, const i
|
|||||||
return m_jsonHandler->sendData("GUI.ShowNotification", params);
|
return m_jsonHandler->sendData("GUI.ShowNotification", params);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Kodi::pressButton(const QString &button)
|
int Kodi::navigate(const QString &to)
|
||||||
{
|
{
|
||||||
|
qCDebug(dcKodi()) << "Navigate:" << to;
|
||||||
|
if (to == "home") {
|
||||||
|
return m_jsonHandler->sendData("Input.Home", QVariantMap());
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap params;
|
QVariantMap params;
|
||||||
params.insert("action", button);
|
QString mappedTo = to;
|
||||||
|
if (to == "enter") {
|
||||||
|
mappedTo = "select";
|
||||||
|
}
|
||||||
|
params.insert("action", mappedTo);
|
||||||
return m_jsonHandler->sendData("Input.ExecuteAction", params);
|
return m_jsonHandler->sendData("Input.ExecuteAction", params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,7 +958,7 @@ void Kodi::processResponse(int id, const QString &method, const QVariantMap &res
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method == "GUI.ShowNotification") {
|
if (method == "GUI.ShowNotification" || method == "Input.ExecuteAction") {
|
||||||
emit actionExecuted(id, !response.contains("error"));
|
emit actionExecuted(id, !response.contains("error"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
// actions
|
// actions
|
||||||
int showNotification(const QString &title, const QString &message, const int &displayTime, const QString ¬ificationType);
|
int showNotification(const QString &title, const QString &message, const int &displayTime, const QString ¬ificationType);
|
||||||
int pressButton(const QString &button);
|
int navigate(const QString &to);
|
||||||
int systemCommand(const QString &command);
|
int systemCommand(const QString &command);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user