Commit 681c82c5 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

local network: be more insistent when querying for UPnP servers

Note that this deploys new APIs in upnpx, so you might need to update your checkout for compilation
parent c9638027
......@@ -46,6 +46,7 @@
Reachability *_reachability;
BOOL _udnpDiscoveryRunning;
NSTimer *_searchTimer;
}
@end
......@@ -164,23 +165,36 @@
if (_UPNPdevices.count > 0)
[self UPnPDBUpdated:nil];
[[managerInstance DB] addObserver:(UPnPDBObserver*)self];
[[managerInstance DB] addObserver:self];
//Optional; set User Agent
[[managerInstance SSDP] setUserAgentProduct:[NSString stringWithFormat:@"VLC for iOS/%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] andOS:@"iOS"];
[[managerInstance SSDP] setUserAgentProduct:[NSString stringWithFormat:@"VLCforiOS/%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] andOS:[NSString stringWithFormat:@"iOS/%@", [[UIDevice currentDevice] systemVersion]]];
//Search for UPnP Devices
[[managerInstance SSDP] startSSDP];
[[managerInstance SSDP] notifySSDPAlive];
_searchTimer = [NSTimer timerWithTimeInterval:10.0 target:self selector:@selector(_performSSDPSearch) userInfo:nil repeats:YES];
[_searchTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
[[NSRunLoop mainRunLoop] addTimer:_searchTimer forMode:NSRunLoopCommonModes];
_udnpDiscoveryRunning = YES;
}
- (void)_performSSDPSearch
{
UPnPManager *managerInstance = [UPnPManager GetInstance];
[[managerInstance SSDP] searchSSDP];
[[managerInstance SSDP] searchForMediaServer];
[[managerInstance SSDP] SSDPDBUpdate];
_udnpDiscoveryRunning = YES;
}
- (void)_stopUPNPDiscovery
{
if (_udnpDiscoveryRunning) {
UPnPManager *managerInstance = [UPnPManager GetInstance];
[[managerInstance DB] removeObserver:(UPnPDBObserver*)self];
[[managerInstance SSDP] notifySSDPByeBye];
[_searchTimer invalidate];
_searchTimer = nil;
[[managerInstance DB] removeObserver:self];
[[managerInstance SSDP] stopSSDP];
_udnpDiscoveryRunning = NO;
}
......@@ -312,7 +326,7 @@
-(void)handleRefresh
{
UPnPManager *managerInstance = [UPnPManager GetInstance];
[[managerInstance DB] removeObserver:(UPnPDBObserver*)self];
[[managerInstance DB] removeObserver:self];
[[managerInstance SSDP] stopSSDP];
//set the title while refreshing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment