Skip to content

Migrate to DAQiFi Core Device Interfaces #164

@tylerkron

Description

@tylerkron

Migrate to DAQiFi Core Device Interfaces

Overview

Begin migrating from the current desktop-specific device interfaces to the new standardized interfaces in the daqifi-core library. This will be the first step in a series of incremental migrations to consolidate device interaction logic.

Background

The daqifi-core library now provides standardized device interfaces that replace the desktop-specific implementations:

  • IDevice - Base interface for all DAQiFi devices
  • IStreamingDevice - Interface for devices that support data streaming
  • ✅ Associated enums and event args
  • ✅ Comprehensive XML documentation
  • ✅ 86 unit tests with full coverage
  • ✅ .NET 8.0 and 9.0 compatibility

Migration Strategy

This will be an incremental, non-breaking migration:

Phase 1: Add Core Library Reference ⬅️ THIS ISSUE

  • Add project reference to daqifi-core
  • No changes to existing functionality
  • Ensure builds and tests pass

Phase 2: Introduce Core Interfaces Alongside Existing

  • Start using Daqifi.Core.Device.IDevice in new code
  • Keep existing interfaces working
  • Add adapter pattern if needed

Phase 3: Gradual Replacement

  • Replace existing device implementations one by one
  • Maintain backward compatibility
  • Update unit tests incrementally

Technical Details

Add Project Reference

<!-- In relevant .csproj files -->
<ItemGroup>
  <ProjectReference Include="..\..\daqifi-core\src\Daqifi.Core\Daqifi.Core.csproj" />
</ItemGroup>

Usage Example

using Daqifi.Core.Device;

// New standardized interface
IDevice device = new DaqifiDevice("My Device", ipAddress);
device.StatusChanged += (s, e) => Console.WriteLine($"Status: {e.Status}");
device.MessageReceived += (s, e) => ProcessMessage(e.Message);

Current Desktop Architecture Integration

Based on the existing sequence diagram:

DAQiFiHardware → IStreamingDevice → MessageConsumer → IDevice → IChannel

The core library interfaces will slot in naturally:

// Keep existing MessageConsumer, but use core events
var coreDevice = new DaqifiStreamingDevice("Device1", ipAddress);
coreDevice.MessageReceived += (s, e) => messageConsumer.ProcessMessage(e.Message);

Acceptance Criteria

  • Add daqifi-core project reference to desktop solution
  • Verify all existing tests pass
  • Create one example usage of core interfaces
  • Document integration approach
  • No breaking changes to existing functionality

Benefits

  • 🔄 Incremental: No big-bang changes
  • 🧪 Testable: Each change can be tested independently
  • 🔧 Maintainable: Single source of truth for device logic
  • 🚀 Reusable: Core library can be used by other applications
  • 📚 Documented: Comprehensive XML docs and examples

Next Steps

After this integration:

  1. Connection Management implementation
  2. Device Discovery Services
  3. Message Consumer migration
  4. Channel Configuration migration

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions