├── Demo └── Access_RealTimeArousalGSRDetection_BySocket │ ├── Access_RealTimeArousalGSRDetection_BySocket.sln │ └── SocketClient │ ├── App.config │ ├── Properties │ └── AssemblyInfo.cs │ ├── SocketClient.cs │ ├── SocketClient.csproj │ └── bin │ └── Release │ ├── SocketClient.exe │ ├── SocketClient.exe.config │ ├── SocketClient.pdb │ ├── SocketClient.vshost.exe │ ├── SocketClient.vshost.exe.config │ └── SocketClient.vshost.exe.manifest ├── Docs ├── GSR Meter Technical Data.docx ├── LICENSE.txt ├── Lightweight Asset Status Tracker.xlsx ├── Post-RAGE-AssetMaintenance-Form_RealTimeArousalDetection.doc ├── RTArousalDetectionAssetDemo.mp4 ├── RTArousalDetectionAssetSettingsManagement.avi ├── RTArousalDetectionAsset_InstallationInstructions.docx ├── RTArousalDetectionAsset_InstallationInstructions_final.doc ├── RTArousalDetectionAsset_InstallationInstructions_final.pdf ├── RTArousalDetectionSettings.docx ├── Real-timeArousalDetectionUsingGalvanicSkinResponseAsset_Showcases.pdf ├── Task 2.3 RT Arousal Detection Using Galvanic Skin Response Asset-ver0.8-design.docx ├── field-trial2-v04.pdf └── licenseApache2.0.png ├── Drivers └── GSRDrivers.zip ├── LICENSE.txt ├── README.md ├── RealTimeArousalDetectionUsingGSRBin ├── DisplayGSRSignal.exe ├── HMDevice.dll ├── RageAssetManager.dll ├── RageAssetManager.xml ├── RealTimeArousalDetection.dll ├── RealTimeArousalDetectionUsingGSRAsset.dll ├── Resources │ └── RealTimeArousalDetectionAssetSettings.xml ├── SignalDevice.dll └── Utils.dll └── RealTimeArousalDetectionUsingGSRSource ├── DisplayGSRSignal ├── App.config ├── Bridge.cs ├── DisplayGSRSignal.csproj ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── RealTimeArousalDetectionUsingGSRAsset.VersionAndDependencies.xml │ ├── go-512.png │ └── mouseScrollUpDown_small_2.png ├── SignalsVisualization.Designer.cs ├── SignalsVisualization.cs ├── SignalsVisualization.resx └── bin │ ├── DisplayGSRSignal.exe │ ├── DisplayGSRSignal.exe.config │ ├── DisplayGSRSignal.vshost.exe │ ├── DisplayGSRSignal.vshost.exe.config │ ├── Logger.dll │ ├── RageAssetManager.dll │ ├── RealTimeArousalDetection.dll │ ├── SignalDevice.dll │ └── SocketServer.dll ├── HMDevice ├── HMDevice.cpp ├── HMDevice.h ├── HMDevice.vcxproj └── HMDevice.vcxproj.filters ├── RageAssetManager ├── AssetManager.cs ├── BaseAsset.cs ├── BaseLog.cs ├── BaseSettings.cs ├── IAsset.cs ├── IBridge.cs ├── IDataStorage.cs ├── IDefaultSettings.cs ├── ILog.cs ├── ISettings.cs ├── IWebServiceRequest.cs ├── IWebServiceRequestAsync.cs ├── Messages.cs ├── Properties │ └── AssemblyInfo.cs ├── RageAssetManager.csproj ├── RageAssetManager.csproj.csdat ├── RageExtensions.cs ├── RageVersionInfo.cs ├── Resources │ └── BaseAsset.VersionAndDependencies.xml ├── VersionAndDependencies.xsd └── pubSubz.cs ├── RealTimeArousalDetection ├── ArousalFeature.cs ├── ArousalStatistics.cs ├── ExtremaType.cs ├── FilterMedian.cs ├── GSRSignalProcessor.cs ├── InflectionLine.cs ├── InflectionLineDirection.cs ├── InflectionPoint.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ ├── Settings.settings │ └── go-512.png ├── RealTimeArousalDetection.csproj ├── Resources │ └── RealTimeArousalDetection.VersionAndDependencies.xml ├── TimeWindowType.cs └── TonicStatistics.cs ├── RealTimeArousalDetectionUsingGSR.sln ├── RealTimeArousalDetectionUsingGSRAsset ├── ErrorStartSignalDevice.cs ├── Properties │ └── AssemblyInfo.cs ├── RealTimeArousalDetectionUsingGSRAsset.cs ├── RealTimeArousalDetectionUsingGSRAsset.csproj ├── Resources │ └── RealTimeArousalDetectionUsingGSRAsset.VersionAndDependencies.xml └── SocketListener.cs ├── SignalDevice ├── Cache.cs ├── GSRHRDevice.cs ├── ISignalDeviceController.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ └── SignalDevice.VersionAndDependencies.xml ├── SignalDevice.csproj └── SignalDeviceSerialPort.cs ├── UnitTestArousalDetectionByGSRDevice ├── GSRSignalProcessorSettings.cs ├── Properties │ └── AssemblyInfo.cs └── UnitTestArousalDetectionByGSRDevice.csproj └── Utils ├── ButterworthFilterCoordinates.cs ├── ButterworthPassType.cs ├── CacheSignalData.cs ├── FilterButterworth.cs ├── Properties └── AssemblyInfo.cs ├── RealTimeArousalDetectionAssetSettings.cs ├── Resources └── Utils.VersionAndDependencies.xml ├── SignalDataByTime.cs └── Utils.csproj /Demo/Access_RealTimeArousalGSRDetection_BySocket/Access_RealTimeArousalGSRDetection_BySocket.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketClient", "SocketClient\SocketClient.csproj", "{025F9B7B-A5AB-48E5-AEC2-8E1965F2B88F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {025F9B7B-A5AB-48E5-AEC2-8E1965F2B88F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {025F9B7B-A5AB-48E5-AEC2-8E1965F2B88F}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {025F9B7B-A5AB-48E5-AEC2-8E1965F2B88F}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {025F9B7B-A5AB-48E5-AEC2-8E1965F2B88F}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SocketClient")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SocketClient")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("025f9b7b-a5ab-48e5-aec2-8e1965f2b88f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/SocketClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Sockets; 3 | using System.Text; 4 | using System.Timers; 5 | 6 | class SocketClient 7 | { 8 | private static Timer calibrationPeriodTimer; 9 | private static Timer getEDAPeriodTimer; 10 | private const int portNum = 10116; 11 | private static int count; 12 | private static bool calibrationStatus = true; 13 | static int timesCallingEda = 15; 14 | 15 | private static bool getDataStatus = true; 16 | 17 | static public void Main() 18 | { 19 | int calibrationPeriod = 20 * 1000; 20 | int getEDAPeriod = 5 * 1000; 21 | 22 | count = 0; 23 | calibrationPeriodTimer = new System.Timers.Timer(); 24 | calibrationPeriodTimer.Interval = calibrationPeriod; 25 | calibrationPeriodTimer.Elapsed += new ElapsedEventHandler(SetCalibrationData); 26 | calibrationPeriodTimer.Start(); 27 | 28 | while (calibrationStatus) 29 | { } 30 | 31 | count = 0; 32 | getEDAPeriodTimer = new Timer(); 33 | getEDAPeriodTimer.Interval = getEDAPeriod; 34 | getEDAPeriodTimer.Elapsed += new ElapsedEventHandler(GetGSRData); 35 | getEDAPeriodTimer.Start(); 36 | 37 | while (getDataStatus) 38 | { } 39 | } 40 | 41 | static void SendMessage(string dataToSend) 42 | { 43 | TcpClient tcpClient = new TcpClient(); 44 | try 45 | { 46 | tcpClient.Connect("localhost", portNum); 47 | NetworkStream networkStream = tcpClient.GetStream(); 48 | if (networkStream.CanWrite && networkStream.CanRead) 49 | { 50 | Console.WriteLine("Send message: " + dataToSend); 51 | Byte[] sendBytes = Encoding.ASCII.GetBytes(dataToSend); 52 | networkStream.Write(sendBytes, 0, sendBytes.Length); 53 | 54 | // Reads the NetworkStream into a byte buffer. 55 | byte[] bytes = new byte[tcpClient.ReceiveBufferSize]; 56 | int BytesRead = networkStream.Read(bytes, 0, (int)tcpClient.ReceiveBufferSize); 57 | 58 | // Returns the data received from the host to the console. 59 | string returndata = Encoding.ASCII.GetString(bytes, 0, BytesRead); 60 | Console.WriteLine("This is what the host returned to you: \r\n{0}", returndata); 61 | 62 | networkStream.Close(); 63 | tcpClient.Close(); 64 | } 65 | else if (!networkStream.CanRead) 66 | { 67 | Console.WriteLine("You can not write data to this stream"); 68 | networkStream.Close(); 69 | tcpClient.Close(); 70 | } 71 | else if (!networkStream.CanWrite) 72 | { 73 | Console.WriteLine("You can not read data from this stream"); 74 | networkStream.Close(); 75 | tcpClient.Close(); 76 | } 77 | networkStream.Close(); 78 | tcpClient.Close(); 79 | } 80 | catch (SocketException) 81 | { 82 | Console.WriteLine("Sever not available!"); 83 | } 84 | catch (System.IO.IOException) 85 | { 86 | Console.WriteLine("Sever not available!"); 87 | } 88 | catch (Exception e) 89 | { 90 | Console.WriteLine(e.ToString()); 91 | } 92 | } 93 | 94 | static void SetCalibrationData(object sender, EventArgs e) 95 | { 96 | if (count++ >= 0) 97 | { 98 | calibrationPeriodTimer.Stop(); 99 | calibrationStatus = false; 100 | } 101 | SendMessage("EOCP"); 102 | Console.WriteLine("calibration"); 103 | } 104 | 105 | static void GetGSRData(object sender, EventArgs e) 106 | { 107 | Console.WriteLine("count: " + count); 108 | Console.WriteLine("timesCallingEda: " + timesCallingEda); 109 | if (count++ >= (timesCallingEda)) 110 | { 111 | SendMessage("EOM"); 112 | Console.WriteLine("End..."); 113 | 114 | getEDAPeriodTimer.Stop(); 115 | getDataStatus = false; 116 | } 117 | SendMessage("GET_EDA"); 118 | Console.WriteLine("eda"); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/SocketClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {025F9B7B-A5AB-48E5-AEC2-8E1965F2B88F} 8 | Exe 9 | Properties 10 | SocketClient 11 | SocketClient 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 60 | -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.exe -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.pdb -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.vshost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.vshost.exe -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.vshost.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Demo/Access_RealTimeArousalGSRDetection_BySocket/SocketClient/bin/Release/SocketClient.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Docs/GSR Meter Technical Data.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/GSR Meter Technical Data.docx -------------------------------------------------------------------------------- /Docs/LICENSE.txt: -------------------------------------------------------------------------------- 1 | ===================================================================================== 2 | The license for Real-Time Arousal Detection Using Galvanic Skin Response Asset 3 | ===================================================================================== 4 | 5 | Copyright 2018 Sofia University 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | This project has received funding from the European Union’s Horizon 10 | 2020 research and innovation programme under grant agreement No 644187. 11 | You may obtain a copy of the License at 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Unless required by applicable law or agreed to in writing, software 16 | distributed under the License is distributed on an "AS IS" BASIS, 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | See the License for the specific language governing permissions and 19 | limitations under the License. -------------------------------------------------------------------------------- /Docs/Lightweight Asset Status Tracker.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/Lightweight Asset Status Tracker.xlsx -------------------------------------------------------------------------------- /Docs/Post-RAGE-AssetMaintenance-Form_RealTimeArousalDetection.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/Post-RAGE-AssetMaintenance-Form_RealTimeArousalDetection.doc -------------------------------------------------------------------------------- /Docs/RTArousalDetectionAssetDemo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/RTArousalDetectionAssetDemo.mp4 -------------------------------------------------------------------------------- /Docs/RTArousalDetectionAssetSettingsManagement.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/RTArousalDetectionAssetSettingsManagement.avi -------------------------------------------------------------------------------- /Docs/RTArousalDetectionAsset_InstallationInstructions.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/RTArousalDetectionAsset_InstallationInstructions.docx -------------------------------------------------------------------------------- /Docs/RTArousalDetectionAsset_InstallationInstructions_final.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/RTArousalDetectionAsset_InstallationInstructions_final.doc -------------------------------------------------------------------------------- /Docs/RTArousalDetectionAsset_InstallationInstructions_final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/RTArousalDetectionAsset_InstallationInstructions_final.pdf -------------------------------------------------------------------------------- /Docs/RTArousalDetectionSettings.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/RTArousalDetectionSettings.docx -------------------------------------------------------------------------------- /Docs/Real-timeArousalDetectionUsingGalvanicSkinResponseAsset_Showcases.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/Real-timeArousalDetectionUsingGalvanicSkinResponseAsset_Showcases.pdf -------------------------------------------------------------------------------- /Docs/Task 2.3 RT Arousal Detection Using Galvanic Skin Response Asset-ver0.8-design.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/Task 2.3 RT Arousal Detection Using Galvanic Skin Response Asset-ver0.8-design.docx -------------------------------------------------------------------------------- /Docs/field-trial2-v04.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/field-trial2-v04.pdf -------------------------------------------------------------------------------- /Docs/licenseApache2.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Docs/licenseApache2.0.png -------------------------------------------------------------------------------- /Drivers/GSRDrivers.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/Drivers/GSRDrivers.zip -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | ===================================================================================== 2 | The license for Real-Time Arousal Detection Using Galvanic Skin Response Asset 3 | ===================================================================================== 4 | 5 | Copyright 2018 Sofia University 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | This project has received funding from the European Union’s Horizon 10 | 2020 research and innovation programme under grant agreement No 644187. 11 | You may obtain a copy of the License at 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Unless required by applicable law or agreed to in writing, software 16 | distributed under the License is distributed on an "AS IS" BASIS, 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | See the License for the specific language governing permissions and 19 | limitations under the License. -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/DisplayGSRSignal.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRBin/DisplayGSRSignal.exe -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/HMDevice.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRBin/HMDevice.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/RageAssetManager.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRBin/RageAssetManager.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/RealTimeArousalDetection.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRBin/RealTimeArousalDetection.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/RealTimeArousalDetectionUsingGSRAsset.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRBin/RealTimeArousalDetectionUsingGSRAsset.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/Resources/RealTimeArousalDetectionAssetSettings.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | C:/Users/XXX/log.txt 4 | C:/Users/logs/testData.txt 5 | 6 | 488 7 | 2000000 8 | 9 | 100 10 | 11 | 8 12 | 10 13 | 100 14 | N.A. 15 | 10116 16 | 127.0.0.1 17 | 18 | 0.05 19 | 0.05 20 | 21 | NoTestWithoutDevice 22 | NoBackgroundMode 23 | 24 | 25 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/SignalDevice.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRBin/SignalDevice.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRBin/Utils.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRBin/Utils.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Bridge.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using AssetPackage; 20 | using System; 21 | using System.IO; 22 | using Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils; 23 | 24 | 25 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.DisplayGSRSignal 26 | { 27 | public class Bridge : IBridge, ILog, IDataStorage 28 | { 29 | public string IDataStoragePath; 30 | protected readonly object lockObj = new object(); 31 | 32 | #region IDataStorage 33 | 34 | public Bridge() 35 | { 36 | IDataStoragePath = String.Format(@".{0}Resources{0}", Path.DirectorySeparatorChar); 37 | } 38 | 39 | public bool Delete(string fileId) 40 | { 41 | throw new NotImplementedException(); 42 | } 43 | 44 | public bool Exists(string fileId) 45 | { 46 | string filePath = IDataStoragePath + fileId; 47 | return (File.Exists(filePath)); 48 | } 49 | 50 | public string[] Files() 51 | { 52 | throw new NotImplementedException(); 53 | } 54 | 55 | public string GetPath(string fileId) 56 | { 57 | return IDataStoragePath + fileId; 58 | } 59 | 60 | public string Load(string fileId) 61 | { 62 | string filePath = IDataStoragePath + fileId; 63 | try 64 | { // Open the text file using a stream reader. 65 | using (StreamReader sr = new StreamReader(filePath)) 66 | { 67 | // Read the stream to a string, and write the string to the console. 68 | String line = sr.ReadToEnd(); 69 | return (line); 70 | } 71 | } 72 | catch (Exception e) 73 | { 74 | Log(Severity.Error, e.Message); 75 | } 76 | 77 | return (null); 78 | } 79 | 80 | public void Save(string fileId, string fileData) 81 | { 82 | string filePath = IDataStoragePath + fileId; 83 | using (StreamWriter file = new StreamWriter(filePath)) 84 | { 85 | file.Write(fileData); 86 | } 87 | } 88 | 89 | #endregion IDataStorage 90 | #region ILog 91 | 92 | public void Log(Severity severity, string logMessage) 93 | { 94 | String currentDate = DateTime.Now.ToString("yyyyMMdd"); 95 | String logFileName = RealTimeArousalDetectionAssetSettings.Instance.LogFile.Replace(".txt", currentDate + ".txt"); 96 | 97 | lock (lockObj) 98 | { 99 | if ((logFileName.LastIndexOf('/') != -1 && Directory.Exists(logFileName.Substring(0, logFileName.LastIndexOf('/')))) || 100 | (logFileName.LastIndexOf('\\') != -1 && Directory.Exists(logFileName.Substring(0, logFileName.LastIndexOf('\\'))))) 101 | { 102 | using (StreamWriter streamWriter = File.AppendText(logFileName)) 103 | { 104 | streamWriter.Write("\r\nLog Entry (type {0}) : ", severity.ToString()); 105 | streamWriter.Write("{0} {1}", DateTime.Now.ToLongTimeString(), 106 | DateTime.Now.ToLongDateString()); 107 | streamWriter.WriteLine(" :{0}", logMessage); 108 | streamWriter.WriteLine("-------------------------------"); 109 | streamWriter.Close(); 110 | } 111 | } 112 | } 113 | } 114 | 115 | 116 | #endregion ILog 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Program.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System; 20 | using System.Windows.Forms; 21 | 22 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.DisplayGSRSignal 23 | { 24 | static class Program 25 | { 26 | /// 27 | /// The main entry point for the application. 28 | /// 29 | [STAThread] 30 | static void Main() 31 | { 32 | Application.EnableVisualStyles(); 33 | Application.SetCompatibleTextRenderingDefault(false); 34 | Application.Run(new SignalsVisualization()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DisplayGSRSignal")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Sofia Univesity")] 12 | [assembly: AssemblyProduct("DisplayGSRSignal")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ab60f40d-f884-4387-b8c2-135df362cb59")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.0.0.0")] 36 | [assembly: AssemblyFileVersion("2.0.0.0")] 37 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DisplayGSRSignal.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DisplayGSRSignal.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap go_512 { 67 | get { 68 | object obj = ResourceManager.GetObject("go-512", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap mouseScrollUpDown_small_2 { 77 | get { 78 | object obj = ResourceManager.GetObject("mouseScrollUpDown_small_2", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\go-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Resources\mouseScrollUpDown_small_2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DisplayGSRSignal.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Resources/RealTimeArousalDetectionUsingGSRAsset.VersionAndDependencies.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | DisplayGSRSignal 4 | 1 5 | 2 6 | 3 7 | 8 | beta 9 | 10 | Logger 11 | RealTimeArousalDetection 12 | SignalDevice 13 | SocketServer 14 | 15 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Resources/go-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Resources/go-512.png -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Resources/mouseScrollUpDown_small_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/Resources/mouseScrollUpDown_small_2.png -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/SignalsVisualization.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 118, 17 125 | 126 | 127 | 231, 17 128 | 129 | 130 | 72 131 | 132 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/DisplayGSRSignal.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/DisplayGSRSignal.exe -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/DisplayGSRSignal.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 1 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/DisplayGSRSignal.vshost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/DisplayGSRSignal.vshost.exe -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/DisplayGSRSignal.vshost.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 1 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/Logger.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/Logger.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/RageAssetManager.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/RageAssetManager.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/RealTimeArousalDetection.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/RealTimeArousalDetection.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/SignalDevice.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/SignalDevice.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/SocketServer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/DisplayGSRSignal/bin/SocketServer.dll -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/HMDevice/HMDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #using 22 | //#using 23 | 24 | using namespace System; 25 | using namespace System::IO; 26 | using namespace System::ComponentModel; 27 | using namespace System::Collections; 28 | using namespace System::IO::Ports; 29 | using namespace AssetPackage; 30 | using namespace AssetManagerPackage; 31 | 32 | namespace HMDevice { 33 | 34 | public ref class HMDevice 35 | { 36 | private: System::IO::Ports::SerialPort^ _serialPort; 37 | private: static const int topDataCounter = 12000; 38 | private: static int GSvalue = 1; 39 | private: static int GSres = 1; 40 | private: static double GSsi = 1; 41 | private: static unsigned char counter = 0; 42 | private: static unsigned char byteReceived = 3; 43 | private: static bool dataRxEnable = false; 44 | private: int tempDevider; 45 | private: int sampleRate; 46 | private: CacheSignalData^ cacheData; 47 | private: ILog^ logger; 48 | 49 | public:HMDevice(void); 50 | protected:~HMDevice(); 51 | private: static void port_PinChanged(Object^ sender, SerialPinChangedEventArgs^ e); 52 | private: void DataReceivedHandler(Object^ sender, SerialDataReceivedEventArgs^ e); 53 | public: void StartSignalsTransfer(); 54 | public: void StopSignalsTransfer(); 55 | public: int GetSignalSampleRate(); 56 | public: void SelectCOMPort(String ^portName); 57 | public: void SelectCOMPortSampleRate(String ^portName, int sampleRate); 58 | public: void SetSignalSamplerate(int sampleRate); 59 | public: bool IsPortOpen(); 60 | public: void OpenPort(); 61 | public: void OpenPort(int sampleRate); 62 | }; 63 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/HMDevice/HMDevice.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/AssetManager.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/RageAssetManager/AssetManager.cs -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/BaseLog.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | namespace AssetPackage 4 | { 5 | using AssetManagerPackage; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Configuration; 9 | using System.IO; 10 | 11 | /// 12 | /// The logger class 13 | /// 14 | public class BaseLog : ILog, IAsset 15 | { 16 | /// 17 | /// Default constructor. 18 | /// 19 | public BaseLog() 20 | { 21 | this.Id = AssetManager.Instance.registerAssetInstance(this, this.Class); 22 | } 23 | 24 | public BaseLog(IBridge bridge) : this() 25 | { 26 | this.Bridge = bridge; 27 | } 28 | 29 | #region Properties 30 | 31 | /// 32 | /// Gets or sets the bridge. 33 | /// 34 | /// 35 | /// 36 | /// The bridge. 37 | /// 38 | public IBridge Bridge 39 | { 40 | get; 41 | set; 42 | } 43 | 44 | /// 45 | /// Gets the class. 46 | /// 47 | /// 48 | /// 49 | /// The class. 50 | /// 51 | public String Class 52 | { 53 | get 54 | { 55 | return this.GetType().Name; 56 | } 57 | } 58 | 59 | /// 60 | /// Gets the dependencies. 61 | /// 62 | /// 63 | /// 64 | /// The dependencies. 65 | /// 66 | public Dictionary Dependencies 67 | { 68 | get 69 | { 70 | Dictionary result = new Dictionary(); 71 | 72 | foreach (Depends dep in VersionInfo.Dependencies) 73 | { 74 | String minv = dep.minVersion != null ? dep.minVersion : "0.0"; 75 | String maxv = dep.maxVersion != null ? dep.maxVersion : "*"; 76 | 77 | result.Add(dep.name, String.Format("{0}-{1}", minv, maxv)); 78 | } 79 | 80 | return result; 81 | } 82 | } 83 | 84 | /// 85 | /// Gets a value indicating whether this object has settings. 86 | /// 87 | /// 88 | /// 89 | /// true if this object has settings, false if not. 90 | /// 91 | public Boolean hasSettings 92 | { 93 | get 94 | { 95 | return Settings != null; 96 | } 97 | } 98 | 99 | /// 100 | /// Gets the identifier. 101 | /// 102 | /// 103 | /// 104 | /// The identifier. 105 | /// 106 | public String Id 107 | { 108 | get; 109 | private set; 110 | } 111 | 112 | /// 113 | /// Gets the maturity. 114 | /// 115 | /// 116 | /// 117 | /// The maturity. 118 | /// 119 | public String Maturity 120 | { 121 | get 122 | { 123 | return VersionInfo.Maturity; 124 | } 125 | } 126 | 127 | /// 128 | /// Gets or sets options for controlling the operation. 129 | /// 130 | /// 131 | /// 132 | /// The settings. 133 | /// 134 | public virtual ISettings Settings 135 | { 136 | get; 137 | set; 138 | } 139 | 140 | /// 141 | /// Gets the version. 142 | /// 143 | /// 144 | /// 145 | /// The version. 146 | /// 147 | public String Version 148 | { 149 | get 150 | { 151 | return String.Format("{0}.{1}.{2}.{3}", 152 | VersionInfo.Major, 153 | VersionInfo.Minor, 154 | VersionInfo.Build, 155 | VersionInfo.Revision == 0 ? "" : VersionInfo.Revision.ToString() 156 | ).TrimEnd('.'); 157 | } 158 | } 159 | 160 | /// 161 | /// Gets information describing the version. 162 | /// 163 | /// 164 | /// 165 | /// Information describing the version. 166 | /// 167 | public RageVersionInfo VersionInfo 168 | { 169 | get; 170 | private set; 171 | } 172 | #endregion Properties 173 | 174 | /// 175 | /// Executes the log operation. 176 | /// 177 | /// 178 | /// The message. 179 | public void Log(string msg) 180 | { 181 | String currentDate = DateTime.Now.ToString("yyyyMMdd"); 182 | String logFileName = ConfigurationManager.AppSettings.Get("LogFile").Replace(".txt", currentDate + ".txt"); 183 | using (StreamWriter w = File.AppendText(logFileName)) 184 | { 185 | w.Write("\r\nLog Entry : "); 186 | w.Write("{0} {1}", DateTime.Now.ToLongTimeString(), 187 | DateTime.Now.ToLongDateString()); 188 | w.WriteLine(" :{0}", msg); 189 | w.WriteLine("-------------------------------"); 190 | } 191 | } 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/BaseSettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | using System; 21 | using System.ComponentModel; 22 | using System.Reflection; 23 | 24 | /// 25 | /// A base settings. 26 | /// 27 | public class BaseSettings : ISettings 28 | { 29 | #region Constructors 30 | 31 | /// 32 | /// Initializes a new instance of the Swiss.BaseSettings class. 33 | /// 34 | public BaseSettings() 35 | { 36 | //! Initialize Settings to their specified default values. 37 | UpdateDefaultValues(); 38 | } 39 | 40 | #endregion Constructors 41 | 42 | #region Methods 43 | 44 | /// 45 | /// Set the value of (Public Instance) properties to the 's 46 | /// Value of that property. 47 | /// 48 | private void UpdateDefaultValues() 49 | { 50 | BaseSettings.UpdateDefaultValues(this); 51 | } 52 | 53 | /// 54 | /// Set the value of (Public Instance) properties to the 55 | /// 's Value of that property. 56 | /// 57 | /// 58 | /// The object. 59 | public static void UpdateDefaultValues(Object obj) 60 | { 61 | // GetProperties not PCL 62 | // BindingFlags not PCL 63 | // foreach (PropertyInfo pi in obj.GetType().GetRuntimeProperties(/*BindingFlags.Instance | BindingFlags.Public*/)) 64 | #if PORTABLE 65 | foreach (PropertyInfo pi in obj.GetType().GetRuntimeProperties()) 66 | #else 67 | foreach (PropertyInfo pi in obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)) 68 | #endif 69 | 70 | { 71 | Boolean found = false; 72 | 73 | if (pi.CanWrite) 74 | { 75 | foreach (Object att in pi.GetCustomAttributes(typeof(DefaultValueAttribute), false)) 76 | { 77 | if (att is DefaultValueAttribute) 78 | { 79 | // Pretty Print Assigned Values. 80 | // 81 | Object val = ((DefaultValueAttribute)att).Value; 82 | 83 | if (val == null) 84 | { 85 | val = "null"; 86 | } 87 | else if (val is String && String.IsNullOrEmpty(val.ToString())) 88 | { 89 | val = "\"\""; 90 | } 91 | else 92 | { 93 | val = String.Format("{0}", val); 94 | } 95 | 96 | found = true; 97 | 98 | if (pi.CanWrite) 99 | { 100 | pi.SetValue(obj, ((DefaultValueAttribute)att).Value, new object[] { }); 101 | 102 | // Debug.WriteLine(String.Format("Updated {0}.{1} to {2}", obj.GetType().Name, pi.Name, val)); 103 | } 104 | else 105 | { 106 | // Debug.WriteLine(String.Format("Error Updating Default Value of {0}.{1}", obj.GetType().Name, pi.Name)); 107 | } 108 | 109 | break; 110 | } 111 | } 112 | 113 | if (found) 114 | { 115 | continue; 116 | } 117 | 118 | // Debug.WriteLine(String.Format("No Default Value for {0}.{1}", obj.GetType().Name, pi.Name)); 119 | } 120 | } 121 | } 122 | 123 | #endregion Methods 124 | } 125 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/IAsset.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | using System; 21 | using System.Collections.Generic; 22 | 23 | /// 24 | /// Interface for asset. 25 | /// 26 | public interface IAsset 27 | { 28 | #region Properties 29 | 30 | /// 31 | /// Gets the class. 32 | /// 33 | /// 34 | /// 35 | /// The class. 36 | /// 37 | String Class 38 | { 39 | get; 40 | } 41 | 42 | /// 43 | /// Gets the dependencies. 44 | /// 45 | /// 46 | /// 47 | /// The dependencies (A Dictionary of class=version pairs). 48 | /// 49 | Dictionary Dependencies 50 | { 51 | get; 52 | } 53 | 54 | /// 55 | /// Gets the identifier. 56 | /// 57 | /// 58 | /// 59 | /// The identifier. 60 | /// 61 | String Id 62 | { 63 | get; 64 | } 65 | 66 | /// 67 | /// Gets the maturity. 68 | /// 69 | /// 70 | /// 71 | /// The maturity. 72 | /// 73 | String Maturity 74 | { 75 | get; 76 | } 77 | 78 | /// 79 | /// Gets or sets options for controlling the operation. 80 | /// 81 | /// 82 | /// 83 | /// The settings. 84 | /// 85 | ISettings Settings 86 | { 87 | get; 88 | set; 89 | } 90 | 91 | /// 92 | /// Gets the version. 93 | /// 94 | /// 95 | /// 96 | /// The version. 97 | /// 98 | String Version 99 | { 100 | get; 101 | } 102 | 103 | /// 104 | /// Gets or sets the bridge. 105 | /// 106 | /// 107 | /// 108 | /// The bridge. 109 | /// 110 | IBridge Bridge 111 | { 112 | get; 113 | set; 114 | } 115 | 116 | #endregion Properties 117 | } 118 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/IBridge.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | /// 21 | /// Interface for bridge. 22 | /// 23 | public interface IBridge 24 | { 25 | #region Other 26 | 27 | // 28 | 29 | #endregion Other 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/IDataStorage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | using System; 21 | 22 | /// 23 | /// Interface for data storage. 24 | /// 25 | public interface IDataStorage 26 | { 27 | #region Methods 28 | 29 | /// 30 | /// Deletes the given fileId. 31 | /// 32 | /// 33 | /// The file identifier to delete. 34 | /// 35 | /// 36 | /// true if it succeeds, false if it fails. 37 | /// 38 | Boolean Delete(String fileId); 39 | 40 | /// 41 | /// Check if exists the file with the given identifier. 42 | /// 43 | /// 44 | /// The file identifier to delete. 45 | /// 46 | /// 47 | /// true if it succeeds, false if it fails. 48 | /// 49 | Boolean Exists(String fileId); 50 | 51 | /// 52 | /// Gets the files. 53 | /// 54 | /// 55 | /// 56 | /// A List<String> gave problems when compiled as PCL and added to a 57 | /// Xamarin Forms project containing iOS, Android and WinPhone subprojects. 58 | /// 59 | /// 60 | /// 61 | /// An array of filenames. 62 | /// 63 | String[] Files(); 64 | 65 | /// 66 | /// Loads the given file. 67 | /// 68 | /// 69 | /// The file identifier to load. 70 | /// 71 | /// 72 | /// A String with with the file contents. 73 | /// 74 | String Load(String fileId); 75 | 76 | /// 77 | /// Saves the given file. 78 | /// 79 | /// 80 | /// The file identifier to delete. 81 | /// Information describing the file. 82 | void Save(String fileId, String fileData); 83 | 84 | #endregion Methods 85 | } 86 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/IDefaultSettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | using System; 21 | 22 | /// 23 | /// Interface for default settings.

This Interface is used to: 24 | /// 25 | /// Check if an asset has default 26 | /// (application) settings that override build-in default settings. 27 | /// Load these settings from the game environment. 28 | /// In certain environments write the actual settings as application defaults. This could 29 | /// for instance be Unity in editor mode. 30 | /// 31 | ///
32 | /// 33 | /// 34 | /// Default settings and application default settings are read-only at run- 35 | /// time.If modification and storage is needed at run-time, 36 | /// theinterface could be used 37 | /// i.c.m.Methods. 38 | /// This interface, if implemented in a bridge, allows to check if an 39 | /// has some default settings 40 | /// 41 | public interface IDefaultSettings 42 | { 43 | #region Methods 44 | 45 | /// 46 | /// Query if a 'Class' with Id has default settings. 47 | /// 48 | /// 49 | /// The class. 50 | /// The identifier. 51 | /// 52 | /// 53 | /// true if default settings, false if not. 54 | /// 55 | Boolean HasDefaultSettings(String Class, String Id); 56 | 57 | /// 58 | /// Loads default settings for a 'Class' with Id. 59 | /// 60 | /// 61 | /// 62 | /// Note that in Unity the file has to be located in the Resource Directory of the Assets Folder. 63 | /// 64 | /// 65 | /// The class. 66 | /// The identifier. 67 | /// 68 | /// 69 | /// The default settings. 70 | /// 71 | String LoadDefaultSettings(String Class, String Id); 72 | 73 | /// 74 | /// Saves a default settings for a 'Class' with Id. 75 | /// 76 | /// 77 | /// 78 | /// This method can only be used during editing the game (so NOT at run-time). 79 | /// 80 | /// 81 | /// The class. 82 | /// The identifier. 83 | /// The File Data. 84 | void SaveDefaultSettings(String Class, String Id, String fileData); 85 | 86 | #endregion Methods 87 | } 88 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/ILog.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/RageAssetManager/ILog.cs -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/ISettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | using System; 21 | 22 | /// 23 | /// Interface for settings. 24 | /// 25 | public interface ISettings 26 | { 27 | #region Other 28 | 29 | // 30 | 31 | #endregion Other 32 | } 33 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/IWebServiceRequest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | using System; 21 | using System.Collections.Generic; 22 | 23 | /// 24 | /// Request Settings. 25 | /// 26 | public class RequestSetttings 27 | { 28 | /// 29 | /// The method. 30 | /// 31 | public string method; 32 | 33 | /// 34 | /// URI of the document. 35 | /// 36 | public Uri uri; 37 | 38 | /// 39 | /// The request headers. 40 | /// 41 | public Dictionary requestHeaders; 42 | 43 | /// 44 | /// The body. 45 | /// 46 | public String body; 47 | 48 | /// 49 | /// The allowed responses. 50 | /// 51 | public List allowedResponsCodes; 52 | 53 | /// 54 | /// Initializes a new instance of the AssetPackage.requestParameters 55 | /// class. 56 | /// 57 | public RequestSetttings() 58 | { 59 | method = "GET"; 60 | requestHeaders = new Dictionary(); 61 | body = String.Empty; 62 | allowedResponsCodes = new List(); 63 | allowedResponsCodes.Add(200); 64 | } 65 | } 66 | 67 | /// 68 | /// Response results. 69 | /// 70 | public class RequestResponse : RequestSetttings 71 | { 72 | /// 73 | /// The response code. 74 | /// 75 | public int responseCode; 76 | 77 | /// 78 | /// Message describing the respons. 79 | /// 80 | public string responsMessage; 81 | 82 | /// 83 | /// The response headers. 84 | /// 85 | public Dictionary responseHeaders; 86 | 87 | /// 88 | /// Initializes a new instance of the AssetPackage.RequestResponse class. 89 | /// 90 | public RequestResponse() : base() 91 | { 92 | responseCode = 0; 93 | responsMessage = String.Empty; 94 | 95 | responseHeaders = new Dictionary(); 96 | } 97 | 98 | /// 99 | /// Initializes a new instance of the AssetPackage.RequestResponse class. 100 | /// 101 | /// 102 | /// 103 | /// The body is not copied as it will contain thee response body instead. 104 | /// 105 | /// 106 | /// Options for controlling the operation. 107 | public RequestResponse(RequestSetttings settings) : this() 108 | { 109 | method = settings.method; 110 | requestHeaders = settings.requestHeaders; 111 | uri = settings.uri; 112 | body = String.Empty; 113 | 114 | allowedResponsCodes = settings.allowedResponsCodes; 115 | } 116 | 117 | /// 118 | /// Gets a value indicating whether result is allowed. 119 | /// 120 | /// 121 | /// 122 | /// true if result allowed, false if not. 123 | /// 124 | public bool ResultAllowed 125 | { 126 | get 127 | { 128 | return allowedResponsCodes.Contains(responseCode); 129 | } 130 | } 131 | } 132 | 133 | /// 134 | /// Interface for web service request. 135 | /// 136 | /// 137 | /// 138 | /// Implemented on a Bridge. 139 | /// 140 | public interface IWebServiceRequest 141 | { 142 | /// 143 | /// Web service request. 144 | /// 145 | /// 146 | /// 147 | /// A RequestResponse. 148 | /// 149 | /// 150 | /// Options for controlling the operation. 151 | /// The request response. 152 | void WebServiceRequest(RequestSetttings requestSettings, out RequestResponse requestResponse); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/IWebServiceRequestAsync.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetPackage 19 | { 20 | using System; 21 | using System.Collections.Generic; 22 | 23 | /// 24 | /// Interface for web service response. 25 | /// 26 | /// 27 | /// 28 | /// Implemented by assets requesting result notification of a 29 | /// IWebServiceRequest. 30 | /// 31 | public interface IWebServiceResponseAsync 32 | { 33 | /// 34 | /// Called when a WebRequest results in an Error. 35 | /// 36 | /// 37 | /// URL of the document. 38 | /// The error message. 39 | void Error(string url, string msg); 40 | 41 | /// 42 | /// Called after a Successfull WebRequest (no Exceptions). 43 | /// 44 | /// 45 | /// URL of the document. 46 | /// The code. 47 | /// The headers. 48 | /// The body. 49 | void Success(string url, int code, Dictionary headers, string body); 50 | } 51 | 52 | /// 53 | /// Interface for web service request. 54 | /// 55 | /// 56 | /// 57 | /// Implemented on a Bridge. 58 | /// Will be replaced by the code from IWebServiceRequest2 once tested. 59 | /// 60 | public interface IWebServiceRequestAsync 61 | { 62 | 63 | #warning Add Tag or Data parameter to this call so we can identify it in IWebServiceResponse? 64 | 65 | /// 66 | /// Web service request. 67 | /// 68 | /// 69 | /// The method. 70 | /// URI of the document. 71 | /// The headers. 72 | /// The body. 73 | /// The response. 74 | void WebServiceRequestAsync( 75 | string method, 76 | Uri uri, 77 | Dictionary headers, 78 | string body, 79 | IWebServiceResponseAsync response 80 | ); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/Messages.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open University of the Netherlands 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union’s Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | namespace AssetManagerPackage 19 | { 20 | using System; 21 | using System.Collections.Generic; 22 | using System.Linq; 23 | 24 | /// 25 | /// A Broadcast Messages class. 26 | /// 27 | public static class Messages 28 | { 29 | #region Fields 30 | 31 | /// 32 | /// The subscription ID generator. 33 | /// 34 | private static Int32 idGenerator = 0; 35 | 36 | /// 37 | /// The messages is a dictionary of messages and their subscribers. 38 | /// 39 | private static Dictionary> messages = new Dictionary>(); 40 | 41 | #endregion Fields 42 | 43 | #region Delegates 44 | 45 | /// 46 | /// Interface for broadcast message callback. 47 | /// 48 | /// 49 | /// The message id. 50 | /// A variable-length parameters list containing arguments. 51 | public delegate void MessagesEventCallback(String message, params object[] parameters); 52 | 53 | #endregion Delegates 54 | 55 | #region Methods 56 | 57 | /// 58 | /// Define a broadcast message. 59 | /// 60 | /// 61 | /// The message. 62 | /// 63 | /// 64 | /// true if it succeeds, false if it fails. 65 | /// 66 | public static Boolean define(String message) 67 | { 68 | if (!messages.Keys.Contains(message)) 69 | { 70 | messages.Add(message, new Dictionary()); 71 | 72 | return true; 73 | } 74 | 75 | return false; 76 | } 77 | 78 | /// 79 | /// Broadcast a message. 80 | /// 81 | /// 82 | /// The message to broadcast. 83 | /// A variable-length parameters list containing 84 | /// arguments. 85 | /// 86 | /// 87 | /// true if it succeeds, false if it fails. 88 | /// 89 | public static Boolean broadcast(String message, params object[] parameters) 90 | { 91 | if (!messages.Keys.Contains(message)) 92 | { 93 | return false; 94 | } 95 | 96 | foreach (KeyValuePair func in messages[message]) 97 | { 98 | func.Value(message, parameters); 99 | } 100 | 101 | return true; 102 | } 103 | 104 | /// 105 | /// Subscribe to a broadcast message. 106 | /// 107 | /// 108 | /// 109 | /// if the message does not exist yet it's created on-the-fly. 110 | /// 111 | /// 112 | /// The message. 113 | /// The callback function. 114 | /// 115 | /// 116 | /// The broadcast subscription id. 117 | /// 118 | public static String subscribe(String message, MessagesEventCallback callback) 119 | { 120 | if (!messages.Keys.Contains(message)) 121 | { 122 | messages.Add(message, new Dictionary()); 123 | } 124 | 125 | String subscriptionId = (++idGenerator).ToString(); 126 | 127 | messages[message].Add(subscriptionId, callback); 128 | 129 | return subscriptionId; 130 | } 131 | 132 | /// 133 | /// Unsubscribes the given broadcast subscription id. 134 | /// 135 | /// 136 | /// The broadcast subscription id. 137 | /// 138 | /// 139 | /// true if it succeeds, false if it fails. 140 | /// 141 | public static Boolean unsubscribe(String subscriptionId) 142 | { 143 | foreach (String message in messages.Keys) 144 | { 145 | Dictionary subscribers = messages[message]; 146 | 147 | foreach (String subscriber in subscribers.Keys) 148 | { 149 | if (subscriptionId.Equals(subscriber)) 150 | { 151 | subscribers.Remove(subscriber); 152 | 153 | return true; 154 | } 155 | } 156 | } 157 | 158 | return false; 159 | } 160 | 161 | #endregion Methods 162 | } 163 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RageAssetManager")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Open University of the Netherlands")] 12 | [assembly: AssemblyProduct("RageAssetManager")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/RageAssetManager.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {DA8E9056-2E52-4029-81EB-A2D167614C47} 8 | Library 9 | Properties 10 | AssetManagerPackage 11 | RageAssetManager 12 | v3.5 13 | 512 14 | 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | TRACE;DEBUG 23 | prompt 24 | 4 25 | bin\Debug\RageAssetManager.XML 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Designer 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | "c:\Program Files (x86)\Mono\bin\pdb2mdb.bat" "$(TargetPath)" 70 | 71 | 78 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/RageAssetManager.csproj.csdat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/RageAssetManager/RageAssetManager.csproj.csdat -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/Resources/BaseAsset.VersionAndDependencies.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | baseasset 4 | 1 5 | 2 6 | 3 7 | rev 8 | alpha 9 | 10 | 11 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/VersionAndDependencies.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RageAssetManager/pubSubz.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2015 RAGE. All rights reserved. 3 | // 4 | // Veg 5 | // 10-4-2015 6 | // Implements the pub subz class 7 | namespace AssetManagerPackage 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | 13 | /// 14 | /// A pubsubz. 15 | /// 16 | public static class pubsubz 17 | { 18 | #region Fields 19 | 20 | /// 21 | /// The sub UID. 22 | /// 23 | private static Int32 subUid = 0; 24 | 25 | /// 26 | /// The topics. 27 | /// 28 | private static Dictionary> topics = new Dictionary>(); 29 | 30 | #endregion Fields 31 | 32 | #region Delegates 33 | 34 | /// 35 | /// Topic event. 36 | /// 37 | /// 38 | /// The topic. 39 | /// A variable-length parameters list containing arguments. 40 | public delegate void TopicEvent(String topic, params object[] args); 41 | 42 | #endregion Delegates 43 | 44 | #region Methods 45 | 46 | /// 47 | /// Defines. 48 | /// 49 | /// 50 | /// The topic. 51 | /// 52 | /// 53 | /// true if it succeeds, false if it fails. 54 | /// 55 | public static Boolean define(String topic) 56 | { 57 | if (!topics.Keys.Contains(topic)) 58 | { 59 | topics.Add(topic, new Dictionary()); 60 | 61 | return true; 62 | } 63 | 64 | return false; 65 | } 66 | 67 | /// 68 | /// Publishes. 69 | /// 70 | /// 71 | /// The topic. 72 | /// A variable-length parameters list containing arguments. 73 | /// 74 | /// 75 | /// true if it succeeds, false if it fails. 76 | /// 77 | public static Boolean publish(String topic, params object[] args) 78 | { 79 | if (!topics.Keys.Contains(topic)) 80 | { 81 | return false; 82 | } 83 | 84 | foreach (KeyValuePair func in topics[topic]) 85 | { 86 | func.Value(topic, args); 87 | } 88 | 89 | return true; 90 | } 91 | 92 | /// 93 | /// Subscribes. 94 | /// 95 | /// 96 | /// The topic. 97 | /// The function. 98 | /// 99 | /// 100 | /// A String. 101 | /// 102 | public static String subscribe(String topic, TopicEvent func) 103 | { 104 | if (!topics.Keys.Contains(topic)) 105 | { 106 | topics.Add(topic, new Dictionary()); 107 | } 108 | 109 | String token = (++subUid).ToString(); 110 | 111 | topics[topic].Add(token, func); 112 | 113 | return token; 114 | } 115 | 116 | /// 117 | /// Unsubscribes. 118 | /// 119 | /// 120 | /// The token. 121 | /// 122 | /// 123 | /// true if it succeeds, false if it fails. 124 | /// 125 | public static Boolean unsubscribe(String token) 126 | { 127 | foreach (String topic in topics.Keys) 128 | { 129 | Dictionary subscribers = topics[topic]; 130 | 131 | foreach (String subscriber in subscribers.Keys) 132 | { 133 | if (token.Equals(subscriber)) 134 | { 135 | subscribers.Remove(subscriber); 136 | 137 | return true; 138 | } 139 | } 140 | } 141 | 142 | return false; 143 | } 144 | 145 | #endregion Methods 146 | } 147 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/ArousalFeature.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System; 20 | using System.Text; 21 | 22 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 23 | { 24 | public class ArousalFeature 25 | { 26 | private double minimum; 27 | private double maximum; 28 | private Decimal mean; 29 | private Decimal stdDeviation; 30 | private String name; 31 | private double count; 32 | 33 | public ArousalFeature() 34 | { 35 | //super(); 36 | } 37 | 38 | public ArousalFeature(String name) 39 | { 40 | this.name = name; 41 | } 42 | 43 | public double Minimum 44 | { 45 | get 46 | { 47 | return minimum; 48 | } 49 | set 50 | { 51 | minimum = value; 52 | } 53 | } 54 | 55 | public double Maximum 56 | { 57 | get 58 | { 59 | return maximum; 60 | } 61 | set 62 | { 63 | maximum = value; 64 | } 65 | } 66 | 67 | public Decimal Mean 68 | { 69 | get 70 | { 71 | return mean; 72 | } 73 | set 74 | { 75 | mean = value; 76 | } 77 | } 78 | 79 | public Decimal StdDeviation 80 | { 81 | get 82 | { 83 | return stdDeviation; 84 | } 85 | set 86 | { 87 | stdDeviation = value; 88 | } 89 | } 90 | 91 | public double Count 92 | { 93 | get 94 | { 95 | return count; 96 | } 97 | set 98 | { 99 | count = value; 100 | } 101 | } 102 | 103 | public String Name 104 | { 105 | get 106 | { 107 | return name; 108 | } 109 | set 110 | { 111 | name = value; 112 | } 113 | } 114 | 115 | 116 | public override string ToString() 117 | { 118 | StringBuilder str = new StringBuilder(); 119 | str.Append("Statistics for " + name + ": \n"); 120 | str.Append("Minimum value: " + minimum + "\n"); 121 | str.Append("Maximum value: " + maximum + "\n"); 122 | str.Append("Mean value: " + mean + "\n"); 123 | str.Append("Standard deviation: " + stdDeviation + "\n"); 124 | str.Append("Count: " + count + "\n"); 125 | 126 | return str.ToString(); 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/ArousalStatistics.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System; 20 | using System.Text; 21 | 22 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 23 | { 24 | public class ArousalStatistics 25 | { 26 | private double scrArousalArea; 27 | private double scrAchievedArousalLevel; 28 | private double sclAchievedArousalLevel; 29 | private double generalArousalLevel; 30 | private ArousalFeature scrAmplitude; 31 | private ArousalFeature scrRise; 32 | private ArousalFeature scrRecoveryTime; 33 | private TonicStatistics tonicStatistics; 34 | private double movingAverage; 35 | private double lastValue; 36 | private double lastRawSignalValue; 37 | private double lastMedianFilterlValue; 38 | private double highPassSignalValue; 39 | private double lowPassSignalValue; 40 | 41 | public ArousalStatistics() 42 | { 43 | //super(); 44 | } 45 | 46 | public double SCRArousalArea 47 | { 48 | get 49 | { 50 | return scrArousalArea; 51 | } 52 | set 53 | { 54 | scrArousalArea = value; 55 | } 56 | } 57 | 58 | public ArousalFeature SCRAmplitude 59 | { 60 | get 61 | { 62 | return scrAmplitude; 63 | } 64 | set 65 | { 66 | scrAmplitude = value; 67 | } 68 | } 69 | 70 | public ArousalFeature SCRRise 71 | { 72 | get 73 | { 74 | return scrRise; 75 | } 76 | set 77 | { 78 | scrRise = value; 79 | } 80 | } 81 | 82 | public ArousalFeature SCRRecoveryTime 83 | { 84 | get 85 | { 86 | return scrRecoveryTime; 87 | } 88 | set 89 | { 90 | scrRecoveryTime = value; 91 | } 92 | } 93 | 94 | public double SCRAchievedArousalLevel 95 | { 96 | get 97 | { 98 | return scrAchievedArousalLevel; 99 | } 100 | set 101 | { 102 | scrAchievedArousalLevel = value; 103 | } 104 | } 105 | 106 | public double GeneralArousalLevel 107 | { 108 | get 109 | { 110 | return generalArousalLevel; 111 | } 112 | set 113 | { 114 | generalArousalLevel = value; 115 | } 116 | } 117 | 118 | public TonicStatistics TonicStatistics 119 | { 120 | get 121 | { 122 | return tonicStatistics; 123 | } 124 | 125 | set 126 | { 127 | tonicStatistics = value; 128 | } 129 | } 130 | 131 | public double SCLAchievedArousalLevel 132 | { 133 | get 134 | { 135 | return sclAchievedArousalLevel; 136 | } 137 | 138 | set 139 | { 140 | sclAchievedArousalLevel = value; 141 | } 142 | } 143 | 144 | public double MovingAverage 145 | { 146 | get 147 | { 148 | return movingAverage; 149 | } 150 | 151 | set 152 | { 153 | movingAverage = value; 154 | } 155 | } 156 | 157 | public double LastValue 158 | { 159 | get 160 | { 161 | return lastValue; 162 | } 163 | 164 | set 165 | { 166 | lastValue = value; 167 | } 168 | } 169 | 170 | public double LastMedianFilterValue 171 | { 172 | get 173 | { 174 | return lastMedianFilterlValue; 175 | } 176 | 177 | set 178 | { 179 | lastMedianFilterlValue = value; 180 | } 181 | } 182 | 183 | public double LastRawSignalValue 184 | { 185 | get 186 | { 187 | return lastRawSignalValue; 188 | } 189 | 190 | set 191 | { 192 | lastRawSignalValue = value; 193 | } 194 | } 195 | 196 | public double HighPassSignalValue 197 | { 198 | get 199 | { 200 | return highPassSignalValue; 201 | } 202 | 203 | set 204 | { 205 | highPassSignalValue = value; 206 | } 207 | } 208 | 209 | public double LowPassSignalValue 210 | { 211 | get 212 | { 213 | return lowPassSignalValue; 214 | } 215 | 216 | set 217 | { 218 | lowPassSignalValue = value; 219 | } 220 | } 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/ExtremaType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 20 | { 21 | public enum ExtremaType 22 | { 23 | Minimum, 24 | Maximum, 25 | None 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/FilterMedian.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System.Collections.Generic; 20 | using System.Linq; 21 | 22 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 23 | { 24 | class FilterMedian 25 | { 26 | private SignalDataByTime[] signalCoordinates; 27 | 28 | public FilterMedian() 29 | { 30 | //super(); 31 | } 32 | 33 | public FilterMedian(SignalDataByTime[] signalCoordinates) 34 | { 35 | this.signalCoordinates = signalCoordinates; 36 | } 37 | 38 | public SignalDataByTime[] GetMedianFilterPoints() 39 | { 40 | if (this.signalCoordinates == null) return null; 41 | 42 | SignalDataByTime[] signalCoordinatesExtented = extendSignalCoordinates(signalCoordinates); 43 | 44 | SignalDataByTime[] result = new SignalDataByTime[signalCoordinates.Length]; 45 | for (int i = 2; i < signalCoordinatesExtented.Length - 2; ++i) 46 | { 47 | double[] window = new double[5]; 48 | //store each 5 consecutive elements 49 | for (int j = 0; j < 5; ++j) 50 | { 51 | window[j] = signalCoordinatesExtented.ElementAt(i - 2 + j).SignalValue; 52 | } 53 | 54 | //sort elements of the array window 55 | for (int j = 0; j < 3; ++j) 56 | { 57 | // Find position of minimum element 58 | int min = j; 59 | for (int k = j + 1; k < 5; ++k) 60 | if (window[k] < window[min]) 61 | min = k; 62 | // Put found minimum element in its place 63 | double temp = window[j]; 64 | window[j] = window[min]; 65 | window[min] = temp; 66 | } 67 | 68 | // Get result - the middle element 69 | result[i - 2] = new SignalDataByTime(signalCoordinatesExtented.ElementAt(i-2).Time, window[2], signalCoordinatesExtented.ElementAt(i - 2).HighPassValue, signalCoordinatesExtented.ElementAt(i - 2).LowPassValue); 70 | } 71 | 72 | signalCoordinatesExtented = null; 73 | 74 | return result; 75 | } 76 | 77 | private SignalDataByTime[] extendSignalCoordinates(SignalDataByTime[] signalCoordinates) 78 | { 79 | if (signalCoordinates == null || signalCoordinates.Length == 0 || signalCoordinates.Length < 2) return signalCoordinates; 80 | 81 | SignalDataByTime[] result = new SignalDataByTime[signalCoordinates.Length + 4]; 82 | result[0] = new SignalDataByTime(signalCoordinates.ElementAt(1).Time - 20.0, signalCoordinates.ElementAt(1).SignalValue); 83 | result[1] = new SignalDataByTime(signalCoordinates.ElementAt(0).Time - 10.0, signalCoordinates.ElementAt(0).SignalValue); 84 | for(int i = 0; i < signalCoordinates.Length; i++) 85 | { 86 | result[i + 2] = signalCoordinates.ElementAt(i); 87 | } 88 | result[signalCoordinates.Length + 2] = new SignalDataByTime(signalCoordinates.ElementAt(signalCoordinates.Length - 1).Time+ 10.0, signalCoordinates.ElementAt(signalCoordinates.Length - 1).SignalValue); 89 | result[signalCoordinates.Length + 3] = new SignalDataByTime(signalCoordinates.ElementAt(signalCoordinates.Length - 2).Time+ 20.0, signalCoordinates.ElementAt(signalCoordinates.Length - 2).SignalValue); 90 | 91 | return result; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/InflectionLineDirection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 20 | { 21 | public enum InflectionLineDirection 22 | { 23 | //arousal decrease 24 | Positive, 25 | //arousal increase 26 | Negative, 27 | //arousal the same 28 | Neutral 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/InflectionPoint.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 21 | { 22 | public class InflectionPoint 23 | { 24 | private double x; 25 | private double y; 26 | private int index; 27 | private ExtremaType extremumType; 28 | 29 | public InflectionPoint(double x1, double y1, int indexOrigin) 30 | { 31 | this.x = x1; 32 | this.y = y1; 33 | this.index = indexOrigin; 34 | } 35 | 36 | public InflectionPoint(SignalDataByTime signalValue, int indexOrigin, ExtremaType extremum) 37 | { 38 | this.x = signalValue.Time; 39 | this.y = signalValue.SignalValue; 40 | this.index = indexOrigin; 41 | this.extremumType = extremum; 42 | } 43 | 44 | 45 | public ExtremaType ExtremaType 46 | { 47 | get 48 | { 49 | return extremumType; 50 | } 51 | set 52 | { 53 | extremumType= value; 54 | } 55 | } 56 | 57 | public int IndexOrigin 58 | { 59 | get 60 | { 61 | return index; 62 | } 63 | set 64 | { 65 | x = value; 66 | } 67 | } 68 | 69 | public double CoordinateX 70 | { 71 | get 72 | { 73 | return x; 74 | } 75 | set 76 | { 77 | x = value; 78 | } 79 | } 80 | 81 | public double CoordinateY 82 | { 83 | get 84 | { 85 | return y; 86 | } 87 | set 88 | { 89 | y = value; 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RealTimeArousalDetection")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Sofia University")] 12 | [assembly: AssemblyProduct("RealTimeArousalDetection")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | //[assembly: Guid("2276781f-bee6-4ffa-9ecc-ec6f00880eca")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 700 7 | 8 | 9 | 700 10 | 11 | 12 | 5000 13 | 14 | 15 | 5000 16 | 17 | 18 | -0.05 19 | 20 | 21 | -0.05 22 | 23 | 24 | 3.12 25 | 26 | 27 | 3.12 28 | 29 | 30 | 1 31 | 32 | 33 | C:/Users/ddessy/log.txt 34 | 35 | 36 | -1 37 | 38 | 39 | -1 40 | 41 | 42 | -100 43 | 44 | 45 | -1 46 | 47 | 48 | -1 49 | 50 | 51 | 100 52 | 53 | 54 | -100 55 | 56 | 57 | 8 58 | 59 | 60 | 100 61 | 62 | 63 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/Properties/go-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ddessy/RealTimeArousalDetectionUsingGSR/cf9f98b4b87821feb3e4cf1ed42c669d97b73ad9/RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/Properties/go-512.png -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/RealTimeArousalDetection.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2276781F-BEE6-4FFA-9ECC-EC6F00880ECA} 8 | Library 9 | Properties 10 | RealTimeArousalDetection 11 | RealTimeArousalDetection 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | true 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | True 56 | True 57 | Settings.settings 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | SettingsSingleFileGenerator 66 | Settings1.Designer.cs 67 | 68 | 69 | 70 | 71 | {DA8E9056-2E52-4029-81EB-A2D167614C47} 72 | RageAssetManager 73 | 74 | 75 | {d44c2378-492f-4d69-823c-024edf41dd98} 76 | SignalDevice 77 | 78 | 79 | {ba4e5dc4-5690-4e45-b690-786dac398e6a} 80 | Utils 81 | 82 | 83 | 84 | 85 | 86 | 87 | 94 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/Resources/RealTimeArousalDetection.VersionAndDependencies.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | RealTimeArousalDetection 4 | 1 5 | 2 6 | 3 7 | 8 | beta 9 | 10 | SignalDevice 11 | 12 | 13 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/TimeWindowType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 20 | { 21 | public enum TimeWindowMeasure 22 | { 23 | //time window in milliseconds 24 | Milliseconds, 25 | //time window in seconds 26 | Seconds 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetection/TonicStatistics.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System; 20 | using System.Text; 21 | 22 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 23 | { 24 | public class TonicStatistics 25 | { 26 | private double slope; 27 | private double meanAmp; 28 | private double minAmp; 29 | private double maxAmp; 30 | private Decimal stdDeviation; 31 | 32 | public double Slope 33 | { 34 | get 35 | { 36 | return slope; 37 | } 38 | 39 | set 40 | { 41 | slope = value; 42 | } 43 | } 44 | 45 | public double MeanAmp 46 | { 47 | get 48 | { 49 | return meanAmp; 50 | } 51 | 52 | set 53 | { 54 | meanAmp = value; 55 | } 56 | } 57 | 58 | public double MinAmp 59 | { 60 | get 61 | { 62 | return minAmp; 63 | } 64 | 65 | set 66 | { 67 | minAmp = value; 68 | } 69 | } 70 | 71 | public double MaxAmp 72 | { 73 | get 74 | { 75 | return maxAmp; 76 | } 77 | 78 | set 79 | { 80 | maxAmp = value; 81 | } 82 | } 83 | 84 | public Decimal StdDeviation 85 | { 86 | get 87 | { 88 | return stdDeviation; 89 | } 90 | 91 | set 92 | { 93 | stdDeviation = value; 94 | } 95 | } 96 | 97 | public override string ToString() 98 | { 99 | StringBuilder str = new StringBuilder(); 100 | str.Append("Slope: " + slope + ": \n"); 101 | str.Append("Minimum value: " + minAmp + "\n"); 102 | str.Append("Maximum value: " + maxAmp + "\n"); 103 | str.Append("Mean value: " + meanAmp + "\n"); 104 | str.Append("Standard deviation: " + stdDeviation + "\n"); 105 | 106 | return str.ToString(); 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetectionUsingGSRAsset/ErrorStartSignalDevice.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System; 20 | 21 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset 22 | { 23 | public class ErrorStartSignalDevice 24 | { 25 | #region Field 26 | private string errorContent; 27 | private ErrorType errorType1; 28 | private Exception exception; 29 | #endregion Field 30 | 31 | #region Contructors 32 | public ErrorStartSignalDevice() 33 | { 34 | 35 | } 36 | 37 | public ErrorStartSignalDevice(string errorContent, ErrorType errorType, Exception exception) 38 | { 39 | this.ErrorContent = errorContent; 40 | this.ErrorType1 = errorType; 41 | this.Exception = exception; 42 | } 43 | #endregion Constructors 44 | 45 | #region Properties 46 | public string ErrorContent 47 | { 48 | get 49 | { 50 | return errorContent; 51 | } 52 | 53 | set 54 | { 55 | errorContent = value; 56 | } 57 | } 58 | 59 | public ErrorType ErrorType1 60 | { 61 | get 62 | { 63 | return errorType1; 64 | } 65 | 66 | set 67 | { 68 | errorType1 = value; 69 | } 70 | } 71 | 72 | public Exception Exception 73 | { 74 | get 75 | { 76 | return exception; 77 | } 78 | 79 | set 80 | { 81 | exception = value; 82 | } 83 | } 84 | #endregion Properties 85 | 86 | public enum ErrorType 87 | { 88 | None, 89 | ErrorComPort, 90 | ErrorOpenPort, 91 | ErrorStartSignalDevice 92 | }; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetectionUsingGSRAsset/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RealTimeArousalDetectionUsingGSRAsset")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Sofia University")] 12 | [assembly: AssemblyProduct("RealTimeArousalDetectionUsingGSRAsset")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("50b7f5ae-9889-44f1-921a-3dc57ecabd8d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.2.3.0")] 36 | [assembly: AssemblyFileVersion("1.2.3.0")] 37 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetectionUsingGSRAsset/RealTimeArousalDetectionUsingGSRAsset.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {50B7F5AE-9889-44F1-921A-3DC57ECABD8D} 8 | Library 9 | Properties 10 | Assets.Rage.RealTimeArousalDetectionUsingGSRAsset 11 | RealTimeArousalDetectionUsingGSRAsset 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {da8e9056-2e52-4029-81eb-a2d167614c47} 51 | RageAssetManager 52 | 53 | 54 | {2276781f-bee6-4ffa-9ecc-ec6f00880eca} 55 | RealTimeArousalDetection 56 | 57 | 58 | {d44c2378-492f-4d69-823c-024edf41dd98} 59 | SignalDevice 60 | 61 | 62 | {ba4e5dc4-5690-4e45-b690-786dac398e6a} 63 | Utils 64 | 65 | 66 | 67 | 68 | Always 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/RealTimeArousalDetectionUsingGSRAsset/Resources/RealTimeArousalDetectionUsingGSRAsset.VersionAndDependencies.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | RealTimeArousalDetectionUsingGSRAsset 4 | 1 5 | 2 6 | 3 7 | 8 | beta 9 | 10 | RealTimeArousalDetection 11 | SignalDevice 12 | Utils 13 | 14 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/Cache.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils; 20 | using System.Collections.Generic; 21 | 22 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.SignalDevice 23 | { 24 | /// 25 | /// For each channel (GSR channel and HR channel) we save the data received by the used device in a cache 26 | /// 27 | public class Cache 28 | { 29 | private readonly static int CACHE_MAX_SIZE = (int)(RealTimeArousalDetectionAssetSettings.Instance.DefaultTimeWindow * (1000/RealTimeArousalDetectionAssetSettings.Instance.Samplerate)); 30 | private static Dictionary> channelsCache = new Dictionary>(); 31 | 32 | public Cache() 33 | { 34 | //super(); 35 | 36 | } 37 | 38 | /// 39 | /// Insert value into the cache using 40 | /// appropriate number of channel and the value 41 | /// 42 | /// The current data received by the device 43 | /// 44 | /// Name of the channel 45 | public static void AddChannelCacheValue(int channel, int cacheValue) 46 | { 47 | RemoveEldestChannelValue(channel); 48 | if (DoesKeyExist(channel)) 49 | { 50 | channelsCache[channel].Add(cacheValue); 51 | } 52 | else 53 | { 54 | channelsCache.Add(channel, new List() { cacheValue }); 55 | } 56 | } 57 | 58 | /// 59 | /// Insert list of values into the cache using 60 | /// appropriate number of channel and the value 61 | /// 62 | /// The current set of data received by the device 63 | /// 64 | /// Name of the channel 65 | public static void AddChannelCacheValue(int channel, List cacheValues) 66 | { 67 | RemoveEldestChannelValues(channel, cacheValues.Count); 68 | if (DoesKeyExist(channel)) 69 | { 70 | channelsCache[channel].AddRange(cacheValues); 71 | } 72 | else 73 | { 74 | channelsCache.Add(channel, cacheValues); 75 | } 76 | } 77 | 78 | /// 79 | /// Remove the eldest value in the cache in order to save the current value instead of it 80 | /// 81 | /// Name of the channel 82 | private static void RemoveEldestChannelValue(int channel) 83 | { 84 | if (DoesKeyExist(channel) && IsMaxSizeCacheHit(channel)) 85 | { 86 | channelsCache[channel].Remove(0); 87 | } 88 | } 89 | 90 | /// 91 | /// Remove the eldest value in the cache in order to save the current value instead of it 92 | /// 93 | /// Name of the channel 94 | private static void RemoveEldestChannelValues(int channel, int numberOfValues) 95 | { 96 | if (DoesKeyExist(channel) && WillMaxSizedCacheHit(channel, numberOfValues)) 97 | { 98 | int extraNumbers = channelsCache[channel].Count + numberOfValues - CACHE_MAX_SIZE; 99 | for (int i = 0; i < extraNumbers; i++) 100 | { 101 | channelsCache[channel].Remove(0); 102 | } 103 | } 104 | } 105 | 106 | private static bool WillMaxSizedCacheHit(int channel, int numberOfValues) 107 | { 108 | return (channelsCache[channel].Count + numberOfValues > CACHE_MAX_SIZE); 109 | } 110 | 111 | /// 112 | /// Check for item in cache 113 | /// 114 | /// Name of cached item 115 | /// True if the key already exists in the cache 116 | private static bool DoesKeyExist(int key) 117 | { 118 | return channelsCache.ContainsKey(key); 119 | } 120 | 121 | private static bool IsMaxSizeCacheHit(int channel) 122 | { 123 | return (channelsCache[channel].Count + 1 > CACHE_MAX_SIZE); 124 | } 125 | 126 | /// 127 | /// Gets all cached items as a list by their key. 128 | /// 129 | /// A list of all cached items 130 | public static List GetAllForChannel(int channel) 131 | { 132 | if (channelsCache != null && channelsCache.ContainsKey(channel)) 133 | { 134 | return channelsCache[channel]; 135 | } 136 | 137 | return null; 138 | } 139 | 140 | /// 141 | /// Gets all cached items as a list by their key. 142 | /// 143 | /// A list of all cached items 144 | public static Dictionary> GetChannelsCache() 145 | { 146 | return channelsCache; 147 | } 148 | 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/GSRHRDevice.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using HMDevice; 20 | using Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils; 21 | 22 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.SignalDevice 23 | { 24 | public class GSRHRDevice : ISignalDeviceController 25 | { 26 | private int SampleRate = 0; 27 | private HMDevice.HMDevice device; 28 | private static GSRHRDevice instance; 29 | private RealTimeArousalDetectionAssetSettings settings; 30 | 31 | private GSRHRDevice() 32 | { 33 | device = new HMDevice.HMDevice(); 34 | settings = RealTimeArousalDetectionAssetSettings.Instance; 35 | } 36 | 37 | public static GSRHRDevice Instance 38 | { 39 | get 40 | { 41 | if (instance == null) 42 | { 43 | instance = new GSRHRDevice(); 44 | } 45 | return instance; 46 | } 47 | } 48 | 49 | public void OpenPort() 50 | { 51 | device.OpenPort(); 52 | } 53 | 54 | public void OpenPort(int sampleRate) 55 | { 56 | device.OpenPort(sampleRate); 57 | } 58 | 59 | public void SelectCOMPort(string portName) 60 | { 61 | if (!device.IsPortOpen()) 62 | { 63 | device.SelectCOMPort(portName); 64 | } 65 | } 66 | 67 | public void SetSignalSettings() 68 | { 69 | if (settings.Samplerate < 1 && device.IsPortOpen()) 70 | { 71 | //default samplerate(speed/per second) 72 | device.SetSignalSamplerate(100); 73 | } 74 | else 75 | { 76 | int sampleRateSetting = settings.Samplerate; 77 | device.SetSignalSamplerate(sampleRateSetting); 78 | SampleRate = sampleRateSetting; 79 | } 80 | } 81 | 82 | public int SetSignalSamplerate(int samplerate) 83 | { 84 | device.SetSignalSamplerate(samplerate); 85 | return -1; 86 | } 87 | 88 | public void SetSignalSamplerate() 89 | { 90 | int sampleRateSettings = settings.Samplerate; 91 | device.SetSignalSamplerate(sampleRateSettings); 92 | } 93 | 94 | public int GetSignalSampleRate() 95 | { 96 | if (SampleRate > 0) 97 | { 98 | if (!(device.GetSignalSampleRate() > 0 && SampleRate == device.GetSignalSampleRate())) 99 | { 100 | device.SetSignalSamplerate(SampleRate); 101 | } 102 | 103 | return SampleRate; 104 | } 105 | else 106 | { 107 | int sampleRateSetting = settings.Samplerate; 108 | return sampleRateSetting; 109 | } 110 | } 111 | 112 | public int GetSignalSampleRateByConfig() 113 | { 114 | return settings.Samplerate; 115 | } 116 | 117 | public int StartSignalsRecord() 118 | { 119 | device.StartSignalsTransfer(); 120 | return 0; 121 | } 122 | 123 | public int StopSignalsRecord() 124 | { 125 | if (!"TestWithoutDevice".Equals(settings.ApplicationMode)) 126 | { 127 | device.StopSignalsTransfer(); 128 | } 129 | 130 | return 0; 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/ISignalDeviceController.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.SignalDevice 20 | { 21 | public enum DataMode { Text, Hex }; 22 | 23 | public interface ISignalDeviceController 24 | { 25 | void SelectCOMPort(string portName); 26 | 27 | int StartSignalsRecord(); 28 | 29 | int StopSignalsRecord(); 30 | 31 | void OpenPort(); 32 | 33 | void OpenPort(int sampleRate); 34 | 35 | int SetSignalSamplerate(int speed); 36 | 37 | int GetSignalSampleRate(); 38 | 39 | int GetSignalSampleRateByConfig(); 40 | 41 | void SetSignalSettings(); 42 | 43 | void SetSignalSamplerate(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SignalDevice")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Sofia University")] 12 | [assembly: AssemblyProduct("SignalDevice")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | //[assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d44c2378-492f-4d69-823c-024edf41dd98")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SignalDevice.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("8")] 29 | public int DataBits { 30 | get { 31 | return ((int)(this["DataBits"])); 32 | } 33 | set { 34 | this["DataBits"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("None")] 41 | public global::System.IO.Ports.Parity Parity { 42 | get { 43 | return ((global::System.IO.Ports.Parity)(this["Parity"])); 44 | } 45 | set { 46 | this["Parity"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("One")] 53 | public global::System.IO.Ports.StopBits StopBits { 54 | get { 55 | return ((global::System.IO.Ports.StopBits)(this["StopBits"])); 56 | } 57 | set { 58 | this["StopBits"] = value; 59 | } 60 | } 61 | 62 | [global::System.Configuration.UserScopedSettingAttribute()] 63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 65 | public bool ClearOnOpen { 66 | get { 67 | return ((bool)(this["ClearOnOpen"])); 68 | } 69 | set { 70 | this["ClearOnOpen"] = value; 71 | } 72 | } 73 | 74 | [global::System.Configuration.UserScopedSettingAttribute()] 75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 76 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 77 | public bool ClearWithDTR { 78 | get { 79 | return ((bool)(this["ClearWithDTR"])); 80 | } 81 | set { 82 | this["ClearWithDTR"] = value; 83 | } 84 | } 85 | 86 | [global::System.Configuration.UserScopedSettingAttribute()] 87 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 88 | [global::System.Configuration.DefaultSettingValueAttribute("38400")] 89 | public int BaudRate { 90 | get { 91 | return ((int)(this["BaudRate"])); 92 | } 93 | set { 94 | this["BaudRate"] = value; 95 | } 96 | } 97 | 98 | [global::System.Configuration.UserScopedSettingAttribute()] 99 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 100 | [global::System.Configuration.DefaultSettingValueAttribute("Hex")] 101 | public global::Assets.Rage.GSRAsset.SignalDevice.DataMode DataMode { 102 | get { 103 | return ((global::Assets.Rage.GSRAsset.SignalDevice.DataMode)(this["DataMode"])); 104 | } 105 | set { 106 | this["DataMode"] = value; 107 | } 108 | } 109 | 110 | [global::System.Configuration.UserScopedSettingAttribute()] 111 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 112 | [global::System.Configuration.DefaultSettingValueAttribute("COM3")] 113 | public string PortName { 114 | get { 115 | return ((string)(this["PortName"])); 116 | } 117 | set { 118 | this["PortName"] = value; 119 | } 120 | } 121 | 122 | [global::System.Configuration.UserScopedSettingAttribute()] 123 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 124 | [global::System.Configuration.DefaultSettingValueAttribute("20")] 125 | public int Samplerate { 126 | get { 127 | return ((int)(this["Samplerate"])); 128 | } 129 | set { 130 | this["Samplerate"] = value; 131 | } 132 | } 133 | 134 | [global::System.Configuration.UserScopedSettingAttribute()] 135 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 136 | [global::System.Configuration.DefaultSettingValueAttribute("10116")] 137 | public int SocketPortNumber { 138 | get { 139 | return ((int)(this["SocketPortNumber"])); 140 | } 141 | set { 142 | this["SocketPortNumber"] = value; 143 | } 144 | } 145 | 146 | [global::System.Configuration.UserScopedSettingAttribute()] 147 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 148 | [global::System.Configuration.DefaultSettingValueAttribute("C:/Users/ddessy/log.txt")] 149 | public string LogFile { 150 | get { 151 | return ((string)(this["LogFile"])); 152 | } 153 | set { 154 | this["LogFile"] = value; 155 | } 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 8 7 | 8 | 9 | None 10 | 11 | 12 | One 13 | 14 | 15 | False 16 | 17 | 18 | False 19 | 20 | 21 | 38400 22 | 23 | 24 | Hex 25 | 26 | 27 | COM3 28 | 29 | 30 | 20 31 | 32 | 33 | 10116 34 | 35 | 36 | C:/Users/ddessy/log.txt 37 | 38 | 39 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/Resources/SignalDevice.VersionAndDependencies.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | RealTimeArousalDetection 4 | 1 5 | 2 6 | 3 7 | 8 | beta 9 | 10 | Utils 11 | HMDevice 12 | 13 | 14 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/SignalDevice.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D44C2378-492F-4D69-823C-024EDF41DD98} 8 | Library 9 | Properties 10 | SignalDevice 11 | SignalDevice 12 | v4.5.2 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | true 25 | false 26 | x86 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | False 39 | ..\..\..\unity\Roll a Ball\Assets\Rage\RageAssetManager.dll 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | {1deff052-1953-4de5-9e73-1f3e14ee2565} 61 | HMDevice 62 | 63 | 64 | {ba4e5dc4-5690-4e45-b690-786dac398e6a} 65 | Utils 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 80 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/SignalDevice/SignalDeviceSerialPort.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System.IO.Ports; 20 | 21 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.SignalDevice 22 | { 23 | /* 24 | * The serial port should have only one instance. 25 | * Therefore we use the Singleton design pattern. 26 | */ 27 | public class SignalDeviceSerialPort 28 | { 29 | private static SerialPort instance; 30 | private SignalDeviceSerialPort() 31 | { 32 | //super(); 33 | } 34 | 35 | public static SerialPort Instance 36 | { 37 | get 38 | { 39 | if (instance == null) 40 | { 41 | instance = new SerialPort(); 42 | } 43 | return instance; 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/UnitTestArousalDetectionByGSRDevice/GSRSignalProcessorSettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using Microsoft.VisualStudio.TestTools.UnitTesting; 20 | 21 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.UnitTest 22 | { 23 | [TestClass] 24 | public class GSRSignalProcessorSettings 25 | { 26 | /* [TestMethod] 27 | public void SetMaxArousalLevel_SetNewValue_ReturnTrue() 28 | { 29 | //arrange 30 | RealTimeArousalDetectionUsingGSRAsset gsrHandler = new RealTimeArousalDetectionUsingGSRAsset(); 31 | 32 | //act 33 | int newMaxArousalLevel = gsrHandler.SetMaxArousalLevel(2); 34 | 35 | //assert 36 | Assert.AreEqual(gsrHandler.GetGSRSignalProcessor().ArousalLevel, 2); 37 | } 38 | 39 | [TestMethod] 40 | public void SetMaxArousalLevel_SetNewValue_ReturnFalse() 41 | { 42 | //arrange 43 | RealTimeArousalDetectionUsingGSRAsset gsrHandler = new RealTimeArousalDetectionUsingGSRAsset(); 44 | int oldArousalLevel = gsrHandler.GetGSRSignalProcessor().ArousalLevel; 45 | 46 | //act 47 | int newMaxArousalLevel = gsrHandler.SetMaxArousalLevel(oldArousalLevel + 1); 48 | 49 | //assert 50 | Assert.AreNotEqual(gsrHandler.GetGSRSignalProcessor().ArousalLevel, oldArousalLevel); 51 | }*/ 52 | 53 | [TestMethod] 54 | public void SetTimeWindow_SetNewValue_ReturnTrue() 55 | { 56 | //arrange 57 | RealTimeArousalDetectionUsingGSRAsset gsrHandler = new RealTimeArousalDetectionUsingGSRAsset(); 58 | 59 | //act 60 | int newMaxArousalLevel = gsrHandler.SetTimeWindow(15); 61 | 62 | //assert 63 | Assert.AreEqual(gsrHandler.GetGSRSignalProcessor().DefaultTimeWindow, 15); 64 | } 65 | 66 | [TestMethod] 67 | public void SetTimeWindow_SetNewValue_ReturnFalse() 68 | { 69 | //arrange 70 | RealTimeArousalDetectionUsingGSRAsset gsrHandler = new RealTimeArousalDetectionUsingGSRAsset(); 71 | double oldTimeWindow = gsrHandler.GetGSRSignalProcessor().DefaultTimeWindow; 72 | 73 | //act 74 | int newMaxArousalLevel = gsrHandler.SetTimeWindow(oldTimeWindow + 10); 75 | 76 | //assert 77 | Assert.AreNotEqual(gsrHandler.GetGSRSignalProcessor().DefaultTimeWindow, oldTimeWindow); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/UnitTestArousalDetectionByGSRDevice/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("UnitTestArousalDetectionByGSRDevice")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Sofia University")] 12 | [assembly: AssemblyProduct("UnitTestArousalDetectionByGSRDevice")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("bf45fef9-3318-40f7-a7e6-71d8a8ff27de")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/UnitTestArousalDetectionByGSRDevice/UnitTestArousalDetectionByGSRDevice.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {BF45FEF9-3318-40F7-A7E6-71D8A8FF27DE} 7 | Library 8 | Properties 9 | UnitTestArousalDetectionByGSRDevice 10 | UnitTestArousalDetectionByGSRDevice 11 | v4.5.2 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {50b7f5ae-9889-44f1-921a-3dc57ecabd8d} 59 | RealTimeArousalDetectionUsingGSRAsset 60 | 61 | 62 | {da8e9056-2e52-4029-81eb-a2d167614c47} 63 | RageAssetManager 64 | 65 | 66 | {2276781f-bee6-4ffa-9ecc-ec6f00880eca} 67 | RealTimeArousalDetection 68 | 69 | 70 | 71 | 72 | 73 | 74 | False 75 | 76 | 77 | False 78 | 79 | 80 | False 81 | 82 | 83 | False 84 | 85 | 86 | 87 | 88 | 89 | 90 | 97 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/ButterworthFilterCoordinates.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System.Collections.Generic; 20 | 21 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 22 | { 23 | public class ButterworthFilterCoordinates 24 | { 25 | private List lowPassCoordinates; 26 | private List highPassCoordinates; 27 | 28 | public ButterworthFilterCoordinates() 29 | { 30 | // 31 | } 32 | 33 | public ButterworthFilterCoordinates(List lowPassCoordinates, List highPassCoordinates) 34 | { 35 | this.lowPassCoordinates = lowPassCoordinates; 36 | this.highPassCoordinates = highPassCoordinates; 37 | } 38 | 39 | public List LowPassCoordinates 40 | { 41 | get 42 | { 43 | return lowPassCoordinates; 44 | } 45 | 46 | set 47 | { 48 | lowPassCoordinates = value; 49 | } 50 | } 51 | 52 | public List HighPassCoordinates 53 | { 54 | get 55 | { 56 | return highPassCoordinates; 57 | } 58 | 59 | set 60 | { 61 | highPassCoordinates = value; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/ButterworthPassType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 20 | { 21 | public enum ButterworthPassType 22 | { 23 | //phasic signal 24 | Highpass, 25 | //tonic signal 26 | Lowpass 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/CacheSignalData.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System; 20 | using System.Collections.Generic; 21 | using Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils; 22 | using System.IO; 23 | using System.Text; 24 | using System.Text.RegularExpressions; 25 | using System.Collections.Specialized; 26 | using System.Globalization; 27 | using AssetPackage; 28 | using AssetManagerPackage; 29 | 30 | public class CacheSignalData 31 | { 32 | private readonly static int CACHE_MAX_SIZE = 1000; 33 | private static List signalValuesCache; 34 | 35 | private RealTimeArousalDetectionAssetSettings config; 36 | private static String applicationMode; 37 | private static int sampleRate; 38 | private static CacheSignalData instance; 39 | private static FilterButterworth butterworthHighPassFilter; 40 | private static FilterButterworth butterworthLowPassFilter; 41 | private static double HIGHPASS_ADJUSTING_VARIABLE = 3000.00; 42 | 43 | public static CacheSignalData Instance 44 | { 45 | get 46 | { 47 | if (instance == null) 48 | { 49 | instance = new CacheSignalData(); 50 | } 51 | return instance; 52 | } 53 | } 54 | 55 | private CacheSignalData() 56 | { 57 | signalValuesCache = new List(); 58 | config = RealTimeArousalDetectionAssetSettings.Instance; 59 | double butterworthPhasicFrequency = config.ButterworthPhasicFrequency; 60 | double butterworthTonicFrequency = config.ButterworthTonicFrequency; 61 | sampleRate = config.Samplerate; 62 | butterworthHighPassFilter = new FilterButterworth(butterworthPhasicFrequency, sampleRate, ButterworthPassType.Highpass, "compute EDA high"); 63 | butterworthLowPassFilter = new FilterButterworth(butterworthTonicFrequency, sampleRate, ButterworthPassType.Lowpass, "compute EDA low"); 64 | 65 | if ("TestWithoutDevice".Equals(config.ApplicationMode)) 66 | { 67 | FillTestGSRDataFromFile(); 68 | } 69 | 70 | applicationMode = config.ApplicationMode; 71 | } 72 | 73 | private void FillTestGSRDataFromFile() 74 | { 75 | 76 | using (StreamReader sr = new StreamReader(config.TestData, Encoding.Default)) 77 | { 78 | string text = sr.ReadToEnd(); 79 | string[] lines = text.Split(';'); 80 | for(int i = 0; i < lines.Length; i++) 81 | { 82 | if(!String.IsNullOrEmpty(lines[i])) AddSignalValue(Int32.Parse(Regex.Replace(lines[i], @"\s+", ""), CultureInfo.InvariantCulture)); 83 | } 84 | } 85 | 86 | } 87 | 88 | /// 89 | /// Insert value into the cache using the value 90 | /// 91 | /// The current data received by the device 92 | /// 93 | public static void AddSignalValue(double cacheValue) 94 | { 95 | if (IsMaxSizeCacheHit()) 96 | { 97 | RemoveEldestCacheValue(); 98 | } 99 | 100 | lock (signalValuesCache) 101 | { 102 | double milliseconds = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; 103 | signalValuesCache.Add(new SignalDataByTime(milliseconds, cacheValue, 104 | butterworthHighPassFilter.GetFilterValue(cacheValue) + HIGHPASS_ADJUSTING_VARIABLE, 105 | butterworthLowPassFilter.GetFilterValue(cacheValue))); 106 | } 107 | } 108 | 109 | /// 110 | /// Remove the eldest value in the cache in order to save the current value instead of it 111 | /// 112 | /// Name of the channel 113 | private static void RemoveEldestCacheValue() 114 | { 115 | signalValuesCache.RemoveAt(0); 116 | } 117 | 118 | private static bool IsMaxSizeCacheHit() 119 | { 120 | return signalValuesCache != null && (signalValuesCache.Count > CACHE_MAX_SIZE); 121 | } 122 | 123 | /// 124 | /// Gets all cached items as a list by their key. 125 | /// 126 | /// A list of all cached items 127 | public static SignalDataByTime[] GetCacheData() 128 | { 129 | SignalDataByTime[] signalValuesArray; 130 | lock (signalValuesCache) 131 | { 132 | signalValuesArray = signalValuesCache.ToArray(); 133 | } 134 | 135 | int numberNotNullListItem = 0; 136 | for (int i = 0; i < signalValuesArray.Length - 100; i++) 137 | { 138 | if (signalValuesArray[i] != null) numberNotNullListItem++; 139 | } 140 | 141 | SignalDataByTime[] result = new SignalDataByTime[numberNotNullListItem]; 142 | if (numberNotNullListItem == signalValuesArray.Length) result = signalValuesArray; 143 | else 144 | { 145 | int j = 0; 146 | for (int i = 0; i < signalValuesArray.Length - 100; i++) 147 | { 148 | if (signalValuesArray[i] != null) 149 | { 150 | result[j] = signalValuesArray[i]; 151 | if ("TestWithoutDevice".Equals(applicationMode) && j > 0) 152 | { 153 | result[j].Time = result[j - 1].Time + sampleRate; 154 | } 155 | else if ("TestWithoutDevice".Equals(applicationMode) && j == 0) 156 | { 157 | result[j].Time = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; 158 | } 159 | j++; 160 | } 161 | } 162 | } 163 | 164 | return result; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/FilterButterworth.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | using System; 20 | 21 | namespace Assets.Rage.RealTimeArousalDetectionUsingGSRAsset.Utils 22 | { 23 | public class FilterButterworth 24 | { 25 | /// 26 | /// rez amount should be from sqrt(2) to ~ 0.1. 27 | /// 28 | private readonly double resonance = Math.Sqrt(2); 29 | 30 | private readonly double frequency; 31 | private readonly int sampleRate; 32 | private readonly ButterworthPassType passType; 33 | 34 | private double c, a1, a2, a3, b1, b2; 35 | 36 | /// 37 | /// Array of input values, latest are in front 38 | /// 39 | private double[] inputHistory = new double[2]; 40 | 41 | /// 42 | /// Array of output values, latest are in front 43 | /// 44 | private double[] outputHistory = new double[3]; 45 | 46 | /// 47 | /// Initialize parameters of the Butterworth filter 48 | /// 49 | public FilterButterworth(double frequency, int sampleRate, ButterworthPassType passType, String calledBy) 50 | { 51 | //this.resonance = resonance; 52 | /* 53 | - we used a 1st order, low-pass Butterworth filter set to 0.05 Hz to extract the tonic signal. 54 | */ 55 | this.frequency = frequency; 56 | this.sampleRate = sampleRate; 57 | this.passType = passType; 58 | this.inputHistory[0] = 0.0; 59 | this.inputHistory[1] = 0.0; 60 | this.outputHistory[0] = 0.0; 61 | this.outputHistory[1] = 0.0; 62 | this.outputHistory[2] = 0.0; 63 | SetButterworthParameters(passType); 64 | } 65 | 66 | public FilterButterworth(double frequency, int sampleRate) 67 | { 68 | this.frequency = frequency; 69 | this.sampleRate = sampleRate; 70 | } 71 | 72 | public void Update(double newInput) 73 | { 74 | double newOutput = a1 * newInput + a2 * this.inputHistory[0] + a3 * this.inputHistory[1] - b1 * this.outputHistory[0] - b2 * this.outputHistory[1]; 75 | 76 | this.inputHistory[1] = this.inputHistory[0]; 77 | this.inputHistory[0] = newInput; 78 | 79 | this.outputHistory[2] = this.outputHistory[1]; 80 | this.outputHistory[1] = this.outputHistory[0]; 81 | this.outputHistory[0] = newOutput; 82 | } 83 | 84 | public double GetFilterValue(double newInput) 85 | { 86 | Update(newInput); 87 | return Math.Round(this.outputHistory[0], 3); 88 | } 89 | 90 | public double GetFilterValue(double newInput, ButterworthPassType passType) 91 | { 92 | SetButterworthParameters(passType); 93 | Update(newInput); 94 | return Math.Round(this.outputHistory[0], 3); 95 | } 96 | 97 | private void SetButterworthParameters(ButterworthPassType passType) 98 | { 99 | switch (passType) 100 | { 101 | case ButterworthPassType.Lowpass: 102 | c = 1.0 / Math.Tan(Math.PI * frequency / sampleRate); 103 | //a1 = 1.0 / (1.0 + c * c); 104 | a1 = 1.0 / (1.0 + resonance * c + c * c); 105 | a2 = 2.0 * a1; 106 | a3 = a1; 107 | b1 = 2.0 * (1.0 - c * c) * a1; 108 | //b2 = (1.0 + c * c) * a1; 109 | b2 = (1.0 - resonance * c + c * c) * a1; 110 | break; 111 | case ButterworthPassType.Highpass: 112 | c = Math.Tan(Math.PI * frequency / sampleRate); 113 | //a1 = 1.0 / (1.0 + c * c); 114 | a1 = 1.0 / (1.0 + resonance * c + c * c); 115 | a2 = -2.0 * a1; 116 | a3 = a1; 117 | b1 = 2.0 * (c * c - 1.0) * a1; 118 | //b2 = (1.0 + c * c) * a1; 119 | b2 = (1.0 - resonance * c + c * c) * a1; 120 | break; 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Utils")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Sofia University")] 12 | [assembly: AssemblyProduct("Utils")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ba4e5dc4-5690-4e45-b690-786dac398e6a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/Resources/Utils.VersionAndDependencies.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | Utils 4 | 1 5 | 2 6 | 3 7 | 8 | beta 9 | 10 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/SignalDataByTime.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Sofia University 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * This project has received funding from the European Union's Horizon 7 | * 2020 research and innovation programme under grant agreement No 644187. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | public class SignalDataByTime 20 | { 21 | #region Fields 22 | private double time; 23 | private double signalValue; 24 | private double highPassValue; 25 | private double lowPassValue; 26 | #endregion Fields 27 | 28 | public SignalDataByTime() 29 | { 30 | // 31 | } 32 | 33 | public SignalDataByTime(double time, double signalValue) 34 | { 35 | this.time = time; 36 | this.signalValue = signalValue; 37 | } 38 | 39 | public SignalDataByTime(double time, double signalValue, double highPassValue, double lowPassValue) 40 | { 41 | this.time = time; 42 | this.signalValue = signalValue; 43 | this.highPassValue = highPassValue; 44 | this.lowPassValue = lowPassValue; 45 | } 46 | 47 | #region Properties 48 | public double Time 49 | { 50 | get 51 | { 52 | return time; 53 | } 54 | 55 | set 56 | { 57 | time = value; 58 | } 59 | } 60 | 61 | public double SignalValue 62 | { 63 | get 64 | { 65 | return signalValue; 66 | } 67 | 68 | set 69 | { 70 | signalValue = value; 71 | } 72 | } 73 | 74 | public double HighPassValue 75 | { 76 | get 77 | { 78 | return highPassValue; 79 | } 80 | 81 | set 82 | { 83 | highPassValue = value; 84 | } 85 | } 86 | 87 | public double LowPassValue 88 | { 89 | get 90 | { 91 | return lowPassValue; 92 | } 93 | 94 | set 95 | { 96 | lowPassValue = value; 97 | } 98 | } 99 | #endregion Properties 100 | } 101 | -------------------------------------------------------------------------------- /RealTimeArousalDetectionUsingGSRSource/Utils/Utils.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BA4E5DC4-5690-4E45-B690-786DAC398E6A} 8 | Library 9 | Properties 10 | Assets.Rage.GSRAsset.Utils 11 | Utils 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | x86 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | {da8e9056-2e52-4029-81eb-a2d167614c47} 56 | RageAssetManager 57 | 58 | 59 | 60 | 61 | 62 | 63 | 70 | --------------------------------------------------------------------------------