Пример #1
0
    // Update is called once per frame
    void Update()
    {
        // Do this until the dropdown menu is updated with anomalies
        if (drop.options.Count == 0)
        {
            drop.transform.Find("Label").gameObject.GetComponent <Text>().text = "";

            // Add the anomalies to the dropdown list
            foreach (string device in SQLConnect.anomDevices)
            {
                drop.options.Add(new Dropdown.OptionData(device));
            }

            // This will onoly happen once
            if (drop.options.Count != 0)
            {
                // Update the dropdown caption to be the number of anomalies detected
                if (drop.options[0].text != "0 Anomalies")
                {
                    drop.transform.Find("Label").gameObject.GetComponent <Text>().text = drop.options.Count.ToString() + " Anomalies";
                }
                else
                {
                    drop.transform.Find("Label").gameObject.GetComponent <Text>().text = drop.options[0].text;
                }
                // When anomaly detection is done, have the system alert the user to the number of anomalies detected
                TextToSpeechControl.Speech(drop.transform.Find("Label").gameObject.GetComponent <Text>().text.Split()[0] + " devices with anomalies");
            }
        }
    }
Пример #2
0
    public void OnTextScan()
    {
        TextToSpeechControl.Speech("Scanning text");
        SQLConnect.ID = "Scanning";


#if !UNITY_EDITOR
            MediaFrameQrProcessing.Wrappers.IPAddressScanner.ScanFirstCameraForIPAddress(
                    result =>
                     {
                      UnityEngine.WSA.Application.InvokeOnAppThread(() =>
                                                                               {
                Debug.Log("scanned");
                            SQLConnect.ID = result?.ToString() ?? "not found";
                if (SQLConnect.ID == "not found")
                {
                    TextToSpeechControl.Speech("Scan failed");
                }
                else
                {
                    TextToSpeechControl.Speech("Scan successful");
                    MoveToView.flag = true;
                }
                          
            },
                                                                              false);
                    
        },
                    TimeSpan.FromSeconds(30));
#endif
    }
Пример #3
0
    private void DeviceQuery(IRestResponse <NestedResults <Telemetry> > response)
    {
        if (!response.IsError)
        {
            Telemetry[] items = response.Data.results;
            if (deviceSkip != 0)
            {
                device.AddRange(items.ToList());
            }
            else
            {
                device = items.ToList(); // set for first page of results
            }

            deviceSkip += 50;
            if (deviceSkip < response.Data.count)
            {
                CustomQuery deviceQuery = new CustomQuery(filter, "eventprocessedutctime, deviceid", 50, deviceSkip, select);
                StartCoroutine(_table.Query <Telemetry>(deviceQuery, DeviceQuery));
            }
            else
            {
                ProgressRing.flag2 = false;
                if (device.Count() == 0)
                {
                    flag = false;
                }
                else
                {
                    foreach (string element in attributes)
                    {
                        graphVals[element] = dataPoints(device, element);
                    }
                    GetStats(4, graphVals);

                    TextToSpeechControl.Speech(getNumAnomalies(device).ToString() + " anomalous data points detected");
                    /*textToSpeech.SpeakText(getNumAnomalies(device).ToString() + " anomalous data points detected");*/
                }
            }
        }
        else
        {
            Debug.LogWarning("Read Nested Results Error Status:" + response.StatusCode.ToString() + " Url: " + response.Url);
        }
    }