Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP Client: add 'discover SAT>IP servers' button to the main config
  • Loading branch information
perexg committed May 6, 2015
1 parent 7cf9325 commit 00d792a
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
23 changes: 23 additions & 0 deletions src/api/api_input.c
Expand Up @@ -36,10 +36,33 @@ api_input_hw_tree ( void )
return is;
}

#if ENABLE_SATIP_CLIENT
static int
api_input_satip_discover
( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
{
int err = 0;

if (strcmp(op, "all"))
return -EINVAL;

tvhinfo("satip", "Triggered new server discovery");

pthread_mutex_lock(&global_lock);
satip_device_discovery_start();
pthread_mutex_unlock(&global_lock);

return err;
}
#endif

void api_input_init ( void )
{
static api_hook_t ah[] = {
{ "hardware/tree", ACCESS_ADMIN, api_idnode_tree, api_input_hw_tree },
#if ENABLE_SATIP_CLIENT
{ "hardware/satip/discover", ACCESS_ADMIN, api_input_satip_discover, NULL },
#endif
{ NULL },
};

Expand Down
4 changes: 1 addition & 3 deletions src/input/mpegts/satip/satip.c
Expand Up @@ -35,8 +35,6 @@
#include <sys/socket.h>
#endif

static void satip_device_discovery_start( void );

/*
*
*/
Expand Down Expand Up @@ -1114,7 +1112,7 @@ satip_discovery_timer_cb(void *aux)
gtimer_arm(&satip_discovery_timer, satip_discovery_timer_cb, NULL, 3600);
}

static void
void
satip_device_discovery_start( void )
{
gtimer_arm(&satip_discovery_timer, satip_discovery_timer_cb, NULL, 1);
Expand Down
2 changes: 2 additions & 0 deletions src/input/mpegts/satip/satip.h
Expand Up @@ -20,6 +20,8 @@
#ifndef __TVH_SATIP_H__
#define __TVH_SATIP_H__

void satip_device_discovery_start( void );

void satip_init( str_list_t *clients );
void satip_done( void );

Expand Down
3 changes: 3 additions & 0 deletions src/main.c
Expand Up @@ -145,6 +145,9 @@ const tvh_caps_t tvheadend_capabilities[] = {
#if ENABLE_V4L || ENABLE_LINUXDVB || ENABLE_SATIP_CLIENT || ENABLE_HDHOMERUN_CLIENT
{ "tvadapters", NULL },
#endif
#if ENABLE_SATIP_CLIENT
{ "satip_client", NULL },
#endif
#if ENABLE_SATIP_SERVER
{ "satip_server", NULL },
#endif
Expand Down
29 changes: 28 additions & 1 deletion src/webui/static/app/config.js
Expand Up @@ -302,6 +302,18 @@ tvheadend.miscconf = function(panel, index) {
handler: cleanImagecache
});

if (tvheadend.capabilities.indexOf('satip_client') !== -1) {
var satipButton = new Ext.Button({
text: "Discover SAT>IP servers",
tooltip: 'Look for new SAT>IP servers',
iconCls: 'find',
handler: satipDiscover,
});
} else {
var satipButton = null;
}


var helpButton = new Ext.Button({
text: 'Help',
iconCls: 'help',
Expand Down Expand Up @@ -332,6 +344,14 @@ tvheadend.miscconf = function(panel, index) {
if (imagecache_form)
_items.push(imagecache_form);

var _tbar = [saveButton, '-', imagecacheButton];
if (satipButton) {
_tbar.push('-');
_tbar.push(satipButton);
}
_tbar.push('->');
_tbar.push(helpButton);

var mpanel = new Ext.Panel({
title: 'General',
iconCls: 'general',
Expand All @@ -340,7 +360,7 @@ tvheadend.miscconf = function(panel, index) {
bodyStyle: 'padding:15px',
layout: 'form',
items: _items,
tbar: [saveButton, '-', imagecacheButton, '->', helpButton]
tbar: _tbar,
});

tvheadend.paneladd(panel, mpanel, index);
Expand Down Expand Up @@ -400,4 +420,11 @@ tvheadend.miscconf = function(panel, index) {
function cleanImagecache() {
saveChangesImagecache({'clean': 1});
}

function satipDiscover() {
Ext.Ajax.request({
url: 'api/hardware/satip/discover',
params: { op: 'all' },
});
}
};

0 comments on commit 00d792a

Please sign in to comment.