skyscraper8/Documentation/code_sample_build_iq.txt
2025-07-26 19:16:19 +02:00

45 lines
1.7 KiB
Plaintext

private static void IntegrationTest()
{
TunerFactoryConnectionManager tunerConnectionManager = TunerFactoryConnectionManager.GetInstance();
ITunerFactory tunerFactory = tunerConnectionManager.GetTunerFactoryById(2);
RemoteStreamReaderTunerFactory remoteTunerFactory = (RemoteStreamReaderTunerFactory)tunerFactory;
remoteTunerFactory.Hostname = "tetsuro";
remoteTunerFactory.Port = 6970;
IStreamReader streamReader = remoteTunerFactory.CreateStreamReader();
streamReader.CheckForDVBExEx((x, y, z) => Console.WriteLine("{0}, {1}, {2}", x, y, z.ToString()));
if (!streamReader.StartDvbEx(2))
{
streamReader.Dispose();
return;
}
DiSEqC_Opcode baseDiseqc = DiSEqC_Opcode.DISEQC_HIGH_NIBBLE | DiSEqC_Opcode.DISEQC_OPTION_A | DiSEqC_Opcode.DISEQC_POSITION_A;
DiSEqC_Opcode lh = baseDiseqc | DiSEqC_Opcode.DISEQC_LOW_BAND | DiSEqC_Opcode.DISEQC_HORIZONTAL;
int lof1 = 9750 * 1000;
int lof2 = 10600 * 1000;
int lofSw = 11700 * 1000;
int startFreq = 10700 * 1000;
int endFreq = 12750 * 1000;
int step = 1000;
streamReader.SendDiSEqC(2, lh);
streamReader.SetChannel(11494000, 22000000, 0, VITERBIRATE_TYPE.VR_2_3, lof1, lof2, lofSw);
SearchResult sr = default(SearchResult);
streamReader.BLScanEx(11494000, 5000, 0, lof1, lof2, lofSw, 1000, STD_TYPE.STD_DVBS2, ref sr);
sbyte[] buffer = new sbyte[200];
IqChartData iq = IqChartData.Create();
while (!iq.IsComplete)
{
if (!streamReader.IQScan(0, buffer, 100))
throw new Exception("iq scan failed");
iq.PushPacket(buffer);
}
FileStream fs = File.OpenWrite("iq.bin");
iq.SaveTo(fs);
fs.Flush(true);
fs.Close();
streamReader.StopDVB();
streamReader.Dispose();
}