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;
}
}
}
java类android.bluetooth.BluetoothGattServer的实例源码
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 26
收藏 0
点赞 0
评论 0
P_NativeServerWrapper.java 文件源码
项目:SweetBlue
阅读 24
收藏 0
点赞 0
评论 0
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;
}
}
}
JniCallbacks.java 文件源码
项目:mesh-core-on-android
阅读 29
收藏 0
点赞 0
评论 0
PeerDevice(BluetoothGattServer server) {
mConnectionState = STATE_DISCONNECTED;
mPeerRole = ROLE_CLIENT;
mGattServer = server;
mSending = false;
mSendList = null;
}
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 28
收藏 0
点赞 0
评论 0
public final int getNativeState(final String macAddress)
{
if( m_nativeConnectionStates.containsKey(macAddress) )
{
return m_nativeConnectionStates.get(macAddress);
}
else
{
return BluetoothGattServer.STATE_DISCONNECTED;
}
}
PA_Task_RequiresServerConnection.java 文件源码
项目:AsteroidOSSync
阅读 25
收藏 0
点赞 0
评论 0
@Override protected boolean isExecutable()
{
boolean shouldBeExecutable = super.isExecutable() && getServer().m_nativeWrapper.getNativeState(m_macAddress) == BluetoothGattServer.STATE_CONNECTED;
if( shouldBeExecutable )
{
return true;
}
return false;
}
Peripheral.java 文件源码
项目:ble-test-peripheral-android
阅读 31
收藏 0
点赞 0
评论 0
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);
}
});
}
Peripheral.java 文件源码
项目:ble-test-peripheral-android
阅读 33
收藏 0
点赞 0
评论 0
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);
}
}
P_NativeServerWrapper.java 文件源码
项目:SweetBlue
阅读 25
收藏 0
点赞 0
评论 0
public final int getNativeState(final String macAddress)
{
if( m_nativeConnectionStates.containsKey(macAddress) )
{
return m_nativeConnectionStates.get(macAddress);
}
else
{
return BluetoothGattServer.STATE_DISCONNECTED;
}
}
PA_Task_RequiresServerConnection.java 文件源码
项目:SweetBlue
阅读 28
收藏 0
点赞 0
评论 0
@Override protected boolean isExecutable()
{
boolean shouldBeExecutable = super.isExecutable() && getServer().m_nativeWrapper.getNativeState(m_macAddress) == BluetoothGattServer.STATE_CONNECTED;
if( shouldBeExecutable )
{
return true;
}
return false;
}
HIDoverGattProfile.java 文件源码
项目:BGSEP
阅读 30
收藏 0
点赞 0
评论 0
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;
}
JniCallbacks.java 文件源码
项目:mesh-core-on-android
阅读 24
收藏 0
点赞 0
评论 0
public BluetoothGattServer getGattServer() {
return mGattServer;
}
CurrentTimeService.java 文件源码
项目:android-bluetooth-current-time-service
阅读 23
收藏 0
点赞 0
评论 0
void setGattServer(BluetoothGattServer gattServer) {
mGattServer = gattServer;
}
UnitTestServerLayer.java 文件源码
项目:AsteroidOSSync
阅读 26
收藏 0
点赞 0
评论 0
@Override
public BluetoothGattServer getNativeServer()
{
return null;
}
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 29
收藏 0
点赞 0
评论 0
public final boolean isDisconnecting(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_DISCONNECTING;
}
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 26
收藏 0
点赞 0
评论 0
public final boolean isDisconnected(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_DISCONNECTED;
}
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 26
收藏 0
点赞 0
评论 0
public final boolean isConnected(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_CONNECTED;
}
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 27
收藏 0
点赞 0
评论 0
public final boolean isConnecting(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_CONNECTING;
}
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 41
收藏 0
点赞 0
评论 0
public final boolean isConnectingOrConnected(final String macAddress)
{
final int nativeState = getNativeState(macAddress);
return nativeState == BluetoothGattServer.STATE_CONNECTING || nativeState == BluetoothGattServer.STATE_CONNECTED;
}
P_NativeServerWrapper.java 文件源码
项目:AsteroidOSSync
阅读 29
收藏 0
点赞 0
评论 0
public final boolean isDisconnectingOrDisconnected(final String macAddress)
{
final int nativeState = getNativeState(macAddress);
return nativeState == BluetoothGattServer.STATE_DISCONNECTING || nativeState == BluetoothGattServer.STATE_DISCONNECTED;
}
BleServer.java 文件源码
项目:AsteroidOSSync
阅读 29
收藏 0
点赞 0
评论 0
/**
* Provides just-in-case lower-level access to the native server instance.
* See similar warning for {@link BleDevice#getNative()}.
*/
@Advanced
public final @Nullable(Nullable.Prevalence.RARE) BluetoothGattServer getNative()
{
return m_nativeWrapper.getNative().getNativeServer();
}
P_AndroidBleServer.java 文件源码
项目:AsteroidOSSync
阅读 26
收藏 0
点赞 0
评论 0
P_AndroidBleServer(BluetoothGattServer server)
{
m_server = server;
}
P_AndroidBleServer.java 文件源码
项目:AsteroidOSSync
阅读 26
收藏 0
点赞 0
评论 0
@Override
public final BluetoothGattServer getNativeServer()
{
return m_server;
}
BLEGattServer.java 文件源码
项目:BLE-Mesh
阅读 31
收藏 0
点赞 0
评论 0
public BluetoothGattServer getGattServer() {
return gattServer;
}
EddystoneGattService.java 文件源码
项目:beacons-android
阅读 27
收藏 0
点赞 0
评论 0
public void readCharacteristic(BluetoothGattServer gattServer, BluetoothDevice device,
int requestId, int offset,
BluetoothGattCharacteristic characteristic) {
// UUID uuid = characteristic.getUuid();
int status = BluetoothGatt.GATT_SUCCESS;
if (isLocked()) {
if (characteristic == mUnlockCharacteristic) {
log("Generating secure unlock challenge");
characteristic.setValue(new byte[16]);
new SecureRandom().nextBytes(characteristic.getValue());
} else {
if (characteristic != mLockStateCharacteristic) {
status = BluetoothGatt.GATT_READ_NOT_PERMITTED;
}
}
}
else if (characteristic == mUnlockCharacteristic) {
status = BluetoothGatt.GATT_READ_NOT_PERMITTED;
} else if (characteristic == mPublicEcdhKeyCharacteristic) {
log("ECDH Public Key was requested");
if (0 == offset) {
characteristic.setValue(null == mEidKeyPair ? new byte[0] : mEidKeyPair.getPublicKey());
}
} else if (characteristic == mAdvSlotDataCharacteristic) {
log("Advertisement slot data requested");
characteristic.setValue(mConfigCallback.getAdvertisedData());
} else if (characteristic == mEidIdentityKeyCharacteristic) {
log("Identity Key was requested");
byte[] identityKey = mConfigCallback.getEidIdentityKey();
if (null == identityKey) {
status = BluetoothGatt.GATT_FAILURE;
}
else {
characteristic.setValue(aes_transform(true, identityKey, 0, 16));
}
}
gattServer.sendResponse(device, requestId, status, offset,
status == BluetoothGatt.GATT_SUCCESS ? Arrays.copyOfRange(characteristic.getValue(), offset, characteristic.getValue().length) : null);
}
BLEManager.java 文件源码
项目:swan-sense-studio
阅读 30
收藏 0
点赞 0
评论 0
public ExecAddService(BluetoothGattServer bleServer, BluetoothGattService service) {
this.bleServer = bleServer;
this.service = service;
}
BLEManager.java 文件源码
项目:swan-sense-studio
阅读 41
收藏 0
点赞 0
评论 0
protected BluetoothGattServer getBleServer() {
return bleServer;
}
BLEClientWorker.java 文件源码
项目:swan-sense-studio
阅读 25
收藏 0
点赞 0
评论 0
public ExecAddService(BluetoothGattServer bleServer, BluetoothGattService service) {
this.bleServer = bleServer;
this.service = service;
}
UnitTestServerLayer.java 文件源码
项目:SweetBlue
阅读 31
收藏 0
点赞 0
评论 0
@Override
public BluetoothGattServer getNativeServer()
{
return null;
}
P_NativeServerWrapper.java 文件源码
项目:SweetBlue
阅读 28
收藏 0
点赞 0
评论 0
public final boolean isDisconnecting(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_DISCONNECTING;
}
P_NativeServerWrapper.java 文件源码
项目:SweetBlue
阅读 25
收藏 0
点赞 0
评论 0
public final boolean isDisconnected(final String macAddress)
{
return getNativeState(macAddress) == BluetoothGattServer.STATE_DISCONNECTED;
}