• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ConnectionState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.microsoft.band.ConnectionState的典型用法代码示例。如果您正苦于以下问题:Java ConnectionState类的具体用法?Java ConnectionState怎么用?Java ConnectionState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConnectionState类属于com.microsoft.band包,在下文中一共展示了ConnectionState类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的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


示例2: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的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


示例3: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的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


示例4: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的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


示例5: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的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


示例6: connectDevice

import com.microsoft.band.ConnectionState; //导入依赖的package包/类
private boolean connectDevice() {
    if (bandClient == null) return false;
    Log.d(TAG, "bandClient=" + bandClient);
    if (bandClient.getConnectionState() == ConnectionState.CONNECTED) return true;
    try {
        ConnectionState state = bandClient.connect().await();
        if (ConnectionState.CONNECTED == state) {
            versionFirmware = bandClient.getFirmwareVersion().await();
            versionHardware = bandClient.getHardwareVersion().await();
            Log.d(TAG, "versionFirmware=" + versionFirmware + " versionHardware=" + versionHardware);
            if (Integer.valueOf(versionHardware) <= 19)
                version = 1;
            else version = 2;
        }
        return ConnectionState.CONNECTED == state;
    } catch (Exception e) {
        if(bandClient.isConnected()) return true;
        Log.d(TAG, deviceId + " exception1");
        Log.d(TAG, deviceId + " ...connectDataKit");
        return false;
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-MicrosoftBand,代码行数:23,代码来源:Device.java


示例7: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的package包/类
private boolean getConnectedBandClient() throws InterruptedException, BandException {
    if (client == null) {
        BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
        if (devices.length == 0) {
            Log.e(this.getClass().getSimpleName(), "Band isn't paired with your phone.");
            return false;
        }
        client = BandClientManager.getInstance().create(activity.getApplicationContext(), devices[0]);
    } else if (ConnectionState.CONNECTED == client.getConnectionState()) {
        return true;
    }

    Log.i(this.getClass().getSimpleName(), "Band is connecting...\n");
    return ConnectionState.CONNECTED == client.connect().await();
}
 
开发者ID:hcmlab,项目名称:ssj,代码行数:16,代码来源:BandComm.java


示例8: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的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.\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:lskk,项目名称:Steppy-Android,代码行数:16,代码来源:BandStreamingAppActivity.java


示例9: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的package包/类
private boolean getConnectedBandClient() throws InterruptedException, BandException {
	if (client == null) {
		BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
		if (devices.length == 0) {
			System.out.println("Band isn't paired with your phone.");
			return false;
		}
		client = BandClientManager.getInstance().create(getBaseContext(), devices[0]);
	} else if (ConnectionState.CONNECTED == client.getConnectionState()) {
		return true;
	}
	
	System.out.println("Band is connecting...");
	return ConnectionState.CONNECTED == client.connect().await();
}
 
开发者ID:lskk,项目名称:Steppy-Android,代码行数:16,代码来源:LoginActivity.java


示例10: getConnectedBandClient

import com.microsoft.band.ConnectionState; //导入依赖的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.\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:w-y,项目名称:Microsoft-Band-Pinyin,代码行数:16,代码来源:BandNotificationToPinyinActivity.java


示例11: connect

import com.microsoft.band.ConnectionState; //导入依赖的package包/类
public  boolean connect() throws InterruptedException, BandException {
    Log.d(TAG,"Client devices detected: "+client);
    if (client == null) {
        BandInfo[] devices = BandClientManager.getInstance().getPairedBands();
        Log.d(TAG,"Devices: "+devices);
        Log.d(TAG,"Band devices detected: "+devices.length);
        if (devices == null) {
            return false;
        }
        client = BandClientManager.getInstance().create(mainActivity.getApplicationContext(), devices[0]);
        Log.d(TAG,"Client devices detected: "+client);
        Log.d(TAG,"Client devices detected: "+client.getConnectionState().toString());
    } else if (ConnectionState.CONNECTED == client.getConnectionState()) {
        return true;
    }
    client.registerConnectionCallback(new BandConnectionCallback() {
        @Override
        public void onStateChanged(ConnectionState connectionState) {
            Log.i(TAG,"Connection status change to: "+connectionState.toString());
            logViewer.addMessage("Band connected: "+ connectionState.toString());
            Log.i(TAG,"2 Connection status change to: "+connectionState.toString());
            mainActivity.updateBandStatus(connectionState.toString());
            Log.i(TAG,"3 Connection status change to: "+connectionState.toString());
        }
    });
    boolean out = ConnectionState.CONNECTED == client.connect().await();
    Log.d(TAG,"Output of the connect method: "+out);

    return out;
}
 
开发者ID:alexandrev,项目名称:mbandroid,代码行数:31,代码来源:MSBandManager.java


示例12: updateBandStatus

import com.microsoft.band.ConnectionState; //导入依赖的package包/类
public void updateBandStatus(final String state){
    this.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            manager = TilesManager.getInstance(mBandroid.this);
            boolean connected = false || ConnectionState.CONNECTED.toString().equals(state);
            String version = "Unknown";
            if(manager.getBand() != null) {
                Log.d(TAG,"Band is not null referenced");
              connected = manager.getBand().isConnected();
                Log.d(TAG,"Connected: "+connected);
              version = manager.getBand().getVersion();
                Log.d(TAG,"Version: "+version);
            }

            Log.d(TAG,"Band is connected: "+connected);
            if(connected){
                statusView.setImageResource(android.R.drawable.button_onoff_indicator_on);
                btnStart.setText("Stop");
                versionView.setText(version);
            }
            else{
                statusView.setImageResource(android.R.drawable.button_onoff_indicator_off);
                btnStart.setText("Start");
                versionView.setText(version);
            }
            Log.d(TAG,"Completed run method to update the band state in the GUI");
        }
    });
}
 
开发者ID:alexandrev,项目名称:mbandroid,代码行数:31,代码来源:mBandroid.java


示例13: onStateChanged

import com.microsoft.band.ConnectionState; //导入依赖的package包/类
@Override
public void onStateChanged(ConnectionState connectionState)
{
	connected = (connectionState == ConnectionState.CONNECTED);
	Log.i("MSBand connection status: " + connectionState.toString());
}
 
开发者ID:hcmlab,项目名称:ssj,代码行数:7,代码来源:BandListener.java



注:本文中的com.microsoft.band.ConnectionState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CPropertyInfo类代码示例发布时间:2022-05-23
下一篇:
Java TextEncryptor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap