public class MDNSFilterPlugin extends Object implements PrintServicePlugin, NsdManager.DiscoveryListener
match
configured listPrintServicePlugin.PrinterDiscoveryCallback
Constructor and Description |
---|
MDNSFilterPlugin(Context context,
String name,
CharSequence packageName,
List<String> mDNSNames)
Create new stub that assumes that a print service can be used to print on all mPrinters
matching some mDNS names.
|
Modifier and Type | Method and Description |
---|---|
int |
getName()
Get the name (a string reference) of the
print
service with the specified package name . |
CharSequence |
getPackageName()
The package name of the full print service.
|
void |
onDiscoveryStarted(String serviceType) |
void |
onDiscoveryStopped(String serviceType) |
void |
onServiceFound(NsdServiceInfo serviceInfo) |
void |
onServiceLost(NsdServiceInfo serviceInfo) |
void |
onStartDiscoveryFailed(String serviceType,
int errorCode) |
void |
onStopDiscoveryFailed(String serviceType,
int errorCode) |
void |
start(PrintServicePlugin.PrinterDiscoveryCallback callback)
Start the discovery plugin.
|
void |
stop()
Stop the plugin.
|
public MDNSFilterPlugin(Context context, String name, CharSequence packageName, List<String> mDNSNames)
context
- The context the plugin runs inname
- The user friendly name of the print servicepackageName
- The package name of the print servicemDNSNames
- The mDNS names of the printer.public CharSequence getPackageName()
PrintServicePlugin
getPackageName
in interface PrintServicePlugin
public void start(PrintServicePlugin.PrinterDiscoveryCallback callback) throws Exception
PrintServicePlugin
start
in interface PrintServicePlugin
callback
- Callbacks used by this plugin.Exception
- If anything went wrong when starting the plugin@StringRes public int getName()
PrintServicePlugin
print
service
with the specified package name
. This is read once, hence
returning different data at different times is not allowed.getName
in interface PrintServicePlugin
public void stop() throws Exception
PrintServicePlugin
stop
in interface PrintServicePlugin
Exception
- If anything went wrong while stopping pluginpublic void onStartDiscoveryFailed(String serviceType, int errorCode)
onStartDiscoveryFailed
in interface NsdManager.DiscoveryListener
public void onStopDiscoveryFailed(String serviceType, int errorCode)
onStopDiscoveryFailed
in interface NsdManager.DiscoveryListener
public void onDiscoveryStarted(String serviceType)
onDiscoveryStarted
in interface NsdManager.DiscoveryListener
public void onDiscoveryStopped(String serviceType)
onDiscoveryStopped
in interface NsdManager.DiscoveryListener
public void onServiceFound(NsdServiceInfo serviceInfo)
onServiceFound
in interface NsdManager.DiscoveryListener
public void onServiceLost(NsdServiceInfo serviceInfo)
onServiceLost
in interface NsdManager.DiscoveryListener