本文整理汇总了Java中android.net.wifi.p2p.WifiP2pDevice.INVITED属性的典型用法代码示例。如果您正苦于以下问题:Java WifiP2pDevice.INVITED属性的具体用法?Java WifiP2pDevice.INVITED怎么用?Java WifiP2pDevice.INVITED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.net.wifi.p2p.WifiP2pDevice
的用法示例。
在下文中一共展示了WifiP2pDevice.INVITED属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getP2pDeviceStatus
private static String getP2pDeviceStatus(int deviceStatus) {
Log.d(TAG, "Peer status :" + deviceStatus);
switch (deviceStatus) {
case WifiP2pDevice.AVAILABLE:
return "Available";
case WifiP2pDevice.INVITED:
return "Invited";
case WifiP2pDevice.CONNECTED:
return "Connected";
case WifiP2pDevice.FAILED:
return "Failed";
case WifiP2pDevice.UNAVAILABLE:
return "Unavailable";
default:
return "Unknown";
}
}
示例2: getDeviceStatus
static String getDeviceStatus(int deviceStatus) {
Log.d(FileTransferService.TAG, "Peer status :" + deviceStatus);
switch (deviceStatus) {
case WifiP2pDevice.AVAILABLE:
return "Available";
case WifiP2pDevice.INVITED:
return "Invited";
case WifiP2pDevice.CONNECTED:
return "Connected";
case WifiP2pDevice.FAILED:
return "Failed";
case WifiP2pDevice.UNAVAILABLE:
return "Unavailable";
default:
return "Unknown";
}
}
示例3: getDeviceStatus
private static String getDeviceStatus(int deviceStatus) {
Log.d(WiFiDirectActivity.TAG, "Peer status :" + deviceStatus);
switch (deviceStatus) {
case WifiP2pDevice.AVAILABLE:
return "Available";
case WifiP2pDevice.INVITED:
return "Invited";
case WifiP2pDevice.CONNECTED:
return "Connected";
case WifiP2pDevice.FAILED:
return "Failed";
case WifiP2pDevice.UNAVAILABLE:
return "Unavailable";
default:
return "Unknown";
}
}
示例4: getDeviceStatus
public static String getDeviceStatus(int statusCode) {
switch (statusCode) {
case WifiP2pDevice.CONNECTED:
return "Connected";
case WifiP2pDevice.INVITED:
return "Invited";
case WifiP2pDevice.FAILED:
return "Failed";
case WifiP2pDevice.AVAILABLE:
return "Available";
case WifiP2pDevice.UNAVAILABLE:
return "Unavailable";
default:
return "Unknown";
}
}
示例5: internalDisconnect
/**
* 切断する
*/
protected void internalDisconnect(final WifiP2pManager.ActionListener listener) {
if (DEBUG) Log.v(TAG, "internalDisconnect:");
if (mWifiP2pManager != null) {
if ((mWifiP2pDevice == null)
|| (mWifiP2pDevice.status == WifiP2pDevice.CONNECTED)) {
// 接続されていないか、既に接続済みの時
if (mChannel != null) {
mWifiP2pManager.removeGroup(mChannel, listener);
}
} else if (mWifiP2pDevice.status == WifiP2pDevice.AVAILABLE
|| mWifiP2pDevice.status == WifiP2pDevice.INVITED) {
// ネゴシエーション中の時
mWifiP2pManager.cancelConnect(mChannel, listener);
}
}
}
示例6: cancelDisconnect
@Override
public void cancelDisconnect() {
if(mManager != null){
final DeviceListFragment fragment = (DeviceListFragment)getFragmentManager().findFragmentById(R.id.frag_list);
if(fragment.getDevice() == null ||
fragment.getDevice().status == WifiP2pDevice.CONNECTED){
disconnect();
}else if(fragment.getDevice().status == WifiP2pDevice.AVAILABLE ||
fragment.getDevice().status == WifiP2pDevice.INVITED){
mManager.cancelConnect(mChannel, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
}
@Override
public void onFailure(int reason) {
}
});
}
}
}
示例7: getDeviceStatus
private static String getDeviceStatus(int deviceStatus){
Log.e(WiFiDirectActivity.TAG, "Peer status: "+deviceStatus);
switch(deviceStatus){
case WifiP2pDevice.AVAILABLE:
return "Avaiable";
case WifiP2pDevice.INVITED:
return "Invited";
case WifiP2pDevice.CONNECTED:
return "Conntend";
case WifiP2pDevice.FAILED:
return "Failed";
case WifiP2pDevice.UNAVAILABLE:
return "Unavailable";
default:
return "Unkonw";
}
}
示例8: deviceStatusToString
/**
* Translates a device status code to a readable String status
* @param status
* @return A readable String device status
*/
public String deviceStatusToString(int status) {
if (status == WifiP2pDevice.AVAILABLE) {
return "Available";
} else if (status == WifiP2pDevice.INVITED) {
return "Invited";
} else if (status == WifiP2pDevice.CONNECTED) {
return "Connected";
} else if (status == WifiP2pDevice.FAILED) {
return "Failed";
} else if (status == WifiP2pDevice.UNAVAILABLE) {
return "Unavailable";
} else {
return "Unknown";
}
}
示例9: getDeviceStatus
private static String getDeviceStatus(int deviceStatus) {
Log.d(WiFiDirectActivity.TAG, "Peer status :" + deviceStatus);
switch (deviceStatus) {
case WifiP2pDevice.AVAILABLE:
return "Available"; //可以连接
case WifiP2pDevice.INVITED:
return "Invited"; //邀请连接
case WifiP2pDevice.CONNECTED:
return "Connected"; //已连接
case WifiP2pDevice.FAILED:
return "Failed"; //失败
case WifiP2pDevice.UNAVAILABLE:
return "Unavailable"; //不可以连接
default:
return "Unknown";
}
}
示例10: onClick
@Override
public void onClick(View v) {
int position = Integer.parseInt(v.getTag().toString());
WifiP2pDevice device = mData.get(position);
switch (device.status){
case WifiP2pDevice.AVAILABLE:
case WifiP2pDevice.CONNECTED:
case WifiP2pDevice.INVITED:
((MainActivity)mContext).connect(device);
break;
case WifiP2pDevice.FAILED:
case WifiP2pDevice.UNAVAILABLE:
Toast.makeText(mContext,String.format(Locale.getDefault(),"status=%d",device.status),Toast.LENGTH_SHORT).show();
break;
}
}
示例11: cancelDisconnect
@Override
public void cancelDisconnect() {
/*
* A cancel abort request by user. Disconnect i.e. removeGroup if
* already connected. Else, request WifiP2pManager to abort the ongoing
* request
*/
if (manager != null) {
final DeviceListFragment fragment = (DeviceListFragment) getFragmentManager()
.findFragmentById(R.id.frag_list);
if (fragment.getDevice() == null
|| fragment.getDevice().status == WifiP2pDevice.CONNECTED) {
disconnect();
} else if (fragment.getDevice().status == WifiP2pDevice.AVAILABLE
|| fragment.getDevice().status == WifiP2pDevice.INVITED) {
manager.cancelConnect(channel, new ActionListener() {
@Override
public void onSuccess() {
Toast.makeText(WiFiDirectActivity.this, "Aborting connection",
Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int reasonCode) {
Toast.makeText(WiFiDirectActivity.this,
"Connect abort request failed. Reason Code: " + reasonCode,
Toast.LENGTH_SHORT).show();
}
});
}
}
}
示例12: cancelDisconnect
@Override
public void cancelDisconnect() {
/*
* A cancel abort request by user. Disconnect i.e. removeGroup if
* already connected. Else, request WifiP2pManager to abort the ongoing
* request
*/
if (manager != null) {
final DeviceListFragment fragment = (DeviceListFragment) getFragmentManager()
.findFragmentById(R.id.frag_list);
if (fragment.getDevice() == null
|| fragment.getDevice().status == WifiP2pDevice.CONNECTED) {
disconnect();
} else if (fragment.getDevice().status == WifiP2pDevice.AVAILABLE
|| fragment.getDevice().status == WifiP2pDevice.INVITED) {
manager.cancelConnect(channel, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
Toast.makeText(WiFiDirectActivity.this, "Aborting connection",
Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int reasonCode) {
Toast.makeText(WiFiDirectActivity.this,
"Connect abort request failed. Reason Code: " + reasonCode,
Toast.LENGTH_SHORT).show();
}
});
}
}
}
示例13: cancelDisconnect
@Override
public void cancelDisconnect() {
/*
* A cancel abort request by user. Disconnect i.e. removeGroup if
* already connected. Else, request WifiP2pManager to abort the ongoing
* request
*/
if (manager != null) {
final DeviceListFragment fragment = (DeviceListFragment) getFragmentManager()
.findFragmentById(R.id.frag_list);
if (fragment.getDevice() == null
|| fragment.getDevice().status == WifiP2pDevice.CONNECTED) {
disconnect();
} else if (fragment.getDevice().status == WifiP2pDevice.AVAILABLE
|| fragment.getDevice().status == WifiP2pDevice.INVITED) {
manager.cancelConnect(channel, new ActionListener() {
@Override
public void onSuccess() {
Toast.makeText(WiFiDirectActivity.this, "Aborting connection",
Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int reasonCode) {
Toast.makeText(WiFiDirectActivity.this,
"Connect abort request failed. Reason Code: " + reasonCode,
Toast.LENGTH_SHORT).show();
}
});
}
}
}
示例14: isConnectedOrConnecting
/**
* WiFi Directで接続を試みているか接続しているかどうか
* @return
*/
public synchronized boolean isConnectedOrConnecting() {
return (mWifiP2pDevice != null)
&& ((mWifiP2pDevice.status == WifiP2pDevice.CONNECTED)
|| (mWifiP2pDevice.status == WifiP2pDevice.INVITED));
}