Zebra LinkOS Multiplatform SDK for Xamarin  1.1
Link-OS Portable Class Library Plugin for Xamarin
LinkOS.Plugin.Abstractions.INetworkDiscoverer Interface Reference

A class used to discover printers on an IP Network.
Note: There are no cancel discovery methods. Be carefull when using these to properly dispose of discoverer objects if navigating prior to finishing discovery. More...

Inheritance diagram for LinkOS.Plugin.Abstractions.INetworkDiscoverer:
LinkOS.Plugin.NetworkDiscovererImplementation

Public Member Functions

void FindPrinters (IDiscoveryHandler discoveryHandler)
 This method will search the network using a combination of discovery methods to find printers on the network. This is a convenience method that can be used as an alternative to the other discovery methods (e.g. multicast) This method will invoke the DiscoveryHandler.OnFoundPrinter event for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. When DiscoveryHandler.OnDiscoveryError is invoked, the discovery will be canceled and DiscoveryHandler.OnDiscoveryFinished will not be invoked. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence. More...
 
void FindPrinters (IDiscoveryHandler discoveryHandler, string[] printersToFind, int waitForResponsesTimeout=3000)
 Sends a discovery request to the list of printer DNS names or IPs in printersToFind. This method will invoke the DiscoveryHandler.OnFoundPrinter method for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence. More...
 
void SubnetSearch (IDiscoveryHandler discoveryHandler, string subnetRange, int waitForResponsesTimeout=3000)
 Sends a discovery packet to the IPs specified in the subnetRange. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. Subnet searches are defined by the first three subnet octets, followed by a range, such as 192.168.2. This method accepts IP addresses of the form, assuming a subnet of 192.168.2: 192.168.2.254 (will send a discovery packet to 192.168.2.254) 192.168.2.* (will send a discovery packet for the range 192.168.2.1 - 192.168.2.254) 192.168.2.8-* (will send a discovery packet for the range 192.168.2.8 - 192.168.2.254) 192.168.2.37-42 (will send a discovery packet for the range 192.168.2.37 - 192.168.2.42) This method will invoke the DiscoveryHandler.OnFoundPrinter method for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence. More...
 
void LocalBroadcast (IDiscoveryHandler discoveryHandler, int waitForResponsesTimeout=3000)
 Sends a local broadcast packet. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. This method will invoke the DiscoveryHandler.OnFoundPrinter event for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. When DiscoveryHandler.OnDiscoveryError is invoked, the discovery will be canceled and DiscoveryHandler.OnDiscoveryFinished will not be invoked. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence. More...
 
void DirectedBroadcast (IDiscoveryHandler discoveryHandler, string ipAddress, int waitForResponsesTimeout=3000)
 Sends a directed broadcast discovery packet to the subnet specified by ipAddress. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. Directed broadcasts are defined by the first three subnet octets, followed by 255, such as 192.168.2.255. This method accepts IP addresses of the form, assuming a subnet of 192.168.2: 192.168.2.255 192.168.2.1 (last octet will be replaced with 255) 192.168.2 (will append 255 for the last octet) 192.168.2. (will append 255 for the last octet) This method will invoke the DiscoveryHandler.OnFoundPrinter method for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence. More...
 
void Multicast (IDiscoveryHandler discoveryHandler, int hops, object androidContext, int waitForResponsesTimeout=3000)
 Sends a multicast discovery packet. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence. More...
 

Detailed Description

A class used to discover printers on an IP Network.
Note: There are no cancel discovery methods. Be carefull when using these to properly dispose of discoverer objects if navigating prior to finishing discovery.

using LinkOS.Plugin;
private void StartNetworkDiscovery()
{
IDiscoveryEventHandler handler = DiscoveryHandlerFactory.Current.GetInstance();
handler.OnDiscoveryError += DiscoveryHandler_OnDiscoveryError;
handler.OnDiscoveryFinished += DiscoveryHandler_OnDiscoveryFinished;
handler.OnFoundPrinter += DiscoveryHandler_OnFoundPrinter;
NetworkDiscoverer.Current.LocalBroadcast(handler);
}
private void OnFoundPrinter(IDiscoveryHandler handler, IDiscoveredPrinter discoveredPrinter)
{
Device.BeginInvokeOnMainThread(() => {
printerList.Add(discoveredPrinter);
});
}
private void OnDiscoveryError(IDiscoveryHandler handler, string message)
{
System.Diagnostics.Debug.WriteLine("Discovery Error: " + message);
}
private void OnDiscoveryFinished(IDiscoveryHandler handler, string message)
{
System.Diagnostics.Debug.WriteLine("Discovery Compete");
}

Member Function Documentation

void LinkOS.Plugin.Abstractions.INetworkDiscoverer.DirectedBroadcast ( IDiscoveryHandler  discoveryHandler,
string  ipAddress,
int  waitForResponsesTimeout = 3000 
)

Sends a directed broadcast discovery packet to the subnet specified by ipAddress. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. Directed broadcasts are defined by the first three subnet octets, followed by 255, such as 192.168.2.255. This method accepts IP addresses of the form, assuming a subnet of 192.168.2: 192.168.2.255 192.168.2.1 (last octet will be replaced with 255) 192.168.2 (will append 255 for the last octet) 192.168.2. (will append 255 for the last octet) This method will invoke the DiscoveryHandler.OnFoundPrinter method for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence.

Parameters
discoveryHandlera DiscoveryHandler instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
ipAddressthe IP address of the subnet.
waitForResponsesTimeouttime to wait, in milliseconds, before determining that there are no more discovery responses.

Implemented in LinkOS.Plugin.NetworkDiscovererImplementation.

void LinkOS.Plugin.Abstractions.INetworkDiscoverer.FindPrinters ( IDiscoveryHandler  discoveryHandler)

This method will search the network using a combination of discovery methods to find printers on the network. This is a convenience method that can be used as an alternative to the other discovery methods (e.g. multicast) This method will invoke the DiscoveryHandler.OnFoundPrinter event for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. When DiscoveryHandler.OnDiscoveryError is invoked, the discovery will be canceled and DiscoveryHandler.OnDiscoveryFinished will not be invoked. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence.

Parameters
discoveryHandlera DiscoveryHandler instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).

Implemented in LinkOS.Plugin.NetworkDiscovererImplementation.

void LinkOS.Plugin.Abstractions.INetworkDiscoverer.FindPrinters ( IDiscoveryHandler  discoveryHandler,
string[]  printersToFind,
int  waitForResponsesTimeout = 3000 
)

Sends a discovery request to the list of printer DNS names or IPs in printersToFind. This method will invoke the DiscoveryHandler.OnFoundPrinter method for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence.

Parameters
discoveryHandlera DiscoveryHandler instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
printersToFindA list of IP addresses or DNS names for the printers to be discovered.
waitForResponsesTimeouttime to wait, in milliseconds, before determining that there are no more discovery responses.

Implemented in LinkOS.Plugin.NetworkDiscovererImplementation.

void LinkOS.Plugin.Abstractions.INetworkDiscoverer.LocalBroadcast ( IDiscoveryHandler  discoveryHandler,
int  waitForResponsesTimeout = 3000 
)

Sends a local broadcast packet. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. This method will invoke the DiscoveryHandler.OnFoundPrinter event for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. When DiscoveryHandler.OnDiscoveryError is invoked, the discovery will be canceled and DiscoveryHandler.OnDiscoveryFinished will not be invoked. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence.

Parameters
discoveryHandlera DiscoveryHandler instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
waitForResponsesTimeouttime to wait, in milliseconds, before determining that there are no more discovery responses.

Implemented in LinkOS.Plugin.NetworkDiscovererImplementation.

void LinkOS.Plugin.Abstractions.INetworkDiscoverer.Multicast ( IDiscoveryHandler  discoveryHandler,
int  hops,
object  androidContext,
int  waitForResponsesTimeout = 3000 
)

Sends a multicast discovery packet. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence.

Parameters
discoveryHandlera DiscoveryHandler instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
hopsnumber of hops.
androidContextthe Android context, set to null in iOS
waitForResponsesTimeouttime to wait, in milliseconds, before determining that there are no more discovery responses.

Implemented in LinkOS.Plugin.NetworkDiscovererImplementation.

void LinkOS.Plugin.Abstractions.INetworkDiscoverer.SubnetSearch ( IDiscoveryHandler  discoveryHandler,
string  subnetRange,
int  waitForResponsesTimeout = 3000 
)

Sends a discovery packet to the IPs specified in the subnetRange. This method will wait up to waitForResponsesTimeout milliseconds determining that there are no more discovery responses. Subnet searches are defined by the first three subnet octets, followed by a range, such as 192.168.2. This method accepts IP addresses of the form, assuming a subnet of 192.168.2: 192.168.2.254 (will send a discovery packet to 192.168.2.254) 192.168.2.* (will send a discovery packet for the range 192.168.2.1 - 192.168.2.254) 192.168.2.8-* (will send a discovery packet for the range 192.168.2.8 - 192.168.2.254) 192.168.2.37-42 (will send a discovery packet for the range 192.168.2.37 - 192.168.2.42) This method will invoke the DiscoveryHandler.OnFoundPrinter method for each printer that is found during discovery. DiscoveryHandler.OnDiscoveryFinished will be invoked when the discovery is finished and DiscoveryHandler.OnDiscoveryError will be invoked when any errors are encountered during discovery. If a printer responds to the discovery request more than once, the DiscoveryHandler.OnFoundPrinter event will only be invoked on the first occurrence.

Parameters
discoveryHandlera DiscoveryHandler instance that is used to handle discovery events (e.g. found a printer, errors, discovery finished).
subnetRangethe subnet search range
waitForResponsesTimeouttime to wait, in milliseconds, before determining that there are no more discovery responses.

Implemented in LinkOS.Plugin.NetworkDiscovererImplementation.


The documentation for this interface was generated from the following file: