Commit 24d26a70afcef882935be8009305478faeda2e4d

Authored by Penley
1 parent 57bb5fe3

lock problem fix,stop message and status request

... ... @@ -16,8 +16,12 @@ ext {
16 16 }
17 17
18 18 android {
19   - compileSdkVersion ANDROID_BUILD_COMPILE_SDK_VERSION as int
20   - buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
  19 +
  20 +// compileSdkVersion ANDROID_BUILD_COMPILE_SDK_VERSION as int
  21 +// buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
  22 + compileSdkVersion 25
  23 + buildToolsVersion '25.0.2'
  24 +
21 25
22 26 lintOptions {
23 27 abortOnError false
... ... @@ -83,7 +87,7 @@ android {
83 87 buildConfigField 'String', 'DEFAULT_IP', "\"192.168.4.215\""
84 88 // buildConfigField 'String', 'MACHINE_TYPE', "\"himedia\"";
85 89 // buildConfigField 'boolean', 'USE_GLIDE', "true";
86   - manifestPlaceholders = [label: "青柠影咖", icon: "@drawable/ic_luancher", channel: "QNJM"]
  90 +// manifestPlaceholders = [label: "青柠影咖", icon: "@drawable/ic_luancher", channel: "QNJM"]
87 91 minifyEnabled false
88 92 signingConfig signingConfigs.myConfig
89 93 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
... ... @@ -133,7 +137,6 @@ android {
133 137 }
134 138 }
135 139 return false
136   - buildToolsVersion '25.0.0'
137 140 }
138 141
139 142 dependencies {
... ...
... ... @@ -126,6 +126,6 @@
126 126 <category android:name="android.intent.category.LAUNCHER" />
127 127 </intent-filter>-->
128 128 </activity>
  129 + <service android:name="com.bluetoothle.GREENBluetoothLeService" android:enabled="true"/>
129 130 </application>
130   -
131 131 </manifest>
\ No newline at end of file
... ...
... ... @@ -60,6 +60,7 @@ import com.gimi.common.cinema.utils.ScreenUtils;
60 60 import com.gimi.common.cinema.utils.SystemUtils;
61 61 import com.qnbar.smc.model.Light;
62 62 import com.qnbar.smc.model.Lights;
  63 +import com.qnbar.smc.service.SocketService;
63 64 import com.qnbar.smc.service.TelinkLightService;
64 65 import com.telink.bluetooth.LeBluetooth;
65 66 import com.telink.bluetooth.TelinkLog;
... ... @@ -153,7 +154,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
153 154 EventBus.getDefault().register(this);
154 155
155 156 initLight();
156   -// initLock();
  157 + initLock();
157 158 context = this;
158 159 mData = new ArrayList<>();
159 160 clazzData = new ArrayList<>();
... ... @@ -171,7 +172,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
171 172 mainSearch = (Button) findViewById(R.id.mainSearch);
172 173 scrollView = (ScrollView) findViewById(R.id.scrollView);
173 174 clazzRv = (OrderRecyclerView) findViewById(R.id.classification);
174   - sourceTypeIv.setVisibility(View.INVISIBLE);
  175 +// sourceTypeIv.setVisibility(View.INVISIBLE);
175 176 mainSearch.setTextColor(Color.GRAY);
176 177 mainSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() {
177 178 @Override
... ... @@ -204,6 +205,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
204 205 clazzRv.setAdapter(adapterClazz);
205 206
206 207 presenter.load(this);
  208 + Intent intent = new Intent(this, SocketService.class);
  209 + startService(intent);
207 210 }
208 211
209 212
... ... @@ -608,7 +611,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
608 611
609 612 //lock
610 613 private String openCMD = "Open the door";
611   - private String onClickDeviceMac;
  614 +// private String onClickDeviceMac;
612 615
613 616 private boolean HAS_SYSTEM_FEATURE_BLUETOOTH_LE = true;
614 617 private BLEBroadcastReceiver bleBroadcastReceiver = new BLEBroadcastReceiver();
... ... @@ -622,7 +625,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
622 625 startService(new Intent(this, GREENBluetoothLeService.class));
623 626 }
624 627
625   - bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() {
  628 + /* bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() {
626 629
627 630 @Override
628 631 public void writeSuccess() {
... ... @@ -630,7 +633,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
630 633 Toast.makeText(MainActivity.this, "开门成功", Toast.LENGTH_SHORT).show();
631 634
632 635 BLEOpenRecord bleOpenRecord = new BLEOpenRecord();
633   - bleOpenRecord.setLockmac(onClickDeviceMac);
  636 + bleOpenRecord.setLockmac("DC:F6:70:C1:AA:D6");
634 637 bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date()));
635 638 Intent intent = new Intent();
636 639 intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS);
... ... @@ -644,7 +647,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
644 647 Toast.makeText(MainActivity.this, "开门失败," + error, Toast.LENGTH_SHORT).show();
645 648 }
646 649 });
647   - GREENBLE.send(this, "DC:F6:70:C1:AA:D6", openCMD.getBytes());
  650 + GREENBLE.send(this, "DC:F6:70:C1:AA:D6", openCMD.getBytes());*/
648 651 }
649 652
650 653 @Override
... ... @@ -855,9 +858,36 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
855 858 Log.d("event bus", messageEvent.getMessage());
856 859 break;
857 860 case 1701:
858   - initLock();
  861 + openDoor();
859 862 Log.d("event bus", messageEvent.getMessage());
  863 + Log.d("event bus", "open door");
860 864 break;
861 865 }
862 866 }
  867 +
  868 + private void openDoor(){
  869 + bleBroadcastReceiver.setResponseObj(new GREENCITYBLEProtocolFactory.GREENCITYBleDataWritten() {
  870 +
  871 + @Override
  872 + public void writeSuccess() {
  873 + bleBroadcastReceiver.setResponseObj(null);
  874 + Toast.makeText(MainActivity.this, "开门成功", Toast.LENGTH_SHORT).show();
  875 +
  876 + BLEOpenRecord bleOpenRecord = new BLEOpenRecord();
  877 + bleOpenRecord.setLockmac("DC:F6:70:C1:AA:D6");
  878 + bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date()));
  879 + Intent intent = new Intent();
  880 + intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS);
  881 + intent.putExtra("openrecord", bleOpenRecord);
  882 + sendBroadcast(intent);
  883 + }
  884 +
  885 + @Override
  886 + public void writeFailure(String error) {
  887 + bleBroadcastReceiver.setResponseObj(null);
  888 + Toast.makeText(MainActivity.this, "开门失败," + error, Toast.LENGTH_SHORT).show();
  889 + }
  890 + });
  891 + GREENBLE.send(this, "DC:F6:70:C1:AA:D6", openCMD.getBytes());
  892 + }
863 893 }
... ...
... ... @@ -26,8 +26,6 @@ import com.xgimi.gimicinema.model.OtherModelImpl;
26 26 import com.xgimi.gimicinema.model.SambaModelImpl;
27 27 import com.xgimi.gimicinema.mview.IAskView;
28 28
29   -import org.apache.http.entity.ContentLengthStrategy;
30   -
31 29 import java.util.ArrayList;
32 30
33 31 /**
... ...
... ... @@ -57,7 +57,6 @@ import com.xgimi.gimicinema.activity.CinemaConfig;
57 57 import com.xgimi.gimicinema.deserializer.GimiMessageDeserializer;
58 58 import com.xgimi.gimicinema.deserializer.GimiSysMsgDeserializer;
59 59 import com.xgimi.gimicinema.mview.IAskView;
60   -import com.xgimi.gimicinema.poll.PollingUtils;
61 60 import com.xgimi.gimicinema.presenter.AskPresenter;
62 61
63 62 import org.greenrobot.eventbus.EventBus;
... ... @@ -222,7 +221,7 @@ public class AskService extends Service implements IAskView {
222 221
223 222 askPresenter.load(context);
224 223 handler.postDelayed(updateRunnable, 5 * 1000);
225   - PollingUtils.startPollingService(context, 60, ProguardService.class, ProguardService.STATUS_ACTION);
  224 +// PollingUtils.startPollingService(context, 60, ProguardService.class, ProguardService.STATUS_ACTION);
226 225 }
227 226
228 227 int promoteCount = 0;
... ... @@ -518,12 +517,12 @@ public class AskService extends Service implements IAskView {
518 517
519 518 @Override
520 519 public int onStartCommand(Intent intent, int flags, int startId) {
521   - if (systemUtils.getYbProp() != 3) {
522   - if (agentType != 5) {
523   - startMessageLoop();
524   - startStatusLoop();
525   - }
526   - }
  520 +// if (systemUtils.getYbProp() != 3) {
  521 +// if (agentType != 5) {
  522 +// startMessageLoop();
  523 +// startStatusLoop();
  524 +// }
  525 +// }
527 526 return START_STICKY;
528 527 }
529 528
... ...
... ... @@ -90,9 +90,9 @@ public class CinemaControlService extends Service {
90 90 currentState = state;
91 91 Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition);
92 92 Log.d("aidl", "state change cinemaSMC not null");
93   - if (true) {
94   - return;
95   - }
  93 +// if (true) {
  94 +// return;
  95 +// }
96 96 switch (state) {
97 97 case 0://空闲
98 98 // open();
... ...
... ... @@ -74,7 +74,7 @@
74 74 android:layout_height="wrap_content"
75 75 android:id="@+id/movie_source_type_iv"
76 76 android:visibility="visible"
77   - android:background="@drawable/m_1905"/>
  77 + android:background="@drawable/m_baofeng"/>
78 78
79 79 </LinearLayout>
80 80
... ...
Please register or login to post a comment