Symphony-DAS / symphony-matlab

Symphony Data Acquisition System
http://symphony-das.github.io
MIT License
19 stars 5 forks source link

ITC1600 board integration on HekaDaqController #1

Closed ragavsathish closed 9 years ago

ragavsathish commented 9 years ago

Current HekaDaqController.m can create only one kind of daq.

cobj = Heka.HekaDAQController(double(Heka.NativeInterop.ITCMM.USB18_ID), 0);

But I need to create cobj based on board (ITC1600_ID or USB18_ID). Is it advisable to modify HekaDaqController constructor to take an argument and create cobj based on it ?

classdef HekaDaqController < symphonyui.core.DaqController
    enumeration
        ITC1600, ITC18
     ...
function obj = HekaDaqController(board)
           ....
            if(board == HekaDaqController.ITC18)
                cobj = Heka.HekaDAQController(double(Heka.NativeInterop.ITCMM.USB18_ID), 0);
            elseif(board == HekaDaqController.ITC1600)
                cobj = Heka.HekaDAQController(double(Heka.NativeInterop.ITCMM.ITC1600_ID), 0);
            else
                error(['board should either be ITC1600 or ITC18']);
            end

Kindly clarify

cafarm commented 9 years ago

Yeah, that sounds good. The enumeration should probably go in it's own class (maybe "HekaDeviceType") or be avoided all together using a string instead.

If we're expanding it to support the ITC1600, we might as well include the other available options (ITC16, USB16, ITC18, USB18, ITC00, ITC1600).

function obj = HekaDaqController(deviceType, deviceNumber)
    import symphonyui.builtin.daqs.HekaDeviceType;

    if nargin < 1
        deviceType = HekaDeviceType.USB18;
    end
    if nargin < 2
        deviceNumber = 0;
    end

    NET.addAssembly(which('HekaDAQInterface.dll'));
    NET.addAssembly(which('HekaNativeInterop.dll'));

    switch deviceType
        case HekaDeviceType.ITC16
            ctype = Heka.NativeInterop.ITCMM.ITC16_ID;
        case HekaDeviceType.ITC18
            ctype = Heka.NativeInterop.ITCMM.ITC18_ID;
        case HekaDeviceType.ITC1600
            ctype = Heka.NativeInterop.ITCMM.ITC1600_ID;
        case HekaDeviceType.ITC00
            ctype = Heka.NativeInterop.ITCMM.ITC00_ID;
        case HekaDeviceType.USB16
            ctype = Heka.NativeInterop.ITCMM.USB16_ID;
        case HekaDeviceType.USB18
            ctype = Heka.NativeInterop.ITCMM.USB18_ID;
        otherwise
            error('Unknown device type');
    end

    cobj = Heka.HekaDAQController(double(ctype), deviceNumber);
    obj@symphonyui.core.DaqController(cobj);'

...
cafarm commented 9 years ago

Closed with 8dd7ebcedcb523e1aa7b75e71427b4612d37e41b