Index: device/vr/android/gvr/gvr_device.cc |
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc |
index f3eebd59c73aa5acbea725c52c065e584428d15d..b6003218477150e6919adbd5b3e1c256d6d25f1b 100644 |
--- a/device/vr/android/gvr/gvr_device.cc |
+++ b/device/vr/android/gvr/gvr_device.cc |
@@ -24,7 +24,10 @@ static const uint64_t kPredictionTimeWithoutVsyncNanos = 50000000; |
} // namespace |
GvrDevice::GvrDevice(VRDeviceProvider* provider, GvrDelegate* delegate) |
- : VRDevice(provider), delegate_(delegate) {} |
+ : VRDevice(provider), |
+ delegate_(delegate), |
+ isConnected_(false), |
+ isConnectionStatusChanged_(false) {} |
GvrDevice::~GvrDevice() {} |
@@ -163,4 +166,19 @@ void GvrDevice::UpdateLayerBounds(VRLayerBoundsPtr leftBounds, |
rightBounds->width, rightBounds->height); |
} |
+// It will poll status from device and resolve it. |
+void GvrDevice::PollEvents(VRClientDispatcher* client) { |
+ if (isConnectionStatusChanged_) { |
+ client->OnDeviceConnectionStatusChanged(this, isConnected_); |
bajones
2016/09/09 05:53:00
Let's call this in UpdateConnectionStatus and avoi
|
+ isConnectionStatusChanged_ = false; |
+ } |
+} |
+ |
+void GvrDevice::UpdateConnectionStatus(bool isConnected) { |
+ if (isConnected_ != isConnected) { |
+ isConnected_ = isConnected; |
+ isConnectionStatusChanged_ = true; |
+ } |
+} |
+ |
} // namespace device |