本文整理汇总了Java中android.bluetooth.BluetoothGattServer类的典型用法代码示例。如果您正苦于以下问题:Java BluetoothGattServer类的具体用法?Java BluetoothGattServer怎么用?Java BluetoothGattServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BluetoothGattServer类属于android.bluetooth包,在下文中一共展示了BluetoothGattServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertThatAllClientsAreDisconnected
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
private void assertThatAllClientsAreDisconnected()
{
if( m_nativeConnectionStates.size() == 0 ) return;
for( String macAddress : m_nativeConnectionStates.keySet() )
{
final Integer state = m_nativeConnectionStates.get(macAddress);
if( state != null && state != BluetoothGattServer.STATE_DISCONNECTED )
{
m_mngr.ASSERT(false, "Found a server connection state that is not disconnected when it should be.");
return;
}
}
}
示例2: PeerDevice
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
PeerDevice(BluetoothGattServer server) {
mConnectionState = STATE_DISCONNECTED;
mPeerRole = ROLE_CLIENT;
mGattServer = server;
mSending = false;
mSendList = null;
}
示例3: getNativeState
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public final int getNativeState(final String macAddress)
{
if( m_nativeConnectionStates.containsKey(macAddress) )
{
return m_nativeConnectionStates.get(macAddress);
}
else
{
return BluetoothGattServer.STATE_DISCONNECTED;
}
}
示例4: isExecutable
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
@Override protected boolean isExecutable()
{
boolean shouldBeExecutable = super.isExecutable() && getServer().m_nativeWrapper.getNativeState(m_macAddress) == BluetoothGattServer.STATE_CONNECTED;
if( shouldBeExecutable )
{
return true;
}
return false;
}
示例5: updateConnectedDevicesStatus
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
private void updateConnectedDevicesStatus() {
final String message = getString(R.string.status_devicesConnected) + " "
+ mBluetoothManager.getConnectedDevices(BluetoothGattServer.GATT).size();
runOnUiThread(new Runnable() {
@Override
public void run() {
mConnectionStatus.setText(message);
}
});
}
示例6: disconnectFromDevices
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
private void disconnectFromDevices() {
Log.d(TAG, "Disconnecting devices...");
for (BluetoothDevice device : mBluetoothManager.getConnectedDevices(
BluetoothGattServer.GATT)) {
Log.d(TAG, "Devices: " + device.getAddress() + " " + device.getName());
mGattServer.cancelConnection(device);
}
}
示例7: addProfileToGATTServer
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public boolean addProfileToGATTServer(BluetoothGattServer server) {
boolean fail = false;
try {
Thread.sleep(2000);
} catch (InterruptedException e2) {
e2.printStackTrace();
}
if (!server.addService(batteryService)) {
fail = true;
Log.d(TAG, "fail adding BatteryService");
} else {
Log.d(TAG, "added BatteryService");
}
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
if (!server.addService(HIDService)) {
fail = true;
Log.d(TAG, "fail adding HIDService");
} else {
Log.d(TAG, "added HIDService");
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (!server.addService(deviceInfoService)) {
fail = true;
Log.d(TAG, "fail adding DeviceInfoService");
} else {
Log.d(TAG, "added DeviceInfoService");
}
return !fail;
}
示例8: getGattServer
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public BluetoothGattServer getGattServer() {
return mGattServer;
}
示例9: setGattServer
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
void setGattServer(BluetoothGattServer gattServer) {
mGattServer = gattServer;
}
示例10: getNativeServer
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
@Override
public BluetoothGattServer getNativeServer()
{
return null;
}
示例11: isDisconnecting
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public final boolean isDisconnecting(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_DISCONNECTING;
}
示例12: isDisconnected
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public final boolean isDisconnected(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_DISCONNECTED;
}
示例13: isConnected
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public final boolean isConnected(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_CONNECTED;
}
示例14: isConnecting
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public final boolean isConnecting(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_CONNECTING;
}
示例15: isConnectingOrConnected
import android.bluetooth.BluetoothGattServer; //导入依赖的package包/类
public final boolean isConnectingOrConnected(final String macAddress)
{
final int nativeState = getNativeState(macAddress);
return nativeState == BluetoothGattServer.STATE_CONNECTING || nativeState == BluetoothGattServer.STATE_CONNECTED;
}