Ejemplo n.º 1
0
        /// <summary>
        /// Instantiiert einen neuen Adapter
        /// </summary>
        /// <param name="pipeName">Pipename über die der Adapter die Einstellungen zum ApiClient bezieht.</param>
        /// <param name="isMdapi">Wenn der Adapter selbst keine Entschlüsselung vornehmen soll, true, anderenfalls false.</param>
        public DvbApiAdapter(string pipeName, bool isMdapi)
        {
            _FilteredPids   = new byte[0x2000]; // index = pid 0 = nicht filtern, 1 = filtern.
            _DescramblePids = new byte[0x2000]; // gleiche hier, wert jedoch descrambler-Index.

            _Descramblers     = new Descrambler[256];
            _DescramblersList = new List <Descrambler>();

            _Filters      = new List <DemuxFilter>();
            _ServiceId    = -1;
            _PmtPid       = -1;
            _AdapterIndex = -1;

            _UseMdApi   = isMdapi;
            _DumpStream = false;

            Globals.Config.Get("debug", "streamdump", ref _DumpStream);

            try
            {
                string srv  = "";
                int    port = 0;

                int adapterOffset = 0;

                Globals.Config.Get(cConfigSection, "server", ref srv);

                if (Globals.Config.Get(cConfigSection, "offset", 0, 128, ref adapterOffset) != Configuration.ConfigRes.Ok)
                {
                    LogProvider.Add(DebugLevel.Error, cLogSection, Message.AdapterConfigInvalidOffset);
                }

                if (Globals.Config.Get(cConfigSection, "port", 1, 65535, ref port) != Configuration.ConfigRes.Ok)
                {
                    LogProvider.Add(DebugLevel.Error, cLogSection, Message.AdapterConfigInvalidPort);
                }

                _ApiClient = new DvbApiClient(srv, port, pipeName, Globals.Info, adapterOffset);
                _ApiClient.Start();
            }
            catch (AlreadyRunningException)
            {
                // ...wenn fehlgeschlagen, weil pipe schon existent,
                // dann war eine andere Plugin-Instanz schneller, wird weiter nicht benötigt.
                LogProvider.Add(DebugLevel.Info, cLogSection, Message.AdapterClientRunning);
            }

            _IcEp = new InterComClient(pipeName);

            _IcEp.GotCommand   += IcCommand;
            _IcEp.Disconnected += IcDisconnected;

            _IcEp.Start();
        }
Ejemplo n.º 2
0
        public void Start()
        {
            if (_IsRunning)
            {
                return;
            }

            _IcEp.Start();
            SendIndex();

            _IsRunning = true;
        }