Commit 24d26a70afcef882935be8009305478faeda2e4d

Authored by Penley
1 parent 57bb5fe3

lock problem fix,stop message and status request

@@ -16,8 +16,12 @@ ext { @@ -16,8 +16,12 @@ ext {
16 } 16 }
17 17
18 android { 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 lintOptions { 26 lintOptions {
23 abortOnError false 27 abortOnError false
@@ -83,7 +87,7 @@ android { @@ -83,7 +87,7 @@ android {
83 buildConfigField 'String', 'DEFAULT_IP', "\"192.168.4.215\"" 87 buildConfigField 'String', 'DEFAULT_IP', "\"192.168.4.215\""
84 // buildConfigField 'String', 'MACHINE_TYPE', "\"himedia\""; 88 // buildConfigField 'String', 'MACHINE_TYPE', "\"himedia\"";
85 // buildConfigField 'boolean', 'USE_GLIDE', "true"; 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 minifyEnabled false 91 minifyEnabled false
88 signingConfig signingConfigs.myConfig 92 signingConfig signingConfigs.myConfig
89 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 93 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
@@ -133,7 +137,6 @@ android { @@ -133,7 +137,6 @@ android {
133 } 137 }
134 } 138 }
135 return false 139 return false
136 - buildToolsVersion '25.0.0'  
137 } 140 }
138 141
139 dependencies { 142 dependencies {
@@ -126,6 +126,6 @@ @@ -126,6 +126,6 @@
126 <category android:name="android.intent.category.LAUNCHER" /> 126 <category android:name="android.intent.category.LAUNCHER" />
127 </intent-filter>--> 127 </intent-filter>-->
128 </activity> 128 </activity>
  129 + <service android:name="com.bluetoothle.GREENBluetoothLeService" android:enabled="true"/>
129 </application> 130 </application>
130 -  
131 </manifest> 131 </manifest>
@@ -60,6 +60,7 @@ import com.gimi.common.cinema.utils.ScreenUtils; @@ -60,6 +60,7 @@ import com.gimi.common.cinema.utils.ScreenUtils;
60 import com.gimi.common.cinema.utils.SystemUtils; 60 import com.gimi.common.cinema.utils.SystemUtils;
61 import com.qnbar.smc.model.Light; 61 import com.qnbar.smc.model.Light;
62 import com.qnbar.smc.model.Lights; 62 import com.qnbar.smc.model.Lights;
  63 +import com.qnbar.smc.service.SocketService;
63 import com.qnbar.smc.service.TelinkLightService; 64 import com.qnbar.smc.service.TelinkLightService;
64 import com.telink.bluetooth.LeBluetooth; 65 import com.telink.bluetooth.LeBluetooth;
65 import com.telink.bluetooth.TelinkLog; 66 import com.telink.bluetooth.TelinkLog;
@@ -153,7 +154,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -153,7 +154,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
153 EventBus.getDefault().register(this); 154 EventBus.getDefault().register(this);
154 155
155 initLight(); 156 initLight();
156 -// initLock(); 157 + initLock();
157 context = this; 158 context = this;
158 mData = new ArrayList<>(); 159 mData = new ArrayList<>();
159 clazzData = new ArrayList<>(); 160 clazzData = new ArrayList<>();
@@ -171,7 +172,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -171,7 +172,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
171 mainSearch = (Button) findViewById(R.id.mainSearch); 172 mainSearch = (Button) findViewById(R.id.mainSearch);
172 scrollView = (ScrollView) findViewById(R.id.scrollView); 173 scrollView = (ScrollView) findViewById(R.id.scrollView);
173 clazzRv = (OrderRecyclerView) findViewById(R.id.classification); 174 clazzRv = (OrderRecyclerView) findViewById(R.id.classification);
174 - sourceTypeIv.setVisibility(View.INVISIBLE); 175 +// sourceTypeIv.setVisibility(View.INVISIBLE);
175 mainSearch.setTextColor(Color.GRAY); 176 mainSearch.setTextColor(Color.GRAY);
176 mainSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() { 177 mainSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() {
177 @Override 178 @Override
@@ -204,6 +205,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -204,6 +205,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
204 clazzRv.setAdapter(adapterClazz); 205 clazzRv.setAdapter(adapterClazz);
205 206
206 presenter.load(this); 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,7 +611,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
608 611
609 //lock 612 //lock
610 private String openCMD = "Open the door"; 613 private String openCMD = "Open the door";
611 - private String onClickDeviceMac; 614 +// private String onClickDeviceMac;
612 615
613 private boolean HAS_SYSTEM_FEATURE_BLUETOOTH_LE = true; 616 private boolean HAS_SYSTEM_FEATURE_BLUETOOTH_LE = true;
614 private BLEBroadcastReceiver bleBroadcastReceiver = new BLEBroadcastReceiver(); 617 private BLEBroadcastReceiver bleBroadcastReceiver = new BLEBroadcastReceiver();
@@ -622,7 +625,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -622,7 +625,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
622 startService(new Intent(this, GREENBluetoothLeService.class)); 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 @Override 630 @Override
628 public void writeSuccess() { 631 public void writeSuccess() {
@@ -630,7 +633,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -630,7 +633,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
630 Toast.makeText(MainActivity.this, "开门成功", Toast.LENGTH_SHORT).show(); 633 Toast.makeText(MainActivity.this, "开门成功", Toast.LENGTH_SHORT).show();
631 634
632 BLEOpenRecord bleOpenRecord = new BLEOpenRecord(); 635 BLEOpenRecord bleOpenRecord = new BLEOpenRecord();
633 - bleOpenRecord.setLockmac(onClickDeviceMac); 636 + bleOpenRecord.setLockmac("DC:F6:70:C1:AA:D6");
634 bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date())); 637 bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date()));
635 Intent intent = new Intent(); 638 Intent intent = new Intent();
636 intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS); 639 intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS);
@@ -644,7 +647,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -644,7 +647,7 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
644 Toast.makeText(MainActivity.this, "开门失败," + error, Toast.LENGTH_SHORT).show(); 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 @Override 653 @Override
@@ -855,9 +858,36 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen @@ -855,9 +858,36 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen
855 Log.d("event bus", messageEvent.getMessage()); 858 Log.d("event bus", messageEvent.getMessage());
856 break; 859 break;
857 case 1701: 860 case 1701:
858 - initLock(); 861 + openDoor();
859 Log.d("event bus", messageEvent.getMessage()); 862 Log.d("event bus", messageEvent.getMessage());
  863 + Log.d("event bus", "open door");
860 break; 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,8 +26,6 @@ import com.xgimi.gimicinema.model.OtherModelImpl;
26 import com.xgimi.gimicinema.model.SambaModelImpl; 26 import com.xgimi.gimicinema.model.SambaModelImpl;
27 import com.xgimi.gimicinema.mview.IAskView; 27 import com.xgimi.gimicinema.mview.IAskView;
28 28
29 -import org.apache.http.entity.ContentLengthStrategy;  
30 -  
31 import java.util.ArrayList; 29 import java.util.ArrayList;
32 30
33 /** 31 /**
@@ -57,7 +57,6 @@ import com.xgimi.gimicinema.activity.CinemaConfig; @@ -57,7 +57,6 @@ import com.xgimi.gimicinema.activity.CinemaConfig;
57 import com.xgimi.gimicinema.deserializer.GimiMessageDeserializer; 57 import com.xgimi.gimicinema.deserializer.GimiMessageDeserializer;
58 import com.xgimi.gimicinema.deserializer.GimiSysMsgDeserializer; 58 import com.xgimi.gimicinema.deserializer.GimiSysMsgDeserializer;
59 import com.xgimi.gimicinema.mview.IAskView; 59 import com.xgimi.gimicinema.mview.IAskView;
60 -import com.xgimi.gimicinema.poll.PollingUtils;  
61 import com.xgimi.gimicinema.presenter.AskPresenter; 60 import com.xgimi.gimicinema.presenter.AskPresenter;
62 61
63 import org.greenrobot.eventbus.EventBus; 62 import org.greenrobot.eventbus.EventBus;
@@ -222,7 +221,7 @@ public class AskService extends Service implements IAskView { @@ -222,7 +221,7 @@ public class AskService extends Service implements IAskView {
222 221
223 askPresenter.load(context); 222 askPresenter.load(context);
224 handler.postDelayed(updateRunnable, 5 * 1000); 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 int promoteCount = 0; 227 int promoteCount = 0;
@@ -518,12 +517,12 @@ public class AskService extends Service implements IAskView { @@ -518,12 +517,12 @@ public class AskService extends Service implements IAskView {
518 517
519 @Override 518 @Override
520 public int onStartCommand(Intent intent, int flags, int startId) { 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 return START_STICKY; 526 return START_STICKY;
528 } 527 }
529 528
@@ -90,9 +90,9 @@ public class CinemaControlService extends Service { @@ -90,9 +90,9 @@ public class CinemaControlService extends Service {
90 currentState = state; 90 currentState = state;
91 Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition); 91 Log.d("aidl", "state change," + currentPath + "," + duration + "," + currentPosition);
92 Log.d("aidl", "state change cinemaSMC not null"); 92 Log.d("aidl", "state change cinemaSMC not null");
93 - if (true) {  
94 - return;  
95 - } 93 +// if (true) {
  94 +// return;
  95 +// }
96 switch (state) { 96 switch (state) {
97 case 0://空闲 97 case 0://空闲
98 // open(); 98 // open();
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 android:layout_height="wrap_content" 74 android:layout_height="wrap_content"
75 android:id="@+id/movie_source_type_iv" 75 android:id="@+id/movie_source_type_iv"
76 android:visibility="visible" 76 android:visibility="visible"
77 - android:background="@drawable/m_1905"/> 77 + android:background="@drawable/m_baofeng"/>
78 78
79 </LinearLayout> 79 </LinearLayout>
80 80
Please register or login to post a comment