Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@
android:theme="@style/AppTheme">
<activity
android:name="com.kinco.MotorApp.MainActivity"
android:label="@string/app_name">
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->

<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
android:label="@string/app_name"
android:exported="true">
</activity>
<activity
android:name="com.kinco.MotorApp.ui.secondpage.SecondMoreActivity"
android:configChanges="orientation|keyboard|keyboardHidden"
android:theme="@style/AppTheme"></activity>
<activity android:name="com.kinco.MotorApp.ui.DeviceList" />
<activity android:name="com.kinco.MotorApp.ui.DeviceList"/>
<activity android:name="com.kinco.MotorApp.ui.firstpage.FirstMoreActivity" />
<activity android:name="com.kinco.MotorApp.OSCActivity" />
<activity android:name=".SplashActivity" >

<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
broadcastUpdate(ACTION_GATT_CONNECTED);
//得到所有Service
List<BluetoothGattService> supportedGattServices = gatt.getServices();
Log.d("ga6tt",supportedGattServices.size()+"");
// supportedGattServices.remove(0);
// supportedGattServices.remove(2);
for (BluetoothGattService gattService : supportedGattServices) {
//得到每个Service的Characteristics
gattCharacteristics = gattService.getCharacteristics();
Expand All @@ -265,6 +268,7 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
Log.d(TAG, "gattCharacteristic的属性为: 具备通知属性");
notifyUuid.add(gattCharacteristic.getUuid());
notify_UUID_service = gattService.getUuid();

notify_UUID_chara = gattCharacteristic.getUuid();
}
}
Expand All @@ -274,6 +278,9 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
mBluetoothGatt.setCharacteristicNotification(mBluetoothGatt
.getService(notify_UUID_service).getCharacteristic(notify_UUID_chara),true);

// mBluetoothGatt.setCharacteristicNotification(UUID.fromString("00002b13-0000-1000-8000-00805f9b34fb"),true);


}

//调用mBluetoothGatt.readCharacteristic(characteristic)读取数据回调,在这里面接收数据
Expand Down Expand Up @@ -329,7 +336,7 @@ public void onCreate() {
super.onCreate();
init();
Log.d(TAG,"创建了服务");
//// //调试用
// //调试用
// mHandler.postDelayed(new Runnable() {
// @Override
// public void run() {
Expand All @@ -348,7 +355,6 @@ public IBinder onBind(Intent intent) {

@Override
public boolean onUnbind(Intent intent) {
close();
return super.onUnbind(intent);
}
public void close() {
Expand Down
19 changes: 15 additions & 4 deletions app/src/main/java/com/kinco/MotorApp/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Expand Down Expand Up @@ -32,9 +33,6 @@
import java.util.List;

public class MainActivity extends AppCompatActivity {
private TextView textview;
private Button mButton3;
private Button mButton4;
private FirstpageFragment firstpageFragment=new FirstpageFragment(); ;
private SecondpageFragment secondpageFragment=new SecondpageFragment();
private ThirdpageFragment thirdpageFragment=new ThirdpageFragment();
Expand Down Expand Up @@ -83,6 +81,19 @@ protected void onSaveInstanceState(Bundle outState) {

}

//返回键不会销毁程序
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

if (keyCode == KeyEvent.KEYCODE_BACK) {
Intent home = new Intent(Intent.ACTION_MAIN);
home.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
home.addCategory(Intent.CATEGORY_HOME);
startActivity(home);
return true;
}
return super.onKeyDown(keyCode, event);
}


@Override
Expand All @@ -97,7 +108,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
break;
case R.id.item01:
Toast.makeText(MyApplication.getContext(),"Coming soon",Toast.LENGTH_SHORT);
Toast.makeText(MainActivity.this,"Coming soon",Toast.LENGTH_SHORT);
break;
case R.id.item02:
Toast.makeText(MyApplication.getContext(),"Coming soon",Toast.LENGTH_SHORT);
Expand Down
204 changes: 0 additions & 204 deletions app/src/main/java/com/kinco/MotorApp/OSCActivity.java

This file was deleted.

8 changes: 7 additions & 1 deletion app/src/main/java/com/kinco/MotorApp/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import android.view.WindowManager;

import com.kinco.MotorApp.ui.DeviceList;


public class SplashActivity extends Activity {
Expand All @@ -31,6 +32,11 @@ protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

//避免重复加载
if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
finish();
return;
}


getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);//隐藏状态栏
Expand Down Expand Up @@ -65,7 +71,7 @@ public void run() {



Intent it=new Intent(getApplicationContext(),MainActivity.class);//启动MainActivity
Intent it=new Intent(getApplicationContext(), DeviceList.class);//启动MainActivity



Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/kinco/MotorApp/TabFragmentUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public TabFragmentUtils(RadioGroup radioGroup, int container, List<Fragment> fra
//设置radiobutton的点事件
radioGroup.setOnCheckedChangeListener(this);
//默认选择0 页面
((RadioButton) radioGroup.getChildAt(0)).setChecked(true);
((RadioButton) radioGroup.getChildAt(3)).setChecked(true);
}

public void onCheckedChanged(RadioGroup group, int checkedId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

import com.kinco.MotorApp.util;

/**
* 错误提示框
*/
public class ErrorDialog extends AlertDialog.Builder{
public ErrorDialog(Context context,String text) {
super(context);
Expand Down
Loading