mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-09 08:41:31 +00:00
[idd] ipc: connect LGInput to LGIdd
Move the reusable named-pipe endpoint and shared support code into the LGCommon static library. Run a dedicated server in LGIdd and a reconnecting client in LGInput, with device-lifecycle handling and report framing. Refactor the helper pipe to use the same endpoint implementation.
This commit is contained in:
@@ -23,40 +23,31 @@
|
||||
#include <windows.h>
|
||||
#include <wdf.h>
|
||||
#include <stdint.h>
|
||||
#include <wrl.h>
|
||||
#include <vector>
|
||||
|
||||
#include "CPipeEndpoint.h"
|
||||
#include "PipeMsg.h"
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace Microsoft::WRL::Wrappers::HandleTraits;
|
||||
|
||||
class CDeviceContext;
|
||||
|
||||
class CPipeServer
|
||||
class CPipeServer : private IPipeEndpointHandler
|
||||
{
|
||||
private:
|
||||
HandleT<HANDLETraits> m_pipe;
|
||||
HandleT<HANDLENullTraits> m_thread;
|
||||
HandleT<EventTraits> m_signal;
|
||||
std::vector<LGPipeMsg> m_queue;
|
||||
|
||||
bool m_running = false;
|
||||
bool m_connected = false;
|
||||
CPipeEndpoint m_endpoint;
|
||||
SRWLOCK m_queueLock = SRWLOCK_INIT;
|
||||
std::vector<LGPipeMsg> m_queue;
|
||||
|
||||
SRWLOCK m_deviceContextLock = SRWLOCK_INIT;
|
||||
CDeviceContext * m_deviceContext = nullptr;
|
||||
|
||||
void _DeInit();
|
||||
|
||||
static DWORD WINAPI _pipeThread(LPVOID lpParam) { ((CPipeServer*)lpParam)->Thread(); return 0; }
|
||||
void Thread();
|
||||
|
||||
void WriteMsg(const LGPipeMsg & msg);
|
||||
void QueueMsgLocked(const LGPipeMsg & msg);
|
||||
|
||||
void HandleReloadSettings();
|
||||
|
||||
void OnPipeConnected() override;
|
||||
bool OnPipeMessage(const void * message, size_t size) override;
|
||||
|
||||
public:
|
||||
~CPipeServer() { DeInit(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user