Commit 2ecad10288f5198b3668562bcffa9d7c3af20653

Authored by jinyan.yi
1 parent 69ce3d85

代码调整

@@ -412,8 +412,7 @@ public class SocketService1 extends BaseService { @@ -412,8 +412,7 @@ public class SocketService1 extends BaseService {
412 * 处理服务器发送的命令 412 * 处理服务器发送的命令
413 * @param socketResponse 413 * @param socketResponse
414 */ 414 */
415 - private void serverCommandDeal(MainResponse socketResponse)  
416 - { 415 + private void serverCommandDeal(MainResponse socketResponse) {
417 switch (socketResponse.getCmd()) 416 switch (socketResponse.getCmd())
418 { 417 {
419 case OPEN_DOOR://开门 418 case OPEN_DOOR://开门
@@ -448,8 +447,7 @@ public class SocketService1 extends BaseService { @@ -448,8 +447,7 @@ public class SocketService1 extends BaseService {
448 447
449 /*--命令处理-start-----------------------------------*/ 448 /*--命令处理-start-----------------------------------*/
450 449
451 - private void openDoor(OpenDoor openDoorResponse)  
452 - { 450 + private void openDoor(OpenDoor openDoorResponse) {
453 switch (openDoorResponse.getUser()) { 451 switch (openDoorResponse.getUser()) {
454 //10用户,20管理员,默认值为0 452 //10用户,20管理员,默认值为0
455 case 10: 453 case 10:
@@ -482,20 +480,18 @@ public class SocketService1 extends BaseService { @@ -482,20 +480,18 @@ public class SocketService1 extends BaseService {
482 } 480 }
483 } 481 }
484 482
485 - private void reportEquStatus(String serverId)  
486 - { 483 + private void reportEquStatus(String serverId) {
487 //填充返回数据 484 //填充返回数据
488 int volume = getAudioVolume()/6 + 1; 485 int volume = getAudioVolume()/6 + 1;
489 int lightStatus = 2; 486 int lightStatus = 2;
490 -  
491 int playStatus = 0; 487 int playStatus = 0;
  488 +
492 try { 489 try {
493 playStatus = iPlayer.getCurrentStatus(); 490 playStatus = iPlayer.getCurrentStatus();
494 Log.d("ReportInfo","playStatus:"+playStatus); 491 Log.d("ReportInfo","playStatus:"+playStatus);
495 } catch (RemoteException e) { 492 } catch (RemoteException e) {
496 e.printStackTrace(); 493 e.printStackTrace();
497 } 494 }
498 -  
499 if( Lights.getInstance().getByMeshAddress( 495 if( Lights.getInstance().getByMeshAddress(
500 ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status == ConnectionStatus.ON ) 496 ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status == ConnectionStatus.ON )
501 { 497 {
@@ -517,8 +513,7 @@ public class SocketService1 extends BaseService { @@ -517,8 +513,7 @@ public class SocketService1 extends BaseService {
517 Log.d("ReportInfo",msg); 513 Log.d("ReportInfo",msg);
518 } 514 }
519 515
520 - private void setLight(int op)  
521 - { 516 + private void setLight(int op) {
522 if (op == 1)//打开灯光 517 if (op == 1)//打开灯光
523 { 518 {
524 Log.d("setEqu","打开灯光"); 519 Log.d("setEqu","打开灯光");
@@ -533,8 +528,7 @@ public class SocketService1 extends BaseService { @@ -533,8 +528,7 @@ public class SocketService1 extends BaseService {
533 } 528 }
534 } 529 }
535 530
536 - private void playCtl(int op)  
537 - { 531 + private void playCtl(int op) {
538 int status = -1; 532 int status = -1;
539 try { 533 try {
540 status = iPlayer.getCurrentStatus(); 534 status = iPlayer.getCurrentStatus();
@@ -552,16 +546,9 @@ public class SocketService1 extends BaseService { @@ -552,16 +546,9 @@ public class SocketService1 extends BaseService {
552 Log.d("setEqu","暂停播放"); 546 Log.d("setEqu","暂停播放");
553 ShellUtils.execCommand("input keyevent 23", false); 547 ShellUtils.execCommand("input keyevent 23", false);
554 } 548 }
555 -  
556 - try {  
557 - status = iPlayer.getCurrentStatus();  
558 - } catch (RemoteException e) {  
559 - e.printStackTrace();  
560 - }  
561 } 549 }
562 550
563 - private void setEquipmentStatus(EquipmentControl equc)  
564 - { 551 + private void setEquipmentStatus(EquipmentControl equc) {
565 setLight(equc.getLightCtl()); 552 setLight(equc.getLightCtl());
566 553
567 playCtl(equc.getPlayCtl()); 554 playCtl(equc.getPlayCtl());
@@ -574,16 +561,14 @@ public class SocketService1 extends BaseService { @@ -574,16 +561,14 @@ public class SocketService1 extends BaseService {
574 561
575 /*--命令处理-end-----------------------------------*/ 562 /*--命令处理-end-----------------------------------*/
576 563
577 - private int getAudioVolume()  
578 - { 564 + private int getAudioVolume() {
579 AudioManager mAudioManager; 565 AudioManager mAudioManager;
580 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); 566 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
581 int current = mAudioManager.getStreamVolume( AudioManager.STREAM_MUSIC ); 567 int current = mAudioManager.getStreamVolume( AudioManager.STREAM_MUSIC );
582 return current; 568 return current;
583 } 569 }
584 570
585 - private int setAudioVolume(int volume)  
586 - { 571 + private int setAudioVolume(int volume) {
587 AudioManager mAudioManager; 572 AudioManager mAudioManager;
588 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); 573 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
589 int now = getAudioVolume()/6; 574 int now = getAudioVolume()/6;
@@ -23,4 +23,12 @@ public class MainRequest { @@ -23,4 +23,12 @@ public class MainRequest {
23 public void setData(DataInfo data) { 23 public void setData(DataInfo data) {
24 this.data = data; 24 this.data = data;
25 } 25 }
  26 +
  27 + @Override
  28 + public String toString() {
  29 + return "MainRequest{" +
  30 + "cmd=" + cmd +
  31 + ", data=" + data +
  32 + '}';
  33 + }
26 } 34 }
@@ -52,4 +52,15 @@ public class EquipmentStatus extends DataInfo { @@ -52,4 +52,15 @@ public class EquipmentStatus extends DataInfo {
52 public void setRoom_sn(String room_sn) { 52 public void setRoom_sn(String room_sn) {
53 this.room_sn = room_sn; 53 this.room_sn = room_sn;
54 } 54 }
  55 +
  56 + @Override
  57 + public String toString() {
  58 + return "EquipmentStatus{" +
  59 + "volume=" + volume +
  60 + ", lightStatus=" + lightStatus +
  61 + ", playStatus=" + playStatus +
  62 + ", serverId='" + serverId + '\'' +
  63 + ", room_sn='" + room_sn + '\'' +
  64 + '}';
  65 + }
55 } 66 }
@@ -49,7 +49,7 @@ public class CinemaControlService extends Service { @@ -49,7 +49,7 @@ public class CinemaControlService extends Service {
49 private int currentState = 0; 49 private int currentState = 0;
50 private String currentPath = null; 50 private String currentPath = null;
51 // private static final int SAVE_BEAT = 500; 51 // private static final int SAVE_BEAT = 500;
52 - private static final int SAVE_BEAT = 100;//default 500 52 + private static final int SAVE_BEAT = 50;//default 50
53 private int saveBeat = SAVE_BEAT; 53 private int saveBeat = SAVE_BEAT;
54 54
55 private final ICinemaControl.Stub cinemaControl = new ICinemaControl.Stub() { 55 private final ICinemaControl.Stub cinemaControl = new ICinemaControl.Stub() {
@@ -82,7 +82,7 @@ public class CinemaControlService extends Service { @@ -82,7 +82,7 @@ public class CinemaControlService extends Service {
82 if (!fadeOuting && Lights.getInstance().getByMeshAddress( 82 if (!fadeOuting && Lights.getInstance().getByMeshAddress(
83 ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status 83 ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status
84 == ConnectionStatus.ON) { 84 == ConnectionStatus.ON) {
85 -// fadeOut(); 85 + fadeOut();
86 } 86 }
87 } catch (Exception e) { 87 } catch (Exception e) {
88 e.printStackTrace(); 88 e.printStackTrace();
Please register or login to post a comment