At the heart of Connect SDK is DiscoveryManager, a multi-protocol service discovery engine with a pluggable architecture. Much of your initial experience with Connect SDK will be with the DiscoveryManager class, as it consolidates discovered service information into ConnectableDevice objects.
DiscoveryManager supports discovering services of differing protocols by using DiscoveryProviders. Many services are discoverable over SSDP and are registered to be discovered with the SSDPDiscoveryProvider class.
As services are discovered on the network, the DiscoveryProviders will notify DiscoveryManager. DiscoveryManager is capable of attributing multiple services, if applicable, to a single ConnectableDevice instance. Thus, it is possible to have a mixed-mode ConnectableDevice object that is theoretically capable of more functionality than a single service can provide.
DiscoveryManager keeps a running list of all discovered devices and maintains a filtered list of devices that have satisfied any of your CapabilityFilters. This filtered list is used by the DevicePicker when presenting the user with a list of devices.
DiscoveryManager *discoveryManager = [DiscoveryManager sharedManager]; discoveryManager.delegate = self; // set delegate to listen for discovery events [discoveryManager startDiscovery];
- id<DiscoveryManagerDelegate> delegate
Delegate which should receive discovery updates. It is not necessary to set this delegate property unless you are implementing your own device picker. Connect SDK provides a default DevicePicker which acts as a DiscoveryManagerDelegate, and should work for most cases.
If you have provided a capabilityFilters array, the delegate will only receive update messages for ConnectableDevices which satisfy at least one of the CapabilityFilters. If no capabilityFilters array is provided, the delegate will receive update messages for all ConnectableDevice objects that are discovered.
- NSArray * capabilityFilters
- DeviceServicePairingLevel pairingLevel
The pairingLevel property determines whether capabilities that require pairing (such as entering a PIN) will be available.
If pairingLevel is set to DeviceServicePairingLevelOn, ConnectableDevices that require pairing will prompt the user to pair when connecting to the ConnectableDevice.
If pairingLevel is set to DeviceServicePairingLevelOff (the default), connecting to the device will avoid requiring pairing if possible but some capabilities may not be available.
- id<ConnectableDeviceStore> deviceStore
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.
- BOOL useDeviceStore
Whether pairing state will be automatically loaded/saved in the deviceStore. This property is not available for direct modification. To disable the device store,
- - (NSDictionary *) compatibleDevices
Filtered list of discovered ConnectableDevices, limited to devices that match at least one of the CapabilityFilters in the capabilityFilters array. Each ConnectableDevice object is keyed against its current IP address.
- - (NSDictionary *) allDevices
- - (void) startDiscovery
Start scanning for devices on the local network.
- - (void) stopDiscovery
Stop scanning for devices.
This method will be called when your app enters a background state. When your app resumes, startDiscovery will be called.
- - (DevicePicker *) devicePicker