本文整理汇总了Java中com.microsoft.band.BandException类的典型用法代码示例。如果您正苦于以下问题:Java BandException类的具体用法?Java BandException怎么用?Java BandException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BandException类属于com.microsoft.band包,在下文中一共展示了BandException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleBandException
import com.microsoft.band.BandException; //导入依赖的package包/类
private void handleBandException(BandException e) {
String exceptionMessage = "";
switch (e.getErrorType()) {
case DEVICE_ERROR:
exceptionMessage = "Please make sure bluetooth is on and the band is in range.\n";
break;
case UNSUPPORTED_SDK_VERSION_ERROR:
exceptionMessage = "Microsoft Health BandService doesn't support your SDK Version. Please update to latest SDK.\n";
break;
case SERVICE_ERROR:
exceptionMessage = "Microsoft Health BandService is not available. Please make sure Microsoft Health is installed and that you have the correct permissions.\n";
break;
case BAND_FULL_ERROR:
exceptionMessage = "Band is full. Please use Microsoft Health to remove a tile.\n";
break;
default:
exceptionMessage = "Unknown error occured: " + e.getMessage() + "\n";
break;
}
Log.e(this.getClass().getSimpleName(), exceptionMessage);
}
开发者ID:hcmlab,项目名称:ssj,代码行数:22,代码来源:BandComm.java
示例2: getConnectedBandClient
import com.microsoft.band.BandException; //导入依赖的package包/类
private boolean getConnectedBandClient() throws InterruptedException, BandException {
if (client == null) {
BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
if (devices.length == 0 || id >= devices.length) {
Log.e("Requested Band isn't paired with your phone.");
return false;
}
Context c = SSJApplication.getAppContext();
client = BandClientManager.getInstance().create(c, devices[id]);
} else if (ConnectionState.CONNECTED == client.getConnectionState()) {
return true;
}
Log.i("Band is connecting...\n");
return ConnectionState.CONNECTED == client.connect().await();
}
开发者ID:hcmlab,项目名称:ssj,代码行数:17,代码来源:BandComm.java
示例3: handleBandException
import com.microsoft.band.BandException; //导入依赖的package包/类
private void handleBandException(BandException e) {
String exceptionMessage = "";
switch (e.getErrorType()) {
case DEVICE_ERROR:
exceptionMessage = "Please make sure bluetooth is on and the band is in range.\n";
break;
case UNSUPPORTED_SDK_VERSION_ERROR:
exceptionMessage = "Microsoft Health BandService doesn't support your SDK Version. Please update to latest SDK.\n";
break;
case SERVICE_ERROR:
exceptionMessage = "Microsoft Health BandService is not available. Please make sure Microsoft Health is installed and that you have the correct permissions.\n";
break;
case BAND_FULL_ERROR:
exceptionMessage = "Band is full. Please use Microsoft Health to remove a tile.\n";
break;
default:
exceptionMessage = "Unknown error occured: " + e.getMessage() + "\n";
break;
}
Log.e(exceptionMessage);
}
开发者ID:hcmlab,项目名称:ssj,代码行数:22,代码来源:BandComm.java
示例4: disconnect
import com.microsoft.band.BandException; //导入依赖的package包/类
@Override
protected void disconnect() throws SSJFatalException
{
Log.d("Disconnecting from MS Band");
if (client != null)
{
try
{
client.getSensorManager().unregisterAllListeners();
client.disconnect().await(1000, TimeUnit.MILLISECONDS);
}
catch (InterruptedException | TimeoutException | BandException e)
{
Log.e("Error while disconnecting from ms band", e);
}
}
client = null;
}
开发者ID:hcmlab,项目名称:ssj,代码行数:20,代码来源:MSBand.java
示例5: getConnectedBandClient
import com.microsoft.band.BandException; //导入依赖的package包/类
private boolean getConnectedBandClient() throws InterruptedException, BandException {
if (client == null) {
BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
if (devices.length == 0) {
appendToUI("Band isn't paired with your phone.", 1);
mTest.setTextColor(Color.parseColor("#d04545"));
return false;
}
client = BandClientManager.getInstance().create(getBaseContext(), devices[0]);
} else if (ConnectionState.CONNECTED == client.getConnectionState()) {
return true;
} else if(ConnectionState.UNBOUND == client.getConnectionState())
return false;
appendToUI("Band is connecting...", 1);
return ConnectionState.CONNECTED == client.connect().await();
}
开发者ID:lskk,项目名称:Steppy-Android,代码行数:18,代码来源:MSBandActivity.java
示例6: getConnectedBandClient
import com.microsoft.band.BandException; //导入依赖的package包/类
/**
* 连接band
*/
private boolean getConnectedBandClient() throws InterruptedException, BandException {
if (client == null) {
BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
if (devices.length == 0) {
appendToUI("Band isn't paired with your phone.\n");
return false;
}
client = BandClientManager.getInstance().create(getBaseContext(), devices[0]);
} else if (ConnectionState.CONNECTED == client.getConnectionState()) {
return true;
}
//appendToUI("Band is connecting...\n");
return ConnectionState.CONNECTED == client.connect().await();
}
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:19,代码来源:WelcomeActivity.java
示例7: getConnectedBandClient
import com.microsoft.band.BandException; //导入依赖的package包/类
/**
* 连接band
*/
private boolean getConnectedBandClient() throws InterruptedException, BandException {
if (client == null) {
BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
if (devices.length == 0) {
Methods.showToast("Band isn't paired with your phone.\n", false);
return false;
}
client = BandClientManager.getInstance().create(getBaseContext(), devices[0]);
BandApplication.client = client;
} else if (ConnectionState.CONNECTED == client.getConnectionState()) {
return true;
}
Methods.showToast("Band is connecting...\n", false);
return ConnectionState.CONNECTED == client.connect().await();
}
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:19,代码来源:DesktopActivity.java
示例8: getConnectedBandClient
import com.microsoft.band.BandException; //导入依赖的package包/类
/**
* get the Microsoft band client, that handles all the connections and does the actual measurement
* @return wether the band is connected
* @throws InterruptedException connection has dropped e.g.
* @throws BandException ohter stuff that should not happen
*/
boolean getConnectedBandClient() throws InterruptedException, BandException {
if (client == null) {
BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
if (devices.length == 0) {
notifyDeviceError(activity.getResources().getString(R.string.error_band_not_paired));
return false;
}
client = BandClientManager.getInstance().create(activity.getApplicationContext(), devices[0]);
} else if (ConnectionState.CONNECTED == client.getConnectionState()) {
return true;
}
notifyDeviceStatusChanged(HRVDeviceStatus.CONNECTING);
return ConnectionState.CONNECTED == client.connect().await();
}
开发者ID:HRVBand,项目名称:hrv-band,代码行数:22,代码来源:MSBandRRIntervalDevice.java
示例9: getVersion
import com.microsoft.band.BandException; //导入依赖的package包/类
public String getVersion() {
Log.d(TAG,"Recovering the firmware version of the MS Band");
String out = "";
if(isConnected()) {
Log.d(TAG,"Retrieving band version as it is connected");
try {
String firmware = client.getFirmwareVersion().await();
String hardware = client.getHardwareVersion().await();
out += hardware + " / " + firmware;
} catch (BandException ex) {
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Log.d(TAG,"Version value: "+out);
return out;
}
开发者ID:alexandrev,项目名称:mbandroid,代码行数:20,代码来源:MSBandManager.java
示例10: run
import com.microsoft.band.BandException; //导入依赖的package包/类
@Override
public void run() {
try {
curVibration++;
Log.d(TAG, "vibrate..." + curVibration + " repeat=" + notificationRequestVibration.getRepeat());
if (curVibration <= notificationRequestVibration.getRepeat()) {
bandClient.getNotificationManager().vibrate(VibrationType.ONE_TONE_HIGH).await();
handlerVibration.postDelayed(this, notificationRequestVibration.getDuration() / notificationRequestVibration.getRepeat());
}
} catch (InterruptedException | BandException e) {
Log.e(TAG, "ERROR=" + e.toString());
// handle InterruptedException
}
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:18,代码来源:Device.java
示例11: configureMicrosoftBand
import com.microsoft.band.BandException; //导入依赖的package包/类
synchronized void configureMicrosoftBand(final Activity activity, final String wrist) {
Log.d(TAG, "change background wrist=" + wrist);
connect(new BandCallBack() {
@Override
public void onBandConnected() {
try {
changeBackGround(wrist);
addTiles(activity, wrist);
disconnect();
Intent intent = new Intent("background");
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} catch (InterruptedException | BandException e) {
e.printStackTrace();
}
}
});
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:21,代码来源:Device.java
示例12: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerCaloriesEventListener(mCaloriesEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:17,代码来源:CaloryBurn.java
示例13: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerUVEventListener(mUltravioletEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:17,代码来源:UltraVioletRadiation.java
示例14: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerContactEventListener(mBandContactEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:18,代码来源:BandContact.java
示例15: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerDistanceEventListener(mDistanceEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:17,代码来源:Distance.java
示例16: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerDistanceEventListener(mPaceEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:17,代码来源:Pace.java
示例17: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerPedometerEventListener(mPedometerEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:17,代码来源:StepCount.java
示例18: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerSkinTemperatureEventListener(mSkinTemperatureEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:17,代码来源:SkinTemperature.java
示例19: run
import com.microsoft.band.BandException; //导入依赖的package包/类
@Override
public void run() {
try {
if (isRegistered == true) return;
if (bandClient.getSensorManager().getCurrentHeartRateConsent() != UserConsent.GRANTED) {
Intent intent = new Intent(context, HRConsentActivity.class);
intent.putExtra("type", HeartRate.class.getSimpleName());
HRConsentActivity.bandClient = bandClient;
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} else if (bandClient.getSensorManager().getCurrentHeartRateConsent() == UserConsent.GRANTED) {
bandClient.getSensorManager().registerHeartRateEventListener(mHeartRateEventListener);
isRegistered = true;
}
} catch (BandException e) {
e.printStackTrace();
}
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:19,代码来源:HeartRate.java
示例20: register
import com.microsoft.band.BandException; //导入依赖的package包/类
public void register(Context context, final BandClient bandClient, Platform platform, CallBack callBack){
registerDataSource(context, platform);
this.callBack=callBack;
final Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
bandClient.getSensorManager().registerDistanceEventListener(mSpeedEventListener);
} catch (BandException e) {
e.printStackTrace();
}
}
});
background.start();
}
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:17,代码来源:Speed.java
注:本文中的com.microsoft.band.BandException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论