Commit f5b409f93cabba9c15b74f2e3e1de1b8095abec3

Authored by Penley
1 parent e7d962d3

charge current status

@@ -26,9 +26,14 @@ import android.os.IBinder; @@ -26,9 +26,14 @@ import android.os.IBinder;
26 import android.os.RemoteException; 26 import android.os.RemoteException;
27 import android.util.Log; 27 import android.util.Log;
28 28
  29 +import com.qnbar.smc.model.Light;
  30 +import com.qnbar.smc.model.Lights;
29 import com.qnbar.smc.service.TelinkLightService; 31 import com.qnbar.smc.service.TelinkLightService;
  32 +import com.telink.bluetooth.light.ConnectionStatus;
  33 +import com.telink.bluetooth.light.DeviceInfo;
30 import com.xgimi.gimicinema.ICinemaControl; 34 import com.xgimi.gimicinema.ICinemaControl;
31 import com.xgimi.gimicinema.ICinemaSMC; 35 import com.xgimi.gimicinema.ICinemaSMC;
  36 +import com.xgimi.gimicinema.application.FangTangApplication;
32 37
33 import java.util.ArrayList; 38 import java.util.ArrayList;
34 import java.util.List; 39 import java.util.List;
@@ -78,6 +83,9 @@ public class CinemaControlService extends Service { @@ -78,6 +83,9 @@ public class CinemaControlService extends Service {
78 @Override 83 @Override
79 public void setCurrentStatus(int state) throws RemoteException { 84 public void setCurrentStatus(int state) throws RemoteException {
80 Log.d("aidl", "setCurrentStatus: " + state); 85 Log.d("aidl", "setCurrentStatus: " + state);
  86 + if (TelinkLightService.Instance() == null) {
  87 + return;
  88 + }
81 if (state != currentState) { 89 if (state != currentState) {
82 currentState = state; 90 currentState = state;
83 Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition); 91 Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition);
@@ -171,13 +179,15 @@ public class CinemaControlService extends Service { @@ -171,13 +179,15 @@ public class CinemaControlService extends Service {
171 } 179 }
172 }; 180 };
173 181
  182 + private FangTangApplication mApplication;
  183 +
174 @Override 184 @Override
175 public void onCreate() { 185 public void onCreate() {
176 super.onCreate(); 186 super.onCreate();
177 if (!mBound) { 187 if (!mBound) {
178 attemptToBindService(); 188 attemptToBindService();
179 } 189 }
180 - 190 + mApplication = (FangTangApplication) getApplication();
181 } 191 }
182 192
183 @Override 193 @Override
@@ -260,11 +270,25 @@ public class CinemaControlService extends Service { @@ -260,11 +270,25 @@ public class CinemaControlService extends Service {
260 } 270 }
261 271
262 private void fadeIn() { 272 private void fadeIn() {
  273 + DeviceInfo connectDevice = mApplication.getConnectDevice();
  274 + Light byMeshAddress = Lights.getInstance().getByMeshAddress(connectDevice.meshAddress);
  275 + if (byMeshAddress.status == ConnectionStatus.ON) {
  276 + return;
  277 + }
  278 +// int status = mApplication.getConnectDevice().status;
  279 +// Log.d("status_charge", "fadeIn: " + status);
263 value = 0; 280 value = 0;
264 handler.post(openRunnable); 281 handler.post(openRunnable);
265 } 282 }
266 283
267 private void fadeOut() { 284 private void fadeOut() {
  285 + DeviceInfo connectDevice = mApplication.getConnectDevice();
  286 + Light byMeshAddress = Lights.getInstance().getByMeshAddress(connectDevice.meshAddress);
  287 + if (byMeshAddress.status == ConnectionStatus.OFF) {
  288 + return;
  289 + }
  290 +// int status = connectDevice.status;
  291 +// Log.d("status_charge", "fadeOut: " + status);
268 value = 50; 292 value = 50;
269 handler.post(closeRunnable); 293 handler.post(closeRunnable);
270 } 294 }
Please register or login to post a comment