Skip to content

Commit 7a2cfd7

Browse files
committed
Update how stream names are created
1 parent f62173a commit 7a2cfd7

File tree

12 files changed

+57
-30
lines changed

12 files changed

+57
-30
lines changed

Source/Devices/AnalogIO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ AnalogIO::AnalogIO (std::string name, std::string hubName, const oni_dev_idx_t d
2828
: OnixDevice (name, hubName, AnalogIO::getDeviceType(), deviceIdx_, oni_ctx)
2929
{
3030
StreamInfo analogInputStream = StreamInfo (
31-
OnixDevice::createStreamName ({ getHubName(), name, "AnalogInput" }),
31+
createStreamName ("AnalogInput", false),
3232
"Analog Input data",
3333
getStreamIdentifier(),
3434
numChannels,

Source/Devices/Bno055.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
3131

3232
std::string port = getPortName (deviceIdx);
3333
StreamInfo eulerAngleStream = StreamInfo (
34-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Euler" }),
34+
createStreamName ("Euler"),
3535
"Bosch Bno055 9-axis inertial measurement unit (IMU) Euler angle",
3636
streamIdentifier,
3737
3,
@@ -46,7 +46,7 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
4646
streamInfos.add (eulerAngleStream);
4747

4848
StreamInfo quaternionStream = StreamInfo (
49-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Quaternion" }),
49+
createStreamName ("Quaternion"),
5050
"Bosch Bno055 9-axis inertial measurement unit (IMU) Quaternion",
5151
streamIdentifier,
5252
4,
@@ -61,7 +61,7 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
6161
streamInfos.add (quaternionStream);
6262

6363
StreamInfo accelerationStream = StreamInfo (
64-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Acceleration" }),
64+
createStreamName ("Acceleration"),
6565
"Bosch Bno055 9-axis inertial measurement unit (IMU) Acceleration",
6666
streamIdentifier,
6767
3,
@@ -76,7 +76,7 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
7676
streamInfos.add (accelerationStream);
7777

7878
StreamInfo gravityStream = StreamInfo (
79-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Gravity" }),
79+
createStreamName ("Gravity"),
8080
"Bosch Bno055 9-axis inertial measurement unit (IMU) Gravity",
8181
streamIdentifier,
8282
3,
@@ -91,7 +91,7 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
9191
streamInfos.add (gravityStream);
9292

9393
StreamInfo temperatureStream = StreamInfo (
94-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Temperature" }),
94+
createStreamName ("Temperature"),
9595
"Bosch Bno055 9-axis inertial measurement unit (IMU) Temperature",
9696
streamIdentifier,
9797
1,
@@ -105,7 +105,7 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
105105
streamInfos.add (temperatureStream);
106106

107107
StreamInfo calibrationStatusStream = StreamInfo (
108-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Calibration" }),
108+
createStreamName ("Calibration"),
109109
"Bosch Bno055 9-axis inertial measurement unit (IMU) Calibration status",
110110
streamIdentifier,
111111
4,

Source/Devices/DigitalIO.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ DigitalIO::DigitalIO (std::string name, std::string hubName, const oni_dev_idx_t
2929
: OnixDevice (name, hubName, DigitalIO::getDeviceType(), deviceIdx_, oni_ctx)
3030
{
3131
StreamInfo digitalInputStream = StreamInfo (
32-
OnixDevice::createStreamName ({ getHubName(), name, "DigitalInputs" }),
32+
createStreamName ({ getHubName(), name, "DigitalInputs" }),
3333
"Digital Inputs data",
3434
getStreamIdentifier(),
3535
NumDigitalInputs,
@@ -43,7 +43,7 @@ DigitalIO::DigitalIO (std::string name, std::string hubName, const oni_dev_idx_t
4343
streamInfos.add (digitalInputStream);
4444

4545
StreamInfo digitalButtonStream = StreamInfo (
46-
OnixDevice::createStreamName ({ getHubName(), name, "DigitalButtons" }),
46+
createStreamName ({ getHubName(), name, "DigitalButtons" }),
4747
"Digital Buttons data",
4848
getStreamIdentifier(),
4949
NumButtons,
@@ -111,7 +111,7 @@ EventChannel::Settings DigitalIO::getEventChannelSettings (DataStream* stream)
111111
{
112112
EventChannel::Settings settings {
113113
EventChannel::Type::TTL,
114-
OnixDevice::createStreamName ({ getHubName(), getName(), "Events" }),
114+
createStreamName ("Events", false),
115115
"Digital inputs and breakout button states coming from a DigitalIO device",
116116
getStreamIdentifier() + ".event.digital",
117117
stream,

Source/Devices/HarpSyncInput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ HarpSyncInput::HarpSyncInput (std::string name, std::string hubName, const oni_d
3030
setEnabled (false);
3131

3232
StreamInfo harpTimeStream = StreamInfo (
33-
OnixDevice::createStreamName ({ getHubName(), getName(), "HarpTime" }),
33+
createStreamName ("HarpTime", false),
3434
"Harp clock time corresponding to the local acquisition ONIX clock count",
3535
getStreamIdentifier(),
3636
1,

Source/Devices/MemoryMonitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ MemoryMonitor::MemoryMonitor (std::string name, std::string hubName, const oni_d
7878
: OnixDevice (name, hubName, MemoryMonitor::getDeviceType(), deviceIdx_, oni_ctx)
7979
{
8080
StreamInfo percentUsedStream = StreamInfo (
81-
OnixDevice::createStreamName ({ getHubName(), getName(), "PercentUsed" }),
81+
createStreamName ("PercentUsed", false),
8282
"Percent of available memory that is currently used",
8383
getStreamIdentifier(),
8484
1,

Source/Devices/Neuropixels1e.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Neuropixels1e::Neuropixels1e (std::string name, std::string hubName, const oni_d
8080
{
8181
std::string port = getPortName (getDeviceIdx());
8282
StreamInfo apStream = StreamInfo (
83-
OnixDevice::createStreamName ({ port, getHubName(), getName(), STREAM_NAME_AP }),
83+
createStreamName (STREAM_NAME_AP),
8484
"Neuropixels 1.0 AP band data stream",
8585
getStreamIdentifier(),
8686
numberOfChannels,
@@ -94,7 +94,7 @@ Neuropixels1e::Neuropixels1e (std::string name, std::string hubName, const oni_d
9494
streamInfos.add (apStream);
9595

9696
StreamInfo lfpStream = StreamInfo (
97-
OnixDevice::createStreamName ({ port, getHubName(), getName(), STREAM_NAME_LFP }),
97+
createStreamName (STREAM_NAME_LFP),
9898
"Neuropixels 1.0 LFP band data stream",
9999
getStreamIdentifier(),
100100
numberOfChannels,

Source/Devices/Neuropixels1f.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Neuropixels1f::Neuropixels1f (std::string name, std::string hubName, const oni_d
6868
{
6969
std::string port = getPortName (deviceIdx);
7070
StreamInfo apStream = StreamInfo (
71-
OnixDevice::createStreamName ({ port, getHubName(), getName(), STREAM_NAME_AP }),
71+
createStreamName (STREAM_NAME_AP),
7272
"Neuropixels 1.0 AP band data stream",
7373
getStreamIdentifier(),
7474
numberOfChannels,
@@ -82,7 +82,7 @@ Neuropixels1f::Neuropixels1f (std::string name, std::string hubName, const oni_d
8282
streamInfos.add (apStream);
8383

8484
StreamInfo lfpStream = StreamInfo (
85-
OnixDevice::createStreamName ({ port, getHubName(), getName(), STREAM_NAME_LFP }),
85+
createStreamName (STREAM_NAME_LFP),
8686
"Neuropixels 1.0 LFP band data stream",
8787
getStreamIdentifier(),
8888
numberOfChannels,

Source/Devices/Neuropixels2e.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Neuropixels2e::~Neuropixels2e()
5757
void Neuropixels2e::createDataStream (int n)
5858
{
5959
StreamInfo apStream = StreamInfo (
60-
OnixDevice::createStreamName ({ getPortName (getDeviceIdx()), getHubName(), "Probe" + std::to_string (n) }),
60+
createStreamName ("Probe" + std::to_string (n)),
6161
"Neuropixels 2.0 data stream",
6262
getStreamIdentifier(),
6363
numberOfChannels,

Source/Devices/PolledBno055.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
3333

3434
std::string port = getPortName (deviceIdx);
3535
StreamInfo eulerAngleStream = StreamInfo (
36-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Euler" }),
36+
createStreamName ("Euler"),
3737
"Bosch Bno055 9-axis inertial measurement unit (IMU) Euler angle",
3838
streamIdentifier,
3939
3,
@@ -48,7 +48,7 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
4848
streamInfos.add (eulerAngleStream);
4949

5050
StreamInfo quaternionStream = StreamInfo (
51-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Quaternion" }),
51+
createStreamName ("Quaternion"),
5252
"Bosch Bno055 9-axis inertial measurement unit (IMU) Quaternion",
5353
streamIdentifier,
5454
4,
@@ -63,7 +63,7 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
6363
streamInfos.add (quaternionStream);
6464

6565
StreamInfo accelerationStream = StreamInfo (
66-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Acceleration" }),
66+
createStreamName ("Acceleration"),
6767
"Bosch Bno055 9-axis inertial measurement unit (IMU) Acceleration",
6868
streamIdentifier,
6969
3,
@@ -78,7 +78,7 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
7878
streamInfos.add (accelerationStream);
7979

8080
StreamInfo gravityStream = StreamInfo (
81-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Gravity" }),
81+
createStreamName ("Gravity"),
8282
"Bosch Bno055 9-axis inertial measurement unit (IMU) Gravity",
8383
streamIdentifier,
8484
3,
@@ -93,7 +93,7 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
9393
streamInfos.add (gravityStream);
9494

9595
StreamInfo temperatureStream = StreamInfo (
96-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Temperature" }),
96+
createStreamName ("Temperature"),
9797
"Bosch Bno055 9-axis inertial measurement unit (IMU) Temperature",
9898
streamIdentifier,
9999
1,
@@ -107,7 +107,7 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
107107
streamInfos.add (temperatureStream);
108108

109109
StreamInfo calibrationStatusStream = StreamInfo (
110-
OnixDevice::createStreamName ({ port, getHubName(), getName(), "Calibration" }),
110+
createStreamName ("Calibration"),
111111
"Bosch Bno055 9-axis inertial measurement unit (IMU) Calibration status",
112112
streamIdentifier,
113113
4,

Source/OnixDevice.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ std::string OnixDevice::createStreamName (std::vector<std::string> names)
7272
return streamName;
7373
}
7474

75+
std::string OnixDevice::createStreamName (std::string suffix, bool usePort)
76+
{
77+
std::vector<std::string> names;
78+
79+
if (usePort)
80+
names.push_back (getPortName (getDeviceIdx()));
81+
82+
names.push_back (getHubName());
83+
names.push_back (getName());
84+
85+
if (suffix != "")
86+
names.push_back (suffix);
87+
88+
return createStreamName (names);
89+
}
90+
7591
bool OnixDevice::isValidPassthroughIndex (oni_dev_idx_t passthroughIndex)
7692
{
7793
return passthroughIndex == (uint32_t) PassthroughIndex::A || passthroughIndex == (uint32_t) PassthroughIndex::B;
@@ -126,11 +142,14 @@ std::string OnixDevice::getStreamIdentifier()
126142
{
127143
std::string streamIdentifier = "onix";
128144

129-
// Insert the headstage or breakout board
130145
if (getHubName() == NEUROPIXELSV1F_HEADSTAGE_NAME)
131146
{
132147
streamIdentifier += ".npx1f";
133148
}
149+
else if (getHubName() == NEUROPIXELSV1E_HEADSTAGE_NAME)
150+
{
151+
streamIdentifier += ".npx1e";
152+
}
134153
else if (getHubName() == NEUROPIXELSV2E_HEADSTAGE_NAME)
135154
{
136155
streamIdentifier += ".npx2e";
@@ -141,10 +160,10 @@ std::string OnixDevice::getStreamIdentifier()
141160
}
142161
else
143162
{
163+
LOGD ("Unknown hub name found when creating the stream identifier: " + getHubName());
144164
streamIdentifier += ".headstage";
145165
}
146166

147-
// Insert the device
148167
if (getDeviceType() == OnixDeviceType::ANALOGIO)
149168
{
150169
streamIdentifier += ".analogio";
@@ -169,12 +188,17 @@ std::string OnixDevice::getStreamIdentifier()
169188
{
170189
streamIdentifier += ".npx1f";
171190
}
191+
else if (getDeviceType() == OnixDeviceType::NEUROPIXELSV1E)
192+
{
193+
streamIdentifier += ".npx1e";
194+
}
172195
else if (getDeviceType() == OnixDeviceType::NEUROPIXELSV2E)
173196
{
174197
streamIdentifier += ".npx2e";
175198
}
176199
else
177200
{
201+
LOGD ("Unknown device type found when creating the stream identifier.");
178202
streamIdentifier += ".device";
179203
}
180204

0 commit comments

Comments
 (0)