Permalink
Browse files

Merge remote-tracking branch 'fetzerch/announce' into pvrapi_1_7_0. C…

…loses #171

Conflicts:
	addons/pvr.mythtv.cmyth/src/cppmyth/MythEventHandler.cpp
  • Loading branch information...
2 parents d12aa6e + e532e0f commit 5ea865068754a13081aa7b076ea73232ee5adfcf @opdenkamp committed Mar 6, 2013
@@ -285,6 +285,10 @@ void ADDON_FreeSettings()
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -125,6 +125,10 @@ void ADDON_FreeSettings()
{
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -248,6 +248,10 @@ void ADDON_FreeSettings()
{
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -354,6 +354,10 @@ void ADDON_FreeSettings()
{
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -418,6 +418,10 @@ void ADDON_FreeSettings()
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -316,6 +316,26 @@ void ADDON_Destroy()
m_CurStatus = ADDON_STATUS_UNKNOWN;
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+ (void)data;
+ XBMC->Log(LOG_INFO, "Received announcement: %s, %s, %s", flag, sender, message);
+
+ if (g_client == NULL)
+ return;
+
+ if (strcmp("xbmc", sender) == 0)
+ {
+ if (strcmp("System", flag) == 0)
+ {
+ if (strcmp("OnSleep", message) == 0)
+ g_client->OnSleep();
+ else if (strcmp("OnWake", message) == 0)
+ g_client->OnWake();
+ }
+ }
+}
+
ADDON_STATUS ADDON_GetStatus()
{
return m_CurStatus;
@@ -508,6 +508,29 @@ void MythEventHandler::RegisterObserver(MythEventObserver *observer)
m_imp->m_observer = observer;
}
+void MythEventHandler::Suspend()
+{
+ if (m_imp->IsRunning())
+ {
+ m_imp->StopThread();
+ // We must close the connection to be able to restart properly.
+ // On resume the thread will retry to connect by RetryConnect().
+ // So all recordings will be reloaded after restoring the connection.
+ m_imp->m_hang = true;
+ ref_release(*(m_imp->m_conn_t));
+ *(m_imp->m_conn_t) = NULL;
+ }
+}
+
+void MythEventHandler::Resume()
+{
+ if (m_imp->IsStopped())
+ {
+ m_imp->Clear();
+ m_imp->CreateThread();
+ }
+}
+
void MythEventHandler::PreventLiveChainUpdate()
{
m_imp->Lock();
@@ -51,6 +51,9 @@ class MythEventHandler
MythEventHandler(const CStdString &server, unsigned short port);
void RegisterObserver(MythEventObserver *observer);
+ void Suspend();
+ void Resume();
+
void PreventLiveChainUpdate();
void AllowLiveChainUpdate();
@@ -252,6 +252,22 @@ bool PVRClientMythTV::GetDriveSpace(long long *iTotal, long long *iUsed)
return m_con.GetDriveSpace(*iTotal, *iUsed);
}
+void PVRClientMythTV::OnSleep()
+{
+ if (m_pEventHandler)
+ m_pEventHandler->Suspend();
+ if (m_fileOps)
+ m_fileOps->Suspend();
+}
+
+void PVRClientMythTV::OnWake()
+{
+ if (m_pEventHandler)
+ m_pEventHandler->Resume();
+ if (m_fileOps)
+ m_fileOps->Resume();
+}
+
PVR_ERROR PVRClientMythTV::GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL &channel, time_t iStart, time_t iEnd)
{
if (g_bExtraDebug)
@@ -65,6 +65,8 @@ class PVRClientMythTV : public MythEventObserver
const char *GetBackendVersion();
const char *GetConnectionString();
bool GetDriveSpace(long long *iTotal, long long *iUsed);
+ void OnSleep();
+ void OnWake();
// EPG
PVR_ERROR GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL &channel, time_t iStart, time_t iEnd);
@@ -251,6 +251,10 @@ void ADDON_FreeSettings()
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -178,6 +178,11 @@ void ADDON_FreeSettings()
return;
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+ return;
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -285,6 +285,10 @@ void ADDON_FreeSettings()
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
@@ -327,6 +327,10 @@ void ADDON_FreeSettings()
{
}
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
/***********************************************************
* PVR Client AddOn specific public library functions
***********************************************************/
View
@@ -46,6 +46,7 @@ extern "C" {
unsigned int __declspec(dllexport) ADDON_GetSettings(ADDON_StructSetting ***sSet);
ADDON_STATUS __declspec(dllexport) ADDON_SetSetting(const char *settingName, const void *settingValue);
void __declspec(dllexport) ADDON_FreeSettings();
+ void __declspec(dllexport) ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data);
#ifdef __cplusplus
};

0 comments on commit 5ea8650

Please sign in to comment.