CEC: Refactor HdmiCecDefault class

Use class member variables instead of global variables
Remove struct keyword since it is redundant
Replace property_get_int32 usage with libbase API

Bug: 185434120
Test: manual
Change-Id: Ide477efd0f1d65bb684993aff783447adbe43aed
diff --git a/tv/cec/1.0/default/HdmiCecDefault.h b/tv/cec/1.0/default/HdmiCecDefault.h
index c1bb2c7..6b850ac 100644
--- a/tv/cec/1.0/default/HdmiCecDefault.h
+++ b/tv/cec/1.0/default/HdmiCecDefault.h
@@ -16,6 +16,8 @@
 
 #include <android/hardware/tv/cec/1.0/IHdmiCec.h>
 #include <hardware/hdmi_cec.h>
+#include <linux/cec.h>
+#include <thread>
 
 namespace android {
 namespace hardware {
@@ -24,7 +26,10 @@
 namespace V1_0 {
 namespace implementation {
 
-struct HdmiCecDefault : public IHdmiCec, public hidl_death_recipient {
+using std::thread;
+
+class HdmiCecDefault : public IHdmiCec, public hidl_death_recipient {
+  public:
     HdmiCecDefault();
     ~HdmiCecDefault();
     // Methods from ::android::hardware::tv::cec::V1_0::IHdmiCec follow.
@@ -47,11 +52,26 @@
 
     Return<Result> init();
     Return<void> release();
-    static void* event_thread(void*);
-    static int getOpcode(struct cec_msg message);
-    static bool isWakeupMessage(struct cec_msg message);
-};
 
+  private:
+    void event_thread();
+    static int getOpcode(cec_msg message);
+    static bool isWakeupMessage(cec_msg message);
+
+    thread mEventThread;
+
+    // When set to false, all the CEC commands are discarded. True by default after initialization.
+    bool mCecEnabled;
+    /*
+     * When set to false, HAL does not wake up the system upon receiving <Image View On> or
+     * <Text View On>. True by default after initialization.
+     */
+    bool mWakeupEnabled;
+    sp<IHdmiCecCallback> mCallback;
+
+    int mCecFd;
+    int mExitFd;
+};
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace cec