mirror of
https://github.com/Netflix/dial-reference.git
synced 2026-06-08 10:59:59 +00:00
added hooks for netflix app manager
This commit is contained in:
@@ -50,6 +50,10 @@
|
|||||||
#define WAKE_OPTION_LONG "--wake-on-wifi-len"
|
#define WAKE_OPTION_LONG "--wake-on-wifi-len"
|
||||||
#define WAKE_DESCRIPTION "Enable wake on wifi/len. Value: on/off. Default (on)"
|
#define WAKE_DESCRIPTION "Enable wake on wifi/len. Value: on/off. Default (on)"
|
||||||
|
|
||||||
|
#define NFMANAGER_OPTION "-A"
|
||||||
|
#define NFMANAGER_OPTION_LONG "--netflix-app-manager"
|
||||||
|
#define NFMANAGER_DESCRIPTION "Enable interface to netflix app manager."
|
||||||
|
|
||||||
struct dial_options
|
struct dial_options
|
||||||
{
|
{
|
||||||
const char * pOption;
|
const char * pOption;
|
||||||
@@ -88,6 +92,11 @@ struct dial_options gDialOptions[] =
|
|||||||
WAKE_OPTION,
|
WAKE_OPTION,
|
||||||
WAKE_OPTION_LONG,
|
WAKE_OPTION_LONG,
|
||||||
WAKE_DESCRIPTION
|
WAKE_DESCRIPTION
|
||||||
|
},
|
||||||
|
{
|
||||||
|
NFMANAGER_OPTION,
|
||||||
|
NFMANAGER_OPTION_LONG,
|
||||||
|
NFMANAGER_DESCRIPTION
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,10 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "nf_appmanager.h"
|
||||||
|
|
||||||
|
#define NF_APP_MANAGER
|
||||||
|
|
||||||
#define BUFSIZE 256
|
#define BUFSIZE 256
|
||||||
|
|
||||||
static char *spAppNetflix = "netflix"; // name of the netflix executable
|
static char *spAppNetflix = "netflix"; // name of the netflix executable
|
||||||
@@ -58,6 +62,8 @@ static char spUuid[BUFSIZE];
|
|||||||
extern bool wakeOnWifiLan;
|
extern bool wakeOnWifiLan;
|
||||||
static int gDialPort;
|
static int gDialPort;
|
||||||
|
|
||||||
|
static bool sUseNFAppManager=false;
|
||||||
|
|
||||||
static char *spAppYouTube = "chrome";
|
static char *spAppYouTube = "chrome";
|
||||||
static char *spAppYouTubeMatch = "chrome.*google-chrome-dial";
|
static char *spAppYouTubeMatch = "chrome.*google-chrome-dial";
|
||||||
static char *spAppYouTubeExecutable = "/opt/google/chrome/google-chrome";
|
static char *spAppYouTubeExecutable = "/opt/google/chrome/google-chrome";
|
||||||
@@ -388,7 +394,18 @@ void runDial(void)
|
|||||||
{
|
{
|
||||||
DIALServer *ds;
|
DIALServer *ds;
|
||||||
ds = DIAL_create();
|
ds = DIAL_create();
|
||||||
struct DIALAppCallbacks cb_nf = {netflix_start, netflix_hide, netflix_stop, netflix_status};
|
struct DIALAppCallbacks cb_nf;
|
||||||
|
if (sUseNFAppManager){
|
||||||
|
cb_nf.start_cb = am_netflix_start;
|
||||||
|
cb_nf.hide_cb = am_netflix_hide;
|
||||||
|
cb_nf.stop_cb = am_netflix_stop;
|
||||||
|
cb_nf.status_cb = am_netflix_status;
|
||||||
|
}else{
|
||||||
|
cb_nf.start_cb = netflix_start;
|
||||||
|
cb_nf.hide_cb = netflix_hide;
|
||||||
|
cb_nf.stop_cb = netflix_stop;
|
||||||
|
cb_nf.status_cb = netflix_status;
|
||||||
|
}
|
||||||
struct DIALAppCallbacks cb_yt = {youtube_start, youtube_hide, youtube_stop, youtube_status};
|
struct DIALAppCallbacks cb_yt = {youtube_start, youtube_hide, youtube_stop, youtube_status};
|
||||||
|
|
||||||
DIAL_register_app(ds, "Netflix", &cb_nf, NULL, 1, ".netflix.com");
|
DIAL_register_app(ds, "Netflix", &cb_nf, NULL, 1, ".netflix.com");
|
||||||
@@ -434,6 +451,13 @@ static void processOption( int index, char * pOption )
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
if (strcmp(pOption, "true")==0){
|
||||||
|
sUseNFAppManager=true;
|
||||||
|
}else{
|
||||||
|
sUseNFAppManager=false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// Should not get here
|
// Should not get here
|
||||||
fprintf( stderr, "Option %d not valid\n", index);
|
fprintf( stderr, "Option %d not valid\n", index);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ CC=$(TARGET)gcc
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
.DEFAULT_GOAL=all
|
.DEFAULT_GOAL=all
|
||||||
|
|
||||||
OBJS := main.o dial_server.o mongoose.o quick_ssdp.o url_lib.o dial_data.o LinuxInterfaces.o
|
OBJS := main.o dial_server.o mongoose.o quick_ssdp.o url_lib.o dial_data.o LinuxInterfaces.o nf_appmanager.o
|
||||||
HEADERS := $(wildcard *.h)
|
HEADERS := $(wildcard *.h)
|
||||||
|
|
||||||
%.c: $(HEADERS)
|
%.c: $(HEADERS)
|
||||||
|
|||||||
28
server/nf_appmanager.c
Normal file
28
server/nf_appmanager.c
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "nf_appmanager.h"
|
||||||
|
|
||||||
|
DIALStatus am_netflix_start(DIALServer *ds, const char *appname,
|
||||||
|
const char *payload, const char *additionalDataUrl,
|
||||||
|
DIAL_run_t *run_id, void *callback_data)
|
||||||
|
{
|
||||||
|
printf ("it's all wired..\n");
|
||||||
|
return kDIALStatusRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALStatus am_netflix_hide(DIALServer *ds, const char *app_name,
|
||||||
|
DIAL_run_t *run_id, void *callback_data)
|
||||||
|
{
|
||||||
|
return kDIALStatusHide;
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALStatus am_netflix_status(DIALServer *ds, const char *appname,
|
||||||
|
DIAL_run_t run_id, int* pCanStop, void *callback_data)
|
||||||
|
{
|
||||||
|
return kDIALStatusStopped;
|
||||||
|
}
|
||||||
|
|
||||||
|
void am_netflix_stop(DIALServer *ds, const char *appname, DIAL_run_t run_id,
|
||||||
|
void *callback_data)
|
||||||
|
{
|
||||||
|
}
|
||||||
40
server/nf_appmanager.h
Normal file
40
server/nf_appmanager.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Netflix, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY NETFLIX, INC. AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL NETFLIX OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dial_server.h"
|
||||||
|
|
||||||
|
DIALStatus am_netflix_start(DIALServer *ds, const char *appname,
|
||||||
|
const char *payload, const char *additionalDataUrl,
|
||||||
|
DIAL_run_t *run_id, void *callback_data);
|
||||||
|
|
||||||
|
|
||||||
|
DIALStatus am_netflix_hide(DIALServer *ds, const char *app_name,
|
||||||
|
DIAL_run_t *run_id, void *callback_data);
|
||||||
|
|
||||||
|
DIALStatus am_netflix_status(DIALServer *ds, const char *appname,
|
||||||
|
DIAL_run_t run_id, int* pCanStop, void *callback_data);
|
||||||
|
|
||||||
|
void am_netflix_stop(DIALServer *ds, const char *appname, DIAL_run_t run_id,
|
||||||
|
void *callback_data);
|
||||||
Reference in New Issue
Block a user