Hybrid8Test (Subsampling Removal)

बनाया गया Diff कभी समाप्त नहीं होता
12 हटाए गए
378 लाइनें
0 जोड़े गए
374 लाइनें
using System;
using System;
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UI;


public class Hybrid8Test : MonoBehaviour
public class Hybrid8Test : MonoBehaviour
{
{
// Class Variables
// Class Variables
private PluxDeviceManager pluxDevManager;
private PluxDeviceManager pluxDevManager;


// GUI Objects.
// GUI Objects.
public Button ScanButton;
public Button ScanButton;
public Button ConnectButton;
public Button ConnectButton;
public Button DisconnectButton;
public Button DisconnectButton;
public Button StartAcqButton;
public Button StartAcqButton;
public Button StopAcqButton;
public Button StopAcqButton;
public Dropdown DeviceDropdown;
public Dropdown DeviceDropdown;
public Dropdown SamplingRateDropdown;
public Dropdown SamplingRateDropdown;
public Dropdown ResolutionDropdown;
public Dropdown ResolutionDropdown;
public Dropdown RedIntensityDropdown;
public Dropdown RedIntensityDropdown;
public Dropdown InfraredIntensityDropdown;
public Dropdown InfraredIntensityDropdown;
public Text OutputMsgText;
public Text OutputMsgText;


// Class constants (CAN BE EDITED BY IN ACCORDANCE TO THE DESIRED DEVICE CONFIGURATIONS)
// Class constants (CAN BE EDITED BY IN ACCORDANCE TO THE DESIRED DEVICE CONFIGURATIONS)
[System.NonSerialized]
[System.NonSerialized]
public List<string> domains = new List<string>() { "BTH" };
public List<string> domains = new List<string>() { "BTH" };
public int samplingRate = 100;
public int samplingRate = 100;


private int Hybrid8PID = 517;
private int Hybrid8PID = 517;
private int BiosignalspluxPID = 513;
private int BiosignalspluxPID = 513;
private int BitalinoPID = 1538;
private int BitalinoPID = 1538;
private int MuscleBanPID = 1282;
private int MuscleBanPID = 1282;
private int MuscleBanNewPID = 2049;
private int MuscleBanNewPID = 2049;
private int BiosignalspluxSoloPID = 532;
private int BiosignalspluxSoloPID = 532;
private int MaxLedIntensity = 255;
private int MaxLedIntensity = 255;


// Start is called before the first frame update
// Start is called before the first frame update
void Start()
void Start()
{
{
// Initialise object
// Initialise object
pluxDevManager = new PluxDeviceManager(ScanResults, ConnectionDone, AcquisitionStarted, OnDataReceived, OnEventDetected, OnExceptionRaised);
pluxDevManager = new PluxDeviceManager(ScanResults, ConnectionDone, AcquisitionStarted, OnDataReceived, OnEventDetected, OnExceptionRaised);


// Important call for debug purposes by creating a log file in the root directory of the project.
// Important call for debug purposes by creating a log file in the root directory of the project.
pluxDevManager.WelcomeFunctionUnity();
pluxDevManager.WelcomeFunctionUnity();
}
}


// Update function, being constantly invoked by Unity.
// Update function, being constantly invoked by Unity.
void Update() {}
void Update() {}


// Method invoked when the application was closed.
// Method invoked when the application was closed.
void OnApplicationQuit()
void OnApplicationQuit()
{
{
try
try
{
{
// Disconnect from device.
// Disconnect from device.
if (pluxDevManager != null)
if (pluxDevManager != null)
{
{
pluxDevManager.DisconnectPluxDev();
pluxDevManager.DisconnectPluxDev();
Console.WriteLine("Application ending after " + Time.time + " seconds");
Console.WriteLine("Application ending after " + Time.time + " seconds");
}
}
}
}
catch (Exception exc)
catch (Exception exc)
{
{
Console.WriteLine("Device already disconnected when the Application Quit.");
Console.WriteLine("Device already disconnected when the Application Quit.");
}
}
}
}


/**
/**
* =================================================================================
* =================================================================================
* ============================= GUI Events ========================================
* ============================= GUI Events ========================================
* =================================================================================
* =================================================================================
*/
*/


// Method called when the "Scan for Devices" button is pressed.
// Method called when the "Scan for Devices" button is pressed.
public void ScanButtonFunction()
public void ScanButtonFunction()
{
{
// Search for PLUX devices
// Search for PLUX devices
pluxDevManager.GetDetectableDevicesUnity(domains);
pluxDevManager.GetDetectableDevicesUnity(domains);


// Disable the "Scan for Devices" button.
// Disable the "Scan for Devices" button.
ScanButton.interactable = false;
ScanButton.interactable = false;
}
}


// Method called when the "Connect to Device" button is pressed.
// Method called when the "Connect to Device" button is pressed.
public void ConnectButtonFunction()
public void ConnectButtonFunction()
{
{
// Disable Connect button.
// Disable Connect button.
ConnectButton.interactable = false;
ConnectButton.interactable = false;


// Connect to the device selected in the Dropdown list.
// Connect to the device selected in the Dropdown list.
pluxDevManager.PluxDev(DeviceDropdown.options[DeviceDropdown.value].text);
pluxDevManager.PluxDev(DeviceDropdown.options[DeviceDropdown.value].text);
}
}


// Method called when the "Disconnect Device" button is pressed.
// Method called when the "Disconnect Device" button is pressed.
public void DisconnectButtonFunction()
public void DisconnectButtonFunction()
{
{
// Disconnect from the device.
// Disconnect from the device.