Commit 3a4bb3ed3dc7ca9206ef71194796deaf2658b8fe

Authored by jinyan.yi
1 parent deaab96f

用户控制灯光渐变(新)

@@ -37,4 +37,8 @@ interface ICinemaControl { @@ -37,4 +37,8 @@ interface ICinemaControl {
37 List<String> getPlayList(); 37 List<String> getPlayList();
38 38
39 void setPlayList(in List<String> movies); 39 void setPlayList(in List<String> movies);
  40 +
  41 + void openLight();
  42 +
  43 + void closeLight();
40 } 44 }
@@ -622,27 +622,37 @@ public class SocketService1 extends BaseService { @@ -622,27 +622,37 @@ public class SocketService1 extends BaseService {
622 private void setLight(int op) { 622 private void setLight(int op) {
623 if (op == SERVER_CMD_OPEN_LIGHT) {//打开灯光 623 if (op == SERVER_CMD_OPEN_LIGHT) {//打开灯光
624 Log.d("setEqu", "打开灯光"); 624 Log.d("setEqu", "打开灯光");
625 - LightOperationUtils.open();  
626 - LightOperationUtils.setLightValue(5);  
627 - //延时增亮  
628 - Timer timer = new Timer();//实例化Timer类  
629 - timer.schedule(new TimerTask() {  
630 - public void run() {  
631 - LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));  
632 - this.cancel();  
633 - }  
634 - }, 2000);//毫秒 625 + try {
  626 + iPlayer.openLight();
  627 + } catch (RemoteException e) {
  628 + e.printStackTrace();
  629 + }
  630 +// LightOperationUtils.open();
  631 +// LightOperationUtils.setLightValue(5);
  632 +// //延时增亮
  633 +// Timer timer = new Timer();//实例化Timer类
  634 +// timer.schedule(new TimerTask() {
  635 +// public void run() {
  636 +// LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
  637 +// this.cancel();
  638 +// }
  639 +// }, 2000);//毫秒
635 } else if (op == SERVER_CMD_CLOSE_LIGHT) {//关闭灯光 640 } else if (op == SERVER_CMD_CLOSE_LIGHT) {//关闭灯光
636 Log.d("setEqu", "关闭灯光"); 641 Log.d("setEqu", "关闭灯光");
637 - LightOperationUtils.setLightValue(5);  
638 - //延时关闭  
639 - Timer timer = new Timer();//实例化Timer类  
640 - timer.schedule(new TimerTask() {  
641 - public void run() {  
642 - LightOperationUtils.close();  
643 - this.cancel();  
644 - }  
645 - }, 2000);//毫秒 642 + try {
  643 + iPlayer.closeLight();
  644 + } catch (RemoteException e) {
  645 + e.printStackTrace();
  646 + }
  647 +// LightOperationUtils.setLightValue(20);
  648 +// //延时关闭
  649 +// Timer timer = new Timer();//实例化Timer类
  650 +// timer.schedule(new TimerTask() {
  651 +// public void run() {
  652 +// LightOperationUtils.close();
  653 +// this.cancel();
  654 +// }
  655 +// }, 2000);//毫秒
646 } 656 }
647 } 657 }
648 658
@@ -173,6 +173,14 @@ public class CinemaControlService extends Service { @@ -173,6 +173,14 @@ public class CinemaControlService extends Service {
173 } 173 }
174 CinemaControlService.this.movies.addAll(movies); 174 CinemaControlService.this.movies.addAll(movies);
175 } 175 }
  176 +
  177 + public void openLight()throws RemoteException {
  178 + fadeIn();
  179 + }
  180 +
  181 + public void closeLight()throws RemoteException {
  182 + fadeOut();
  183 + }
176 }; 184 };
177 185
178 public CinemaControlService() { 186 public CinemaControlService() {
@@ -259,7 +267,7 @@ public class CinemaControlService extends Service { @@ -259,7 +267,7 @@ public class CinemaControlService extends Service {
259 private boolean fadeOuting = false; 267 private boolean fadeOuting = false;
260 private int maxValue = 50; 268 private int maxValue = 50;
261 269
262 - private void fadeIn() { 270 + public void fadeIn() {
263 DeviceInfo connectDevice = mApplication.getConnectDevice(); 271 DeviceInfo connectDevice = mApplication.getConnectDevice();
264 if (connectDevice == null) { 272 if (connectDevice == null) {
265 Log.d("aidl", "connect device is null"); 273 Log.d("aidl", "connect device is null");
@@ -288,7 +296,7 @@ public class CinemaControlService extends Service { @@ -288,7 +296,7 @@ public class CinemaControlService extends Service {
288 handler.post(openRunnable); 296 handler.post(openRunnable);
289 } 297 }
290 298
291 - private void fadeOut() { 299 + public void fadeOut() {
292 fadeOuting = true; 300 fadeOuting = true;
293 DeviceInfo connectDevice = mApplication.getConnectDevice(); 301 DeviceInfo connectDevice = mApplication.getConnectDevice();
294 if (connectDevice == null) { 302 if (connectDevice == null) {
Please register or login to post a comment