当前位置: 首页>>代码示例>>Java>>正文


Java WpsInfo类代码示例

本文整理汇总了Java中android.net.wifi.WpsInfo的典型用法代码示例。如果您正苦于以下问题:Java WpsInfo类的具体用法?Java WpsInfo怎么用?Java WpsInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WpsInfo类属于android.net.wifi包,在下文中一共展示了WpsInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPeersAvailable

import android.net.wifi.WpsInfo; //导入依赖的package包/类
@Override
public void onPeersAvailable(WifiP2pDeviceList wifiP2pDeviceList) {

    if (!connectionAttemptInProgress.compareAndSet(false, true)) {
        return;
    }

    if (connected.get()) {
        return;
    }

    for (WifiP2pDevice device : wifiP2pDeviceList.getDeviceList()) {
        if (device.deviceAddress.equals(target)) {
            WifiP2pConfig config = new WifiP2pConfig();
            config.deviceAddress = device.deviceAddress;
            config.wps.setup = WpsInfo.PBC;
            config.groupOwnerIntent = 0; // I want the other device to be the group owner (or 'server')

            Log.d(TAG, "Trying to connect to "+device.deviceAddress+" "+device.deviceName+" Owner: "+device.isGroupOwner());

            connect(config);
            break;
        }
    }
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:26,代码来源:WiFiDirectConnection.java

示例2: connectToPeer

import android.net.wifi.WpsInfo; //导入依赖的package包/类
private void connectToPeer (WifiP2pDevice device)
{
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = device.deviceAddress;
    config.wps.setup = WpsInfo.PBC;

    mManager.connect(mChannel, config, new WifiP2pManager.ActionListener() {

        @Override
        public void onSuccess() {
            // WiFiDirectBroadcastReceiver will notify us. Ignore for now.
        }

        @Override
        public void onFailure(int reason) {

        }
    });

}
 
开发者ID:n8fr8,项目名称:LittleBitLouder,代码行数:21,代码来源:WifiP2pSender.java

示例3: initiateConnectToService

import android.net.wifi.WpsInfo; //导入依赖的package包/类
/**
 * Initiates a connection to a service
 * @param service The service to connect to
 */
public void initiateConnectToService(DnsSdService service) {
    // Device info of peer to connect to
    WifiP2pConfig wifiP2pConfig = new WifiP2pConfig();
    wifiP2pConfig.deviceAddress = service.getSrcDevice().deviceAddress;
    wifiP2pConfig.wps.setup = WpsInfo.PBC;

    // Starts a peer-to-peer connection with a device with the specified configuration
    wifiP2pManager.connect(channel, wifiP2pConfig, new WifiP2pManager.ActionListener() {
        // The ActionListener only notifies that initiation of connection has succeeded or failed

        @Override
        public void onSuccess() {
            Log.i(TAG, "Initiating connection to service");
        }

        @Override
        public void onFailure(int reason) {
            Log.e(TAG, "Failure initiating connection to service: " + FailureReason.fromInteger(reason).toString());
        }
    });
}
 
开发者ID:Crash-Test-Buddies,项目名称:WiFi-Buddy,代码行数:26,代码来源:WifiDirectHandler.java

示例4: connect

import android.net.wifi.WpsInfo; //导入依赖的package包/类
/**
 * Connect to the desired peer.
 *
 * @param deviceMacAddress the MAC address of the Server peer to connect with.
 */
private void connect(String deviceMacAddress) {
    // Create other device config
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = deviceMacAddress;
    config.wps.setup = WpsInfo.PBC;
    config.groupOwnerIntent = 0; // I want the other device to be the Group Owner !!

    // Perform connection
    manager.connect(channel, config, new ActionListener() {
        @Override
        public void onSuccess() {
            // WiFiDirectBroadcastReceiver will notify us. Ignore for now.
        }

        @Override
        public void onFailure(int reason) {
            Toast.makeText(TransferActivity.this, R.string.aqrdt_error_connection_failed, Toast.LENGTH_SHORT).show();

            // Error during connection to the peer. Force the Activity to be finished.
            finishTransmissionWithError();
        }
    });
}
 
开发者ID:prgpascal,项目名称:android-qr-data-transfer,代码行数:29,代码来源:TransferActivity.java

示例5: connectP2p

import android.net.wifi.WpsInfo; //导入依赖的package包/类
public synchronized void connectP2p(WifiClientP2pService peer) {
	Log.d(TAG,"inside connectp2p ");
	/***auto device list***/
	/***auto device list***/
			Log.d(TAG,"device address: "+peer.getDevice().deviceAddress);
			WifiP2pConfig config = new WifiP2pConfig();
			config.deviceAddress = peer.getDevice().deviceAddress;
			config.wps.setup = WpsInfo.PBC;
	    	//Toast.makeText(getApplicationContext(), "Trying to connect with "+config.deviceAddress, Toast.LENGTH_SHORT).show();
			if (serviceRequest != null)
				manager.removeServiceRequest(channel, serviceRequest,new ActionListener() {
					public void onSuccess() {           }
					public void onFailure(int arg0) {   }
				});
				manager.connect(channel, config, new ActionListener() {
					public void onSuccess() {        	Log.d(TAG,"Connecting to device");            }
					public void onFailure(int errorCode) {    	Log.d(TAG,"failed Connecting to device");         }
			});
	/***auto device list***/		
	/***auto device list***/
}
 
开发者ID:pranay22,项目名称:Audio-based-probing-of-the-environment,代码行数:22,代码来源:WifiClient.java

示例6: SendImage

import android.net.wifi.WpsInfo; //导入依赖的package包/类
private void SendImage(WifiP2pDevice device)
{
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = device.deviceAddress;
    config.wps.setup = WpsInfo.PBC;

    mManager.connect(mChannel, config, new WifiP2pManager.ActionListener() {

        @Override
        public void onSuccess() {
            // WiFiDirectBroadcastReceiver will notify us. Ignore for now.
        }

        @Override
        public void onFailure(int reason) {
            throw new RuntimeException("Oh god damn");
        }
    });
}
 
开发者ID:ritave,项目名称:RevolutionStarbucks,代码行数:20,代码来源:MainActivity.java

示例7: connectToLocalService

import android.net.wifi.WpsInfo; //导入依赖的package包/类
/**
 * Establishes a connection to a local "susurrus"-service.
 * @param roomModel
 * @param feedbackActivity
 */
public void connectToLocalService(final RoomModel roomModel, final MainActivity feedbackActivity) {
    WifiP2pConfig connectionConfig = new WifiP2pConfig();
    connectionConfig.deviceAddress = roomModel.getOwnerAddr();
    // user connects, don't make him the owner
    connectionConfig.groupOwnerIntent = 0;
    // connectionConfig.wps.setup = WpsInfo.INVALID;
    connectionConfig.wps.setup = WpsInfo.PBC;

    wifiDirectManager.connect(wifiDirectChannel, connectionConfig, new WifiP2pManager.
            ActionListener() {

        @Override
        public void onSuccess() {
            //feedbackActivity.showRoomJoinFeedbackUpdate(GROUP_CONNECTED);
        }

        @Override
        public void onFailure(int reason) {
            Log.d(LOG_TAG, "Connection to room failed: " + reason);

            feedbackActivity.showRoomJoinFeedbackUpdate(GROUP_NOT_CONNECTED);
        }
    });
}
 
开发者ID:deshi-basara,项目名称:susurrus-android-app,代码行数:30,代码来源:WifiDirectService.java

示例8: connect

import android.net.wifi.WpsInfo; //导入依赖的package包/类
public void connect(WifiP2pDevice peerDevice) {
  WifiP2pConfig config = new WifiP2pConfig();
  config.deviceAddress = peerDevice.deviceAddress;
  config.wps.setup = WpsInfo.PBC;
  wifiP2pManager.connect(channel, config, new WifiP2pManager.ActionListener() {
    @Override
    public void onSuccess() {
      // onReceive() in WDBroadcastReceiver will receive an intent
    }

    @Override
    public void onFailure(int reason) {

      String reasonString = WDBroadcastReceiver
        .getWifiP2pManagerMessageFromReasonCode(reason);

      Log.e(TAG, "There was an issue with initiating connection reason: " + reasonString);
    }
  });
}
 
开发者ID:named-data-mobile,项目名称:NFD-android,代码行数:21,代码来源:NDNController.java

示例9: Connect

import android.net.wifi.WpsInfo; //导入依赖的package包/类
public void Connect(String address) {

        WifiP2pConfig config = new WifiP2pConfig();
        config.deviceAddress = address;
        config.wps.setup = WpsInfo.PBC;

        p2p.connect(channel, config, new WifiP2pManager.ActionListener() {
            @Override
            public void onSuccess() {
                debug_print("Connecting to service" );
            }

            @Override
            public void onFailure(int errorCode) {
                debug_print("Failed connecting to service : " + errorCode);
            }
        });
    }
 
开发者ID:DrJukka,项目名称:WifiPairing,代码行数:19,代码来源:WifiConnection.java

示例10: onStart

import android.net.wifi.WpsInfo; //导入依赖的package包/类
@Override
protected void onStart() {
    /*
     * increment timeout bar per second.
     */
    mTimer = new Timer(false);
    mTimer.schedule(new TimerTask() {
        @Override
        public void run() {
            mHandler.post(new Runnable() {

                @Override
                public void run() {
                    mTimeoutBar.incrementProgressBy(1);
                }
            });
        }
    }, 1000, 1000);

    mContext.registerReceiver(mReceiver, mFilter);

    WpsInfo wpsConfig = new WpsInfo();
    wpsConfig.setup = mWpsSetup;
    mWifiManager.startWps(wpsConfig, mWpsListener);
}
 
开发者ID:voyagewu,项目名称:AndroidSettingDemoAP,代码行数:26,代码来源:WpsDialog.java

示例11: connectToDevice

import android.net.wifi.WpsInfo; //导入依赖的package包/类
private void connectToDevice(WifiP2pDevice dev) {
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = dev.deviceAddress;
    config.wps.setup = WpsInfo.PBC;

    manager.connect(channel, config, new WifiP2pManager.ActionListener() {
        @Override
        public void onSuccess() {
            //this gets broadcast to WifiDirectBroadcastReceiver
            //here
        }

        @Override
        public void onFailure(int reason) {
            Log.e(TAG, "Failed to connect to wifidirect device");
        }
    });
}
 
开发者ID:gnu3ra,项目名称:Scatterbrain,代码行数:19,代码来源:WifiManager.java

示例12: connect

import android.net.wifi.WpsInfo; //导入依赖的package包/类
private void connect(){

        WifiP2pConfig config = new WifiP2pConfig();
        config.deviceAddress = device.deviceAddress;
        config.wps.setup = WpsInfo.PBC;
        if (progressDialog != null && progressDialog.isShowing()) {
            progressDialog.dismiss();
        }
        progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel",
                "Connecting to :" + device.deviceAddress, true, true
//                        new DialogInterface.OnCancelListener() {
//
//                            @Override
//                            public void onCancel(DialogInterface dialog) {
//                                ((DeviceActionListener) getActivity()).cancelDisconnect();
//                            }
//                        }
        );
        ((DevicesListFragment.DeviceActionListener) getActivity()).connect(config);
    }
 
开发者ID:PeeJWeeJ,项目名称:AndroidSideLoading,代码行数:21,代码来源:DeviceDetailFragment.java

示例13: onListItemClick

import android.net.wifi.WpsInfo; //导入依赖的package包/类
/**
 * Initiate a connection with the peer.
 */
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    Log.d(TAG, "onListItemClick");
    WifiP2pDevice device = (WifiP2pDevice)getListAdapter().getItem(position);
    Log.d(TAG, "device is: " + device.deviceAddress);
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = device.deviceAddress;
    config.wps.setup = WpsInfo.PBC;
    if (progressDialog != null && progressDialog.isShowing()) {
        progressDialog.dismiss();
    }
    progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel",
            "Connecting to :" + device.deviceAddress, true, true);

    ((DeviceActionListener)getActivity()).connect(config);

}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:21,代码来源:DeviceListFragment.java

示例14: onPeerSelected

import android.net.wifi.WpsInfo; //导入依赖的package包/类
@Override
public void onPeerSelected(WifiP2pDevice device) {
	WifiP2pConfig config = new WifiP2pConfig();
	config.deviceAddress = device.deviceAddress;
	config.wps.setup = WpsInfo.PBC;
	synCarnet.syncService.setConnecting(true);
	progressDialog = ProgressDialog.show(synCarnet, synCarnet.getString(R.string.backCancel),
	synCarnet.getString(R.string.connectingTo) + device.deviceAddress, true, true);
	ServiceStatic.setDevice(device.deviceName, device.deviceAddress);
	manager.connect(channel, config, new ActionListener() {
		@Override
		public void onSuccess() {
			// WiFiDirectBroadcastReceiver will notify us. Ignore for now.
		}

		@Override
		public void onFailure(int reason) {
			Toast.makeText(synCarnet, synCarnet.getString(R.string.connectFailed),
			Toast.LENGTH_SHORT).show();
			Log.d(TAG, "Connect failed : "+reason);
			
		}
	});
}
 
开发者ID:npmiller,项目名称:syncarnet,代码行数:25,代码来源:PeerSelection.java

示例15: initialiseDnsTxtRecordListener

import android.net.wifi.WpsInfo; //导入依赖的package包/类
private void initialiseDnsTxtRecordListener() {
    mDnsTxtRecordListener = new DnsSdTxtRecordListener() {

        @Override
        public void onDnsSdTxtRecordAvailable(String fullDomainName,
                Map<String, String> txtRecordMap, WifiP2pDevice srcDevice) {

            if (fullDomainName.contains(SERVICE_INSTANCE)) {

                WifiP2pConfig config = new WifiP2pConfig();
                config.deviceAddress = srcDevice.deviceAddress;
                config.groupOwnerIntent = 0;
                config.wps.setup = WpsInfo.PBC;

                mP2PManager.connect(mChannel, config, null);
            }

        }
    };
}
 
开发者ID:lolletsoc,项目名称:dissertation-project,代码行数:21,代码来源:WifiDirectSdHelper.java


注:本文中的android.net.wifi.WpsInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。