public void SetDescramblerMode(int caIndex, DescramblerAlgo algo, DescramblerMode mode) { using (MemoryStream ms = new MemoryStream()) using (BinaryWriter wr = new BinaryWriter(ms)) { wr.Write(caIndex); wr.Write((int)algo); wr.Write((int)mode); wr.Flush(); _IcEp.SendCommand(InterComCommand.SetDescramblerMode, ms.ToArray()); } }
private void CmdSetCaDescrMode(BinaryReader r) { int adapter = r.ReadByte(); int idx = IPAddress.NetworkToHostOrder(r.ReadInt32()); DescramblerAlgo algo = (DescramblerAlgo)IPAddress.NetworkToHostOrder(r.ReadInt32()); DescramblerMode mode = (DescramblerMode)IPAddress.NetworkToHostOrder(r.ReadInt32()); LogProvider.Add(DebugLevel.DvbApi, cLogSection, Message.DvbapiSetMode, adapter, idx, algo, mode); ChannelSession c = _ChanSessions[adapter - _AdapterOffset]; if (c != null) { c.SetDescramblerMode(idx, algo, mode); } }
private void IcCommandSetDescramblerMode(BinaryReader rdr) { int index = rdr.ReadInt32(); DescramblerAlgo algo = (DescramblerAlgo)rdr.ReadInt32(); DescramblerMode mode = (DescramblerMode)rdr.ReadInt32(); if (_UseMdApi) { if (algo != DescramblerAlgo.DvbCsa) { LogProvider.Add(DebugLevel.Warning, cLogSection, Message.AdapterMdapiMode); } return; } Descrambler descr = GetDescrambler(index); descr.SetDescramblerMode(algo, mode); }
/// <summary> /// Setzt den Descrambler-Modus /// </summary> /// <param name="algo">Zu verwendender Algorithmus</param> /// <param name="mode">Betriebsmodus des Algorithmus, wird für DVB-CSA ignoriert</param> public void SetDescramblerMode(DescramblerAlgo algo, DescramblerMode mode) { if (_Disposed) { throw new ObjectDisposedException(GetType().Name); } Type t = null; lock (this) { if (_Algo != null) { t = _Algo.GetType(); } try { switch (algo) { case DescramblerAlgo.DvbCsa: if (t != typeof(DvbCsa)) { if (_Algo != null) { _Algo.Dispose(); } _Algo = new DvbCsa(); } break; case DescramblerAlgo.Des: if (t != typeof(Des)) { if (_Algo != null) { _Algo.Dispose(); } _Algo = new Des(); } break; case DescramblerAlgo.Aes128: if (t != typeof(Aes128)) { if (_Algo != null) { _Algo.Dispose(); } _Algo = new Aes128(); } break; } _Algo.SetDescramblerMode(mode); } catch (Exception ex) { LogProvider.Exception(cLogSection, Message.DescrAlgoSwitchFailed, ex); } } }