コード例 #1
0
        /// <summary>
        /// Get IP settings.
        /// </summary>
        /// <param name="Interface">eth1, wlan0</param>
        /// <returns></returns>
        public string GetIP(string Interface)
        {
            RovioResponse response = this.Request("/GetIP.cgi",
                                                  new RequestItem("Interface", Interface));

            return("");
        }
コード例 #2
0
        /// <summary>
        /// Set Mac address.
        /// </summary>
        /// <param name="MAC">Mac address</param>
        /// <returns></returns>
        public bool SetMac(string MAC)
        {
            RovioResponse response = this.Request("/SetMac.cgi",
                                                  new RequestItem("MAC", MAC));

            return(true);
        }
コード例 #3
0
        /// <summary>
        /// Get Rovio’s base firmware version, Rovio also has a UI version and a NS2 version this function only get the base OS version.
        /// </summary>
        /// <returns></returns>
        public FirmwareVersion GetVer()
        {
            //Version = Jan 12 2010 14:41:24 $Revision: 5.3503$
            RovioResponse response = this.Request("/GetVer.cgi");

            return(FirmwareVersion.Parse(response["Version"]));
        }
コード例 #4
0
ファイル: RovioAPI.Users.cs プロジェクト: sunsunsun000/rovio
        /// <summary>
        /// Get the username who sent this HTTP request.
        /// </summary>
        /// <param name="ShowPrivilege"></param>
        /// <returns>Privilege = 0 (for common user),Privilege = 1 (for super user),(Always returns 0 if it is in Non-authorization mode under SetUserCheck.cgi)</returns>
        public UserInformation GetMyself(bool ShowPrivilege)
        {
            RovioResponse response = this.Request("/GetMyself.cgi",
                                                  new RequestItem("ShowPrivilege", ShowPrivilege ? 1 : 0));

            UserGroups group = UserGroups.Unknown;

            if (response.ContainsKey("Privilege"))
            {
                if (response["Privilege"] == "1")
                {
                    group = UserGroups.Administrator;
                }
                else if (response["Privilege"] == "0")
                {
                    group = UserGroups.User;
                }
                else
                {
                    group = UserGroups.Unknown;
                }
            }

            UserInformation info = new UserInformation(
                group, response["Name"]);

            return(info);
        }
コード例 #5
0
        /// <summary>
        /// Get current IP Camera's time zone and time.
        /// </summary>
        /// <returns></returns>
        void GetTime(out DateTime timeUtc, out TimeZoneInfo timeZone, out string ntpServer, out bool useNtp)
        {
            ///GetTime.cgi[?JsVar=variable[&OnJs=function]]
            timeUtc   = DateTime.MinValue;
            timeZone  = TimeZoneInfo.Local;
            ntpServer = "";
            useNtp    = false;

            RovioResponse dic = this.Request("/GetTime.cgi");

            if (dic == null)
            {
                return;
            }
            long sec1970;

            if (!(dic.ContainsKey("Sec1970") && long.TryParse(dic["Sec1970"], out sec1970)))
            {
                return;
            }
            int timeZoneMinutes;

            if (!(dic.ContainsKey("TimeZone") && int.TryParse(dic["TimeZone"], out timeZoneMinutes)))
            {
                return;
            }

            DateTime date1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            timeUtc  = date1970.AddSeconds(sec1970);
            timeZone = CreateTimeZone(TimeSpan.FromMinutes(-timeZoneMinutes));

            ntpServer = dic.ContainsKey("NtpServer") ? dic["NtpServer"] : "";
            useNtp    = dic.ContainsKey("UseNtp") ? (dic["UseNtp"] == "1") : false;
        }
コード例 #6
0
ファイル: RovioAPI.Users.cs プロジェクト: sunsunsun000/rovio
        /// <summary>
        /// Delete a user account.
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        public bool DelUser(string User)
        {
            RovioResponse response = this.Request("/DelUser.cgi",
                                                  new RequestItem("User", User));

            return(true);
        }
コード例 #7
0
ファイル: RovioAPI.Users.cs プロジェクト: sunsunsun000/rovio
        /// <summary>
        /// Get the users list of IP Camera.
        /// </summary>
        /// <param name="ShowPrivilege"></param>
        /// <returns></returns>
        public string GetUser(bool ShowPrivilege)
        {
            RovioResponse response = this.Request("/GetUser.cgi",
                                                  new RequestItem("ShowPrivilege", ShowPrivilege));

            return("");
        }
コード例 #8
0
ファイル: RovioAPI.Users.cs プロジェクト: sunsunsun000/rovio
        /// <summary>
        /// Add a user or change the password for existed user.
        /// </summary>
        /// <param name="User"></param>
        /// <param name="Pass"></param>
        /// <returns></returns>
        public bool SetUser(string User, string Pass)
        {
            RovioResponse response = this.Request("/SetUser.cgi",
                                                  new RequestItem("User", User),
                                                  new RequestItem("Pass", Pass));

            return(true);
        }
コード例 #9
0
        /// <summary>
        /// Set the media format.
        /// </summary>
        /// <param name="Audio">0 – 4</param>
        /// <param name="Video">0 – 1</param>
        /// <returns></returns>
        public string SetMediaFormat(int Audio, int Video)
        {
            RovioResponse response = this.Request("/SetMediaFormat.cgi",
                                                  new RequestItem("Audio", Audio.ToString()),
                                                  new RequestItem("Video", Video.ToString()));

            return("");
        }
コード例 #10
0
        public void SetNight(NightMode mode)
        {
            movement.SaveParameter(FlashParameters.NightMode, (byte)mode);

            RovioResponse response = this.Request("/debug.cgi",
                                                  new RequestItem("action", "write_i2c"),
                                                  new RequestItem("address", "0x14"),
                                                  new RequestItem("value", "0x" + ((int)mode).ToString("X2")));
        }
コード例 #11
0
        /// <summary>
        /// 扫描Wifi网络。
        /// </summary>
        /// <returns></returns>
        public WifiInfo[] ScanWlan()
        {
            //ESSID = 2#3004
            //Mode = Managed
            //Encode = 1
            //Quality = 93
            RovioResponse response = this.Request("/ScanWlan.cgi");

            List <string>   listSSID    = new List <string>();
            List <WifiMode> listMode    = new List <WifiMode>();
            List <bool>     listEncode  = new List <bool>();
            List <int>      listQuality = new List <int>();

            foreach (RovioResponseItem item in response)
            {
                switch (item.Key)
                {
                case "ESSID":
                    listSSID.Add(item.Value);
                    break;

                case "Mode":
                    WifiMode mode;
                    if (item.Value == "Managed")
                    {
                        mode = WifiMode.WirelessNetwork;
                    }
                    else
                    {
                        mode = WifiMode.Computer2ComputerNetwork;
                    }
                    listMode.Add(mode);
                    break;

                case "Encode":
                    listEncode.Add((item.Value == "1"));
                    break;

                case "Quality":
                    listQuality.Add(int.Parse(item.Value));
                    break;
                }
            }
            List <WifiInfo> listWifi = new List <WifiInfo>();

            for (int i = 0; i < listSSID.Count; i++)
            {
                listWifi.Add(new WifiInfo(
                                 (i > listSSID.Count - 1) ? "" : listSSID[i],
                                 (i > listMode.Count - 1) ? WifiMode.WirelessNetwork : listMode[i],
                                 (i > listEncode.Count - 1) ? false : listEncode[i],
                                 (i > listQuality.Count - 1) ? 0 : listQuality[i]));
            }

            return(listWifi.ToArray());
        }
コード例 #12
0
        /// <summary>
        /// Get HTTP server's settings.
        /// </summary>
        /// <returns></returns>
        public int GetHttp()
        {
            RovioResponse response = this.Request("/GetHttp.cgi");

            int WebPort = int.Parse(response["Port0"]);

            //Port1

            return(WebPort);
        }
コード例 #13
0
        /// <summary>
        /// 读取夜视设置。
        /// </summary>
        public void GetNight()
        {
            // roviosrc20100408.7z\Host\LibCamera\Src\LibIPCamera.c
            // int Config_MemDebug(HTTPCONNECTION hConnection, LIST *pParamList, int iAction, XML *pReturnXML)

            RovioResponse response = this.Request("/debug.cgi",
                                                  new RequestItem("action", "read_i2c"),
                                                  new RequestItem("address", "0x14"));
            //
        }
コード例 #14
0
        /// <summary>
        /// Get camera's name.
        /// </summary>
        /// <returns></returns>
        public string GetName()
        {
            RovioResponse response = this.Request("/GetName.cgi");

            if (response == null || !response.ContainsKey("CameraName"))
            {
                return(null);
            }

            return(response["CameraName"]);
        }
コード例 #15
0
        /// <summary>
        /// Set server time zone and time.
        /// </summary>
        /// <param name="Sec1970">seconds since "00:00:00 1/1/1970".</param>
        /// <param name="TimeZone">Time zone in minutes. (e.g. Beijing is GMT+08:00, TimeZone = -480)</param>
        /// <returns></returns>
        public string SetTime(DateTime time, TimeZoneInfo timeZone)
        {
            DateTime date1970 = new DateTime(1970, 1, 1);
            long     sec1970  = (long)time.Subtract(date1970).TotalSeconds;

            RovioResponse response = this.Request("/SetTime.cgi",
                                                  new RequestItem("Sec1970", sec1970),
                                                  new RequestItem("TimeZone", 0 - (int)timeZone.BaseUtcOffset.TotalMinutes));

            return("");
        }
コード例 #16
0
ファイル: RovioAPI.Mail.cs プロジェクト: sunsunsun000/rovio
 /// <summary>
 /// Configure email for sending IPCam images.
 /// </summary>
 public void SetMail(MailSettings settings)
 {
     RovioResponse response = this.Request("/SetMail.cgi",
                                           new RequestItem("Enable", settings.Enabled ? "true" : "false"),
                                           new RequestItem("MailServer", settings.MailServer),
                                           new RequestItem("Port", settings.Port),
                                           new RequestItem("Sender", settings.Sender),
                                           new RequestItem("Receiver", settings.Receiver),
                                           new RequestItem("Subject", settings.Subject),
                                           new RequestItem("Body", settings.Body),
                                           new RequestItem("User", settings.UserName),
                                           new RequestItem("PassWord", settings.Password),
                                           new RequestItem("CheckFlag", settings.AuthRequired ? "CHECK" : ""),
                                           new RequestItem("Interval", settings.Interval));
 }
コード例 #17
0
ファイル: RovioAPI.Mail.cs プロジェクト: sunsunsun000/rovio
        /// <summary>
        /// Get email settings.
        /// </summary>
        /// <returns></returns>
        public MailSettings GetMail()
        {
            RovioResponse response = this.Request("/GetMail.cgi");

            MailSettings settings = new MailSettings();

            settings.MailServer   = response["MailServer"];
            settings.Port         = int.Parse(response["Port"]);
            settings.Sender       = response["Sender"];
            settings.Receiver     = response["Receiver"];
            settings.Subject      = response["Subject"];
            settings.Body         = response["Body"];
            settings.UserName     = response["User"];
            settings.Password     = response["PassWord"];
            settings.AuthRequired = RovioAPI.GetBoolean(int.Parse(response["CheckFlag"]));

            settings.Enabled = RovioAPI.GetBoolean(int.Parse(response["Enable"]));

            return(settings);
        }
コード例 #18
0
        /// <summary>
        /// Get run-time status of Rovio.
        /// </summary>
        /// <returns></returns>
        public RovioStatus GetStatus()
        {
            RovioResponse response = this.Request("/GetStatus.cgi");

            return(RovioStatus.Parse(response));
        }
コード例 #19
0
        /// <summary>
        /// Get Mac address.
        /// </summary>
        /// <returns></returns>
        public string GetMac()
        {
            RovioResponse response = this.Request("GetMac.cgi");

            return(response["MAC"]);
        }
コード例 #20
0
        /// <summary>
        /// Get the media format.
        /// </summary>
        /// <returns></returns>
        public string GetMediaFormat()
        {
            RovioResponse response = this.Request("/GetMediaFormat.cgi");

            return("");
        }
コード例 #21
0
        /// <summary>
        /// Get WiFi settings.
        /// </summary>
        /// <returns></returns>
        public string GetWlan()
        {
            RovioResponse response = this.Request("/GetWlan.cgi");

            return("");
        }
コード例 #22
0
 /// <summary>
 /// Change all settings to factory-default.
 /// </summary>
 /// <returns></returns>
 public void SetFactoryDefault()
 {
     RovioResponse response = this.Request("/SetFactoryDefault.cgi");
 }
コード例 #23
0
 public void SetLED(BlueLightState mode)
 {
     movement.SaveParameter(FlashParameters.BlueLights, (byte)mode);
     RovioResponse response = this.Request("/mcu",
                                           new RequestItem("parameters", string.Format("114D4D00010053485254000100011A{0:X2}0000", (byte)mode)));
 }
コード例 #24
0
        public UPnPInfo GetUPnP()
        {
            RovioResponse response = this.Request("/GetUPnP.cgi");

            return(UPnPInfo.Parse(response));
        }
コード例 #25
0
 /// <summary>
 /// Set camera's name.
 /// </summary>
 /// <param name="CameraName"></param>
 /// <returns></returns>
 public void SetName(string name)
 {
     RovioResponse response = this.Request("/SetName.cgi",
                                           new RequestItem("CameraName", name));
 }
コード例 #26
0
        /// <summary>
        /// Get DDNS settings.
        /// </summary>
        /// <returns></returns>
        public string GetDDNS()
        {
            RovioResponse response = this.Request("/GetDDNS.cgi");

            return(response["DNS0"]);
        }
コード例 #27
0
ファイル: RovioAPI.Mail.cs プロジェクト: sunsunsun000/rovio
        /// <summary>
        /// Send an email with IPCam images.
        /// </summary>
        /// <returns></returns>
        public string SendMail()
        {
            RovioResponse response = this.Request("/SendMail.cgi");

            return("");
        }
コード例 #28
0
 /// <summary>
 /// Set a logo string on the image.
 /// </summary>
 /// <param name="showstring">time - time, date - date,ver - version</param>
 /// <param name="pos">0 – top left, 1 – top right, 2 – bottom left, 3 – bottom right</param>
 /// <returns></returns>
 public void SetLogo(string showstring, LogoPostions position)
 {
     RovioResponse response = this.Request("/SetLogo.cgi",
                                           new RequestItem("showstring", showstring),
                                           new RequestItem("pos", (int)position));
 }
コード例 #29
0
ファイル: RovioAPI.Users.cs プロジェクト: sunsunsun000/rovio
 /// <summary>
 /// Enable or disable user authorization check.
 /// </summary>
 /// <param name="Check"></param>
 /// <returns></returns>
 public void SetUserCheck(bool Check)
 {
     RovioResponse response = this.Request("/SetUserCheck.cgi",
                                           new RequestItem("Check", Check));
 }
コード例 #30
0
 /// <summary>
 /// Reboot Rovio.
 /// </summary>
 /// <returns></returns>
 public void Reboot()
 {
     RovioResponse response = this.Request("/Reboot.cgi");
 }