本文整理汇总了Java中com.google.android.gms.wearable.ConnectionConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionConfiguration类的具体用法?Java ConnectionConfiguration怎么用?Java ConnectionConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionConfiguration类属于com.google.android.gms.wearable包,在下文中一共展示了ConnectionConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putConfiguration
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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});
}
}
示例2: getConfigurations
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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;
}
示例3: closeConnection
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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");
}
示例4: MessageHandler
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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;
}
示例5: configFromCursor
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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);
}
示例6: getConfiguration
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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;
}
示例7: getAllConfigurations
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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;
}
}
示例8: onConnectReceived
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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();
}
}
示例9: onDisconnectReceived
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
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));
}
示例10: zza
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
public abstract void zza(zzaz paramzzaz, ConnectionConfiguration paramConnectionConfiguration)
throws RemoteException;
示例11: zzb
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
public abstract void zzb(zzaz paramzzaz, ConnectionConfiguration paramConnectionConfiguration)
throws RemoteException;
示例12: GetConfigResponse
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
GetConfigResponse(int paramInt1, int paramInt2, ConnectionConfiguration paramConnectionConfiguration)
{
this.versionCode = paramInt1;
this.statusCode = paramInt2;
this.zzcgp = paramConnectionConfiguration;
}
示例13: GetConfigsResponse
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
GetConfigsResponse(int paramInt1, int paramInt2, ConnectionConfiguration[] paramArrayOfConnectionConfiguration)
{
this.versionCode = paramInt1;
this.statusCode = paramInt2;
this.zzcgq = paramArrayOfConnectionConfiguration;
}
示例14: GetConfigResponse
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
public GetConfigResponse(int statusCode, ConnectionConfiguration connectionConfiguration) {
this.statusCode = statusCode;
this.connectionConfiguration = connectionConfiguration;
}
示例15: GetConfigsResponse
import com.google.android.gms.wearable.ConnectionConfiguration; //导入依赖的package包/类
public GetConfigsResponse(int statusCode, ConnectionConfiguration[] configurations) {
this.statusCode = statusCode;
this.configurations = configurations;
}