Commit 794ca6f65f91a632f2e012b84803892e273ccbc6

Authored by jinyan.yi
1 parent 56d0caf2

.

... ... @@ -11,6 +11,7 @@ import android.os.RemoteException;
11 11 import android.text.TextUtils;
12 12 import android.util.Log;
13 13 import android.widget.Toast;
  14 +
14 15 import com.gimi.common.cinema.model.MessageEvent;
15 16 import com.gimi.common.cinema.model.RoomInfo;
16 17 import com.gimi.common.cinema.utils.ActivityCollector;
... ... @@ -36,6 +37,7 @@ import com.xgimi.gimicinema.activity.QrCodeShowActivity;
36 37 import com.xgimi.gimicinema.application.FangTangApplication;
37 38 import com.xgimi.gimicinema.service.CinemaControlService;
38 39 import com.xgimi.smartscreen.encrypt.AuthCode;
  40 +
39 41 import org.greenrobot.eventbus.EventBus;
40 42
41 43 import java.io.IOException;
... ... @@ -415,11 +417,11 @@ public class SocketService1 extends BaseService {
415 417
416 418 /**
417 419 * 处理服务器发送的命令
  420 + *
418 421 * @param socketResponse
419 422 */
420 423 private void serverCommandDeal(MainResponse socketResponse) {
421   - switch (socketResponse.getCmd())
422   - {
  424 + switch (socketResponse.getCmd()) {
423 425 case OPEN_DOOR://开门
424 426 if (socketResponse.getData() != null) {
425 427 OpenDoor openDoorResponse = gson.fromJson(socketResponse.getData(), OpenDoor.class);
... ... @@ -435,7 +437,7 @@ public class SocketService1 extends BaseService {
435 437 break;
436 438
437 439 case REPORT_EQU_STATUS://获取声音,灯光,播放暂停状态
438   - Log.d("ReportInfo","收到上报命令");
  440 + Log.d("ReportInfo", "收到上报命令");
439 441 //获取serverId
440 442 ReportEquStatus rps = gson.fromJson(socketResponse.getData(), ReportEquStatus.class);
441 443 // String serverId = rps.getServerId();
... ... @@ -443,7 +445,7 @@ public class SocketService1 extends BaseService {
443 445 break;
444 446
445 447 case SET_EQU_STATUS://设置声音,灯光,播放暂停
446   - Log.d("ReportInfo","收到控制命令:"+socketResponse.getData());
  448 + Log.d("ReportInfo", "收到控制命令:" + socketResponse.getData());
447 449 EquipmentControl equc = gson.fromJson(socketResponse.getData(), EquipmentControl.class);
448 450 setEquipmentStatus(equc);
449 451 break;
... ... @@ -487,19 +489,19 @@ public class SocketService1 extends BaseService {
487 489
488 490 private void reportEquStatus(String serverId) {
489 491 //填充返回数据
490   - int volume = getAudioVolume()/6 + 1;
  492 + int volume = getAudioVolume() / 6 + 1;
491 493 int lightStatus = 2;
492 494 int playStatus = 0;
493 495
494 496 try {
495 497 playStatus = iPlayer.getCurrentStatus();
496   - Log.d("ReportInfo","playStatus:"+playStatus);
  498 + Log.d("ReportInfo", "playStatus:" + playStatus);
497 499 } catch (RemoteException e) {
498 500 e.printStackTrace();
499 501 }
500   - if( Lights.getInstance().getByMeshAddress(
501   - ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status == ConnectionStatus.ON )
502   - {
  502 + if (Lights.getInstance().getByMeshAddress(
  503 + ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status
  504 + == ConnectionStatus.ON) {
503 505 lightStatus = 1;
504 506 }
505 507
... ... @@ -515,19 +517,16 @@ public class SocketService1 extends BaseService {
515 517 rep.setData(equStatus);
516 518 String msg = gson.toJson(rep) + END_SYMBOL;
517 519 sendMsg(msg);
518   - Log.d("ReportInfo",msg);
  520 + Log.d("ReportInfo", msg);
519 521 }
520 522
521 523 private void setLight(int op) {
522   - if (op == 1)//打开灯光
523   - {
524   - Log.d("setEqu","打开灯光");
  524 + if (op == 1) {//打开灯光
  525 + Log.d("setEqu", "打开灯光");
525 526 LightOperationUtils.open();
526 527 LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
527   - }
528   - else if(op == 2)//关闭灯光
529   - {
530   - Log.d("setEqu","关闭灯光");
  528 + } else if (op == 2) {//关闭灯光
  529 + Log.d("setEqu", "关闭灯光");
531 530 LightOperationUtils.setLightValue(5);
532 531 LightOperationUtils.close();
533 532 }
... ... @@ -541,14 +540,11 @@ public class SocketService1 extends BaseService {
541 540 e.printStackTrace();
542 541 }
543 542
544   - if (op == 1 && status == 2)
545   - {
546   - Log.d("setEqu","开始播放");
  543 + if (op == 1 && status == 2) {
  544 + Log.d("setEqu", "开始播放");
547 545 ShellUtils.execCommand("input keyevent 23", false);
548   - }
549   - else if (op == 2 && status == 1)
550   - {
551   - Log.d("setEqu","暂停播放");
  546 + } else if (op == 2 && status == 1) {
  547 + Log.d("setEqu", "暂停播放");
552 548 ShellUtils.execCommand("input keyevent 23", false);
553 549 }
554 550 }
... ... @@ -569,46 +565,38 @@ public class SocketService1 extends BaseService {
569 565 private int getAudioVolume() {
570 566 AudioManager mAudioManager;
571 567 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
572   - int current = mAudioManager.getStreamVolume( AudioManager.STREAM_MUSIC );
  568 + int current = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
573 569 return current;
574 570 }
575 571
576 572 private int setAudioVolume(int volume) {
577 573 AudioManager mAudioManager;
578 574 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
579   - int now = getAudioVolume()/6;
  575 + int now = getAudioVolume() / 6;
580 576
581   - if (volume == 0)
582   - {
  577 + if (volume == 0) {
583 578 return now;
584   - }
585   - else
586   - {
  579 + } else {
587 580 volume--;
588 581 }
589 582
590   - if (volume > now)//加音量
591   - {
592   - Log.d("setEqu","加音量"+now+":"+volume);
593   - while(now < volume)
594   - {
  583 + if (volume > now) {//加音量
  584 + Log.d("setEqu", "加音量" + now + ":" + volume);
  585 + while (now < volume) {
595 586 mAudioManager.adjustStreamVolume(
596 587 AudioManager.STREAM_MUSIC,
597 588 AudioManager.ADJUST_RAISE,
598 589 AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
599   - now ++;
  590 + now++;
600 591 }
601   - }
602   - else if(volume < now)//减音量
603   - {
604   - Log.d("setEqu","减音量"+now+":"+volume);
605   - while(now > volume)
606   - {
  592 + } else if (volume < now) {//减音量
  593 + Log.d("setEqu", "减音量" + now + ":" + volume);
  594 + while (now > volume) {
607 595 mAudioManager.adjustStreamVolume(
608 596 AudioManager.STREAM_MUSIC,
609 597 AudioManager.ADJUST_LOWER,
610 598 AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
611   - now --;
  599 + now--;
612 600 }
613 601 }
614 602
... ... @@ -622,6 +610,8 @@ public class SocketService1 extends BaseService {
622 610 }
623 611
624 612 public void onServiceDisconnected(ComponentName className) {
625   - };
  613 + }
  614 +
  615 + ;
626 616 };
627 617 }
\ No newline at end of file
... ...
... ... @@ -4,5 +4,4 @@ package com.qnbar.smc.soketProtocol;
4 4 * Created by jinyan.yi on 2017/5/23.
5 5 */
6 6
7   -public abstract class DataInfo {
8   -}
  7 +public abstract class DataInfo {}
... ...
Please register or login to post a comment