From db44f9fc73f31ae740120b92330c98315450a0d4 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Tue, 26 Sep 2023 15:59:52 +0100 Subject: [PATCH] Allow setting hub base name --- OpenEphys.Onix/OpenEphys.Onix/Headstage64.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenEphys.Onix/OpenEphys.Onix/Headstage64.cs b/OpenEphys.Onix/OpenEphys.Onix/Headstage64.cs index 4d2142c5..c40c3105 100644 --- a/OpenEphys.Onix/OpenEphys.Onix/Headstage64.cs +++ b/OpenEphys.Onix/OpenEphys.Onix/Headstage64.cs @@ -1,9 +1,10 @@ using System.Collections.Generic; using System.ComponentModel; +using Bonsai; namespace OpenEphys.Onix { - public class Headstage64 : HubDeviceFactory + public class Headstage64 : HubDeviceFactory, INamedElement { PortName port; readonly ConfigureFmcLinkController LinkController = new(); @@ -16,9 +17,13 @@ public Headstage64() LinkController.MaxVoltage = 7.0; } + public string Name { get; set; } + + [Category(ConfigurationCategory)] [TypeConverter(typeof(HubDeviceConverter))] public ConfigureRhd2164 Rhd2164 { get; set; } = new(); + [Category(ConfigurationCategory)] [TypeConverter(typeof(HubDeviceConverter))] public ConfigureBno055 Bno055 { get; set; } = new(); @@ -29,6 +34,8 @@ public PortName Port { port = value; LinkController.DeviceAddress = (uint)port; + Rhd2164.DeviceName = !string.IsNullOrEmpty(Name) ? $"{Name}.Rhd2164" : null; + Bno055.DeviceName = !string.IsNullOrEmpty(Name) ? $"{Name}.Bno055" : null; Rhd2164.DeviceAddress = ((uint)port << 8) + 0; Bno055.DeviceAddress = ((uint)port << 8) + 1; }