Commit e43e6968250b289fa4b893e63805e53ea392d5fd

Authored by 李攀
1 parent 6dfcf0b2

save log files

... ... @@ -235,6 +235,7 @@ public class SmartControlService extends BaseService implements EventListener<St
235 235 switch (messageEvent.getEventId()) {
236 236 case SocketService1.JUST_OPEN_DOOR:
237 237 //check qr code is showing
  238 + needReport = false;
238 239 openDoor();
239 240 if (ActivityCollector.isActivityExist(QrCodeShowActivity.class)
240 241 || ActivityCollector.isActivityExist(SimpleAdsPlayer2.class)
... ...
... ... @@ -57,29 +57,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
57 57 import java.util.concurrent.atomic.AtomicInteger;
58 58
59 59 public class SocketService1 extends BaseService {
60   - private static final String TAG = "BackService1";
  60 + private static final String TAG = "BackService";
61 61 private static final long HEART_BEAT_RATE = 2 * 1000;
62 62 private final long READ_THREAD_DEFAULT_SLEEP_MTIME = 100;
63 63 public static final int JUST_OPEN_DOOR = 1701;
64 64 public static final int USER_OPEN_DOOR_AND_GET_MOVIE = 1703;
65 65 public static final int USER_OPEN_DOOR = 1704;
66   -
67   - // public static final int USER_OPEN_DOOR_AND_GET_MOVIE = 1703;
68   - /*
69   - 10001 //服务器发送了命令(带命令的返回消息),这个一般是服务器主动发消息的时候code为这个值
70   - 10002 //连接(认证)失败
71   - 10003 //还未注册连接就进行认证
72   - 10004 //终端编号未传
73   - 10005 //心跳异常,没有找到房间连接信息
74   - 10006 //心跳异常,连接标识符不一致
75   - 10007 //收到未知命令
76   - 10008 //收到无法解析的消息
77   - 10009 //已经认证过了,不允许再认证
78   - 10010 //room_sn 已连接,不能再连接
79   - 9997 //心跳成功
80   - 9998 //请求认证被服务器接受了,服务器返回了认证码
81   - 9999 //认证成功,可以开始心跳了
82   - */
83 66 private static final int HEART_BEAT_SUCCESS = 9997;
84 67 private static final int RETURN_VERIFY_CODE = 9998;
85 68 private static final int VERIFY_SUCCESS = 9999;
... ... @@ -116,13 +99,9 @@ public class SocketService1 extends BaseService {
116 99 public int heartbeatNum = 0;
117 100
118 101 public static final String END_SYMBOL = "\\r\\n\\r\\n";//心跳包内容
119   - // public String testRoomSn = "R170413034374";
120 102 public String testRoomSn = "c";
121 103
122   - // private ReadThread mReadThread;
123 104 private Gson gson = new Gson();
124   -
125   - // private WeakReference<Socket> mSocket;
126 105 private Socket socket = null;
127 106 StringBuilder readingMsg = new StringBuilder();
128 107
... ... @@ -135,11 +114,12 @@ public class SocketService1 extends BaseService {
135 114 public ICinemaControl iPlayer = null;
136 115 private ServiceConnection conn = new ServiceConnection() {
137 116 public void onServiceConnected(ComponentName className, IBinder service) {
138   - Log.d("yao", "ServiceConnection -> onServiceConnected");
  117 + LogUtils.i("bind cinema control service success");
139 118 iPlayer = ICinemaControl.Stub.asInterface(service);
140 119 }
141 120
142 121 public void onServiceDisconnected(ComponentName className) {
  122 + LogUtils.i("cinema control service error");
143 123 }
144 124 };
145 125
... ... @@ -162,12 +142,9 @@ public class SocketService1 extends BaseService {
162 142 rep.setCmd(HEART_BEAT);
163 143 rep.setData(heartbeat);
164 144 String msg = gson.toJson(rep);
165   -// final String msg = new Gson().toJson(
166   -// new SocketSendMsg().contractHeartBeatMsg(testRoomSn));
167 145 boolean isSuccess = sendMsg(msg + END_SYMBOL);
168 146 if (!isSuccess) {
169 147 LogUtils.i(TAG, "send heart beat error restart");
170   - Log.d("heartbeat content", msg);
171 148 }
172 149 }
173 150 };
... ... @@ -205,7 +182,6 @@ public class SocketService1 extends BaseService {
205 182 super.onStartCommand(intent, flags, startId);
206 183 LogUtils.i(TAG, "onStartCommand");
207 184 int ftTest = Utils.getInt(this, "ft-test", 0);
208   - Log.d("Host", "" + ftTest);
209 185 switch (ftTest) {
210 186 case 0:
211 187 serverHost = SERVER_HOST_ONLINE;
... ... @@ -229,7 +205,7 @@ public class SocketService1 extends BaseService {
229 205 }
230 206
231 207 LogUtils.i("room-info", "room info not null");
232   - RoomInfo roomInfo = null;
  208 + RoomInfo roomInfo;
233 209 try {
234 210 roomInfo = gson.fromJson(roomInfoStr, RoomInfo.class);
235 211 LogUtils.i("room-info", "room info room_sn update");
... ... @@ -337,14 +313,12 @@ public class SocketService1 extends BaseService {
337 313 && !socket.isInputShutdown()
338 314 && ((length = is.read(buffer)) > 0)) {
339 315 String tmp = new String(Arrays.copyOf(buffer, length));
340   - LogUtils.d("recvMsg", msgId + ":" + length + ":" + tmp);
341 316 readingMsg.append(tmp);
342 317 int pos = readingMsg.indexOf(END_SYMBOL);
343 318 if (pos != -1) {
344 319 msg.setLength(0);
345 320 msg.append(readingMsg.substring(0, pos));
346 321 readingMsg.delete(0, pos + END_SYMBOL.length());
347   - LogUtils.d("recvMsg", msgId + ":" + length + ":" + msg);
348 322 return true;
349 323 }
350 324 msgId++;
... ... @@ -412,12 +386,9 @@ public class SocketService1 extends BaseService {
412 386 sendRegister.set(true);
413 387 }
414 388
415   - LogUtils.d(TAG, "begin to recv msg");
416   -
417 389 sleepTime = READ_THREAD_DEFAULT_SLEEP_MTIME;
418 390 while (recvMsg(message)) {
419 391 sleepTime = READ_THREAD_DEFAULT_SLEEP_MTIME;
420   - LogUtils.d("recvMsg", "logic:" + message);
421 392 LogUtils.d(TAG, "recv msg:" + message);
422 393 MainResponse socketResponse;
423 394 try {
... ... @@ -540,23 +511,20 @@ public class SocketService1 extends BaseService {
540 511 e.printStackTrace();
541 512 }
542 513 break;
543   -
544   - case REPORT_EQU_STATUS://获取声音,灯光,播放暂停状态
  514 + case REPORT_EQU_STATUS:
  515 + //获取声音,灯光,播放暂停状态并上报
545 516 //获取serverId
546 517 ReportEquStatus rps = gson.fromJson(socketResponse.getData(), ReportEquStatus.class);
547 518 reportEquStatus(rps.getServerId(), 0);
548 519 break;
549   -
550 520 case SET_EQU_STATUS://设置声音,灯光,播放暂停
551   - Log.d("ReportInfo", "收到控制命令:" + socketResponse.getData());
  521 + LogUtils.i("ReportInfo", "收到控制命令:" + socketResponse.getData());
552 522 EquipmentControl equc = gson.fromJson(socketResponse.getData(), EquipmentControl.class);
553 523 setEquipmentStatus(equc);
554 524 break;
555 525 }
556 526 }
557 527
558   - /*--命令处理-start-----------------------------------*/
559   -
560 528 private void openDoor(OpenDoor openDoorResponse) {
561 529 switch (openDoorResponse.getUser()) {
562 530 //10用户,20管理员,默认值为0
... ... @@ -572,7 +540,6 @@ public class SocketService1 extends BaseService {
572 540 } else {
573 541 sendMessage(USER_OPEN_DOOR, "user open the door");
574 542 }
575   - Log.d("op", "开门");
576 543 break;
577 544 case 20:
578 545 LogUtils.i(TAG, "admin open the door,del the log");
... ... @@ -673,8 +640,6 @@ public class SocketService1 extends BaseService {
673 640 reportEquStatus(equc.getServerId(), equc.getLightCtl());
674 641 }
675 642
676   -/*--命令处理-end-----------------------------------*/
677   -
678 643 public int getAudioVolume() {
679 644 AudioManager mAudioManager;
680 645 mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
... ...
1 1 package com.qnbar.smc.socketProtocol;
2 2
3   -/**
4   - * Created by jinyan.yi on 2017/5/23.
5   - */
6   -
7 3 public abstract class DataInfo {}
... ...
1 1 package com.qnbar.smc.socketProtocol;
2 2
3   -import com.qnbar.smc.socketProtocol.toServer.Heartbeat;
4   -
5   -/**
6   - * Created by jinyan.yi on 2017/5/23.
7   - */
8   -
9 3 public class MainRequest {
10 4 private int cmd;
11 5 private DataInfo data;
... ...
1 1 package com.qnbar.smc.socketProtocol;
2 2
3   -/**
4   - * Created by jinyan.yi on 2017/5/23.
5   - */
6   -
7 3 public class MainResponse {
8 4 private int code;
9 5 private String msg;
... ...
... ... @@ -3,7 +3,6 @@ package com.qnbar.smc.socketProtocol.fromServer;
3 3 /**
4 4 * Created by jinyan.yi on 2017/5/23.
5 5 */
6   -
7 6 public class EquipmentControl {
8 7 private int audioCtl;
9 8 private int playCtl;
... ...
... ... @@ -3,7 +3,6 @@ package com.qnbar.smc.socketProtocol.fromServer;
3 3 /**
4 4 * Created by jinyan.yi on 2017/5/23.
5 5 */
6   -
7 6 public class OpenDoor {
8 7 private String verify;
9 8 private int user;
... ...
... ... @@ -3,7 +3,6 @@ package com.qnbar.smc.socketProtocol.fromServer;
3 3 /**
4 4 * Created by jinyan.yi on 2017/5/23.
5 5 */
6   -
7 6 public class ReportEquStatus {
8 7 private String serverId;
9 8
... ...
... ... @@ -3,7 +3,6 @@ package com.qnbar.smc.socketProtocol.fromServer;
3 3 /**
4 4 * Created by jinyan.yi on 2017/6/2.
5 5 */
6   -
7 6 public class VerifyCode {
8 7 private String verify;
9 8
... ...
... ... @@ -5,7 +5,6 @@ import com.qnbar.smc.socketProtocol.DataInfo;
5 5 /**
6 6 * Created by jinyan.yi on 2017/5/23.
7 7 */
8   -
9 8 public class EquipmentStatus extends DataInfo {
10 9 private int volume;
11 10 private int lightStatus;
... ...
... ... @@ -2,10 +2,6 @@ package com.qnbar.smc.socketProtocol.toServer;
2 2
3 3 import com.qnbar.smc.socketProtocol.DataInfo;
4 4
5   -/**
6   - * Created by jinyan.yi on 2017/6/14.
7   - */
8   -
9 5 public class Heartbeat extends DataInfo {
10 6 private int lightStatus;
11 7 private int volume;
... ...
... ... @@ -639,11 +639,11 @@ public class MainActivity extends BaseActivity implements IMainView/*, EventList
639 639 startService(new Intent(this, ConfigService.class));
640 640 mDeviceIp = Utils.getString(context, "screen-ip");
641 641 if (TextUtils.isEmpty(mDeviceIp)) {
642   - show("没有配置智能幕布");
  642 +// show("没有配置智能幕布");
643 643 return;
644 644 }
645 645 if (!NetStatusUtils.isAvailableByPing(mDeviceIp)) {
646   - show("没有找到智能幕布");
  646 +// show("没有找到智能幕布");
647 647 return;
648 648 }
649 649 messageThread = new MessageThread();
... ...
... ... @@ -37,6 +37,7 @@ public class QrCodeShowActivity extends Activity implements IUpdateQrCodeView {
37 37 };
38 38
39 39 private void closeSystem() {
  40 + LogUtils.i("closeSystem");
40 41 LightOperationUtils.close();
41 42 LightOperationUtils.setLightValue(5);
42 43 new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext());
... ... @@ -67,17 +68,9 @@ public class QrCodeShowActivity extends Activity implements IUpdateQrCodeView {
67 68 super.onCreate(savedInstanceState);
68 69 setContentView(R.layout.activity_qr_code_show);
69 70 EventBus.getDefault().register(this);
70   - //back press,movie length
71 71 present = new QrCodeShowPresent(this);
72   -// final String qr = getIntent().getStringExtra("qr");
73 72 orderSn = getIntent().getStringExtra("order_sn");
74 73 roomSn = getIntent().getStringExtra("room_sn");
75   -// boolean countCall = getIntent().getBooleanExtra("count_call", false);
76   -// if (countCall) {
77   -// Toast.makeText(this, "你预定的时段已结束,请携带好随身物品,欢迎下次光临", Toast.LENGTH_LONG).show();
78   -// } else {
79   -// Toast.makeText(this, "电影观看完成,请携带好随身物品,欢迎下次光临", Toast.LENGTH_LONG).show();
80   -// }
81 74 iv = (ImageView) findViewById(qrCodeIv);
82 75 handler.postDelayed(r, 20 * 60 * 1000);
83 76
... ... @@ -122,7 +115,7 @@ public class QrCodeShowActivity extends Activity implements IUpdateQrCodeView {
122 115 switch (messageEvent.getEventId()) {
123 116 case KILL_SELF:
124 117 QrCodeShowActivity.this.finish();
125   - LogUtils.d("room-info", messageEvent.getMessage());
  118 + LogUtils.i("room-info", "kill qr code show activity " + messageEvent.getMessage());
126 119 break;
127 120 }
128 121 }
... ...
... ... @@ -27,6 +27,7 @@ import com.gimi.common.cinema.model.SambaMsg;
27 27 import com.gimi.common.cinema.model.WrongMsg;
28 28 import com.gimi.common.cinema.utils.FolderUtils;
29 29 import com.gimi.common.cinema.utils.LeeImageLoader;
  30 +import com.gimi.common.cinema.utils.LogUtils;
30 31 import com.gimi.common.cinema.utils.MovieMessageUtils;
31 32 import com.gimi.common.cinema.utils.NameFilterUtils;
32 33 import com.gimi.common.cinema.utils.SambaFileCharge;
... ... @@ -261,6 +262,7 @@ public class MovieDetailPresenter extends BasePresenter
261 262 public void playPath(String path) {
262 263 String playPath = TextUtils.isEmpty(path)
263 264 ? view.getMovieItem().getPlayPath() : path;
  265 + LogUtils.i("admin play the movie:" + path);
264 266 if (SambaFileCharge.fileExist(playPath)) {
265 267 view.jumpToPlay(playPath);
266 268 } else {
... ...
... ... @@ -107,7 +107,6 @@ public class CinemaControlService extends Service {
107 107 }
108 108 if (state != currentState) {
109 109 currentState = state;
110   -// ShellUtils.execCommand("input keyevent 23", false);
111 110 Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition + ",state:" + state);
112 111 Log.d("aidl", "state change cinemaSMC not null");
113 112 // if (true) {
... ... @@ -174,11 +173,11 @@ public class CinemaControlService extends Service {
174 173 CinemaControlService.this.movies.addAll(movies);
175 174 }
176 175
177   - public void openLight()throws RemoteException {
  176 + public void openLight() throws RemoteException {
178 177 fadeIn();
179 178 }
180 179
181   - public void closeLight()throws RemoteException {
  180 + public void closeLight() throws RemoteException {
182 181 fadeOut();
183 182 }
184 183 };
... ... @@ -346,12 +345,6 @@ public class CinemaControlService extends Service {
346 345
347 346 private void showQrCodeRightNow() {
348 347 if (duration - currentPosition < 1000 * 60) {
349   - //save order complete
350   -// Constant.count = -1;
351   -// MessageEvent messageEvent = new MessageEvent();
352   -// messageEvent.setEventId(COUNT_DOWN_ZERO);
353   -// messageEvent.setMessage("CinemaControlService,记数为0");
354   -// EventBus.getDefault().post(messageEvent);
355 348 MessageEvent messageEvent = new MessageEvent();
356 349 messageEvent.setEventId(SmartControlService.ORDER_PLAY_COMPLETE);
357 350 messageEvent.setMessage("电影播放完成,记录完成订单信息");
... ...
Please register or login to post a comment