public bool ManualDrive(DriveArguments arguments) { if (isrunning) { return(false); } isrunning = true; try { //s_value = 1 (fastest) – 10 (slowest) int speedTick = RovioAPI.SetDouble(arguments.Speed, 10, 1); int?angleTick = null; if (arguments.Angle == null) { angleTick = null; } else { angleTick = (int)Math.Floor(arguments.Angle.Value / 12.0); } //angleTick 务必小于32,否则会溢出导致不断转圈。 rovio.ManualDrive((int)arguments.Action, speedTick, angleTick); } catch (Exception ex) { } finally { isrunning = false; } return(true); }
public void SetIRState(bool irDetectEnabled) { this.IrDetectEnabled = irDetectEnabled; RovioAPI api = rovio.API; MovementController movement = api.Movement; movement.SetIRState(this.IrDetectEnabled); }
public void SetNightMode(NightMode mode) { this.NightMode = mode; RovioAPI api = rovio.API; MovementController movement = api.Movement; api.SetNight(this.NightMode); }
public void SavePlayer(VideoPlayers value) { this.PlayerType = value; RovioAPI api = rovio.API; MovementController movement = api.Movement; movement.SaveParameter(FlashParameters.video_player, (int)this.PlayerType); }
public void SaveSpeakerVolume(double volume) { this.SpeakerVolume = volume; RovioAPI api = rovio.API; CameraController camera = api.Camera; camera.ChangeSpeakerVolume(volume); }
public void SaveMicrophoneVolume(double volume) { this.MicrophoneVolume = volume; RovioAPI api = rovio.API; CameraController camera = api.Camera; camera.ChangeMicVolume(volume); }
public void SetHeadLight(HeadLightState state) { this.HeadLight = state; RovioAPI api = rovio.API; MovementController movement = api.Movement; movement.SetHeadLight(this.HeadLight); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } api.ManualDriver.Forward(this.speed); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } api.Movement.UpdateHomePosition(); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } rovio.Settings.SetBlueLight(this.state); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } api.SetFactoryDefault(); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } api.Reboot(); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } api.ManualDriver.RotateRightByDegree(angle); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } api.GetAudio(audio, offset, length); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } rovio.QueueWorkItem(api.Movement.GoHomeAndDock); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } rovio.Settings.SetNightMode(this.mode); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } api.ManualDriver.Stop(); }
public override void Execute() { RovioAPI api = rovio.API; if (api == null) { throw new Exception("Rovio 尚未连接。"); } rovio.QueueWorkItem(api.ManualDriver.HeadUp); }
internal override void Load(Dictionary <FlashParameters, Int32> flashParameters, RovioStatusReport report, RovioMcuReport mcuReport) { //此处跟Rovio Web设置保持一致,范围是1-10, 1为最慢 this.movementSpeed = RovioAPI.GetDouble( flashParameters[FlashParameters.MovementSpeed], 1, 10, 0.5); this.turnSpeed = RovioAPI.GetDouble( flashParameters[FlashParameters.TurnSpeed], 1, 10, 0.5); this.rotSpeed = RovioAPI.GetDouble( flashParameters[FlashParameters.RotSpeed], 1, 10, 0.8); this.modified = false; }
internal override void Load(Dictionary <FlashParameters, Int32> flashParameters, RovioStatusReport report, RovioMcuReport mcuReport) { RovioAPI api = owner.rovio.API; this.brightness = report.brightness; this.resolutionId = report.ResolutionId; this.videoCompression = report.VideoCompression; this.frameRate = report.frame_rate; this.acFrequency = report.ACFrequency; this.modified = false; }
public void SetFirmwareAlert(bool value) { if (this.FirmwareAlert == value) { return; } this.FirmwareAlert = value; RovioAPI api = rovio.API; MovementController movement = api.Movement; movement.SaveParameter( new FlashParameterItem(FlashParameters.firmware_alert, RovioAPI.SetBoolean(value))); }
public override void Save() { if (!this.modified) { return; } MovementController movement = owner.rovio.API.Movement; movement.SaveParameter( new FlashParameterItem(FlashParameters.MovementSpeed, RovioAPI.SetDouble(this.movementSpeed, 1, 10)), new FlashParameterItem(FlashParameters.TurnSpeed, RovioAPI.SetDouble(this.turnSpeed, 1, 10)), new FlashParameterItem(FlashParameters.RotSpeed, RovioAPI.SetDouble(this.rotSpeed, 1, 10))); this.modified = false; }
public override void Save() { if (!this.modified) { return; } RovioAPI api = owner.rovio.API; CameraController camera = api.Camera; camera.ChangeBrightness(this.brightness); camera.ChangeResolution(this.resolutionId); camera.ChangeCompressRatio(this.videoCompression); camera.ChangeFramerate(this.frameRate); camera.SetCamera(this.acFrequency); this.modified = false; }
/// <summary> /// /// </summary> /// <param name="value"></param> /// <param name="force">如果强制刷新,则无论值有无改变都重新写入到设备。</param> public void SetBlueLight(BlueLightState value, bool force = false) { if (this.BlueLights == value && !force) { return; } this.BlueLights = value; RovioAPI api = rovio.API; MovementController movement = api.Movement; api.SetLED(this.BlueLights); if (this.BlueLightStateChanged != null) { this.BlueLightStateChanged(this, EventArgs.Empty); } }
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; } }
public void Load() { RovioAPI api = rovio.API; MovementController movement = api.Movement; CameraController camera = api.Camera; RovioStatusReport report = movement.GetReport(); RovioMcuReport mcuReport = movement.GetMCUReport(); Dictionary <FlashParameters, Int32> flashParameters = movement.ReadAllParameters(); this.Name = api.GetName(); this.DateTime = api.GetTime(); this.MaintainAspectRatio = RovioAPI.GetBoolean(flashParameters[FlashParameters.MaintainAspectRatio]); ///// <summary> ///// i_LR ///// </summary> //latency = 4, this.PlayerType = (VideoPlayers)flashParameters[FlashParameters.video_player]; ///// <summary> ///// i_UPnP upnp just enabled ///// </summary> //upnp_just_enabled = 6, ///// <summary> ///// i_SS show status ///// </summary> //show_online_status = 7, ///// <summary> ///// i_MIIP1 manual ip ///// </summary> //manual_internetip = 8, ///// <summary> ///// i_MIIP2 manual ip ///// </summary> //manual_internetip2 = 9, ///// <summary> ///// i_VIA verify internet access ///// </summary> //net_verify_access = 10, this.FirmwareAlert = RovioAPI.GetBoolean( flashParameters[FlashParameters.firmware_alert]); ///// <summary> ///// i_AVF auto set video frequency ///// </summary> //video_freq = 12, this.IrDetectEnabled = ((report.Flags & RovioFlags.IRDetectorActivated) == RovioFlags.IRDetectorActivated); this.HeadLight = mcuReport.HeadLight; this.BlueLights = (BlueLightState)RovioAPI.GetByte(flashParameters[FlashParameters.BlueLights], (byte)BlueLightState.All); this.NightMode = (NightMode)RovioAPI.GetByte(flashParameters[FlashParameters.NightMode], (byte)NightMode.Normal); this.SpeakerVolume = report.speaker_volume; this.MicrophoneVolume = report.mic_volume; groupVideo.Load(flashParameters, report, mcuReport); groupMovement.Load(flashParameters, report, mcuReport); groupMail.Load(flashParameters, report, mcuReport); }
public CameraController(RovioAPI rovio) { this.rovio = rovio; }
public MovementController(RovioAPI rovio) { this.rovio = rovio; this.driver = new ManualDriver(this); }
/// <summary> /// Change the Speaker Volume setting of camera. /// </summary> /// <param name="SpeakerVolume">[0.0, 1.0]</param> /// <returns></returns> public void ChangeSpeakerVolume(double volume) { //Speaker Volume : 0 - 31 (The lower the value is, the lower the speaker volume is) int rawValue = RovioAPI.SetDouble(volume, 0, 31); RovioResponse response = rovio.Request("ChangeSpeakerVolume.cgi?SpeakerVolume=" + rawValue); }