blob: 061a2b83bd1d966c8607f19e6e98d1b0c730a17d
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 __unused, unsigned char msg_buf[] __unused) { |
25 | }; |
26 | }; |
27 | |
28 | void setObserver ( IHDMIRxCECObserver *pOb ) { |
29 | mpObserver = pOb; |
30 | }; |
31 | |
32 | int start(); |
33 | int stop(); |
34 | int pause(); |
35 | int resume(); |
36 | int ClearRxMessageBuffer(); |
37 | int processRefreshSrcDevice(int source_input); |
38 | int SendCustomMessage(int source_input, unsigned char data_buf[]); |
39 | int SendCustomMessageAndWaitReply(int source_input, unsigned char data_buf[], unsigned char reply_buf[], int WaitCmd, int timeout); |
40 | int SendBoradcastStandbyMessage(int source_input); |
41 | int SendGiveCECVersionMessage(int source_input, unsigned char data_buf[]); |
42 | int SendGiveDeviceVendorIDMessage(int source_input, unsigned char data_buf[]); |
43 | int SendGiveOSDNameMessage(int source_input, unsigned char data_buf[]); |
44 | int SendGivePhysicalAddressMessage(int source_input, int logic_addr, int *physical_addr); |
45 | int SendSetMenuLanguageMessage(int source_input, unsigned char data_buf[]); |
46 | int SendVendorRemoteKeyDownMessage(int source_input, unsigned char key_val); |
47 | int SendVendorRemoteKeyUpMessage(int source_input); |
48 | |
49 | |
50 | private: |
51 | int mModuleEnableFlag; |
52 | int mRequestPause; |
53 | int mState; |
54 | IHDMIRxCECObserver *mpObserver; |
55 | |
56 | bool threadLoop(); |
57 | int processData(int msg_cnt); |
58 | |
59 | int isAllowOperate(int source_input); |
60 | int GetModuleEnableFlag(); |
61 | int GetDeviceLogicAddr(int source_input); |
62 | int SendMessage(struct _cec_msg *msg); |
63 | int sendMessageAndWaitReply(struct _cec_msg *msg, struct _cec_msg *reply_msg, int WaitCmd, int timeout); |
64 | int GetMessage(struct _cec_msg *msg_list); |
65 | int rmFromRequestList(int index); |
66 | int addToRequestList(HDMIRxRequestReplyItem *reply_item); |
67 | int PrintMessage(const char *func_name, int data_type, struct _cec_msg *msg); |
68 | int ClrReplyListItem(HDMIRxRequestReplyItem *reply_item); |
69 | int CopyMessageData(unsigned char data_buf[], unsigned char msg_data[], int msg_len); |
70 | |
71 | int mSourceDevLogicAddrBuf[CC_SOURCE_DEV_REFRESH_CNT]; |
72 | int mSourceDevRefreshBuf[CC_SOURCE_DEV_REFRESH_CNT]; |
73 | |
74 | CCondition mPauseCondition; |
75 | mutable CMutex mLock; |
76 | mutable CMutex mListLock; |
77 | mutable CMutex mReplyLock[CC_REQUEST_LIST_SIZE]; |
78 | HDMIRxRequestReplyItem mReplyList[CC_REQUEST_LIST_SIZE]; |
79 | struct _cec_msg mMsgBuf[CC_REQUEST_LIST_SIZE]; |
80 | |
81 | enum RefreshState { |
82 | STATE_STOPED = 0, |
83 | STATE_RUNNING, |
84 | STATE_PAUSE, |
85 | STATE_FINISHED, |
86 | }; |
87 | }; |
88 | |
89 | #ifdef __cplusplus |
90 | //} |
91 | #endif |
92 | |
93 | #endif/*_C_HDMI_RX_CEC_H_*/ |
94 | |
95 |