private void Start() { oxiConn = ConnectionManager.Instance["Oximeter"] as NoninOximeterConnection; Configurations.Instance.AddCallback("Tags_Place", () => Tag = ObjectFactory.NewTag(transform, GetPlace()), Configurations.RunOnMainThead.YES); Configurations.Instance.AddCallback("Tags_Remove", () => LCY.Utilities.DestroyChildren(transform), Configurations.RunOnMainThead.YES); }
private void Start() { oxiConn = ConnectionManager.Instance["Oximeter"] as NoninOximeterConnection; HR = ObjectFactory.NewVitalSign(transform, new Vector3(XOffset, YOffset + 0.00f, 0f), Color.green, "HR", "160", "75"); SpO2 = ObjectFactory.NewVitalSign(transform, new Vector3(XOffset, YOffset + 0.25f, 0f), Color.cyan, "SpO2", "100", "90"); Configurations.Instance.SetAndAddCallback("*VitalSigns_Distance", Distantce, v => { Distantce = v; if (gameObject.activeInHierarchy) { Configurations.Instance.Invoke("*VitalSigns_Place"); } }, Configurations.RunOnMainThead.YES); Configurations.Instance.AddCallback("*VitalSigns_Place", () => { transform.SetPositionAndRotation(Camera.transform.position + Camera.transform.forward * Distantce, Quaternion.LookRotation(Camera.transform.forward, Vector3.up)); gameObject.SetActive(true); }, Configurations.RunOnMainThead.YES); Configurations.Instance.AddCallback("*VitalSigns_Remove", () => gameObject.SetActive(false), Configurations.RunOnMainThead.YES); }
/// <summary> /// Update all the information /// TopLeft: WebRTC connection status; TopRight: IP address /// BottomLeft: Ultrasound status; BottomRight: Vital signs /// </summary> private void Update() { if (Mode == Modes.DEBUG) { // TopLeft, WebRTC Status TopLeftText.text = "Self: " + WebRTCConn.StatusInfo + "\n" + "Peer: " + (WebRTCConn.PeerName ?? "NotConnected"); switch (WebRTCConn.Status) { case WebRTCConnection.Statuses.NotConnected: TopLeftText.color = Color.red; break; case WebRTCConnection.Statuses.Pending: TopLeftText.color = Color.yellow; break; case WebRTCConnection.Statuses.Connected: TopLeftText.color = Color.green; break; } // TopRight, IP address string ip = Utilities.GetIPAddress(); if (ip != null) { TopRightText.text = Utilities.GetIPAddress(); } TopRightText.color = GetColor(ip != null); } // BottomLeft, Ultrasound if (WebRTCConn.WebRTCStatus == WebRTCConnection.WebRTCStatuses.InCall) { Color ultraColor = GetColor(UltrasoundTracker.Tracked); StringBuilder sb = new StringBuilder(); if (Mode == Modes.DEBUG) { sb.Append("FPS: ").Append(UltrasoundController.GetTrackingFPS()).AppendLine(); } sb.Append("Ultrasound: ").Append(UltrasoundTracker.Tracked ? "Tracked" : "Lost tracking"); BottomLeftText.text = sb.ToString(); BottomLeftText.color = ultraColor; } // BottomRight, Vital signs NoninOximeterConnection oxiConn = ConnectionManager.Instance["Oximeter"] as NoninOximeterConnection; if (oxiConn.StatusInfo == null) { StringBuilder sb = new StringBuilder(); Color oxiColor = GetColor(oxiConn.Connected); sb.Append("Pulse rate: ").Append(oxiConn.PulseRate).AppendLine(); sb.Append("SpO2: ").Append(oxiConn.SpO2).Append("%"); BottomRightText.text = sb.ToString(); BottomRightText.color = oxiColor; } else { BottomRightText.text = oxiConn.StatusInfo; BottomRightText.color = Color.red; } }