Commit b6ae7a1d authored by Steve Johnson's avatar Steve Johnson
Browse files

Use external file for host configuration

parent 5ca20806
Loading
Loading
Loading
Loading
+23 −7
Original line number Diff line number Diff line
#My Stuff Everywhere™ - mse-ios repository

iPhone iOS client application for My Stuff Everywhere. The native application uses C++ code to discover DIAL and Chromecast devices. The device information is sent to a web page in an embedded UIWebView. Everything else of interest happens in the web application (see the mse-html repository for more information).
iPhone iOS client application for My Stuff Everywhere. The native application uses C++ code to discover DIAL and Chromecast devices. The device information is sent to a web page in an embedded UIWebView. Everything else of interest happens in the web application (see the `mse-html` repository for more information).

##Important Notes 

1. The Xcode project for the iOS application (mseclient/mseclient.xcodeproj) also contains two OS X targets. One is a simulator with basically the same functionality as the iOS application except that it only supports the discovery of DIAL Servers (no chromecast support). The other is a discovery proxy application that discovers DIAL Servers and uploads the discovered devices to a web service. There is a JavaScript library for querying this web service - mse-html/js/dial.js. This is not used at the moment but could be used to create a JavaScript client application that is not capable of native discovery.
1. The Xcode project for the iOS application (mseclient/mseclient.xcodeproj) also contains two OS X targets. One is a simulator with basically the same functionality as the iOS application except that it only supports the discovery of DIAL Servers (no chromecast support). The other is a discovery proxy application that discovers DIAL Servers and uploads the discovered devices to a web service. There is a JavaScript library for querying this web service - `mse-html/js/dial.js`. This is not used at the moment but could be used to create a JavaScript client application that is not capable of native discovery.

2. The above OS X targets use a version of curl that is only available in Mavericks (OS X version 9) and above. If you wish to build these on Mountain Lion or below, you'll have to build and install a newer version of the curl library. You can download the source for this here: https://html5.cablelabs.com/mse/support/curl-7.33.0.tar.gz
2. The above OS X targets use a version of curl that is only available in Mavericks (OS X version 9) and above. If you wish to build these on Mountain Lion or below, you'll have to build and install a newer version of the curl library. You can download the source for this here: 

3. The iOS target requires the GoogleCast framework and a libcurl binary. These are included in the repository for your convenience. You may in the future have to download a newer version of the framework and/or rebuild the curl library. You can download the source for the curl library here: https://html5.cablelabs.com/mse/support/ioscurl-7.36.0.tar.gz
[https://html5.cablelabs.com/mse/support/curl-7.33.0.tar.gz](https://html5.cablelabs.com/mse/support/curl-7.33.0.tar.gz)

3. The iOS target requires the GoogleCast framework and a libcurl binary. These are included in the repository for your convenience. You may in the future have to download a newer version of the framework and/or rebuild the curl library. You can download the source for the curl library here: 

[https://html5.cablelabs.com/mse/support/ioscurl-7.36.0.tar.gz](https://html5.cablelabs.com/mse/support/ioscurl-7.36.0.tar.gz)


##Folder descriptions

####discovery
###discovery
Contains C++ sources for DIAL discovery, shared by all of the targets in the Xcode project.

####ios
###ios
Contains required iOS frameworks, libraries, and include files.

####mseclient
###mseclient
Contains the Xcode project and related files

##Targets
The Xcode project mseclient/mseclient.xcodeproj contains several projects:

- mseclient-ios - iOS client
- mseclient - OS X client that simulates running on an iPhone
- mseproxy = OS X application that discovers dial servers and local WebSockets bridge instances and conveys this to a web service which is accessible from JavaScript

##Configuration
You will need to copy mseConfig.h from mse/samples to this folder and configure it for your external server.

See [https://html5.cablelabs.com/mse/quickstart.html](https://html5.cablelabs.com/mse/quickstart.html)
+6 −2
Original line number Diff line number Diff line
// Baked in url to landing page for mobile applications
// Baked in url to landing page for iOS/OS X applications

#define MSE_REMOTE_URL "https://yourdomain.com/basedir/mse/html/remote/remote.html"
 No newline at end of file
// Used by OS X and iOS mseclient applications
#define MSE_REMOTE_URL "https://html5.cablelabs.com/atg/mse/html/remote/remote.html"

// Used by OS X mseproxy application
#define MSE_PROXY_URL "https://html5.cablelabs.com/atg/mse/php/dial/discovery.php"
+2 −40
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#import "NSTimer+Blocks.h"
#import "Reachability.h"
#import "DialDevice.h"
#import "../../mseConfig.h"

static NSString *const kReceiverAppID = @"337DFFAD";

@@ -30,8 +31,6 @@ static NSString *const kReceiverAppID = @"337DFFAD";
@property (strong) UIAlertView * alertView;
@property (strong) Reachability* reach;

- (NSString *) selectedHost;
- (void)hostChanged:(NSNotification *)notification;
- (void) disconnectDevice;
- (void)reachabilityChanged:(NSNotification*)note;
- (void) dismissWIFIAlert;
@@ -74,11 +73,7 @@ static NSString *const kReceiverAppID = @"337DFFAD";

    
    // TODO: Add App Settings
    self.hostURL = [self selectedHost];
    self.baseURL = [self.hostURL stringByAppendingString:@"/mse/html/remote/remote.html?ios"];
    
    NSString * host = [self selectedHost];
    NSLog(@"host: %@", host );
    self.baseURL = [NSString stringWithFormat:@"%s?ios",MSE_REMOTE_URL];

    self.webview.scrollView.scrollEnabled = NO;
    self.webview.scrollView.bounces = NO;
@@ -109,8 +104,6 @@ static NSString *const kReceiverAppID = @"337DFFAD";
        [self onDIALServerListUpdate: notification.object];
    }];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hostChanged:) name:NSUserDefaultsDidChangeNotification object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillTerminate:) name:UIApplicationWillTerminateNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
@@ -199,37 +192,6 @@ static NSString *const kReceiverAppID = @"337DFFAD";
    return UIInterfaceOrientationMaskPortrait;
}

- (NSString *) selectedHost {
    
    /*
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString * host = [defaults stringForKey:@"host"];
    if (host == nil) {
        host = @"https://html5.cablelabs.com";
        NSLog(@"First run: setting host to %@", host);
        [defaults setObject: host forKey: @"host"];
		[defaults synchronize];
	}
    if ([host compare:@"Other"] == 0) {
        host = [defaults stringForKey:@"CustomURL"];
    }
    return host;
     */
    //return @"http:localhost";
    return @"https://html5.cablelabs.com";
}

- (void) hostChanged:(NSNotification *)notification {
    if ([self.hostURL compare:[self selectedHost]] != 0) {
        NSLog(@"Settings: host changed from %@ to %@", self.hostURL, [self selectedHost]);
        self.hostURL = [self selectedHost];
        self.baseURL = [self.hostURL stringByAppendingString:@"/mse/remote/remote.html?ios"];
        [self generateURL: false];
        [self navigateHome];
    }
}


- (void) didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
+0 −1
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ class DiscoveryProxy;
@property (assign) IBOutlet WebView *webview;
@property (assign) IBOutlet NSView *view;
@property (assign) IBOutlet HomeButtonView *homeButton;
@property (strong) NSString * hostURL;
@property (strong) NSString * baseURL;
@property (strong) NSString * menuURL;
@property (strong) NSString * applicationList;
+4 −5
Original line number Diff line number Diff line
@@ -13,12 +13,12 @@
#import "WebCache+Private.h"

#include "DiscoveryProxy.h"
#include "../../mseConfig.h"

@implementation AppDelegate

@synthesize menuURL;
@synthesize baseURL;
@synthesize hostURL;
@synthesize WSBridgeList;
@synthesize deviceList;
@synthesize keyList;
@@ -33,10 +33,9 @@
    [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:@"WebKitDeveloperExtras"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    
    // DEVELOPERS: CHANGE THIS URL TO POINT TO YOUR SERVER!
    self.hostURL = [[AppConfig instance] objectForKey: @"hostUrl" defaultValue: @"https://html5.cablelabs.com"];
    
    self.baseURL = [self.hostURL stringByAppendingString:@"/mse/html/remote/remote.html"];
    // Developers: You will need to copy mseConfig.h from the mse/samples folder to the root folder of this repository
    // and add the url to your server
    self.baseURL = [[AppConfig instance] objectForKey: @"remoteUrl" defaultValue: NSString stringWithFormat:@"%s",MSE_REMOTE_URL];
    
    // Insert code here to initialize your application
    [[NSNotificationCenter defaultCenter] addObserverForName:Notification_HomePage object:nil queue:nil usingBlock:^(NSNotification * notification){
Loading