|
...
|
...
|
@@ -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;
|
...
|
...
|
|