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

项目: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");
}
项目:FMTech    文件:WearableListenerService.java   
public final void onConnectedNodes(final List<NodeParcelable> paramList)
{
  zzb(new Runnable()
  {
    public final void run() {}
  }, "onConnectedNodes", paramList);
}
项目:FMTech    文件:WearableListenerService.java   
public final void zza(final NodeParcelable paramNodeParcelable)
{
  zzb(new Runnable()
  {
    public final void run() {}
  }, "onPeerConnected", paramNodeParcelable);
}
项目:FMTech    文件:WearableListenerService.java   
public final void zzb(final NodeParcelable paramNodeParcelable)
{
  zzb(new Runnable()
  {
    public final void run() {}
  }, "onPeerDisconnected", paramNodeParcelable);
}
项目:android_external_GmsLib    文件:WearableListenerService.java   
@Override
public void onPeerConnected(final NodeParcelable node) throws RemoteException {
    post(new Runnable() {
        @Override
        public void run() {
            WearableListenerService.this.onPeerConnected(node);
        }
    });
}
项目:android_external_GmsLib    文件:WearableListenerService.java   
@Override
public void onPeerDisconnected(final NodeParcelable node) throws RemoteException {
    post(new Runnable() {
        @Override
        public void run() {
            WearableListenerService.this.onPeerDisconnected(node);
        }
    });
}
项目:android_external_GmsLib    文件:WearableListenerService.java   
@Override
public void onConnectedNodes(final List<NodeParcelable> nodes) throws RemoteException {
    post(new Runnable() {
        @Override
        public void run() {
            WearableListenerService.this.onConnectedNodes(new ArrayList<Node>(nodes));
        }
    });
}
项目: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));
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public List<NodeParcelable> getConnectedNodesParcelableList() {
    List<NodeParcelable> nodes = new ArrayList<NodeParcelable>();
    for (Node connectedNode : connectedNodes) {
        nodes.add(new NodeParcelable(connectedNode));
    }
    return nodes;
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public void onPeerConnected(NodeParcelable node) {
    Log.d(TAG, "onPeerConnected: " + node);
    try {
        getAllListeners().onPeerConnected(node);
    } catch (RemoteException e) {
        Log.w(TAG, e);
    }
    addConnectedNode(node);
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public void onPeerDisconnected(NodeParcelable node) {
    Log.d(TAG, "onPeerDisconnected: " + node);
    try {
        getAllListeners().onPeerDisconnected(node);
    } catch (RemoteException e) {
        Log.w(TAG, e);
    }
    removeConnectedNode(node.getId());
}
项目:android_packages_apps_GmsCore    文件:WearableImpl.java   
public void onConnectedNodes(List<NodeParcelable> nodes) {
    Log.d(TAG, "onConnectedNodes: " + nodes);
    try {
        getAllListeners().onConnectedNodes(nodes);
    } catch (RemoteException e) {
        Log.w(TAG, e);
    }
}