当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionState.CONNECTED属性代码示例

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


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

示例1: getConnectedBandClient

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,代码行数:16,代码来源:BandComm.java

示例2: getConnectedBandClient

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,代码行数:17,代码来源:MSBandActivity.java

示例3: getConnectedBandClient

/**
 * 连接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,代码行数:18,代码来源:WelcomeActivity.java

示例4: getConnectedBandClient

/**
 * 连接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,代码行数:18,代码来源:DesktopActivity.java

示例5: getConnectedBandClient

/**
 * 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,代码行数:21,代码来源:MSBandRRIntervalDevice.java

示例6: connectDevice

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,代码行数:22,代码来源:Device.java

示例7: getConnectedBandClient

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,代码行数:15,代码来源:BandComm.java

示例8: getConnectedBandClient

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,代码行数:15,代码来源:BandStreamingAppActivity.java

示例9: getConnectedBandClient

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,代码行数:15,代码来源:LoginActivity.java

示例10: getConnectedBandClient

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,代码行数:15,代码来源:BandNotificationToPinyinActivity.java

示例11: connect

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,代码行数:30,代码来源:MSBandManager.java

示例12: onStateChanged

@Override
public void onStateChanged(ConnectionState connectionState)
{
	connected = (connectionState == ConnectionState.CONNECTED);
	Log.i("MSBand connection status: " + connectionState.toString());
}
 
开发者ID:hcmlab,项目名称:ssj,代码行数:6,代码来源:BandListener.java


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