Commit 2ecad10288f5198b3668562bcffa9d7c3af20653

Authored by jinyan.yi
1 parent 69ce3d85

代码调整

... ... @@ -412,8 +412,7 @@ public class SocketService1 extends BaseService {
412 412 * 处理服务器发送的命令
413 413 * @param socketResponse
414 414 */
415   - private void serverCommandDeal(MainResponse socketResponse)
416   - {
  415 + private void serverCommandDeal(MainResponse socketResponse) {
417 416 switch (socketResponse.getCmd())
418 417 {
419 418 case OPEN_DOOR://开门
... ... @@ -448,8 +447,7 @@ public class SocketService1 extends BaseService {
448 447
449 448 /*--命令处理-start-----------------------------------*/
450 449
451   - private void openDoor(OpenDoor openDoorResponse)
452   - {
  450 + private void openDoor(OpenDoor openDoorResponse) {
453 451 switch (openDoorResponse.getUser()) {
454 452 //10用户,20管理员,默认值为0
455 453 case 10:
... ... @@ -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 485 int volume = getAudioVolume()/6 + 1;
489 486 int lightStatus = 2;
490   -
491 487 int playStatus = 0;
  488 +
492 489 try {
493 490 playStatus = iPlayer.getCurrentStatus();
494 491 Log.d("ReportInfo","playStatus:"+playStatus);
495 492 } catch (RemoteException e) {
496 493 e.printStackTrace();
497 494 }
498   -
499 495 if( Lights.getInstance().getByMeshAddress(
500 496 ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status == ConnectionStatus.ON )
501 497 {
... ... @@ -517,8 +513,7 @@ public class SocketService1 extends BaseService {
517 513 Log.d("ReportInfo",msg);
518 514 }
519 515
520   - private void setLight(int op)
521   - {
  516 + private void setLight(int op) {
522 517 if (op == 1)//打开灯光
523 518 {
524 519 Log.d("setEqu","打开灯光");
... ... @@ -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 532 int status = -1;
539 533 try {
540 534 status = iPlayer.getCurrentStatus();
... ... @@ -552,16 +546,9 @@ public class SocketService1 extends BaseService {
552 546 Log.d("setEqu","暂停播放");
553 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 552 setLight(equc.getLightCtl());
566 553
567 554 playCtl(equc.getPlayCtl());
... ... @@ -574,16 +561,14 @@ public class SocketService1 extends BaseService {
574 561
575 562 /*--命令处理-end-----------------------------------*/
576 563
577   - private int getAudioVolume()
578   - {
  564 + private int getAudioVolume() {
579 565 AudioManager mAudioManager;
580 566 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
581 567 int current = mAudioManager.getStreamVolume( AudioManager.STREAM_MUSIC );
582 568 return current;
583 569 }
584 570
585   - private int setAudioVolume(int volume)
586   - {
  571 + private int setAudioVolume(int volume) {
587 572 AudioManager mAudioManager;
588 573 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
589 574 int now = getAudioVolume()/6;
... ...
... ... @@ -23,4 +23,12 @@ public class MainRequest {
23 23 public void setData(DataInfo data) {
24 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 52 public void setRoom_sn(String room_sn) {
53 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 49 private int currentState = 0;
50 50 private String currentPath = null;
51 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 53 private int saveBeat = SAVE_BEAT;
54 54
55 55 private final ICinemaControl.Stub cinemaControl = new ICinemaControl.Stub() {
... ... @@ -82,7 +82,7 @@ public class CinemaControlService extends Service {
82 82 if (!fadeOuting && Lights.getInstance().getByMeshAddress(
83 83 ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status
84 84 == ConnectionStatus.ON) {
85   -// fadeOut();
  85 + fadeOut();
86 86 }
87 87 } catch (Exception e) {
88 88 e.printStackTrace();
... ...
Please register or login to post a comment