summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-05-29 23:30:45 +0000
committerrandomdan <randomdan@localhost>2013-05-29 23:30:45 +0000
commit56bc4a016adf05495895543d45379f6250c2f1e3 (patch)
treecea166943e1335fce52face1e25d73e99fb3fae2
parentTidy up and fixes - tested working (diff)
downloadp2pvr-56bc4a016adf05495895543d45379f6250c2f1e3.tar.bz2
p2pvr-56bc4a016adf05495895543d45379f6250c2f1e3.tar.xz
p2pvr-56bc4a016adf05495895543d45379f6250c2f1e3.zip
Tidy up and create a separate comms module
-rw-r--r--p2pvr/Jamfile.jam1
-rw-r--r--p2pvr/ice/Jamfile.jam13
-rw-r--r--p2pvr/ice/p2tv.ice9
-rw-r--r--p2pvr/scanner/ice_scan.cpp343
-rw-r--r--p2pvr/scanner/icescan.cpp0
-rw-r--r--p2pvr/scanner/scanner.ice7
6 files changed, 23 insertions, 350 deletions
diff --git a/p2pvr/Jamfile.jam b/p2pvr/Jamfile.jam
index adbd6f6..5d63f0d 100644
--- a/p2pvr/Jamfile.jam
+++ b/p2pvr/Jamfile.jam
@@ -1 +1,2 @@
build-project scanner ;
+build-project ice ;
diff --git a/p2pvr/ice/Jamfile.jam b/p2pvr/ice/Jamfile.jam
new file mode 100644
index 0000000..e77a3ae
--- /dev/null
+++ b/p2pvr/ice/Jamfile.jam
@@ -0,0 +1,13 @@
+import package ;
+
+lib Ice : : <name>Ice ;
+lib IceUtil : : <name>IceUtil ;
+lib pthread : : <name>pthread ;
+
+lib p2tvice :
+ p2tv.ice :
+ <library>Ice
+ <library>IceUtil
+ <library>pthread
+ ;
+
diff --git a/p2pvr/ice/p2tv.ice b/p2pvr/ice/p2tv.ice
new file mode 100644
index 0000000..7602ffa
--- /dev/null
+++ b/p2pvr/ice/p2tv.ice
@@ -0,0 +1,9 @@
+module P2TV {
+ interface Recordings {
+ void DeleteRecording(int recordingId);
+ };
+ interface Schedules {
+ void DoReschedule();
+ };
+};
+
diff --git a/p2pvr/scanner/ice_scan.cpp b/p2pvr/scanner/ice_scan.cpp
deleted file mode 100644
index 24ea1bc..0000000
--- a/p2pvr/scanner/ice_scan.cpp
+++ /dev/null
@@ -1,343 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <assert.h>
-
-#include <linux/dvb/dmx.h>
-#include <linux/dvb/version.h>
-
-#include "version.h"
-#include "scan.h"
-#include "dump-vdr.h"
-#include "dump-xine.h"
-#include "dump-dvbscan.h"
-#include "dump-kaffeine.h"
-#include "dump-mplayer.h"
-#include "dump-vlc-m3u.h"
-#include "dvbscan.h"
-#include "parse-dvbscan.h"
-#include "countries.h"
-#include "satellites.h"
-#include "atsc_psip_section.h"
-#include "descriptors.h"
-#include "lnb.h"
-#include "diseqc.h"
-
-#define MOD_USE_STANDARD 0x00
-#define MOD_OVERRIDE_MIN 0x01
-#define MOD_OVERRIDE_MAX 0x02
-
-static struct lnb_types_st this_lnb; // 20090320: DVB-S/S2, LNB type, initialized in main to 'UNIVERSAL'
-
-int main (int argc, char **argv)
-{
- char frontend_devname [80];
- int adapter = 999, frontend = 0, demux = 0;
- int opt;
- unsigned int i = 0, j;
- int frontend_fd = -1;
- int fe_open_mode;
- uint16_t frontend_type = FE_OFDM;
- int Radio_Services = 1;
- int TV_Services = 1;
- int Other_Services = 0; // 20080106: don't search other services by default.
- int ext = 0;
- int retVersion = 0;
- int discover = 0;
- int a=0,c=0,s=0,t=0;
- int device_preferred = -1;
- int valid_initial_data = 0;
- int valid_rotor_data = 0;
- int modulation_flags = MOD_USE_STANDARD;
- char * country = NULL;
- char * satellite = NULL;
- char * initdata = NULL;
- char * positionfile = NULL;
- char sw_type = 0;
-
- this_lnb = * lnb_enum(0);
- this_lnb.low_val *= 1000;
- this_lnb.high_val *= 1000;
- this_lnb.switch_val *= 1000;
-
- flags.version = version;
- start_time = time(NULL);
-
- while ((opt = getopt(argc, argv, "a:c:e:f:hi:kl:o:p:qr:s:t:vxA:D:E:FHI:LMO:PQ:R:S:T:VX")) != -1) {
- switch (opt) {
- case 'a': //adapter
- adapter = strtoul(optarg, NULL, 0);
- break;
- case 'c': //country setting
- country=strdup(optarg);
- if (0 == strcasecmp(country, "?")) {
- print_countries();
- return(0);
- }
- break;
- case 'e': //extended scan flags
- ext = strtoul(optarg, NULL, 0);
- if (ext & 0x01)
- dvbc_symbolrate_max = 16;
- if (ext & 0x02) {
- modulation_max = 2;
- modulation_flags |= MOD_OVERRIDE_MAX;
- }
- break;
- case 'f': //frontend type
- if (strcmp(optarg, "t") == 0) frontend_type = FE_OFDM;
- if (strcmp(optarg, "c") == 0) frontend_type = FE_QAM;
- if (strcmp(optarg, "a") == 0) frontend_type = FE_ATSC;
- if (strcmp(optarg, "s") == 0) frontend_type = FE_QPSK;
- if (strcmp(optarg, "?") == 0) discover++;
- if (frontend_type == FE_ATSC)
- this_channellist = ATSC_VSB;
- break;
- case 'h': //basic help
- bad_usage("w_scan");
- return 0;
- break;
- case 'i': //specify inversion
- caps_inversion = strtoul(optarg, NULL, 0);
- break;
- case 'k': //kaffeine output
- output_format = OUTPUT_KAFFEINE;
- break;
- case 'l': //satellite lnb type
- if (strcmp(optarg, "?") == 0) {
- struct lnb_types_st * p;
- char ** cp;
-
- while((p = lnb_enum(i++))) {
- info("%s\n", p->name);
- for (cp = p->desc; *cp;)
- info("\t%s\n", *cp++);
- }
- return 0;
- }
- if (lnb_decode(optarg, &this_lnb) < 0)
- fatal("LNB decoding failed. Use \"-l ?\" for list.\n");
- /* MHz -> kHz */
- this_lnb.low_val *= 1000;
- this_lnb.high_val *= 1000;
- this_lnb.switch_val *= 1000;
- break;
- case 'o': //vdr Version
- flags.vdr_version = strtoul(optarg, NULL, 0);
- if (flags.vdr_version > 2) flags.dump_provider = 1;
- break;
- case 'p': //satellite *p*osition file
- positionfile=strdup(optarg);
- break;
- case 'q': //quite
- if (--verbosity < 0)
- verbosity = 0;
- break;
- case 'r': //satellite rotor position
- flags.rotor_position = strtoul(optarg, NULL, 0);
- break;
- case 's': //satellite setting
- satellite=strdup(optarg);
- if (0 == strcasecmp(satellite, "?")) {
- print_satellites();
- return(0);
- }
- break;
- case 't': //tuning speed
- flags.tuning_timeout = strtoul(optarg, NULL, 0);
- if ((flags.tuning_timeout < 1)) bad_usage(argv[0]);
- if ((flags.tuning_timeout > 3)) bad_usage(argv[0]);
- break;
- case 'v': //verbose
- verbosity++;
- break;
- case 'x': //dvbscan output
- output_format = OUTPUT_DVBSCAN_TUNING_DATA;
- break;
- case 'A': //ATSC type
- ATSC_type = strtoul(optarg,NULL,0);
- switch (ATSC_type) {
- case 1: ATSC_type = ATSC_VSB; break;
- case 2: ATSC_type = ATSC_QAM; break;
- case 3: ATSC_type = (ATSC_VSB + ATSC_QAM); break;
- default:
- bad_usage(argv[0]);
- return -1;
- }
- /* if -A is specified, it implies -f a */
- frontend_type = FE_ATSC;
- break;
- case 'D': //DiSEqC committed/uncommitted switch
- sscanf(optarg,"%d%c", &i, &sw_type);
- switch(sw_type) {
- case 'u':
- uncommitted_switch = i;
- if (uncommitted_switch > 15)
- fatal("uncommitted switch position needs to be < 16!\n");
- flags.sw_pos = (flags.sw_pos & 0xF) | uncommitted_switch;
- break;
- case 'c':
- committed_switch = i;
- if (committed_switch > 3)
- fatal("committed switch position needs to be < 4!\n");
- flags.sw_pos = (flags.sw_pos & 0xF0) | committed_switch;
- break;
- default:
- fatal("Could not parse Argument \"-D\"\n"
- "Should be number followed \"u\" or \"c\"\n");
- }
- break;
- case 'E': //include encrypted channels
- flags.ca_select = strtoul(optarg, NULL, 0);
- break;
- case 'F': //filter timeout
- flags.filter_timeout = 1;
- break;
- case 'H': //expert help
- ext_help();
- return 0;
- break;
- case 'I': //expert providing initial_tuning_data
- initdata=strdup(optarg);
- break;
- case 'L': //vlc output
- output_format = OUTPUT_VLC_M3U;
- break;
- case 'M': //mplayer output
- output_format = OUTPUT_MPLAYER;
- break;
- case 'O': //other services
- Other_Services = strtoul(optarg, NULL, 0);
- if ((Other_Services < 0)) bad_usage(argv[0]);
- if ((Other_Services > 1)) bad_usage(argv[0]);
- break;
- case 'P': //ATSC PSIP scan
- no_ATSC_PSIP = 1;
- break;
- case 'Q': //specify DVB-C QAM
- modulation_min=modulation_max=strtoul(optarg, NULL, 0);
- modulation_flags |= MOD_OVERRIDE_MIN;
- modulation_flags |= MOD_OVERRIDE_MAX;
- break;
- case 'R': //include Radio
- Radio_Services = strtoul(optarg, NULL, 0);
- if ((Radio_Services < 0)) bad_usage(argv[0]);
- if ((Radio_Services > 1)) bad_usage(argv[0]);
- break;
- case 'S': //DVB-C symbolrate index
- dvbc_symbolrate_min=dvbc_symbolrate_max=strtoul(optarg, NULL, 0);
- break;
- case 'T': //include TV
- TV_Services = strtoul(optarg, NULL, 0);
- if ((TV_Services < 0)) bad_usage(argv[0]);
- if ((TV_Services > 1)) bad_usage(argv[0]);
- break;
- case 'V': //Version
- retVersion++;
- break;
- case 'X': //xine output
- output_format = OUTPUT_XINE;
- break;
- default: //undefined
- bad_usage(argv[0]);
- return -1;
- }
- }
- info("w_scan version %d (compiled for DVB API %d.%d)\n", version, DVB_API_VERSION, DVB_API_VERSION_MINOR);
- if ((flags.vdr_version < 7) && (frontend_type == FE_ATSC))
- fatal("VDR up to version 1.7.13 doesn't support ATSC.\n"
- "\tPlease add option '-o 7' enabling vdr-1.7 support or"
- "\tchoose other output format, current: 'VDR channels.conf'.\n");
- if (NULL == initdata) {
- if ((NULL == country) && (frontend_type != FE_QPSK))
- fatal("Missing argument \"-c\" (country setting)\n");
- if ((NULL == satellite) && (frontend_type == FE_QPSK))
- fatal("Missing argument \"-s\" (satellite setting)\n");
- }
- serv_select = 1 * TV_Services + 2 * Radio_Services + 4 * Other_Services;
- if (caps_inversion > INVERSION_AUTO) {
- info("Inversion out of range!\n");
- bad_usage(argv[0]);
- return -1;
- }
- if (((adapter > 7) && (adapter != 999)) || (adapter < 0)) {
- info("Invalid adapter: out of range (0..7)\n");
- bad_usage(argv[0]);
- return -1;
- }
- switch(frontend_type) {
- case FE_ATSC:
- case FE_QAM:
- case FE_OFDM:
- if (country != NULL) {
- int atsc = ATSC_type;
- int dvb = frontend_type;
- flags.atsc_type = ATSC_type;
- choose_country(country, &atsc, &dvb, &frontend_type, &this_channellist);
- //dvbc: setting qam loop
- if ((modulation_flags & MOD_OVERRIDE_MAX) == MOD_USE_STANDARD)
- modulation_max = dvbc_qam_max(2, this_channellist);
- if ((modulation_flags & MOD_OVERRIDE_MIN) == MOD_USE_STANDARD)
- modulation_min = dvbc_qam_min(2, this_channellist);
- flags.list_id = txt_to_country(country);
- free(country);
- }
- break;
- case FE_QPSK:
- if (satellite != NULL) {
- choose_satellite(satellite, &this_channellist);
- flags.list_id = txt_to_satellite(satellite);
- free(satellite);
- sat_list[this_channellist].rotor_position = flags.rotor_position;
- }
- else if (flags.rotor_position > -1)
- fatal("Using rotor position needs option \"-s\"\n");
- if (positionfile != NULL) {
- valid_rotor_data = dvbscan_parse_rotor_positions(positionfile);
- free(positionfile);
- if (! valid_rotor_data)
- fatal("could not parse rotor position file\n"
- "CHECK IDENTIFIERS AND FILE FORMAT.\n");
- }
- break;
- default:
- fatal("Unknown frontend type %d\n", frontend_type);
- }
-
- if (initdata != NULL) {
- valid_initial_data = dvbscan_parse_tuningdata(initdata, &flags);
- free(initdata);
- if (valid_initial_data == 0)
- fatal("Could not read initial tuning data. EXITING.\n");
- if (flags.fe_type != frontend_type) {
- warning("\n"
- "========================================================================\n"
- "INITIAL TUNING DATA NEEDS FRONTEND TYPE %s, YOU SELECTED TYPE %s.\n"
- "I WILL OVERRIDE YOUR DEFAULTS TO %s\n"
- "========================================================================\n",
- frontend_type_to_text(flags.fe_type),
- frontend_type_to_text(frontend_type),
- frontend_type_to_text(flags.fe_type));
- frontend_type = flags.fe_type;
- sleep(10); // enshure that user reads warning.
- }
- }
- info("frontend_type %s, channellist %d\n", frontend_type_to_text(frontend_type), this_channellist);
-
- for (i = 0; i < MAX_RUNNING; i++)
- poll_fds[i].fd = -1;
-
- fe_open_mode = O_RDWR;
- if (adapter == 999)
- fatal("***** NO USEABLE DVB CARD FOUND. *****\n"
- "Please check wether dvb driver is loaded and\n"
- "verify that no dvb application (i.e. vdr) is running.\n");
-
-
- return 0;
-}
-
diff --git a/p2pvr/scanner/icescan.cpp b/p2pvr/scanner/icescan.cpp
deleted file mode 100644
index e69de29..0000000
--- a/p2pvr/scanner/icescan.cpp
+++ /dev/null
diff --git a/p2pvr/scanner/scanner.ice b/p2pvr/scanner/scanner.ice
deleted file mode 100644
index 7730a1c..0000000
--- a/p2pvr/scanner/scanner.ice
+++ /dev/null
@@ -1,7 +0,0 @@
-module P2TV {
- interface Scanner {
- void updatePrograms(bool zap, int adapter, int frontend);
- void updateNowAndNext(bool zap, int adapter, int frontend);
- };
-};
-