Java 类com.google.android.gms.wearable.ConnectionConfiguration 实例源码

项目:android_packages_apps_GmsCore    文件:ConfigurationDatabaseHelper.java   
public void putConfiguration(ConnectionConfiguration config, String oldNodeId) {
    ContentValues contentValues = new ContentValues();
    if (config.name != null) {
        contentValues.put("name", config.name);
    } else if (config.role == 2) {
        contentValues.put("name", "server");
    } else {
        contentValues.put("name", "NULL_STRING");
    }
    if (config.address != null) {
        contentValues.put("pairedBtAddress", config.address);
    } else {
        contentValues.put("pairedBtAddress", "NULL_STRING");
    }
    contentValues.put("connectionType", config.type);
    contentValues.put("role", config.role);
    contentValues.put("connectionEnabled", true);
    contentValues.put("nodeId", config.nodeId);
    if (oldNodeId == null) {
        getWritableDatabase().insert(TABLE_NAME, null, contentValues);
    } else {
        getWritableDatabase().update(TABLE_NAME, contentValues, "nodeId=?", new String[]{oldNodeId});
    }
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public synchronized ConnectionConfiguration[] getConfigurations() {
    if (configurations == null) {
        configurations = configDatabase.getAllConfigurations();
    }
    if (configurationsUpdated) {
        configurationsUpdated = false;
        ConnectionConfiguration[] newConfigurations = configDatabase.getAllConfigurations();
        for (ConnectionConfiguration configuration : configurations) {
            for (ConnectionConfiguration newConfiguration : newConfigurations) {
                if (newConfiguration.name.equals(configuration.name)) {
                    newConfiguration.connected = configuration.connected;
                    newConfiguration.peerNodeId = configuration.peerNodeId;
                    newConfiguration.nodeId = configuration.nodeId;
                    break;
                }
            }
        }
        configurations = newConfigurations;
    }
    Log.d(TAG, "Configurations reported: " + Arrays.toString(configurations));
    return configurations;
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
private void closeConnection(String nodeId) {
    WearableConnection connection = activeConnections.get(nodeId);
    try {
        connection.close();
    } catch (IOException e1) {
        Log.w(TAG, e1);
    }
    if (connection == sct.getWearableConnection()) {
        sct.close();
        sct = null;
    }
    activeConnections.remove(nodeId);
    for (ConnectionConfiguration config : getConfigurations()) {
        if (config.nodeId.equals(nodeId) || config.peerNodeId.equals(nodeId)) {
            config.connected = false;
        }
    }
    onPeerDisconnected(new NodeParcelable(nodeId, "Wear device"));
    Log.d(TAG, "Closed connection to " + nodeId + " on error");
}
项目:android_packages_apps_GmsCore    文件:MessageHandler.java   
private MessageHandler(WearableImpl wearable, ConnectionConfiguration config, String name, String networkId, long androidId) {
    super(new Connect.Builder()
            .name(name)
            .id(wearable.getLocalNodeId())
            .networkId(networkId)
            .peerAndroidId(androidId)
            .unknown4(3)
            .peerVersion(1)
            .build());
    this.wearable = wearable;
    this.oldConfigNodeId = config.nodeId;
}
项目:android_packages_apps_GmsCore    文件:ConfigurationDatabaseHelper.java   
private static ConnectionConfiguration configFromCursor(final Cursor cursor) {
    String name = cursor.getString(cursor.getColumnIndex("name"));
    String pairedBtAddress = cursor.getString(cursor.getColumnIndex("pairedBtAddress"));
    int connectionType = cursor.getInt(cursor.getColumnIndex("connectionType"));
    int role = cursor.getInt(cursor.getColumnIndex("role"));
    int enabled = cursor.getInt(cursor.getColumnIndex("connectionEnabled"));
    String nodeId = cursor.getString(cursor.getColumnIndex("nodeId"));
    if (NULL_STRING.equals(name)) name = null;
    if (NULL_STRING.equals(pairedBtAddress)) pairedBtAddress = null;
    return new ConnectionConfiguration(name, pairedBtAddress, connectionType, role, enabled > 0, nodeId);
}
项目:android_packages_apps_GmsCore    文件:ConfigurationDatabaseHelper.java   
public ConnectionConfiguration getConfiguration(String name) {
    Cursor cursor = getReadableDatabase().query(TABLE_NAME, null, BY_NAME, new String[]{name}, null, null, null);
    ConnectionConfiguration config = null;
    if (cursor != null) {
        if (cursor.moveToNext())
            config = configFromCursor(cursor);
        cursor.close();
    }
    return config;
}
项目:android_packages_apps_GmsCore    文件:ConfigurationDatabaseHelper.java   
public ConnectionConfiguration[] getAllConfigurations() {
    Cursor cursor = getReadableDatabase().query(TABLE_NAME, null, null, null, null, null, null);
    if (cursor != null) {
        List<ConnectionConfiguration> configurations = new ArrayList<ConnectionConfiguration>();
        while (cursor.moveToNext()) {
            configurations.add(configFromCursor(cursor));
        }
        cursor.close();
        return configurations.toArray(new ConnectionConfiguration[configurations.size()]);
    } else {
        return null;
    }
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public void onConnectReceived(WearableConnection connection, String nodeId, Connect connect) {
    for (ConnectionConfiguration config : getConfigurations()) {
        if (config.nodeId.equals(nodeId)) {
            if (config.nodeId != nodeId) {
                config.nodeId = connect.id;
                configDatabase.putConfiguration(config, nodeId);
            }
            config.peerNodeId = connect.id;
            config.connected = true;
        }
    }
    Log.d(TAG, "Adding connection to list of open connections: " + connection + " with connect " + connect);
    activeConnections.put(connect.id, connection);
    onPeerConnected(new NodeParcelable(connect.id, connect.name));
    // Fetch missing assets
    Cursor cursor = nodeDatabase.listMissingAssets();
    if (cursor != null) {
        while (cursor.moveToNext()) {
            try {
                Log.d(TAG, "Fetch for " + cursor.getString(12));
                connection.writeMessage(new RootMessage.Builder()
                        .fetchAsset(new FetchAsset.Builder()
                                .assetName(cursor.getString(12))
                                .packageName(cursor.getString(1))
                                .signatureDigest(cursor.getString(2))
                                .permission(false)
                                .build()).build());
            } catch (IOException e) {
                Log.w(TAG, e);
                closeConnection(connect.id);
            }
        }
        cursor.close();
    }
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public void onDisconnectReceived(WearableConnection connection, Connect connect) {
    for (ConnectionConfiguration config : getConfigurations()) {
        if (config.nodeId.equals(connect.id)) {
            config.connected = false;
        }
    }
    Log.d(TAG, "Removing connection from list of open connections: " + connection);
    activeConnections.remove(connect.id);
    onPeerDisconnected(new NodeParcelable(connect.id, connect.name));
}
项目:FMTech    文件:zzbb.java   
public abstract void zza(zzaz paramzzaz, ConnectionConfiguration paramConnectionConfiguration)
throws RemoteException;
项目:FMTech    文件:zzbb.java   
public abstract void zzb(zzaz paramzzaz, ConnectionConfiguration paramConnectionConfiguration)
throws RemoteException;
项目:FMTech    文件:zzbb.java   
public final void zza(zzaz paramzzaz, ConnectionConfiguration paramConnectionConfiguration)
  throws RemoteException
{
  // Byte code:
  //   0: invokestatic 27   android/os/Parcel:obtain    ()Landroid/os/Parcel;
  //   3: astore_3
  //   4: invokestatic 27   android/os/Parcel:obtain    ()Landroid/os/Parcel;
  //   7: astore 4
  //   9: aload_3
  //   10: ldc 29
  //   12: invokevirtual 33 android/os/Parcel:writeInterfaceToken   (Ljava/lang/String;)V
  //   15: aload_1
  //   16: ifnull +63 -> 79
  //   19: aload_1
  //   20: invokeinterface 37 1 0
  //   25: astore 6
  //   27: aload_3
  //   28: aload 6
  //   30: invokevirtual 40 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
  //   33: aload_2
  //   34: ifnull +51 -> 85
  //   37: aload_3
  //   38: iconst_1
  //   39: invokevirtual 62 android/os/Parcel:writeInt  (I)V
  //   42: aload_2
  //   43: aload_3
  //   44: iconst_0
  //   45: invokevirtual 78 com/google/android/gms/wearable/ConnectionConfiguration:writeToParcel   (Landroid/os/Parcel;I)V
  //   48: aload_0
  //   49: getfield 15  com/google/android/gms/wearable/internal/zzbb$zza$zza:zzop  Landroid/os/IBinder;
  //   52: bipush 20
  //   54: aload_3
  //   55: aload 4
  //   57: iconst_0
  //   58: invokeinterface 46 5 0
  //   63: pop
  //   64: aload 4
  //   66: invokevirtual 49 android/os/Parcel:readException ()V
  //   69: aload 4
  //   71: invokevirtual 52 android/os/Parcel:recycle   ()V
  //   74: aload_3
  //   75: invokevirtual 52 android/os/Parcel:recycle   ()V
  //   78: return
  //   79: aconst_null
  //   80: astore 6
  //   82: goto -55 -> 27
  //   85: aload_3
  //   86: iconst_0
  //   87: invokevirtual 62 android/os/Parcel:writeInt  (I)V
  //   90: goto -42 -> 48
  //   93: astore 5
  //   95: aload 4
  //   97: invokevirtual 52 android/os/Parcel:recycle   ()V
  //   100: aload_3
  //   101: invokevirtual 52    android/os/Parcel:recycle   ()V
  //   104: aload 5
  //   106: athrow
  // Local variable table:
  //   start    length  slot    name    signature
  //   0    107 0   this    zza
  //   0    107 1   paramzzaz   zzaz
  //   0    107 2   paramConnectionConfiguration    ConnectionConfiguration
  //   3    98  3   localParcel1    Parcel
  //   7    89  4   localParcel2    Parcel
  //   93   12  5   localObject Object
  //   25   56  6   localIBinder    IBinder
  // Exception table:
  //   from to  target  type
  //   9    15  93  finally
  //   19   27  93  finally
  //   27   33  93  finally
  //   37   48  93  finally
  //   48   69  93  finally
  //   85   90  93  finally
}
项目:FMTech    文件:zzbb.java   
public final void zzb(zzaz paramzzaz, ConnectionConfiguration paramConnectionConfiguration)
  throws RemoteException
{
  // Byte code:
  //   0: invokestatic 27   android/os/Parcel:obtain    ()Landroid/os/Parcel;
  //   3: astore_3
  //   4: invokestatic 27   android/os/Parcel:obtain    ()Landroid/os/Parcel;
  //   7: astore 4
  //   9: aload_3
  //   10: ldc 29
  //   12: invokevirtual 33 android/os/Parcel:writeInterfaceToken   (Ljava/lang/String;)V
  //   15: aload_1
  //   16: ifnull +62 -> 78
  //   19: aload_1
  //   20: invokeinterface 37 1 0
  //   25: astore 6
  //   27: aload_3
  //   28: aload 6
  //   30: invokevirtual 40 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
  //   33: aload_2
  //   34: ifnull +50 -> 84
  //   37: aload_3
  //   38: iconst_1
  //   39: invokevirtual 62 android/os/Parcel:writeInt  (I)V
  //   42: aload_2
  //   43: aload_3
  //   44: iconst_0
  //   45: invokevirtual 78 com/google/android/gms/wearable/ConnectionConfiguration:writeToParcel   (Landroid/os/Parcel;I)V
  //   48: aload_0
  //   49: getfield 15  com/google/android/gms/wearable/internal/zzbb$zza$zza:zzop  Landroid/os/IBinder;
  //   52: iconst_2
  //   53: aload_3
  //   54: aload 4
  //   56: iconst_0
  //   57: invokeinterface 46 5 0
  //   62: pop
  //   63: aload 4
  //   65: invokevirtual 49 android/os/Parcel:readException ()V
  //   68: aload 4
  //   70: invokevirtual 52 android/os/Parcel:recycle   ()V
  //   73: aload_3
  //   74: invokevirtual 52 android/os/Parcel:recycle   ()V
  //   77: return
  //   78: aconst_null
  //   79: astore 6
  //   81: goto -54 -> 27
  //   84: aload_3
  //   85: iconst_0
  //   86: invokevirtual 62 android/os/Parcel:writeInt  (I)V
  //   89: goto -41 -> 48
  //   92: astore 5
  //   94: aload 4
  //   96: invokevirtual 52 android/os/Parcel:recycle   ()V
  //   99: aload_3
  //   100: invokevirtual 52    android/os/Parcel:recycle   ()V
  //   103: aload 5
  //   105: athrow
  // Local variable table:
  //   start    length  slot    name    signature
  //   0    106 0   this    zza
  //   0    106 1   paramzzaz   zzaz
  //   0    106 2   paramConnectionConfiguration    ConnectionConfiguration
  //   3    97  3   localParcel1    Parcel
  //   7    88  4   localParcel2    Parcel
  //   92   12  5   localObject Object
  //   25   55  6   localIBinder    IBinder
  // Exception table:
  //   from to  target  type
  //   9    15  92  finally
  //   19   27  92  finally
  //   27   33  92  finally
  //   37   48  92  finally
  //   48   68  92  finally
  //   84   89  92  finally
}
项目:FMTech    文件:GetConfigResponse.java   
GetConfigResponse(int paramInt1, int paramInt2, ConnectionConfiguration paramConnectionConfiguration)
{
  this.versionCode = paramInt1;
  this.statusCode = paramInt2;
  this.zzcgp = paramConnectionConfiguration;
}
项目:FMTech    文件:GetConfigsResponse.java   
GetConfigsResponse(int paramInt1, int paramInt2, ConnectionConfiguration[] paramArrayOfConnectionConfiguration)
{
  this.versionCode = paramInt1;
  this.statusCode = paramInt2;
  this.zzcgq = paramArrayOfConnectionConfiguration;
}
项目:android_external_GmsApi    文件:GetConfigResponse.java   
public GetConfigResponse(int statusCode, ConnectionConfiguration connectionConfiguration) {
    this.statusCode = statusCode;
    this.connectionConfiguration = connectionConfiguration;
}
项目:android_external_GmsApi    文件:GetConfigsResponse.java   
public GetConfigsResponse(int statusCode, ConnectionConfiguration[] configurations) {
    this.statusCode = statusCode;
    this.configurations = configurations;
}
项目:android_packages_apps_GmsCore    文件:MessageHandler.java   
public MessageHandler(WearableImpl wearable, ConnectionConfiguration config) {
    this(wearable, config, new Build().model, config.nodeId, LastCheckinInfo.read(wearable.getContext()).androidId);
}
项目:android_packages_apps_GmsCore    文件:WearableServiceImpl.java   
@Override
@Deprecated
public void putConnection(IWearableCallbacks callbacks, ConnectionConfiguration config) throws RemoteException {
    Log.d(TAG, "unimplemented Method: putConnection");
}
项目:android_packages_apps_GmsCore    文件:ConfigurationDatabaseHelper.java   
public void putConfiguration(ConnectionConfiguration config) {
    putConfiguration(config, null);
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public void createConnection(ConnectionConfiguration config) {
    if (config.nodeId == null) config.nodeId = getLocalNodeId();
    Log.d(TAG, "putConfig[nyp]: " + config);
    configDatabase.putConfiguration(config);
    configurationsUpdated = true;
}