public void OnImageCaptured(HomeOS.Hub.Common.WebCam.WebCamWrapper.Contracts.IFrameSource frameSource, HomeOS.Hub.Common.WebCam.WebCamWrapper.Contracts.Frame frame, double fps) { List<VParamType> ret = new List<VParamType>(); lock (this) { _latestFrame = frame.Image; var newImageBytes = ImageToByteArray(frame.Image); //make a copy, so we do not pass on this new object to the remote guys (which leads to higher memory consumption) if (_latestImageBytes.Length < newImageBytes.Length) { _latestImageBytes = newImageBytes; } else { Buffer.BlockCopy(newImageBytes, 0, _latestImageBytes, 0, newImageBytes.Length); } } ret.Add(new ParamType(ParamType.SimpleType.jpegimage, _latestImageBytes)); cameraPort.Notify(RoleCamera.RoleName, RoleCamera.OpGetVideo, ret); }
public bool IsCompatibleWithRole(HomeOS.Hub.Platform.Views.VRole role) { foreach (RoleList roleList in roleLists) { if (roleList.IsContained(role)) return true; } return false; }
public bool IsContained(HomeOS.Hub.Platform.Views.VRole role) { foreach (HomeOS.Hub.Platform.Views.VRole myRole in roles) { if (Role.ContainsRole(role, myRole)) return true; } return false; }
internal static VModuleState C2V(HomeOS.Hub.Platform.Contracts.IModuleState contract) { if (contract == null) return null; if (!System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(contract) && (contract.GetType().Equals(typeof(ModuleStateV2C)))) { return ((ModuleStateV2C)(contract)).GetSourceView(); } else { return new ModuleStateC2V(contract); } }
public PortInfo(HomeOS.Hub.Platform.Views.VModuleInfo moduleInfo, string moduleFacingName, List<HomeOS.Hub.Platform.Views.VRole> roles, string friendlyName) { this.friendlyName = friendlyName; this.moduleInfo = moduleInfo; this.moduleFacingName = moduleFacingName; if (roles != null) { this.roles = roles; } else { this.roles = new List<HomeOS.Hub.Platform.Views.VRole>(); } }
//*** /// <summary> /// Does this location contain this port? /// </summary> public bool ContainsPort(HomeOS.Hub.Platform.Views.VPortInfo portInfo) { foreach (var childPort in ChildPorts) { if (childPort.Equals(portInfo)) return true; } foreach (var childLocation in ChildLocations) { if (childLocation.ContainsPort(portInfo)) return true; } return false; }
private void NewFrame(HomeOS.Hub.Common.WebCam.WebCamWrapper.Contracts.IFrameSource frameSource, HomeOS.Hub.Common.WebCam.WebCamWrapper.Contracts.Frame frame, double fps) { //We want to ignore frames we can't render fast enough lock (_frameSync) { if (!_frameWaiting) { _frameWaiting = true; Action workAction = delegate { this.labelCameraFPSValue.Content = fps.ToString(); this.imgPreview.Source = frame.OriginalImage.ToBitmapSource(); lock (_frameSync) { _frameWaiting = false; } }; Dispatcher.BeginInvoke(workAction); } } }
///unclear how to make this safe public SafeThread(ThreadStart start, string name, HomeOS.Hub.Platform.Views.VLogger logger) { this.logger = logger; thread = new Thread(delegate() { try { start(); } catch (Exception exception) { //string message = "HomeOS SafeThread named: " + name + ", raised exception: " + exception.GetType(); string message = "HomeOS SafeThread named: " + name + ", raised exception: " + exception.ToString(); logger.Log(message); //lets print these messages to stderr as well Console.Error.WriteLine(message); } } ); thread.Name = name; }
public override void Update(HomeOS.Hub.Platform.Views.VModuleState s) { this.state = (SimpleState)s.GetSimpleState(); this.timestamp = s.GetTimestamp(); }
public void PortRegistered(HomeOS.Hub.Platform.Contracts.IPort port) { _view.PortRegisteredWithHooks(PortAdapter.C2V(port)); }
//*** public int InstallCapability(HomeOS.Hub.Platform.Contracts.ICapability capability, HomeOS.Hub.Platform.Contracts.IPort targetPort) { return _view.InstallCapability(CapabilityAdapter.C2V(capability), PortAdapter.C2V(targetPort)); }
public void OnImageCaptured(HomeOS.Hub.Common.WebCam.WebCamWrapper.Contracts.IFrameSource frameSource, HomeOS.Hub.Common.WebCam.WebCamWrapper.Contracts.Frame frame, double fps) { _latestFrame = frame.Image; pictureBoxDisplay.Invalidate(); }
public void AddRole(HomeOS.Hub.Platform.Views.VRole role) { roles.Add(role); }
public void CancelAllSubscriptions(HomeOS.Hub.Platform.Contracts.IModule module , HomeOS.Hub.Platform.Contracts.IPort controlPort, HomeOS.Hub.Platform.Contracts.ICapability controlportcap) { _view.CancelAllSubscriptions( ModuleAdapter.C2V(module), PortAdapter.C2V(controlPort), CapabilityAdapter.C2V(controlportcap)); }
public ModuleStateC2V(HomeOS.Hub.Platform.Contracts.IModuleState contract) { _contract = contract; _handle = new ContractHandle(contract); }
public PortInfo(string moduleFacingName, HomeOS.Hub.Platform.Views.VModuleInfo moduleInfo, List<HomeOS.Hub.Platform.Views.VRole> roles) : this(moduleInfo, moduleFacingName, roles, null) { }
public PortInfo(string moduleFacingName, HomeOS.Hub.Platform.Views.VModuleInfo moduleInfo) : this(moduleInfo, moduleFacingName, null, null) { }
/// <summary> /// Handler for end-of-forwarding event. /// </summary> /// <param name="forwarder">The forwarder that is closing.</param> private void StopForwarding(HomeOS.Shared.Gatekeeper.Forwarder forwarder) { }
public HomeOS.Hub.Platform.Contracts.IPortInfo GetPortInfo(string moduleFacingName, HomeOS.Hub.Platform.Contracts.IModule module) { return PortInfoAdapter.V2C(_view.GetPortInfo(moduleFacingName, ModuleAdapter.C2V(module))); }
public void Update(HomeOS.Hub.Platform.Contracts.IModuleState s) { _view.Update(ModuleStateAdapter.C2V(s)); }
public void SetLocation(HomeOS.Hub.Platform.Views.VLocation location) { this.location = location; }
public int DeregisterPort(HomeOS.Hub.Platform.Contracts.IPort port, HomeOS.Hub.Platform.Contracts.IModule module) { return _view.DeregisterPort(PortAdapter.C2V(port), ModuleAdapter.C2V(module)); }
internal static bool Expired(HomeOS.Hub.Platform.Views.VCapability capability) { return capability.ExpiryTime() < DateTime.Now; }
//*** public void UpdateState(HomeOS.Hub.Platform.Contracts.IModule module, HomeOS.Hub.Platform.Contracts.IModuleState state) { _view.UpdateState(ModuleAdapter.C2V(module), ModuleStateAdapter.C2V(state)); }