using System;

namespace Lesson06.Devices
{
    class Camera : IDevice
    {
        private string name;
        public bool IsConnected { get; private set; }

        public Camera(string name)
        {
            this.name = name;
            this.IsConnected = false;
        }

        public void Connect()
        {
            if (!IsConnected)
            {
                IsConnected = true;
                Console.WriteLine($"[{name}] 摄像头已连接");
            }
        }

        public void Disconnect()
        {
            if (IsConnected)
            {
                IsConnected = false;
                Console.WriteLine($"[{name}] 摄像头已断开");
            }
        }
    }
}
