Navigation Menu

Skip to content

Commit

Permalink
add the scroll and use android studio
Browse files Browse the repository at this point in the history
  • Loading branch information
jimaobian committed Dec 28, 2015
1 parent 22b40cf commit 5587099
Show file tree
Hide file tree
Showing 395 changed files with 790 additions and 3,869 deletions.
Binary file modified Android/BlunoBasicDemo.apk
Binary file not shown.
8 changes: 8 additions & 0 deletions Android/BlunoBasicDemo/.gitignore
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
1 change: 1 addition & 0 deletions Android/BlunoBasicDemo/.idea/.name

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

22 changes: 22 additions & 0 deletions Android/BlunoBasicDemo/.idea/compiler.xml

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

3 changes: 3 additions & 0 deletions Android/BlunoBasicDemo/.idea/copyright/profiles_settings.xml

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

19 changes: 19 additions & 0 deletions Android/BlunoBasicDemo/.idea/gradle.xml

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

62 changes: 62 additions & 0 deletions Android/BlunoBasicDemo/.idea/misc.xml

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

9 changes: 9 additions & 0 deletions Android/BlunoBasicDemo/.idea/modules.xml

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

12 changes: 12 additions & 0 deletions Android/BlunoBasicDemo/.idea/runConfigurations.xml

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

6 changes: 6 additions & 0 deletions Android/BlunoBasicDemo/.idea/vcs.xml

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

1 change: 1 addition & 0 deletions Android/BlunoBasicDemo/app/.gitignore
@@ -0,0 +1 @@
/build
26 changes: 26 additions & 0 deletions Android/BlunoBasicDemo/app/build.gradle
@@ -0,0 +1,26 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.dfrobot.angelo.blunobasicdemo"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.3'
}
@@ -1,11 +1,8 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
# in /Users/Angelo/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
@@ -0,0 +1,13 @@
package com.dfrobot.angelo.blunobasicdemo;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
35 changes: 35 additions & 0 deletions Android/BlunoBasicDemo/app/src/main/AndroidManifest.xml
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dfrobot.angelo.blunobasicdemo">


<!-- Declare this required feature if you want to make the app available to BLE-capable
devices only. If you want to make your app available to devices that don't support BLE,
you should omit this in the manifest. Instead, determine BLE capability by using
PackageManager.hasSystemFeature(FEATURE_BLUETOOTH_LE) -->
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.dfrobot.angelo.blunobasicdemo.BluetoothLeService" android:enabled="true"/>

</application>

</manifest>
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.blunobasicdemo;
package com.dfrobot.angelo.blunobasicdemo;

import android.app.Service;
import android.bluetooth.BluetoothAdapter;
Expand Down
@@ -1,10 +1,8 @@
package com.example.blunobasicdemo;
package com.dfrobot.angelo.blunobasicdemo;

import java.util.ArrayList;
import java.util.List;

import com.example.blunobasicdemo.R;

import android.os.Handler;
import android.os.IBinder;
import android.annotation.SuppressLint;
Expand Down Expand Up @@ -40,7 +38,7 @@ public abstract class BlunoLibrary extends Activity{
//
// mainContext=theContext;
// }

public abstract void onConectionStateChange(connectionStateEnum theconnectionStateEnum);
public abstract void onSerialReceived(String theString);
public void serialSend(String theString){
Expand Down Expand Up @@ -121,10 +119,10 @@ public void onCreateProcess()
Toast.LENGTH_SHORT).show();
((Activity) mainContext).finish();
}
Intent gattServiceIntent = new Intent(mainContext, BluetoothLeService.class);
mainContext.bindService(gattServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);


Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
bindService(gattServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE);

// Initializes list view adapter.
mLeDeviceListAdapter = new LeDeviceListAdapter();
Expand All @@ -139,19 +137,21 @@ public void onClick(DialogInterface dialog, int which)
if (device == null)
return;
scanLeDevice(false);
System.out.println("onListItemClick " + device.getName().toString());

System.out.println("Device Name:"+device.getName() + " " + "Device Name:" + device.getAddress());

mDeviceName=device.getName().toString();
mDeviceAddress=device.getAddress().toString();

if(mDeviceName.equals("No Device Available") && mDeviceAddress.equals("No Address Available"))

if(device.getName()==null || device.getAddress()==null)
{
mConnectionState=connectionStateEnum.isToScan;
onConectionStateChange(mConnectionState);
}
else{

System.out.println("onListItemClick " + device.getName().toString());

System.out.println("Device Name:"+device.getName() + " " + "Device Name:" + device.getAddress());

mDeviceName=device.getName().toString();
mDeviceAddress=device.getAddress().toString();

if (mBluetoothLeService.connect(mDeviceAddress)) {
Log.d(TAG, "Connect request success");
mConnectionState=connectionStateEnum.isConnecting;
Expand All @@ -166,14 +166,14 @@ public void onClick(DialogInterface dialog, int which)
}
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener(){
.setOnCancelListener(new DialogInterface.OnCancelListener() {

@Override
public void onCancel(DialogInterface arg0) {
System.out.println("mBluetoothAdapter.stopLeScan");

mConnectionState=connectionStateEnum.isToScan;
onConectionStateChange(mConnectionState);
mConnectionState = connectionStateEnum.isToScan;
onConectionStateChange(mConnectionState);
mScanDeviceDialog.dismiss();

scanLeDevice(false);
Expand Down Expand Up @@ -408,7 +408,7 @@ void scanLeDevice(final boolean enable) {
}

// Code to manage Service lifecycle.
private final ServiceConnection mServiceConnection = new ServiceConnection() {
ServiceConnection mServiceConnection = new ServiceConnection() {

@Override
public void onServiceConnected(ComponentName componentName, IBinder service) {
Expand All @@ -426,7 +426,7 @@ public void onServiceDisconnected(ComponentName componentName) {
mBluetoothLeService = null;
}
};

// Device scan callback.
private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {

Expand Down

0 comments on commit 5587099

Please sign in to comment.