Commit 69ce3d85344635057cdf49b82a4da3c96b7b613d

Authored by jinyan.yi
1 parent 55b014ef

投影控制

1 package com.qnbar.smc.service; 1 package com.qnbar.smc.service;
2 2
  3 +import android.content.ComponentName;
3 import android.content.Context; 4 import android.content.Context;
4 import android.content.Intent; 5 import android.content.Intent;
  6 +import android.content.ServiceConnection;
  7 +import android.media.AudioManager;
5 import android.os.Handler; 8 import android.os.Handler;
6 import android.os.IBinder; 9 import android.os.IBinder;
  10 +import android.os.RemoteException;
7 import android.text.TextUtils; 11 import android.text.TextUtils;
8 import android.util.Log; 12 import android.util.Log;
9 import android.widget.Toast; 13 import android.widget.Toast;
10 import com.gimi.common.cinema.model.MessageEvent; 14 import com.gimi.common.cinema.model.MessageEvent;
11 import com.gimi.common.cinema.model.RoomInfo; 15 import com.gimi.common.cinema.model.RoomInfo;
12 import com.gimi.common.cinema.utils.ActivityCollector; 16 import com.gimi.common.cinema.utils.ActivityCollector;
  17 +import com.gimi.common.cinema.utils.ShellUtils;
13 import com.gimi.common.cinema.utils.SystemUtils; 18 import com.gimi.common.cinema.utils.SystemUtils;
14 import com.gimi.common.cinema.utils.Utils; 19 import com.gimi.common.cinema.utils.Utils;
15 import com.google.gson.Gson; 20 import com.google.gson.Gson;
16 import com.google.gson.JsonSyntaxException; 21 import com.google.gson.JsonSyntaxException;
  22 +import com.qnbar.smc.model.Lights;
  23 +import com.qnbar.smc.soketProtocol.fromServer.EquipmentControl;
  24 +import com.qnbar.smc.soketProtocol.toServer.EquipmentStatus;
  25 +import com.qnbar.smc.soketProtocol.MainRequest;
  26 +import com.qnbar.smc.soketProtocol.MainResponse;
  27 +import com.qnbar.smc.soketProtocol.fromServer.OpenDoor;
  28 +import com.qnbar.smc.soketProtocol.fromServer.ReportEquStatus;
17 import com.qnbar.smc.utils.LightOperationUtils; 29 import com.qnbar.smc.utils.LightOperationUtils;
  30 +import com.telink.bluetooth.light.ConnectionStatus;
  31 +import com.xgimi.gimicinema.ICinemaControl;
18 import com.xgimi.gimicinema.activity.MainActivity; 32 import com.xgimi.gimicinema.activity.MainActivity;
19 import com.xgimi.gimicinema.activity.QrCodeShowActivity; 33 import com.xgimi.gimicinema.activity.QrCodeShowActivity;
20 import com.xgimi.gimicinema.application.FangTangApplication; 34 import com.xgimi.gimicinema.application.FangTangApplication;
  35 +import com.xgimi.gimicinema.service.CinemaControlService;
21 import com.xgimi.smartscreen.encrypt.AuthCode; 36 import com.xgimi.smartscreen.encrypt.AuthCode;
22 import org.greenrobot.eventbus.EventBus; 37 import org.greenrobot.eventbus.EventBus;
23 38
@@ -65,11 +80,15 @@ public class SocketService1 extends BaseService { @@ -65,11 +80,15 @@ public class SocketService1 extends BaseService {
65 private static final int ROOM_SN_CONNECTED = 10010;//room_sn 已连接,不能再连接 80 private static final int ROOM_SN_CONNECTED = 10010;//room_sn 已连接,不能再连接
66 private static final int OPEN_DOOR = 50001;//开门命令 81 private static final int OPEN_DOOR = 50001;//开门命令
67 private static final int CLEAN_OVER = 50002;// 82 private static final int CLEAN_OVER = 50002;//
  83 + private static final int REPORT_EQU_STATUS = 50003;//返回设备状态信息
  84 + private static final int SET_EQU_STATUS = 50004;//返回设备状态信息
68 85
69 private static final int ROOM_HAS_REGISTERED = 1001; 86 private static final int ROOM_HAS_REGISTERED = 1001;
70 private static final int ROOM_NOT_EXIST_M = 1002; 87 private static final int ROOM_NOT_EXIST_M = 1002;
71 private static final int HEAT_BEAT_RTN = 1003; 88 private static final int HEAT_BEAT_RTN = 1003;
72 89
  90 + private static final int CMD_REPORT_EQU_STATUS = 20030;//上报设备状态信息
  91 +
73 // online 92 // online
74 public static final String SERVER_HOST_ONLINE = "conn.ft.qnbar.com";// "192.168.1.21";// 93 public static final String SERVER_HOST_ONLINE = "conn.ft.qnbar.com";// "192.168.1.21";//
75 public static final int SERVER_PORT_ONLINE = 8899; 94 public static final int SERVER_PORT_ONLINE = 8899;
@@ -91,6 +110,7 @@ public class SocketService1 extends BaseService { @@ -91,6 +110,7 @@ public class SocketService1 extends BaseService {
91 110
92 private ReadThread mReadThread; 111 private ReadThread mReadThread;
93 private Gson gson; 112 private Gson gson;
  113 + ICinemaControl iPlayer;
94 114
95 private WeakReference<Socket> mSocket; 115 private WeakReference<Socket> mSocket;
96 // For heart Beat 116 // For heart Beat
@@ -141,6 +161,9 @@ public class SocketService1 extends BaseService { @@ -141,6 +161,9 @@ public class SocketService1 extends BaseService {
141 gson = new Gson(); 161 gson = new Gson();
142 context = this; 162 context = this;
143 Log.d(TAG, "onCreate"); 163 Log.d(TAG, "onCreate");
  164 +
  165 + bindService(new Intent(SocketService1.this, CinemaControlService.class), conn, Context.BIND_AUTO_CREATE);
  166 + startService(new Intent(SocketService1.this, CinemaControlService.class));
144 } 167 }
145 168
146 @Override 169 @Override
@@ -295,7 +318,8 @@ public class SocketService1 extends BaseService { @@ -295,7 +318,8 @@ public class SocketService1 extends BaseService {
295 if (message.endsWith(END_SYMBOL)) { 318 if (message.endsWith(END_SYMBOL)) {
296 message = message.replace(END_SYMBOL, ""); 319 message = message.replace(END_SYMBOL, "");
297 } 320 }
298 - SocketResponse socketResponse = gson.fromJson(message, SocketResponse.class); 321 +// SocketResponse socketResponse = gson.fromJson(message, SocketResponse.class);
  322 + MainResponse socketResponse = gson.fromJson(message, MainResponse.class);
299 switch (socketResponse.getCode()) { 323 switch (socketResponse.getCode()) {
300 case SUCCESS_MESSAGE: 324 case SUCCESS_MESSAGE:
301 Log.d(TAG, "SUCCESS_MESSAGE"); 325 Log.d(TAG, "SUCCESS_MESSAGE");
@@ -336,55 +360,20 @@ public class SocketService1 extends BaseService { @@ -336,55 +360,20 @@ public class SocketService1 extends BaseService {
336 break; 360 break;
337 case RETURN_VERIFY_CODE: 361 case RETURN_VERIFY_CODE:
338 Log.d(TAG, "RETURN_VERIFY_CODE"); 362 Log.d(TAG, "RETURN_VERIFY_CODE");
339 - if (!TextUtils.isEmpty(socketResponse.getData().getVerify())) {  
340 - String verifyMsg = AuthCode.getDecodeStr(socketResponse.getData().getVerify());  
341 - SocketSendMsg ssm = new SocketSendMsg().contractVerifyMsg(testRoomSn, verifyMsg);  
342 - String msg = gson.toJson(ssm) + END_SYMBOL;  
343 - sendMsg(msg); 363 + if (!TextUtils.isEmpty(socketResponse.getData())) {
  364 + OpenDoor openDoorResponse = gson.fromJson(socketResponse.getData(), OpenDoor.class);
  365 +
  366 + if (!TextUtils.isEmpty(openDoorResponse.getVerify())) {
  367 + String verifyMsg = AuthCode.getDecodeStr(openDoorResponse.getVerify());
  368 + SocketSendMsg ssm = new SocketSendMsg().contractVerifyMsg(testRoomSn, verifyMsg);
  369 + String msg = gson.toJson(ssm) + END_SYMBOL;
  370 + sendMsg(msg);
  371 + }
344 } 372 }
345 break; 373 break;
346 case CONTAIN_MESSAGE: 374 case CONTAIN_MESSAGE:
347 Log.d(TAG, "CONTAIN_MESSAGE"); 375 Log.d(TAG, "CONTAIN_MESSAGE");
348 - if (socketResponse.getData() != null) {  
349 - if (socketResponse.getCmd() == OPEN_DOOR) {  
350 - switch (socketResponse.getData().getUser()) {  
351 - //10用户,20管理员,默认值为0  
352 - case 10:  
353 - new SystemUtils().openFtLed(context.getApplicationContext());  
354 - if (TextUtils.isEmpty(((FangTangApplication) getApplication()).getCurrentPlayUrl())) {  
355 - LightOperationUtils.open();  
356 - LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));  
357 - }  
358 - sendMessage(QrCodeShowActivity.KILL_SELF, "finish the QR CODE activity when new user come in");  
359 - if (socketResponse.getData().getFirst() == 1) {  
360 - sendMessage(USER_OPEN_DOOR_AND_GET_MOVIE, "user first open the door");  
361 - } else {  
362 - sendMessage(USER_OPEN_DOOR, "user open the door");  
363 - }  
364 - break;  
365 - case 20:  
366 - if (TextUtils.isEmpty(((FangTangApplication) getApplication()).getCurrentPlayUrl())) {  
367 - Log.d("LightOperationUtils", "admin open light");  
368 - LightOperationUtils.open();  
369 - LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));  
370 - }  
371 - sendMessage(JUST_OPEN_DOOR, "administrator open the door");  
372 - break;  
373 - case 0:  
374 - sendMessage(JUST_OPEN_DOOR, "get zero none user or administrator open the door");  
375 - break;  
376 - default:  
377 - sendMessage(JUST_OPEN_DOOR, "none user or administrator open the door");  
378 - break;  
379 - }  
380 - } else if (socketResponse.getCmd() == CLEAN_OVER) {  
381 - Log.d("LightOperationUtils", "admin clean over close light");  
382 - LightOperationUtils.setLightValue(5);  
383 - LightOperationUtils.close();  
384 - new SystemUtils().closeFtLed(context.getApplicationContext());  
385 - sendMessage(QrCodeShowActivity.KILL_SELF, "finish the QR CODE activity when clean over");  
386 - }  
387 - } 376 + serverCommandDeal(socketResponse);
388 break; 377 break;
389 default: 378 default:
390 Log.d(TAG, "default msg:" + socketResponse.toString()); 379 Log.d(TAG, "default msg:" + socketResponse.toString());
@@ -418,4 +407,231 @@ public class SocketService1 extends BaseService { @@ -418,4 +407,231 @@ public class SocketService1 extends BaseService {
418 Log.d(TAG, "socket service destroy"); 407 Log.d(TAG, "socket service destroy");
419 super.onDestroy(); 408 super.onDestroy();
420 } 409 }
  410 +
  411 + /**
  412 + * 处理服务器发送的命令
  413 + * @param socketResponse
  414 + */
  415 + private void serverCommandDeal(MainResponse socketResponse)
  416 + {
  417 + switch (socketResponse.getCmd())
  418 + {
  419 + case OPEN_DOOR://开门
  420 + if (socketResponse.getData() != null) {
  421 + OpenDoor openDoorResponse = gson.fromJson(socketResponse.getData(), OpenDoor.class);
  422 + openDoor(openDoorResponse);
  423 + }
  424 + break;
  425 + case CLEAN_OVER://清洁完成处理
  426 + Log.d("LightOperationUtils", "admin clean over close light");
  427 + LightOperationUtils.setLightValue(5);
  428 + LightOperationUtils.close();
  429 + new SystemUtils().closeFtLed(context.getApplicationContext());
  430 + sendMessage(QrCodeShowActivity.KILL_SELF, "finish the QR CODE activity when clean over");
  431 + break;
  432 +
  433 + case REPORT_EQU_STATUS://获取声音,灯光,播放暂停状态
  434 + Log.d("ReportInfo","收到上报命令");
  435 + //获取serverId
  436 + ReportEquStatus rps = gson.fromJson(socketResponse.getData(), ReportEquStatus.class);
  437 +// String serverId = rps.getServerId();
  438 + reportEquStatus(rps.getServerId());
  439 + break;
  440 +
  441 + case SET_EQU_STATUS://设置声音,灯光,播放暂停
  442 + Log.d("ReportInfo","收到控制命令:"+socketResponse.getData());
  443 + EquipmentControl equc = gson.fromJson(socketResponse.getData(), EquipmentControl.class);
  444 + setEquipmentStatus(equc);
  445 + break;
  446 + }
  447 + }
  448 +
  449 +/*--命令处理-start-----------------------------------*/
  450 +
  451 + private void openDoor(OpenDoor openDoorResponse)
  452 + {
  453 + switch (openDoorResponse.getUser()) {
  454 + //10用户,20管理员,默认值为0
  455 + case 10:
  456 + new SystemUtils().openFtLed(context.getApplicationContext());
  457 + if (TextUtils.isEmpty(((FangTangApplication) getApplication()).getCurrentPlayUrl())) {
  458 + LightOperationUtils.open();
  459 + LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
  460 + }
  461 + sendMessage(QrCodeShowActivity.KILL_SELF, "finish the QR CODE activity when new user come in");
  462 + if (openDoorResponse.getFirst() == 1) {
  463 + sendMessage(USER_OPEN_DOOR_AND_GET_MOVIE, "user first open the door");
  464 + } else {
  465 + sendMessage(USER_OPEN_DOOR, "user open the door");
  466 + }
  467 + break;
  468 + case 20:
  469 + if (TextUtils.isEmpty(((FangTangApplication) getApplication()).getCurrentPlayUrl())) {
  470 + Log.d("LightOperationUtils", "admin open light");
  471 + LightOperationUtils.open();
  472 + LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
  473 + }
  474 + sendMessage(JUST_OPEN_DOOR, "administrator open the door");
  475 + break;
  476 + case 0:
  477 + sendMessage(JUST_OPEN_DOOR, "get zero none user or administrator open the door");
  478 + break;
  479 + default:
  480 + sendMessage(JUST_OPEN_DOOR, "none user or administrator open the door");
  481 + break;
  482 + }
  483 + }
  484 +
  485 + private void reportEquStatus(String serverId)
  486 + {
  487 + //填充返回数据
  488 + int volume = getAudioVolume()/6 + 1;
  489 + int lightStatus = 2;
  490 +
  491 + int playStatus = 0;
  492 + try {
  493 + playStatus = iPlayer.getCurrentStatus();
  494 + Log.d("ReportInfo","playStatus:"+playStatus);
  495 + } catch (RemoteException e) {
  496 + e.printStackTrace();
  497 + }
  498 +
  499 + if( Lights.getInstance().getByMeshAddress(
  500 + ((FangTangApplication) getApplication()).getConnectDevice().meshAddress).status == ConnectionStatus.ON )
  501 + {
  502 + lightStatus = 1;
  503 + }
  504 +
  505 + EquipmentStatus equStatus = new EquipmentStatus();
  506 + equStatus.setLightStatus(lightStatus);
  507 + equStatus.setPlayStatus(playStatus);
  508 + equStatus.setVolume(volume);
  509 + equStatus.setServerId(serverId);
  510 + equStatus.setRoom_sn(testRoomSn);
  511 +
  512 + MainRequest rep = new MainRequest();
  513 + rep.setCmd(CMD_REPORT_EQU_STATUS);
  514 + rep.setData(equStatus);
  515 + String msg = gson.toJson(rep) + END_SYMBOL;
  516 + sendMsg(msg);
  517 + Log.d("ReportInfo",msg);
  518 + }
  519 +
  520 + private void setLight(int op)
  521 + {
  522 + if (op == 1)//打开灯光
  523 + {
  524 + Log.d("setEqu","打开灯光");
  525 + LightOperationUtils.open();
  526 + LightOperationUtils.setLightValue(Utils.getInt(context, "brightness", 50));
  527 + }
  528 + else if(op == 2)//关闭灯光
  529 + {
  530 + Log.d("setEqu","关闭灯光");
  531 + LightOperationUtils.setLightValue(5);
  532 + LightOperationUtils.close();
  533 + }
  534 + }
  535 +
  536 + private void playCtl(int op)
  537 + {
  538 + int status = -1;
  539 + try {
  540 + status = iPlayer.getCurrentStatus();
  541 + } catch (RemoteException e) {
  542 + e.printStackTrace();
  543 + }
  544 +
  545 + if (op == 1 && status == 2)
  546 + {
  547 + Log.d("setEqu","开始播放");
  548 + ShellUtils.execCommand("input keyevent 23", false);
  549 + }
  550 + else if (op == 2 && status == 1)
  551 + {
  552 + Log.d("setEqu","暂停播放");
  553 + ShellUtils.execCommand("input keyevent 23", false);
  554 + }
  555 +
  556 + try {
  557 + status = iPlayer.getCurrentStatus();
  558 + } catch (RemoteException e) {
  559 + e.printStackTrace();
  560 + }
  561 + }
  562 +
  563 + private void setEquipmentStatus(EquipmentControl equc)
  564 + {
  565 + setLight(equc.getLightCtl());
  566 +
  567 + playCtl(equc.getPlayCtl());
  568 +
  569 + setAudioVolume(equc.getAudioCtl());
  570 +
  571 + reportEquStatus(equc.getServerId());
  572 +
  573 + }
  574 +
  575 +/*--命令处理-end-----------------------------------*/
  576 +
  577 + private int getAudioVolume()
  578 + {
  579 + AudioManager mAudioManager;
  580 + mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
  581 + int current = mAudioManager.getStreamVolume( AudioManager.STREAM_MUSIC );
  582 + return current;
  583 + }
  584 +
  585 + private int setAudioVolume(int volume)
  586 + {
  587 + AudioManager mAudioManager;
  588 + mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
  589 + int now = getAudioVolume()/6;
  590 +
  591 + if (volume == 0)
  592 + {
  593 + return now;
  594 + }
  595 + else
  596 + {
  597 + volume--;
  598 + }
  599 +
  600 + if (volume > now)//加音量
  601 + {
  602 + Log.d("setEqu","加音量"+now+":"+volume);
  603 + while(now < volume)
  604 + {
  605 + mAudioManager.adjustStreamVolume(
  606 + AudioManager.STREAM_MUSIC,
  607 + AudioManager.ADJUST_RAISE,
  608 + AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
  609 + now ++;
  610 + }
  611 + }
  612 + else if(volume < now)//减音量
  613 + {
  614 + Log.d("setEqu","减音量"+now+":"+volume);
  615 + while(now > volume)
  616 + {
  617 + mAudioManager.adjustStreamVolume(
  618 + AudioManager.STREAM_MUSIC,
  619 + AudioManager.ADJUST_LOWER,
  620 + AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
  621 + now --;
  622 + }
  623 + }
  624 +
  625 + return now;
  626 + }
  627 +
  628 + private ServiceConnection conn = new ServiceConnection() {
  629 + public void onServiceConnected(ComponentName className, IBinder service) {
  630 + Log.i("yao", "ServiceConnection -> onServiceConnected");
  631 + iPlayer = ICinemaControl.Stub.asInterface(service);
  632 + }
  633 +
  634 + public void onServiceDisconnected(ComponentName className) {
  635 + };
  636 + };
421 } 637 }
  1 +package com.qnbar.smc.soketProtocol;
  2 +
  3 +/**
  4 + * Created by jinyan.yi on 2017/5/23.
  5 + */
  6 +
  7 +public abstract class DataInfo {
  8 +}
  1 +package com.qnbar.smc.soketProtocol;
  2 +
  3 +/**
  4 + * Created by jinyan.yi on 2017/5/23.
  5 + */
  6 +
  7 +public class MainRequest {
  8 + private int cmd;
  9 + private DataInfo data;
  10 +
  11 + public int getCmd() {
  12 + return cmd;
  13 + }
  14 +
  15 + public void setCmd(int cmd) {
  16 + this.cmd = cmd;
  17 + }
  18 +
  19 + public DataInfo getData() {
  20 + return data;
  21 + }
  22 +
  23 + public void setData(DataInfo data) {
  24 + this.data = data;
  25 + }
  26 +}
  1 +package com.qnbar.smc.soketProtocol;
  2 +
  3 +/**
  4 + * Created by jinyan.yi on 2017/5/23.
  5 + */
  6 +
  7 +public class MainResponse {
  8 + private int code;
  9 + private String msg;
  10 + private String data;
  11 + private int cmd;
  12 +
  13 + public int getCode() {
  14 + return code;
  15 + }
  16 +
  17 + public void setCode(int code) {
  18 + this.code = code;
  19 + }
  20 +
  21 + public String getMsg() {
  22 + return msg;
  23 + }
  24 +
  25 + public void setMsg(String msg) {
  26 + this.msg = msg;
  27 + }
  28 +
  29 + public String getData() {
  30 + return data;
  31 + }
  32 +
  33 + public void setData(String data) {
  34 + this.data = data;
  35 + }
  36 +
  37 + public int getCmd() {
  38 + return cmd;
  39 + }
  40 +
  41 + public void setCmd(int cmd) {
  42 + this.cmd = cmd;
  43 + }
  44 +
  45 + @Override
  46 + public String toString() {
  47 + return "MainResponse{" +
  48 + "code=" + code +
  49 + ", msg='" + msg + '\'' +
  50 + ", data='" + data + '\'' +
  51 + ", cmd=" + cmd +
  52 + '}';
  53 + }
  54 +}
  1 +package com.qnbar.smc.soketProtocol.fromServer;
  2 +
  3 +/**
  4 + * Created by jinyan.yi on 2017/5/23.
  5 + */
  6 +
  7 +public class EquipmentControl {
  8 + private int audioCtl;
  9 + private int playCtl;
  10 + private int lightCtl;
  11 + private String serverId;
  12 +
  13 + public int getAudioCtl() {
  14 + return audioCtl;
  15 + }
  16 +
  17 + public void setAudioCtl(int audioCtl) {
  18 + this.audioCtl = audioCtl;
  19 + }
  20 +
  21 + public int getPlayCtl() {
  22 + return playCtl;
  23 + }
  24 +
  25 + public void setPlayCtl(int playCtl) {
  26 + this.playCtl = playCtl;
  27 + }
  28 +
  29 + public int getLightCtl() {
  30 + return lightCtl;
  31 + }
  32 +
  33 + public void setLightCtl(int lightCtl) {
  34 + this.lightCtl = lightCtl;
  35 + }
  36 +
  37 + public String getServerId() {
  38 + return serverId;
  39 + }
  40 +
  41 + public void setServerId(String serverId) {
  42 + this.serverId = serverId;
  43 + }
  44 +
  45 + @Override
  46 + public String toString() {
  47 + return "EquipmentControl{" +
  48 + "audioCtl=" + audioCtl +
  49 + ", playCtl=" + playCtl +
  50 + ", lightCtl=" + lightCtl +
  51 + ", serverId='" + serverId + '\'' +
  52 + '}';
  53 + }
  54 +}
  1 +package com.qnbar.smc.soketProtocol.fromServer;
  2 +
  3 +/**
  4 + * Created by jinyan.yi on 2017/5/23.
  5 + */
  6 +
  7 +public class OpenDoor {
  8 + private String verify;
  9 + private int user;
  10 + private int first;
  11 +
  12 + public String getVerify() {
  13 + return verify;
  14 + }
  15 +
  16 + public void setVerify(String verify) {
  17 + this.verify = verify;
  18 + }
  19 +
  20 + public int getUser() {
  21 + return user;
  22 + }
  23 +
  24 + public void setUser(int user) {
  25 + this.user = user;
  26 + }
  27 +
  28 + public int getFirst() {
  29 + return first;
  30 + }
  31 +
  32 + public void setFirst(int first) {
  33 + this.first = first;
  34 + }
  35 +
  36 + @Override
  37 + public String toString() {
  38 + return "OpenDoor{" +
  39 + "verify='" + verify + '\'' +
  40 + ", user=" + user +
  41 + ", first=" + first +
  42 + '}';
  43 + }
  44 +}
  1 +package com.qnbar.smc.soketProtocol.fromServer;
  2 +
  3 +/**
  4 + * Created by jinyan.yi on 2017/5/23.
  5 + */
  6 +
  7 +public class ReportEquStatus {
  8 + private String serverId;
  9 +
  10 + public String getServerId() {
  11 + return serverId;
  12 + }
  13 +
  14 + public void setServerId(String serverId) {
  15 + this.serverId = serverId;
  16 + }
  17 +}
  1 +package com.qnbar.smc.soketProtocol.toServer;
  2 +
  3 +import com.qnbar.smc.soketProtocol.DataInfo;
  4 +
  5 +/**
  6 + * Created by jinyan.yi on 2017/5/23.
  7 + */
  8 +
  9 +public class EquipmentStatus extends DataInfo {
  10 + private int volume;
  11 + private int lightStatus;
  12 + private int playStatus;
  13 + private String serverId;
  14 + private String room_sn;
  15 +
  16 + public int getVolume() {
  17 + return volume;
  18 + }
  19 +
  20 + public void setVolume(int volume) {
  21 + this.volume = volume;
  22 + }
  23 +
  24 + public int getLightStatus() {
  25 + return lightStatus;
  26 + }
  27 +
  28 + public void setLightStatus(int lightStatus) {
  29 + this.lightStatus = lightStatus;
  30 + }
  31 +
  32 + public int getPlayStatus() {
  33 + return playStatus;
  34 + }
  35 +
  36 + public void setPlayStatus(int playStatus) {
  37 + this.playStatus = playStatus;
  38 + }
  39 +
  40 + public String getServerId() {
  41 + return serverId;
  42 + }
  43 +
  44 + public void setServerId(String serverId) {
  45 + this.serverId = serverId;
  46 + }
  47 +
  48 + public String getRoom_sn() {
  49 + return room_sn;
  50 + }
  51 +
  52 + public void setRoom_sn(String room_sn) {
  53 + this.room_sn = room_sn;
  54 + }
  55 +}
@@ -74,15 +74,15 @@ public class CinemaControlService extends Service { @@ -74,15 +74,15 @@ public class CinemaControlService extends Service {
74 public void setCurrentMoviePosition(long duration) throws RemoteException { 74 public void setCurrentMoviePosition(long duration) throws RemoteException {
75 // Log.d("aidl", "setCurrentMoviePosition: " + duration); 75 // Log.d("aidl", "setCurrentMoviePosition: " + duration);
76 currentPosition = duration; 76 currentPosition = duration;
77 - if (saveBeat-- <= 0) { 77 + if (saveBeat-- == 0) {
78 //TODO 保存当前进度,需要时从保存位置开始播放,取消播放器播放记录功能 78 //TODO 保存当前进度,需要时从保存位置开始播放,取消播放器播放记录功能
79 // 播放一段时间确保状态为关闭 79 // 播放一段时间确保状态为关闭
80 - saveBeat = SAVE_BEAT; 80 +// saveBeat = SAVE_BEAT;
81 try { 81 try {
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();
@@ -129,7 +129,7 @@ public class CinemaControlService extends Service { @@ -129,7 +129,7 @@ public class CinemaControlService extends Service {
129 // EventBus.getDefault().post(msgEvent); 129 // EventBus.getDefault().post(msgEvent);
130 break; 130 break;
131 case 2://暂停 131 case 2://暂停
132 - fadeIn(); 132 +// fadeIn();
133 // msgEvent.setEventId(0x19910); 133 // msgEvent.setEventId(0x19910);
134 // msgEvent.setMessage("open_switch"); 134 // msgEvent.setMessage("open_switch");
135 // EventBus.getDefault().post(msgEvent); 135 // EventBus.getDefault().post(msgEvent);
Please register or login to post a comment