Showing
1 changed file
with
25 additions
and
1 deletions
| ... | ... | @@ -26,9 +26,14 @@ import android.os.IBinder; |
| 26 | 26 | import android.os.RemoteException; |
| 27 | 27 | import android.util.Log; |
| 28 | 28 | |
| 29 | +import com.qnbar.smc.model.Light; | |
| 30 | +import com.qnbar.smc.model.Lights; | |
| 29 | 31 | import com.qnbar.smc.service.TelinkLightService; |
| 32 | +import com.telink.bluetooth.light.ConnectionStatus; | |
| 33 | +import com.telink.bluetooth.light.DeviceInfo; | |
| 30 | 34 | import com.xgimi.gimicinema.ICinemaControl; |
| 31 | 35 | import com.xgimi.gimicinema.ICinemaSMC; |
| 36 | +import com.xgimi.gimicinema.application.FangTangApplication; | |
| 32 | 37 | |
| 33 | 38 | import java.util.ArrayList; |
| 34 | 39 | import java.util.List; |
| ... | ... | @@ -78,6 +83,9 @@ public class CinemaControlService extends Service { |
| 78 | 83 | @Override |
| 79 | 84 | public void setCurrentStatus(int state) throws RemoteException { |
| 80 | 85 | Log.d("aidl", "setCurrentStatus: " + state); |
| 86 | + if (TelinkLightService.Instance() == null) { | |
| 87 | + return; | |
| 88 | + } | |
| 81 | 89 | if (state != currentState) { |
| 82 | 90 | currentState = state; |
| 83 | 91 | Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition); |
| ... | ... | @@ -171,13 +179,15 @@ public class CinemaControlService extends Service { |
| 171 | 179 | } |
| 172 | 180 | }; |
| 173 | 181 | |
| 182 | + private FangTangApplication mApplication; | |
| 183 | + | |
| 174 | 184 | @Override |
| 175 | 185 | public void onCreate() { |
| 176 | 186 | super.onCreate(); |
| 177 | 187 | if (!mBound) { |
| 178 | 188 | attemptToBindService(); |
| 179 | 189 | } |
| 180 | - | |
| 190 | + mApplication = (FangTangApplication) getApplication(); | |
| 181 | 191 | } |
| 182 | 192 | |
| 183 | 193 | @Override |
| ... | ... | @@ -260,11 +270,25 @@ public class CinemaControlService extends Service { |
| 260 | 270 | } |
| 261 | 271 | |
| 262 | 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 | 280 | value = 0; |
| 264 | 281 | handler.post(openRunnable); |
| 265 | 282 | } |
| 266 | 283 | |
| 267 | 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 | 292 | value = 50; |
| 269 | 293 | handler.post(closeRunnable); |
| 270 | 294 | } | ... | ... |
Please
register
or
login
to post a comment