Skip to content

Commit 0930455

Browse files
committed
Add unit field to data channel objects
1 parent 9a25718 commit 0930455

8 files changed

Lines changed: 62 additions & 6 deletions

File tree

Builds/VisualStudio2013/open-ephys.sln

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
Microsoft Visual Studio Solution File, Format Version 11.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 2013
3-
Project("{5A05F353-1D63-394C-DFB0-981BB2309002}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
3+
VisualStudioVersion = 12.0.40629.0
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
46
EndProject
57
Global
68
GlobalSection(SolutionConfigurationPlatforms) = preSolution
79
Debug|Win32 = Debug|Win32
8-
Release|Win32 = Release|Win32
10+
Debug|x64 = Debug|x64
11+
Debug64|Win32 = Debug64|Win32
912
Debug64|x64 = Debug64|x64
13+
Release|Win32 = Release|Win32
14+
Release|x64 = Release|x64
15+
Release64|Win32 = Release64|Win32
1016
Release64|x64 = Release64|x64
1117
EndGlobalSection
1218
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1319
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.ActiveCfg = Debug|Win32
1420
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.Build.0 = Debug|Win32
15-
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
16-
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
21+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|x64.ActiveCfg = Debug|Win32
22+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|Win32.ActiveCfg = Debug64|x64
1723
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.ActiveCfg = Debug64|x64
1824
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.Build.0 = Debug64|x64
25+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
26+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
27+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|x64.ActiveCfg = Release|Win32
28+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|Win32.ActiveCfg = Release64|x64
1929
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.ActiveCfg = Release64|x64
2030
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.Build.0 = Release64|x64
2131
EndGlobalSection

Source/Processors/Channel/InfoObjects.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ float DataChannel::getBitVolts() const
179179
return m_bitVolts;
180180
}
181181

182+
void DataChannel::setDataUnits(String unit)
183+
{
184+
m_unitName = unit;
185+
}
186+
187+
String DataChannel::getDataUnits() const
188+
{
189+
return m_unitName;
190+
}
191+
182192
DataChannel::DataChannelTypes DataChannel::getChannelType() const
183193
{
184194
return m_type;

Source/Processors/Channel/InfoObjects.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ class PLUGIN_API DataChannel
201201
/** Returns the bitVolts value for this channel. */
202202
float getBitVolts() const;
203203

204+
/** Sets the unit string */
205+
void setDataUnits(String unit);
206+
207+
/** Gets the data units*/
208+
String getDataUnits() const;
209+
204210
DataChannelTypes getChannelType() const;
205211

206212
//--------- STATUS METHODS ----------//
@@ -235,6 +241,7 @@ class PLUGIN_API DataChannel
235241
bool m_isEnabled{ true };
236242
bool m_isMonitored{ false };
237243
bool m_isRecording{ false };
244+
String m_unitName{ "uV" };
238245

239246
JUCE_LEAK_DETECTOR(DataChannel);
240247
};

Source/Processors/DataThreads/DataThread.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,9 @@ void DataThread::createExtraEvents(Array<EventChannel*>&)
141141
{}
142142

143143
void DataThread::resizeBuffers()
144-
{}
144+
{}
145+
146+
String DataThread::getChannelUnits(int chanIndex) const
147+
{
148+
return String::empty;
149+
}

Source/Processors/DataThreads/DataThread.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ class PLUGIN_API DataThread : public Thread
137137

138138
void createTTLChannels();
139139

140+
virtual String getChannelUnits(int chanIndex) const;
141+
140142
protected:
141143
virtual void setDefaultChannelNames();
142144

Source/Processors/DataThreads/RhythmNode/RHD2000Thread.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,19 @@ int RHD2000Thread::getNumDataOutputs(DataChannel::DataChannelTypes type, int sub
929929
}
930930
}
931931

932+
String RHD2000Thread::getChannelUnits(int chanIndex) const
933+
{
934+
switch (sn->getDataChannel(chanIndex)->getChannelType())
935+
{
936+
case DataChannel::AUX_CHANNEL:
937+
return "mV";
938+
case DataChannel::ADC_CHANNEL:
939+
return "V";
940+
default:
941+
return "uV";
942+
}
943+
}
944+
932945

933946
int RHD2000Thread::getNumTTLOutputs(int subproc) const
934947
{

Source/Processors/DataThreads/RhythmNode/RHD2000Thread.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ class RHD2000Thread : public DataThread
126126
String getChannelName (int ch) const;
127127
void setNumChannels (int hsNum, int nChannels);
128128

129+
String getChannelUnits(int chanIndex) const override;
130+
129131
int getHeadstageChannels (int hsNum) const;
130132
int getActiveChannelsInHeadstage (int hsNum) const;
131133

Source/Processors/SourceNode/SourceNode.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ void SourceNode::updateSettings()
109109
{
110110
dataThread->updateChannels();
111111
resizeBuffers();
112+
int nChans = dataChannelArray.size();
113+
for (int i = 0; i < nChans; i++)
114+
{
115+
String unit = dataThread->getChannelUnits(i);
116+
if (unit.isNotEmpty())
117+
dataChannelArray[i]->setDataUnits(unit);
118+
}
112119
}
113120
}
114121

0 commit comments

Comments
 (0)