Skip to content

Commit

Permalink
Merge pull request #91 from neurogears/issue-52
Browse files Browse the repository at this point in the history
Add helper to get fully qualified hub device name
  • Loading branch information
glopesdev authored May 14, 2024
2 parents ac9806c + a801b23 commit dcb94f6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions OpenEphys.Onix/OpenEphys.Onix/HubDeviceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ public string Name
set
{
_name = value;
UpdateDeviceNames(_name);
UpdateDeviceNames();
}
}

internal virtual void UpdateDeviceNames(string hubName)
protected string GetFullDeviceName(string deviceName)
{
return !string.IsNullOrEmpty(_name) ? $"{_name}/{deviceName}" : string.Empty;
}

internal virtual void UpdateDeviceNames()
{
foreach (var device in GetDevices())
{
device.DeviceName = !string.IsNullOrEmpty(hubName)
? $"{hubName}.{device.DeviceType.Name}"
: string.Empty;
device.DeviceName = GetFullDeviceName(device.DeviceType.Name);
}
}

Expand Down

0 comments on commit dcb94f6

Please sign in to comment.