Added ThinkGear Plugin
This commit is contained in:
parent
d5c4d93c8f
commit
20a432a52b
4 changed files with 173 additions and 0 deletions
132
Assets/Plugins/NativeThinkgear64.cs
Normal file
132
Assets/Plugins/NativeThinkgear64.cs
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace libStreamSDK
|
||||
{
|
||||
public class NativeThinkgear
|
||||
{
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_GetVersion", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_GetVersion();
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_GetNewConnectionId", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_GetNewConnectionId();
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_SetStreamLog", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_SetStreamLog(int connectionId, string filename);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_SetDataLog", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_SetDataLog(int connectionId, string filename);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_WriteStreamLog", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_WriteStreamLog(int connectionId, int insertTimestamp, string msg);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_WriteDataLog", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_WriteDataLog(int connectionId, int insertTimestamp, string msg);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_Connect", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_Connect(int connectionId, string serialPortName, int serialBaudrate,
|
||||
int serialDataFormat);
|
||||
|
||||
public static int TG_Connect(int connectionId, string serialPortName, Baudrate baudrate,
|
||||
SerialDataFormat format)
|
||||
{
|
||||
return TG_Connect(connectionId, serialPortName, (int)baudrate, (int)format);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_ReadPackets", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_ReadPackets(int connectionId, int numPackets);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_GetValueStatus", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_GetValueStatus(int connectionId, int dataType);
|
||||
public static int TG_GetValueStatus(int connectionId, DataType dataType)
|
||||
{
|
||||
return TG_GetValueStatus(connectionId, (int)dataType);
|
||||
}
|
||||
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_GetValue", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float TG_GetValue(int connectionId, int dataType);
|
||||
public static float TG_GetValue(int connectionId, DataType dataType)
|
||||
{
|
||||
return TG_GetValue(connectionId, (int)dataType);
|
||||
}
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_SendByte", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_SendByte(int connectionId, int b);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_SetBaudrate", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_SetBaudrate(int connectionId, int serialBaudrate);
|
||||
public static int TG_SetBaudrate(int connectionId, Baudrate baudrate)
|
||||
{
|
||||
return TG_SetBaudrate(connectionId, (int)baudrate);
|
||||
}
|
||||
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_EnableAutoRead", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int TG_EnableAutoRead(int connectionId, int enable);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_Disconnect", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TG_Disconnect(int connectionId);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "TG_FreeConnection", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void TG_FreeConnection(int connectionId);
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "MWM15_getFilterType", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int MWM15_getFilterType(int connectionId);
|
||||
|
||||
[DllImport(@"thinkgear64.dll", EntryPoint = "MWM15_setFilterType", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int MWM15_setFilterType(int connectionId, int filterType);
|
||||
public static int MWM15_setFilterType(int connectionId, FilterType filterType)
|
||||
{
|
||||
return MWM15_setFilterType(connectionId, (int)filterType);
|
||||
}
|
||||
|
||||
public const int TG_MAX_CONNECTION_HANDLES = 128;
|
||||
|
||||
public enum Baudrate
|
||||
{
|
||||
TG_BAUD_1200 = 1200,
|
||||
TG_BAUD_2400 = 2400,
|
||||
TG_BAUD_4800 = 4800,
|
||||
TG_BAUD_9600 = 9600,
|
||||
TG_BAUD_57600 = 57600,
|
||||
TG_BAUD_115200 = 115200
|
||||
}
|
||||
|
||||
public enum SerialDataFormat
|
||||
{
|
||||
TG_STREAM_PACKETS = 0,
|
||||
TG_STREAM_FILE_PACKETS = 2
|
||||
}
|
||||
|
||||
public enum DataType
|
||||
{
|
||||
//TG_DATA_BATTERY = 0,
|
||||
TG_DATA_POOR_SIGNAL = 1,
|
||||
TG_DATA_ATTENTION = 2,
|
||||
TG_DATA_MEDITATION = 3,
|
||||
TG_DATA_RAW = 4,
|
||||
TG_DATA_DELTA = 5,
|
||||
TG_DATA_THETA = 6,
|
||||
TG_DATA_ALPHA1 = 7,
|
||||
TG_DATA_ALPHA2 = 8,
|
||||
TG_DATA_BETA1 = 9,
|
||||
TG_DATA_BETA2 = 10,
|
||||
TG_DATA_GAMMA1 = 11,
|
||||
TG_DATA_GAMMA2 = 12,
|
||||
MWM15_DATA_FILTER_TYPE = 49
|
||||
}
|
||||
|
||||
public enum FilterType
|
||||
{
|
||||
MWM15_FILTER_TYPE_50HZ = 4,
|
||||
MWM15_FILTER_TYPE_60HZ = 5
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Plugins/NativeThinkgear64.cs.meta
Normal file
11
Assets/Plugins/NativeThinkgear64.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d989347df1b55c346954e8150f58ecb3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Plugins/thinkgear64.dll
(Stored with Git LFS)
Normal file
BIN
Assets/Plugins/thinkgear64.dll
(Stored with Git LFS)
Normal file
Binary file not shown.
27
Assets/Plugins/thinkgear64.dll.meta
Normal file
27
Assets/Plugins/thinkgear64.dll.meta
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f66e3dba1f248a24aaa7201936428478
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue