Commit baaf8a93048ba49321abfbf3addc4f83a615aaca

Authored by 李攀
1 parent 64859132

fix report after play

... ... @@ -212,10 +212,6 @@ public class SmartControlService extends BaseService implements EventListener<St
212 212 public void writeSuccess() {
213 213 bleBroadcastReceiver.setResponseObj(null);
214 214 Toast.makeText(SmartControlService.this, "开门成功", Toast.LENGTH_SHORT).show();
215   - if (needReport) {
216   - mHandler.postDelayed(reportRunnable, 2 * 1000);
217   - LogUtils.i("room-info", "user open door ,report the open success status");
218   - }
219 215 LogUtils.i("room-info", "open success");
220 216 }
221 217
... ... @@ -230,12 +226,12 @@ public class SmartControlService extends BaseService implements EventListener<St
230 226 if (!TextUtils.isEmpty(lockMac)) {
231 227 String openCMD = "Open the door";
232 228 GREENBLE.send(this, lockMac, openCMD.getBytes());
233   - } else {
  229 + } /*else {
234 230 if (needReport) {
235 231 mHandler.postDelayed(reportRunnable, 2 * 1000);
236 232 LogUtils.i("room-info", "user open door ,report the open success status");
237 233 }
238   - }
  234 + }*/
239 235 }
240 236
241 237 @Subscribe(threadMode = ThreadMode.MAIN)
... ... @@ -372,6 +368,7 @@ public class SmartControlService extends BaseService implements EventListener<St
372 368 }
373 369 LogUtils.i("room-info", messageEvent.getMessage());
374 370 Utils.saveString(this, "oder-play-completed", new Gson().toJson(roomStatusInfo));
  371 + roomStatusInfo = null;
375 372 // playEndAds();
376 373 break;
377 374 default:
... ... @@ -632,6 +629,10 @@ public class SmartControlService extends BaseService implements EventListener<St
632 629 mHandler.postDelayed(reportRunnable, 2 * 1000);
633 630 }
634 631 if (localMovieMessages != null) {
  632 + if (needReport) {
  633 + mHandler.postDelayed(reportRunnable, 2 * 1000);
  634 + LogUtils.i("room-info", "user open door ,report the open success status");
  635 + }
635 636 LogUtils.i("room-info", "play movie" + localMovieMessages.toString());
636 637 String showMsg;
637 638 if (offset > 0) {
... ...
... ... @@ -13,6 +13,7 @@ import android.util.Log;
13 13 import android.widget.Toast;
14 14 import com.gimi.common.cinema.model.MessageEvent;
15 15 import com.gimi.common.cinema.model.RoomInfo;
  16 +import com.gimi.common.cinema.model.SambaMsg;
16 17 import com.gimi.common.cinema.utils.ActivityCollector;
17 18 import com.gimi.common.cinema.utils.CToast;
18 19 import com.gimi.common.cinema.utils.LogUtils;
... ... @@ -245,7 +246,8 @@ public class SocketService1 extends BaseService {
245 246 boolean networkConnected = NetStatusUtils.isNetworkConnected(context);
246 247 boolean availableByPing = NetStatusUtils.isAvailableByPing("www.baidu.com");
247 248 boolean availableByPing1 = NetStatusUtils.isAvailableByPing(serverHost);
248   - boolean availableByPing2 = NetStatusUtils.isAvailableByPing("192.168.200.241");
  249 + SambaMsg sambaMsg = Utils.getSambaMsg(context);
  250 + boolean availableByPing2 = NetStatusUtils.isAvailableByPing(sambaMsg != null ? sambaMsg.getIp() : "192.168.31.202");
249 251 LogUtils.i(TAG, "init socket serverHost:serverPort:" + serverHost + ":" + serverPort);
250 252 LogUtils.i(TAG, "networkConnected:" + networkConnected + ":baidu:" + availableByPing + ",serverHost:" + availableByPing1 + ",serverIp:" + availableByPing2);
251 253 mHandler.post(new Runnable() {
... ... @@ -688,7 +690,7 @@ public class SocketService1 extends BaseService {
688 690 }
689 691
690 692 public int getLightStatus() {
691   - int lightStatus = 2;
  693 + int lightStatus = 3;
692 694 try {
693 695 DeviceInfo connectDevice = ((FangTangApplication) getApplication()).
694 696 getConnectDevice();
... ...
... ... @@ -212,8 +212,30 @@ public class MainActivity extends BaseActivity implements IMainView/*, EventList
212 212 handler.postDelayed(this, 10 * 1000);
213 213 FangTangApplication application = (FangTangApplication) getApplication();
214 214 // int mConnectionState = GREENBluetoothLeService.mConnectionState;
215   - statusPromoteTv.setText(application.getServerStatus() + "\n" + application.getLightStatus());
216   -
  215 + String serverPromote = "";
  216 + switch (application.getServerStatus()) {
  217 + case SERVER_IDLE:
  218 + serverPromote = "未连接服务器";
  219 + break;
  220 + case SERVER_CONNECTING:
  221 + serverPromote = "正在连接服务器";
  222 + break;
  223 + case SERVER_CONNECTED:
  224 + serverPromote = "服务器连接正常";
  225 + break;
  226 + }
  227 + String lightPromote = "";
  228 + switch (application.getLightStatus()) {
  229 + case LIGHT_CONNECTED:
  230 + lightPromote = "灯光连接正常";
  231 + break;
  232 + case LIGHT_IDLE:
  233 + if (application.getMesh() != null && !TextUtils.isEmpty(application.getMesh().name)) {
  234 + lightPromote = "灯光断开";
  235 + }
  236 + break;
  237 + }
  238 + statusPromoteTv.setText(serverPromote + "\n" + lightPromote);
217 239 }
218 240 };
219 241
... ...
... ... @@ -113,6 +113,6 @@
113 113 <string name="end_ads">本场电影已结束,请观看《青柠电影先锋》</string>
114 114 <string name="welcome_again">离场时请携带好随身物品,欢迎下次光临。</string>
115 115 <string name="play_next_fill_name">本场电影已结束,即将为您播放下一部影片</string>
116   - <string name="time_ends_ten_min">距观时间结束还有10分钟。</string>
  116 + <string name="time_ends_ten_min">距观时间结束还有10分钟。</string>
117 117
118 118 </resources>
... ...
Please register or login to post a comment