Exemple #1
0
        /// <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);
        }
 public MovementController(RovioAPI rovio)
 {
     this.rovio = rovio;
     this.driver = new ManualDriver(this);
 }
Exemple #3
0
 public CameraController(RovioAPI rovio)
 {
     this.rovio = rovio;
 }
Exemple #4
0
        public void Open(string host, int port, int rtspPort, NetworkCredential credentials, BackgroundWorker bw = null)
        {
            try
            {
                this.api = new RovioAPI(host, port, credentials);
                this.api.CommandTimeout = this.commandTimeout;
                this.RtspUrl = string.Format("rtsp://{0}:{1}@{2}{3}/webcam",
                    credentials.UserName,
                    credentials.Password,
                    host,
                    (rtspPort == 554) ? "" : ":" + rtspPort);
                this.MJpegUrl = string.Format("http://{0}{1}/GetData.cgi",
                    host, ((port == 80) ? "" : ":" + port));

                if (bw != null)
                    bw.ReportProgress(0, string.Format("登录到 {0}{1} ...",
                        host, (port == 80) ? "" : ":" + port));

                //检查是否登录
                this.userInfo = api.GetMyself(true);

                FirmwareVersion firmware = api.GetVer();
                string libNSVersion = api.Movement.GetLibNSVersion();
                this.Version = new RovioVersionInfo(firmware, libNSVersion);

                if (bw != null)
                    bw.ReportProgress(0, "登录成功,载入Rovio配置...");
                this.settings.Load();

                this.networkConfig = api.GetNetworkConfig();

                //resetMovementSettings
                this.movement_speed = DEFAULT_SPEED;
                this.turn_speed = DEFAULT_TURN_SPEED;
                this.rot_speed = DEFAULT_ROT_SPEED;

                // upnp settings need to be called as soon as possible for RTSP feeds
                //loadUPnPFields
                this.upnp_info = api.GetUPnP();
                //updateOnlineStatus();
                //updateUPnPFields();
                //initial_upnp_load = false;

                // need to know web port for ActiveX
                //loadWebPort
                this.net_web_port = api.GetHttp();

                // need to know the manual external ip

                //refreshPathList
                this.listWays.Clear();
                string[] list = api.Movement.GetPathList();
                this.listWays.AddRange(list);

                //loadForceMJPEGFromURL();

                //var force_reboot = getQueryVariable("reboot");
                //if(force_reboot != null && parseInt(force_reboot)){
                //    $('settings_dialog').style.display = 'none';
                //    selectTab($('sidetab_1'));
                //    initReboot();
                //    return;
                //}

                //access_settings_panel = 1;
                //$('move_ir').checked = IR_val;

                if (userInfo.Group == UserGroups.Administrator)
                {//管理员账号
                    // need to know if we are using a domain for checking external access
                    //loadDynDNSSettings();

                    ////loadSettingsPanels();
                    //setServerTime();
                    //getEvoVersion();
                    //getWBVersion();
                    //loadSMTPSettings();

                    //setTimeout('getLatestVersion()',5000);
                }

                //if(!user_guest){
                //setTimeout("access_settings_panel = 1",1000);
                //}

                RovioStatusReport report = api.Movement.GetReport();
                this.status = report;
                timerRefreshStatus.Start();
                timerMovement.Start();

                StartWorkerThread();
                isOpen = true;
            }
            catch (Exception ex)
            {
                this.api = null;
                isOpen = false;

                throw ex;
            }
        }