PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/titanium/mobile/network/BonjourBrowser.hx

http://github.com/visup/haxe-titanium-api
Haxe | 85 lines | 20 code | 8 blank | 57 comment | 0 complexity | 8730d5cb44f9c09ae43adb40049cea23 MD5 | raw file
 1package titanium.mobile.network;
 2import titanium.mobile.core.Dispatcher;
 3
 4/**
 5BonjourBrowser class
 6
 7Documentation available at:
 8http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Network-module
 9
10- namespace
11
12Titanium.Network.BonjourBrowser
13
14- type
15
16object
17
18- description
19
20The BonjourBrowser instance returned from `Titanium.Network.createBonjourBrowser`.  This object is a browser for the discovery and retrieval of Bonjour services available on the network.  
21
22- since
23
241.2.0
25
26- platforms
27
28iphone, ipad
29
30- properties
31
32serviceType[string]: The type of the service the browser searches for
33domain[string]: The domain the browser is searching in
34isSearching[boolean]: Whether or not the browser is currently searching
35
36- methods
37
38search: Conduct a search for Bonjour services matching the type and domain specified during creation
39stopSearch: Halt an ongoing search
40
41- events
42
43updatedServices: Fired when the discovered services list is updated
44
45-event : updatedServices
46
47services: An array of BonjourService objects corresponding to currently available services.  If you cache this value, including using it as table data, be aware that it could become out of date at any time due to the asynchronous nature of Bonjour service discovery.
48
49~~~
50~~~
51
52- notes
53
54If your application publishes Bonjour services itself, that service will be discovered by the browser if necessary; be prepared to perform a check if you do not want to list local services as available.  Bonjour service browsing is an asynchronous operation, meaning that you should be extremely careful when caching values from the 'services' property returned by the updatedServices event.  In particular, if you maintain a local copy of available services and a user tries to connect to one, you should be prepared to handle failures gracefully; the next updatedServices event should provide the new services list, but you should not rely on it being delivered before user input.  When a window which uses Bonjour browsing is closed, if you do not want to continue searching, you must call the stop() method.
55
56**/
57
58#if iphoneos
59
60typedef NetworkBonjourBrowserUpdateEvent = 
61{ > Event,
62	services:Array<BonjourService>
63}
64
65
66@:native("Titanium.Network.BonjourBrowser")
67extern class BonjourBrowser extends Dispatcher
68{
69	// static constructor
70	public inline static function create(serviceType:String, domain:String, ?params:Dynamic):BonjourBrowser
71		return titanium.mobile.Network.createBonjourBrowser(serviceType, domain, params)
72		
73	// events
74	public static inline var UPDATE_SERVICES_EVENT = "updatedServices";
75	
76	// properties
77	public var serviceType:String;
78	public var domain:String;
79	public var isSearching:Bool;
80	
81	// methods
82	public function search():Void;
83	public function stopSearch():Void;
84}
85#end