Example #1
0
        static async Task Main(string[] args)
        {
            // Run this together with SnoopApp for diagnostics
            connection = new DeviceConnection();
            connection.UnknownCommandReceived += Connection_UnknownCommandReceived;
            await connection.Connect("127.0.0.1", 5000);

            Console.WriteLine("Connected");
            Console.Write("Password: "******"admin", password);

            Console.WriteLine("Logged in");
            Console.WriteLine("Device name: {0}", loginSuccess.ProductInfo.DeviceName);
            Console.WriteLine("Firmware version: {0}", loginSuccess.ProductInfo.FirmwareVersion);
            StreamFrame keyframe = await connection.SnapKeyframe(0);

            Console.WriteLine("Keyframe received");
            Console.WriteLine("Width: {0}", keyframe.Width);
            Console.WriteLine("Height: {0}", keyframe.Height);
            // File.WriteAllBytes("C:\\temp\\keyframe.h264", keyframe.Data);
            connection.StreamFrameReceived += Connection_StreamFrameReceived;
            fs       = new FileStream("C:\\temp\\channel0a.h264", FileMode.Create, FileAccess.Write, FileShare.Read);
            streamId = await connection.StreamStart(0);

            // Console.ReadKey();
            await(new TaskCompletionSource <bool>().Task);
        }