Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: ac381cf98e0ac3c3e727e5885b462b8ad9c70cef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) Symbian Software Ltd 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<title>Programmatic usage</title>
</head>
<body>
<h1>Programmatic usage</h1>
<p>
Perform service discovery session:
</p>
<pre>
<samp>
int timeout = 500; // milliseconds
String query = "_services._dns-sd._udp.local.";	//DNS-SD query
		
//instantiate protocol by name attribute		
IProtocol protocol = ProtocolFactory.getProtocol("DNS-SD");  

//instantiate transport by name attribute
ITransport transport = TransportFactory.getTransport("UDP", "224.0.0.251", timeout); 

//get engine instance and kick off discovery		
ServiceDiscoveryEngine serviceDiscoveryEngine = ServiceDiscoveryEngine.getInstance();	
serviceDiscoveryEngine.doServiceDiscovery(query, protocol,transport);
</samp>
</pre>
<p>
Access EMF model:
</p>
<pre>
<samp>
//get engine instance
ServiceDiscoveryEngine serviceDiscoveryEngine = ServiceDiscoveryEngine.getInstance();	

//access org.eclipse.emf.ecore.resource.Resource
Resource model = serviceDiscoveryEngine.getResource();
</samp>		
</pre>


</body>
</html>

Back to the top