本文整理汇总了Java中com.connectsdk.device.ConnectableDeviceStore类的典型用法代码示例。如果您正苦于以下问题:Java ConnectableDeviceStore类的具体用法?Java ConnectableDeviceStore怎么用?Java ConnectableDeviceStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectableDeviceStore类属于com.connectsdk.device包,在下文中一共展示了ConnectableDeviceStore类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DiscoveryManager
import com.connectsdk.device.ConnectableDeviceStore; //导入依赖的package包/类
/**
* Create a new instance of DiscoveryManager.
* Direct use of this constructor is not recommended. In most cases,
* you should use DiscoveryManager.getInstance() instead.
*/
public DiscoveryManager(Context context, ConnectableDeviceStore connectableDeviceStore) {
this.context = context;
this.connectableDeviceStore = connectableDeviceStore;
allDevices = new ConcurrentHashMap<String, ConnectableDevice>(8, 0.75f, 2);
compatibleDevices = new ConcurrentHashMap<String, ConnectableDevice>(8, 0.75f, 2);
deviceClasses = new ConcurrentHashMap<String, Class<? extends DeviceService>>(4, 0.75f, 2);
discoveryProviders = new CopyOnWriteArrayList<DiscoveryProvider>();
discoveryListeners = new CopyOnWriteArrayList<DiscoveryManagerListener>();
WifiManager wifiMgr = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
multicastLock = wifiMgr.createMulticastLock(Util.T);
multicastLock.setReferenceCounted(true);
capabilityFilters = new ArrayList<CapabilityFilter>();
pairingLevel = PairingLevel.OFF;
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {
NetworkInfo networkInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
switch (networkInfo.getState()) {
case CONNECTED:
if (mSearching) {
for (DiscoveryProvider provider : discoveryProviders) {
provider.restart();
}
}
break;
case DISCONNECTED:
Log.w(Util.T, "Network connection is disconnected");
for (DiscoveryProvider provider : discoveryProviders) {
provider.reset();
}
allDevices.clear();
for (ConnectableDevice device: compatibleDevices.values()) {
handleDeviceLoss(device);
}
compatibleDevices.clear();
break;
case CONNECTING:
break;
case DISCONNECTING:
break;
case SUSPENDED:
break;
case UNKNOWN:
break;
}
}
}
};
registerBroadcastReceiver();
}
示例2: MyConnectableDeviceStore
import com.connectsdk.device.ConnectableDeviceStore; //导入依赖的package包/类
/**
* Initilizes the Discovery manager with a valid context. This should be done as soon as possible and it should use getApplicationContext() as the Discovery manager could persist longer than the current Activity.
*
* This accepts a ConnectableDeviceStore to use instead of the default device store.
*
@code
MyConnectableDeviceStore myDeviceStore = new MyConnectableDeviceStore();
DiscoveryManager.init(getApplicationContext(), myDeviceStore);
@endcode
*/
public static synchronized void init(Context context, ConnectableDeviceStore connectableDeviceStore) {
instance = new DiscoveryManager(context, connectableDeviceStore);
}
示例3: setConnectableDeviceStore
import com.connectsdk.device.ConnectableDeviceStore; //导入依赖的package包/类
/**
* ConnectableDeviceStore object which loads & stores references to all discovered devices. Pairing codes/keys, SSL certificates, recent access times, etc are kept in the device store.
*
* ConnectableDeviceStore is a protocol which may be implemented as needed. A default implementation, DefaultConnectableDeviceStore, exists for convenience and will be used if no other device store is provided.
*
* In order to satisfy user privacy concerns, you should provide a UI element in your app which exposes the ConnectableDeviceStore removeAll method.
*
* To disable the ConnectableDeviceStore capabilities of Connect SDK, set this value to nil. This may be done at the time of instantiation with `DiscoveryManager.init(context, null);`.
*/
public void setConnectableDeviceStore(ConnectableDeviceStore connectableDeviceStore) {
this.connectableDeviceStore = connectableDeviceStore;
}
示例4: getConnectableDeviceStore
import com.connectsdk.device.ConnectableDeviceStore; //导入依赖的package包/类
/**
* ConnectableDeviceStore object which loads & stores references to all discovered devices. Pairing codes/keys, SSL certificates, recent access times, etc are kept in the device store.
*
* ConnectableDeviceStore is a protocol which may be implemented as needed. A default implementation, DefaultConnectableDeviceStore, exists for convenience and will be used if no other device store is provided.
*
* In order to satisfy user privacy concerns, you should provide a UI element in your app which exposes the ConnectableDeviceStore removeAll method.
*
* To disable the ConnectableDeviceStore capabilities of Connect SDK, set this value to nil. This may be done at the time of instantiation with `DiscoveryManager.init(context, null);`.
*/
public ConnectableDeviceStore getConnectableDeviceStore() {
return connectableDeviceStore;
}