blob: 2e01112c65ab82698333bab9dce8670f9b70a0b3
1 | #ifndef _C_HDMI_RX_CEC_H_ |
2 | #define _C_HDMI_RX_CEC_H_ |
3 | |
4 | #ifdef __cplusplus |
5 | //extern "C" { |
6 | #endif |
7 | |
8 | #include "CTvin.h" |
9 | #include <pthread.h> |
10 | //#include <cm.h> |
11 | //#include <ve.h> |
12 | #include "../tvutils/CThread.h" |
13 | #include <hdmirx_cec.h> |
14 | |
15 | class CHDMIRxCEC: public CThread { |
16 | public: |
17 | CHDMIRxCEC(); |
18 | ~CHDMIRxCEC(); |
19 | |
20 | class IHDMIRxCECObserver { |
21 | public: |
22 | IHDMIRxCECObserver() {}; |
23 | virtual ~IHDMIRxCECObserver() {}; |
24 | virtual void onHDMIRxCECMessage(int msg_len, unsigned char msg_buf[]) {}; |
25 | }; |
26 | void setObserver ( IHDMIRxCECObserver *pOb ) |
27 | { |
28 | mpObserver = pOb; |
29 | }; |
30 | |
31 | int start(); |
32 | int stop(); |
33 | int pause(); |
34 | int resume(); |
35 | int ClearRxMessageBuffer(); |
36 | int processRefreshSrcDevice(int source_input); |
37 | int SendCustomMessage(int source_input, unsigned char data_buf[]); |
38 | int SendCustomMessageAndWaitReply(int source_input, unsigned char data_buf[], unsigned char reply_buf[], int WaitCmd, int timeout); |
39 | int SendBoradcastStandbyMessage(int source_input); |
40 | int SendGiveCECVersionMessage(int source_input, unsigned char data_buf[]); |
41 | int SendGiveDeviceVendorIDMessage(int source_input, unsigned char data_buf[]); |
42 | int SendGiveOSDNameMessage(int source_input, unsigned char data_buf[]); |
43 | int SendGivePhysicalAddressMessage(int source_input, int logic_addr, int *physical_addr); |
44 | int SendSetMenuLanguageMessage(int source_input, unsigned char data_buf[]); |
45 | int SendVendorRemoteKeyDownMessage(int source_input, unsigned char key_val); |
46 | int SendVendorRemoteKeyUpMessage(int source_input); |
47 | |
48 | |
49 | private: |
50 | int mModuleEnableFlag; |
51 | int mRequestPause; |
52 | int mState; |
53 | IHDMIRxCECObserver *mpObserver; |
54 | |
55 | bool threadLoop(); |
56 | int processData(int msg_cnt); |
57 | |
58 | int isAllowOperate(int source_input); |
59 | int GetModuleEnableFlag(); |
60 | int GetDeviceLogicAddr(int source_input); |
61 | int SendMessage(struct _cec_msg *msg); |
62 | int sendMessageAndWaitReply(struct _cec_msg *msg, struct _cec_msg *reply_msg, int WaitCmd, int timeout); |
63 | int GetMessage(struct _cec_msg *msg_list); |
64 | int rmFromRequestList(int index); |
65 | int addToRequestList(HDMIRxRequestReplyItem *reply_item); |
66 | int PrintMessage(const char *func_name, int data_type, struct _cec_msg *msg); |
67 | int ClrReplyListItem(HDMIRxRequestReplyItem *reply_item); |
68 | int CopyMessageData(unsigned char data_buf[], unsigned char msg_data[], int msg_len); |
69 | |
70 | int mSourceDevLogicAddrBuf[CC_SOURCE_DEV_REFRESH_CNT]; |
71 | int mSourceDevRefreshBuf[CC_SOURCE_DEV_REFRESH_CNT]; |
72 | |
73 | CCondition mPauseCondition; |
74 | mutable CMutex mLock; |
75 | mutable CMutex mListLock; |
76 | mutable CMutex mReplyLock[CC_REQUEST_LIST_SIZE]; |
77 | HDMIRxRequestReplyItem mReplyList[CC_REQUEST_LIST_SIZE]; |
78 | struct _cec_msg mMsgBuf[CC_REQUEST_LIST_SIZE]; |
79 | |
80 | enum RefreshState { |
81 | STATE_STOPED = 0, |
82 | STATE_RUNNING, |
83 | STATE_PAUSE, |
84 | STATE_FINISHED, |
85 | }; |
86 | }; |
87 | |
88 | #ifdef __cplusplus |
89 | //} |
90 | #endif |
91 | |
92 | #endif/*_C_HDMI_RX_CEC_H_*/ |
93 | |
94 |