/**************************************************************************************************
Filename: DeviceActivity.java
Copyright (c) 2013 - 2014 Texas Instruments Incorporated
All rights reserved not granted herein.
Limited License.
Texas Instruments Incorporated grants a world-wide, royalty-free,
non-exclusive license under copyrights and patents it now or hereafter
owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
this software subject to the terms herein. With respect to the foregoing patent
license, such license is granted solely to the extent that any such patent is necessary
to Utilize the software alone. The patent license shall not apply to any combinations which
include this software, other than combinations with devices manufactured by or for TI ('TI Devices').
No hardware patent is licensed hereunder.
Redistributions must preserve existing copyright notices and reproduce this license (including the
above copyright notice and the disclaimer and (if applicable) source code license limitations below)
in the documentation and/or other materials provided with the distribution
Redistribution and use in binary form, without modification, are permitted provided that the following
conditions are met:
* No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
software provided in binary form.
* any redistribution and use are licensed by TI for use only with TI Devices.
* Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
If software source code is provided to you, modification and redistribution of the source code are permitted
provided that the following conditions are met:
* any redistribution and use of the source code, including any resulting derivative works, are licensed by
TI for use only with TI Devices.
* any redistribution and use of any object code compiled from the source code and any resulting derivative
works, are licensed by TI for use only with TI Devices.
Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
promote products derived from this software without specific prior written permission.
DISCLAIMER.
THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
**************************************************************************************************/
package com.example.ti.ble.sensortag;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
// import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import android.widget.Toast;
import com.example.ti.ble.btsig.profiles.DeviceInformationServiceProfile;
import com.example.ti.ble.common.BluetoothGATTDefines;
import com.example.ti.ble.common.BluetoothLeService;
import com.example.ti.ble.common.GattInfo;
import com.example.ti.ble.common.GenericBluetoothProfile;
import com.example.ti.ble.common.HCIDefines;
import com.example.ti.ble.common.HelpView;
import com.example.ti.ble.sensortag.R;
import com.example.ti.ble.ti.profiles.TILampControlProfile;
import com.example.ti.ble.ti.profiles.TIOADProfile;
import com.example.ti.ble.common.IBMIoTCloudProfile;
import com.example.ti.util.PreferenceWR;
@SuppressLint("InflateParams") public class DeviceActivity extends ViewPagerActivity {
// Log
// private static String TAG = "DeviceActivity";
// Activity
public static final String EXTRA_DEVICE = "EXTRA_DEVICE";
private static final int PREF_ACT_REQ = 0;
private static final int FWUPDATE_ACT_REQ = 1;
private DeviceView mDeviceView = null;
// BLE
private BluetoothLeService mBtLeService = null;
private BluetoothDevice mBluetoothDevice = null;
private BluetoothGatt mBtGatt = null;
private List<BluetoothGattService> mServiceList = null;
private boolean mServicesRdy = false;
private boolean mIsReceiving = false;
private IBMIoTCloudProfile mqttProfile;
// SensorTagGatt
private BluetoothGattService mOadService = null;
private BluetoothGattService mConnControlService = null;
private BluetoothGattService mTestService = null;
private boolean mIsSensorTag2;
private String mFwRev;
public ProgressDialog progressDialog;
//GUI
private List<GenericBluetoothProfile> mProfiles;
public DeviceActivity() {
mResourceFragmentPager = R.layout.fragment_pager;
mResourceIdPager = R.id.pager;
mFwRev = new String("1.5"); // Assuming all SensorTags are up to date until actual FW revision is read
}
public static DeviceActivity getInstance() {
return (DeviceActivity) mThis;
}
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
Intent intent = getIntent();
// BLE
mBtLeService = BluetoothLeService.getInstance();
mBluetoothDevice = intent.getParcelableExtra(EXTRA_DEVICE);
mServiceList = new ArrayList<BluetoothGattService>();
mIsSensorTag2 = false;
// Determine type of SensorTagGatt
String deviceName = mBluetoothDevice.getName();
if ((deviceName.equals("SensorTag2")) ||(deviceName.equals("CC2650 SensorTag"))) {
mIsSensorTag2 = true;
}
else mIsSensorTag2 = false;
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
// Log.i(TAG, "Preferences for: " + deviceName);
// GUI
mDeviceView = new DeviceView();
mSectionsPagerAdapter.addSection(mDeviceView, "Sensors");
HelpView hw = new HelpView();
hw.setParameters("help_device.html", R.layout.fragment_help, R.id.webpage);
mSectionsPagerAdapter.addSection(hw, "Help");
mProfiles = new ArrayList<GenericBluetoothProfile>();
progressDialog = new ProgressDialog(DeviceActivity.this);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setIndeterminate(true);
progressDialog.setTitle("Discovering Services");
progressDialog.setMessage("");
progressDialog.setMax(100);
progressDialog.setProgress(0);
progressDialog.show();
// GATT database
Resources res = getResources();
XmlResourceParser xpp = res.getXml(R.xml.gatt_uuid);
new GattInfo(xpp);
}
@Override
public void onDestroy()
没有合适的资源?快使用搜索试试~ 我知道了~
sensortag-20-android-master
共254个文件
png:126个
java:62个
xml:29个
需积分: 1 0 下载量 3 浏览量
2023-08-03
10:56:18
上传
评论
收藏 4.4MB ZIP 举报
温馨提示
ti的android OAD工具
资源推荐
资源详情
资源评论
收起资源包目录
sensortag-20-android-master (254个子文件)
gradlew.bat 2KB
CC2650SensorTag_BLE_All_v0.91.bin 128KB
CC2650SensorTag_BLE_All_v1.01.bin 128KB
CC2650SensorTag_BLE_All_v1.12.bin 128KB
SensorTagImgA.bin 124KB
SensorTagImgB.bin 124KB
CC2650SensorTag_ZigBee_All.bin 124KB
CC2650SensorTag_BLE_App_LCD_v1.12.bin 56KB
CC2650SensorTag_BLE_App_Light_v1.12.bin 52KB
help.css 564B
about.css 435B
license.css 423B
.DS_Store 8KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.gitattributes 68B
build.gradle 836B
build.gradle 301B
settings.gradle 24B
gradlew 5KB
SensorTag Android manifest.html 38KB
license.html 22KB
help_device.html 2KB
help_scan.html 2KB
about.html 915B
org.eclipse.paho.client.mqttv3-1.0.2.jar 157KB
org.eclipse.paho.android.service-1.0.2.jar 54KB
gradle-wrapper.jar 49KB
DeviceActivity.java 36KB
BluetoothLeService.java 32KB
FwUpdateActivity_CC26xx.java 31KB
IBMIoTCloudProfile.java 24KB
CloudProfileConfigurationDialogFragment.java 22KB
FwUpdateActivity.java 21KB
GenericCharacteristicTableRow.java 20KB
MainActivity.java 18KB
Sensor.java 15KB
SensorTagMovementTableRow.java 12KB
ScanView.java 11KB
GenericBluetoothProfile.java 11KB
SensorTagBarometerProfile.java 10KB
SensorTagMovementProfile.java 10KB
DeviceInformationServiceProfile.java 9KB
SensorTagSimpleKeysTableRow.java 9KB
SensorTagDisplayProfile.java 9KB
ViewPagerActivity.java 9KB
firmwareEntriesParser.java 9KB
SensorTagApplicationClass.java 8KB
SparkLineView.java 8KB
FileActivity.java 8KB
SensorTagSimpleKeysProfile.java 8KB
HCIDefines.java 8KB
TIOADProfile.java 8KB
DeviceInformationServiceTableRow.java 7KB
IBMIoTCloudTableRow.java 7KB
SensorTagAmbientTemperatureProfile.java 7KB
fwSelectorView.java 7KB
GattInfo.java 7KB
SensorTagGatt.java 7KB
PreferencesListener.java 7KB
TILampControlProfile.java 7KB
SensorTagBarometerTableRow.java 6KB
SensorTagIRTemperatureProfile.java 6KB
SensorTagAccelerometerProfile.java 6KB
SensorTagHumidityProfile.java 6KB
SensorTagDisplayTableRow.java 6KB
AboutDialog.java 6KB
SensorTagLuxometerProfile.java 6KB
firmwareEntryTableRow.java 6KB
Conversion.java 6KB
PreferenceWR.java 5KB
TILampControlDialogFragment.java 5KB
DeviceView.java 5KB
PreferencesFragment.java 5KB
Point3D.java 4KB
LicenseDialog.java 4KB
CustomTimer.java 4KB
tiFirmwareEntry.java 4KB
SensorTagTestProfile.java 4KB
PreferencesActivity.java 4KB
HelpView.java 4KB
BluetoothGATTDefines.java 4KB
TIOADProfileTableRow.java 4KB
SensorTagUtil.java 4KB
BleDeviceInfo.java 4KB
CustomToast.java 4KB
BarometerCalibrationCoefficients.java 3KB
MagnetometerCalibrationCoefficients.java 3KB
CustomTimerCallback.java 3KB
TILampControlProfileTableRow.java 1KB
colorpicker_450.png 426KB
colorpicker_300.png 195KB
共 254 条
- 1
- 2
- 3
资源评论
vincent_y
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功