Android Open Source - GizwitsBLE Ble Application






From Project

Back to project page GizwitsBLE.

License

The source code is released under:

Apache License

If you think the Android project GizwitsBLE listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.bluetooth.le;
/*from w  w  w  .  j  a va  2s .c  o m*/
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;

import com.xtremeprog.sdk.ble.BleService;
import com.xtremeprog.sdk.ble.IBle;

public class BleApplication extends Application {

  private BleService mService;
  private IBle mBle;

  private final ServiceConnection mServiceConnection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName className,
        IBinder rawBinder) {
      mService = ((BleService.LocalBinder) rawBinder).getService();
      mBle = mService.getBle();
      if (mBle != null && !mBle.adapterEnabled()) {
        // TODO: enalbe adapter
      }
    }

    @Override
    public void onServiceDisconnected(ComponentName classname) {
      mService = null;
    }
  };

  @Override
  public void onCreate() {
    super.onCreate();

    Intent bindIntent = new Intent(this, BleService.class);
    bindService(bindIntent, mServiceConnection, Context.BIND_AUTO_CREATE);
  }
  
  public IBle getIBle() {
    return mBle;
  }
}




Java Source Code List

com.example.bluetooth.le.BleApplication.java
com.example.bluetooth.le.CharacteristicActivity.java
com.example.bluetooth.le.DeviceControlActivity.java
com.example.bluetooth.le.DeviceScanActivity.java
com.example.bluetooth.le.Utils.java
com.xtremeprog.sdk.ble.AndroidBle.java
com.xtremeprog.sdk.ble.BleGattCharacteristic.java
com.xtremeprog.sdk.ble.BleGattService.java
com.xtremeprog.sdk.ble.BleRequest.java
com.xtremeprog.sdk.ble.BleService.java
com.xtremeprog.sdk.ble.BroadcomBle.java
com.xtremeprog.sdk.ble.IBleRequestHandler.java
com.xtremeprog.sdk.ble.IBle.java
com.xtremeprog.sdk.ble.SamsungBle.java