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


Java ChannelListener类代码示例

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


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

示例1: register

import android.net.wifi.p2p.WifiP2pManager.ChannelListener; //导入依赖的package包/类
@Override
public void register(final int port, final boolean discover, Context context) {
    mP2PManager.initialize(context, context.getMainLooper(), new ChannelListener() {

        @Override
        public void onChannelDisconnected() {
            Log.d(TAG, "Channel disconnected...");
        }
    });

    mService.registerReceiver(mWifiReceiver, mWifiIntentFilter);

    final Map<String, String> record = new HashMap<String, String>();
    record.put(TXTRECORD_PORT, String.valueOf(port));

    mServiceInfo = WifiP2pDnsSdServiceInfo.newInstance(SERVICE_INSTANCE, SERVICE_REG_TYPE, record);

    mP2PManager.addLocalService(mChannel, mServiceInfo, mLocalServiceListener);

    if (discover) {
        discover();
    }
}
 
开发者ID:lolletsoc,项目名称:dissertation-project,代码行数:24,代码来源:WifiDirectSdHelper.java

示例2: init

import android.net.wifi.p2p.WifiP2pManager.ChannelListener; //导入依赖的package包/类
void init(Context ctx, ChannelListener lsn) {
	wifip2p = (WifiP2pManager) ctx.getSystemService(WIFI_P2P_SERVICE);

	channel = wifip2p.initialize(ctx, ctx.getMainLooper(), lsn);

	if (wifip2p != null && channel != null) {
		isWifiP2pEnabled = true;
		status = STA_P2P_INITED;
	} else {
		isWifiP2pEnabled = false;
		status = STA_P2P_UNINIT;
	}
}
 
开发者ID:sinpolib,项目名称:nfcspy,代码行数:14,代码来源:WiFiP2PManager.java

示例3: init

import android.net.wifi.p2p.WifiP2pManager.ChannelListener; //导入依赖的package包/类
public void init (GilgaService service)
{
 mService = service;

     mWifiManager = (WifiP2pManager) mService.getSystemService(Context.WIFI_P2P_SERVICE);
     
     mWifiChannel = mWifiManager.initialize(mService, mService.getMainLooper(), new ChannelListener()
     {

@Override
public void onChannelDisconnected() {
	Log.d(GilgaService.TAG,"wifi p2p disconnected");
}
     	
     });
     
     WifiP2pDnsSdServiceRequest serviceRequest = WifiP2pDnsSdServiceRequest.newInstance();
     mWifiManager.addServiceRequest(mWifiChannel,
             serviceRequest,
             new ActionListener() {
                 @Override
                 public void onSuccess() {
                     // Success!
 	            	Log.d(TAG,"SUCCESS: added service request wifi name service");

                 }

                 @Override
                 public void onFailure(int code) {
                     // Command failed.  Check for P2P_UNSUPPORTED, ERROR, or BUSY
                 	Log.d(TAG,"FAILURED: added service request wifi name service: " + code);
                 }
             });
     
}
 
开发者ID:n8fr8,项目名称:gilgamesh,代码行数:36,代码来源:WifiController.java

示例4: createChannel

import android.net.wifi.p2p.WifiP2pManager.ChannelListener; //导入依赖的package包/类
/**
 * attempt to create channel until it's established
 */
protected void createChannel() {
	channel = manager.initialize(
			context, 
			context.getMainLooper(), 
			new ChannelListener() {
		@Override
		public void onChannelDisconnected() {
			Logg.d(TAG, "Lost wifi channel, reconnecting...");
			createChannel();
		}
	});
}
 
开发者ID:wordsaretoys,项目名称:klammer,代码行数:16,代码来源:Wifi.java


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