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);
        }
        private void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            try
            {
                devicesList.IsEnabled = false;
                connection            = DeviceConnection.GetConnection((Model.Device)e.Item);
                connection.Connect();
            }
            catch (Exception)
            {
                throw;
            }

            devicesList.SelectedItem = null;
        }
Example #3
0
        private void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            try
            {
                _connection = DeviceConnection.GetConnection((Model.Device)e.Item);
                _connection.Connect();
                DisconnectButton.IsEnabled = _connection.IsConnected;
                devicesList.IsEnabled      = !_connection.IsConnected;
            }
            catch (Exception)
            {
                throw;
            }

            devicesList.SelectedItem = null;
        }
Example #4
0
        /// <summary>
        /// dotnet SnapshotForZR04RN.dll ipaddr 5000 admin passwd 0 | ffmpeg -i - -vframes 1 -f image2pipe -vcodec mjpeg -q 3 - > snapshot.jpg
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        static async Task Main(string[] args)
        {
            int channel = args.Length > 4 ? int.Parse(args[4]) : 0;
            int sub     = args.Length > 5 ? int.Parse(args[5]) : 0;

            connection = new DeviceConnection();
            await connection.Connect(args[0], int.Parse(args[1]));

            LoginSuccess loginSuccess = await connection.Login(args[2], args[3]);

            StreamFrame keyframe = await connection.SnapKeyframe(channel, sub);

            Stream stdout = Console.OpenStandardOutput();
            await stdout.WriteAsync(keyframe.Data, 0, keyframe.Data.Length);

            connection.Disconnect();
            await stdout.FlushAsync();

            stdout.Close();
        }