feat(cordova-plugin-discovery) add SSDP discovery plugin wrapper (#3194)
This commit is contained in:
parent
eae8c1000c
commit
2312665792
45
src/@ionic-native/plugins/service-discovery/index.ts
Normal file
45
src/@ionic-native/plugins/service-discovery/index.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name ServiceDiscovery
|
||||
* @description
|
||||
* Simple plugin to get any SSDP / UPnP / DLNA service on a local network
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { ServiceDiscovery } from '@ionic-native/service-discovery';
|
||||
*
|
||||
*
|
||||
* constructor(private serviceDiscovery: ServiceDiscovery) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.serviceDiscovery.getNetworkServices('ssdp:all')
|
||||
* .then(devices => console.log(devices))
|
||||
* .catch(error => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'ServiceDiscovery',
|
||||
plugin: 'cordova-plugin-discovery',
|
||||
pluginRef: 'serviceDiscovery',
|
||||
repo: 'https://github.com/scottdermott/cordova-plugin-discovery',
|
||||
platforms: ['Android', 'iOS']
|
||||
})
|
||||
@Injectable()
|
||||
export class ServiceDiscovery extends IonicNativePlugin {
|
||||
|
||||
/**
|
||||
* Finds and returns metadata about devices discovered on the network via SSDP / UPnP / DLNA
|
||||
* @param service {string} The service name to discover
|
||||
* @return {Promise<any>} Returns a promise that resolves when something happens
|
||||
*/
|
||||
@Cordova()
|
||||
getNetworkServices(service: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user