mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-10 14:09:51 -05:00
Merge from dev-FireflyShell branch
This commit is contained in:
55
win32/FireflyShell/ServerEvents.h
Normal file
55
win32/FireflyShell/ServerEvents.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
*(C) 2006 Roku LLC
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License Version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* without any warranty; without even the implied warranty of
|
||||
* merchantability or fitness for a particular purpose. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* Please read README.txt in the same directory as this source file for
|
||||
* further license information.
|
||||
*/
|
||||
|
||||
#ifndef SERVEREVENTS_H
|
||||
#define SERVEREVENTS_H
|
||||
|
||||
class ServerEvents
|
||||
{
|
||||
public:
|
||||
/// Note that the observer is called on the wrong thread.
|
||||
class Observer
|
||||
{
|
||||
public:
|
||||
virtual void OnServerEvent(UINT32 id, UINT32 intval, const CString &str) = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
HANDLE m_thread;
|
||||
HANDLE m_mailslot;
|
||||
Observer *m_obs;
|
||||
|
||||
static unsigned __stdcall StaticThreadProc(void *);
|
||||
DWORD ThreadProc();
|
||||
|
||||
void OnEvent(const void *buffer, size_t length);
|
||||
|
||||
public:
|
||||
ServerEvents(Observer *obs);
|
||||
~ServerEvents();
|
||||
|
||||
void SetObserver(Observer *obs)
|
||||
{
|
||||
ATLASSERT(m_obs == NULL);
|
||||
m_obs = obs;
|
||||
}
|
||||
|
||||
bool Start();
|
||||
void Stop();
|
||||
};
|
||||
|
||||
#endif // SERVICE
|
||||
Reference in New Issue
Block a user