Skip to content

Commit

Permalink
[cec] Fixed PeripheralCecAdapter application exit code handling.
Browse files Browse the repository at this point in the history
      Introduced new field "exitcode" for "OnQuit" message (@pdf).
  • Loading branch information
ksooo committed Nov 24, 2014
1 parent 9f35a93 commit d7df798
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3481,7 +3481,8 @@ void CApplication::Stop(int exitCode)
{
try
{
CVariant vExitCode(exitCode);
CVariant vExitCode(CVariant::VariantTypeObject);
vExitCode["exitcode"] = exitCode;
CAnnouncementManager::Get().Announce(System, "xbmc", "OnQuit", vExitCode);

SaveFileState(true);
Expand Down
6 changes: 5 additions & 1 deletion xbmc/interfaces/json-rpc/schema/notifications.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,11 @@
"description": "XBMC will be closed.",
"params": [
{ "name": "sender", "type": "string", "required": true },
{ "name": "data", "type": "null", "required": true }
{ "name": "data", "type": "object", "required": true,
"properties": {
"exitcode": { "type": "integer", "minimum": 0, "required": true }
}
}
],
"returns": null
},
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/json-rpc/schema/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.20.1
6.21.0
4 changes: 2 additions & 2 deletions xbmc/peripherals/devices/PeripheralCecAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void CPeripheralCecAdapter::ResetMembers(void)
m_strMenuLanguage = "???";
m_lastKeypress = 0;
m_lastChange = VOLUME_CHANGE_NONE;
m_iExitCode = 0;
m_iExitCode = EXITCODE_QUIT;
m_bIsMuted = false; // TODO fetch the correct initial value when system audiostatus is implemented in libCEC
m_bGoingToStandby = false;
m_bIsRunning = false;
Expand All @@ -149,7 +149,7 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnQuit") && m_bIsReady)
{
CSingleLock lock(m_critSection);
m_iExitCode = (int)data["shuttingdown"].asInteger(0);
m_iExitCode = static_cast<int>(data["exitcode"].asInteger(EXITCODE_QUIT));
CAnnouncementManager::Get().RemoveAnnouncer(this);
StopThread(false);
}
Expand Down

0 comments on commit d7df798

Please sign in to comment.