IdwThread.h
author sl
Mon, 17 Mar 2014 12:38:39 +0100
changeset 3 d5f6b2119a13
parent 2 558712318e1b
permissions -rw-r--r--
Fixing init result issue.
     1 //------------------------------------------------------------------------------
     2 #ifndef IDWTHREAD_H_INCLUDED
     3 #define IDWTHREAD_H_INCLUDED
     4 //------------------------------------------------------------------------------
     5 #include <windows.h>
     6 #include "Thread.h"
     7 #include "Event.h"
     8 #include "Mutex.h"
     9 #include "iMONDisplayDefines.h"
    10 #include "iMONDisplayWrapper.h"
    11 
    12 
    13 /**
    14 iMON Display Wrapper thread.
    15 Create a window and implement its event loop.
    16 This window will be used to process iMON display messages.
    17 Implement iMON Display API by send messages to our window.
    18 Actual iMON Display API call call are made from the window procedure.
    19 */
    20 class IdwThread : public Thread
    21 {
    22 public:
    23 	IdwThread(HINSTANCE hInstance);
    24 	virtual ~IdwThread();
    25 
    26 private:
    27 	IdwThread(const IdwThread& other) {}
    28 	IdwThread& operator=(const IdwThread& other) { return *this; }
    29 
    30 public:
    31 	virtual void Interrupt();
    32 	DSPResult Init(IDW_INITRESULT* pInitResult);
    33 	DSPResult Uninit();
    34 	DSPResult IsInitialized();
    35 	DSPResult IsPluginModeEnabled();
    36 	DSPResult GetStatus(IDW_STATUS* aStatus);
    37 	DSPResult SetVfdText(LPCWSTR lpszLine1, LPCWSTR lpszLine2);
    38 	DSPResult SetVfdEqData(PDSPEQDATA pEqData);
    39 	DSPResult SetLcdText(LPCWSTR lpszText);
    40 	DSPResult SetLcdEqData(PDSPEQDATA pEqDataL, PDSPEQDATA pEqDataR);
    41 	DSPResult SetLcdAllIcons(BOOL bOn);
    42 	DSPResult SetLcdOrangeIcon(BYTE btIconData1, BYTE btIconData2);
    43 	DSPResult SetLcdMediaTypeIcon(BYTE btIconData);
    44 	DSPResult SetLcdSpeakerIcon(BYTE btIconData1, BYTE btIconData2);
    45 	DSPResult SetLcdVideoCodecIcon(BYTE btIconData);
    46 	DSPResult SetLcdAudioCodecIcon(BYTE btIconData);
    47 	DSPResult SetLcdAspectRatioIcon(BYTE btIconData);
    48 	DSPResult SetLcdEtcIcon(BYTE btIconData);
    49 	DSPResult SetLcdProgress(int nCurPos, int nTotal);
    50 	
    51 protected:
    52 	virtual void Run();
    53   
    54 private:
    55 	bool RegisterClass();
    56 	bool CreateMessageWindow();
    57 	void AllowImonMessages();
    58 	bool WaitForWindow();
    59 	static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
    60 	static void MapChars(LPWSTR lpszTarget, LPCWSTR lpszSource, int nMaxLength);
    61 	static wchar_t MapChar(wchar_t ch);
    62 
    63 private:
    64 	HINSTANCE m_hInstance;
    65 	HWND m_hWnd;
    66 	Event m_eventWindowCreationDone;
    67 };
    68 //------------------------------------------------------------------------------
    69 #endif
    70 //------------------------------------------------------------------------------