Class NINetworkDaq
- All Implemented Interfaces:
NetworkDataUser
,PamSettings
,SettingsNameProvider
- Author:
- Doug Gillespie
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
Fields inherited from class Acquisition.DaqSystem
PARAMETER_FIXED, PARAMETER_UNKNOWN, STREAM_CLOSED, STREAM_ENDED, STREAM_OPEN, STREAM_PAUSED, STREAM_RUNNING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canPlayBack
(float sampleRate) void
cRioCommandLineError
(CRioErrorStrings cRioError) void
Called after DAQ has stopped - for whatever reason.boolean
Called by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog component.void
Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's fieldsgetDaqSpecificDialogComponent
(AcquisitionDialog acquisitionDialog) The AcquisitionDialog has been designed to that each data source type can plug in it's own panel of device specific controls.int
Gets a name for the acquisition device (may just be a number but need to generalise).int
int
double
getPeak2PeakVoltage
(int swChannel) getPlaybackSystem
(PlaybackControl playbackControl, DaqSystem daqSystem) Gets a playback system for playing sound back out through headphones / speakers, etc.long
long
boolean
interpretData
(Socket socket, short dataVersion2, short dataId1, int dataId2, int dataLen, byte[] duBuffer) interpretData
(NetworkObject receivedData) interpretHeadInfo
(int dataLen, byte[] duBuffer) Called when Network header data arrive.boolean
void
newReceivedDataUnit
(BuoyStatusDataUnit buoyStatusDataUnit, PamDataUnit dataUnit) boolean
prepareSystem
(AcquisitionControl daqControl) Prepare the DaqSystem.boolean
restoreSettings
(PamControlledUnitSettings pamControlledUnitSettings) void
setSelected
(boolean select) Tell a DAQ system it's been selected or deselected.void
socketClosed
(NetworkReceiveThread networkReceiveThread) boolean
startSystem
(AcquisitionControl daqControl) Start the DaqSystem.void
stopSystem
(AcquisitionControl daqControl) Stop the DaqSystem.Methods inherited from class Acquisition.DaqSystem
areSampleSettingsOk, getChannelGain, getDaqSpecificChannelListNode, getDaqSpecificChannelListPanel, getDAQSpecificPane, getInputChannelMap, getSampleBits, getStreamStatus, notifyModelChanged, setStreamStatus, showSampleSettingsDialog, supportsChannelLists
-
Field Details
-
NET_AUDIO_HEADINFO
public static final int NET_AUDIO_HEADINFO- See Also:
-
NET_AUDIO_SOUND
public static final int NET_AUDIO_SOUND- See Also:
-
-
Constructor Details
-
NINetworkDaq
-
-
Method Details
-
getLastTemperature
-
getSystemType
- Specified by:
getSystemType
in classDaqSystem
- Returns:
- The 'type' of data source for display in the Data Source dialog
Calling functions should be able to handle 'null'
-
getSystemName
- Specified by:
getSystemName
in classDaqSystem
- Returns:
- A string describing the data source, e.g. the sound card name, file name, udp port, etc.
-
getDaqSpecificDialogComponent
Description copied from class:DaqSystem
The AcquisitionDialog has been designed to that each data source type can plug in it's own panel of device specific controls. These could be things like a file name, gain settings, channel lists, whatever is available for the specific deviceThe AcquisitionDialog will handle placing this component on the dialog when a particular DaqSystem is selected. The component will be placed between a drop down list of available DaqSystem's and a section of the dialog showing the sample rate and number of channels.
- Specified by:
getDaqSpecificDialogComponent
in classDaqSystem
- Parameters:
acquisitionDialog
- the AcquisitionDialog this component will be added to- Returns:
- dialog component specific to this DAQ device
-
dialogSetParams
public void dialogSetParams()Description copied from class:DaqSystem
Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's fields- Specified by:
dialogSetParams
in classDaqSystem
-
dialogGetParams
public boolean dialogGetParams()Description copied from class:DaqSystem
Called by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog component. The DaqSystem should also implement PamSettings and handle storage of parameters between runs.- Specified by:
dialogGetParams
in classDaqSystem
- Returns:
- true if the parameters and selections are OK. If false is returned the Acquisition dialog will not respond to its Ok button.
-
getMaxChannels
public int getMaxChannels()- Specified by:
getMaxChannels
in classDaqSystem
- Returns:
- the maximum number of channels supporrted by the selected device, or PARAMETER_UNKNOWN
-
getMaxSampleRate
public int getMaxSampleRate()- Specified by:
getMaxSampleRate
in classDaqSystem
- Returns:
- the maximum sample rate supporrted by the selected device, or PARAMETER_UNKNOWN
-
getPeak2PeakVoltage
public double getPeak2PeakVoltage(int swChannel) - Specified by:
getPeak2PeakVoltage
in classDaqSystem
- Returns:
- peak to peak voltage for the device or PARAMETER_UNKNOWN
-
prepareSystem
Description copied from class:DaqSystem
Prepare the DaqSystem.Usually this is the time for opening files, preparing data buffers, etc.
- Specified by:
prepareSystem
in classDaqSystem
- Parameters:
daqControl
- AcquisitionControl unit.- Returns:
- true if OK, false otherwise.
-
startSystem
Description copied from class:DaqSystem
Start the DaqSystem. This is called immediately after PrepareSystemMost things should be ready from the call to PrepareSystem. In StartSystem you will generally need to start a thread which will read in the data and place PamDataUnits in a buffer from where they are read by the main thred and passed on to other Pam modules for processing (see SoundCardSystem for an example)
- Specified by:
startSystem
in classDaqSystem
- Parameters:
daqControl
- AcquisitionControl unit.- Returns:
- true if OK, false otherwise
-
stopSystem
Description copied from class:DaqSystem
Stop the DaqSystem.- Specified by:
stopSystem
in classDaqSystem
-
isRealTime
public boolean isRealTime()- Specified by:
isRealTime
in classDaqSystem
- Returns:
- true for real time systems (e.g. sound cards, NI cards, wav files which are being played back over speakers. false for reading files which are to be processed as fast as possible with no playback.
-
canPlayBack
public boolean canPlayBack(float sampleRate) - Specified by:
canPlayBack
in classDaqSystem
- Returns:
- true if the system can also play back sound - likely to be true for sound cards and ASIO, and some NI cards, false for wav files. Simulator ?
-
getPlaybackSystem
Description copied from class:DaqSystem
Gets a playback system for playing sound back out through headphones / speakers, etc.Generally, anything acquiring data in real time should play the sound back through itself so that clocks are correctly synchronised. i.e. A sound card input will go to the same sound card output, etc. At a later date, we may try to support output through different devices at different speeds - but this will be problematic !
If data are being read from a file, then playback is through a sound card which sits in a stand alone implementation of PlaybackSystem
- Overrides:
getPlaybackSystem
in classDaqSystem
- Returns:
- null if no playback available or a PlaybackSystem object.
- See Also:
-
getDataUnitSamples
public int getDataUnitSamples()- Specified by:
getDataUnitSamples
in classDaqSystem
- Returns:
- the number of samples expected in each data unit.
-
daqHasEnded
public void daqHasEnded()Description copied from class:DaqSystem
Called after DAQ has stopped - for whatever reason. Nost DAQ systems will not need to do anything here, but they could potentially clean up memory The motivation for putting this here now is for the folder analysis system so that it can start analysing the next file.- Specified by:
daqHasEnded
in classDaqSystem
-
getDeviceName
Description copied from class:DaqSystem
Gets a name for the acquisition device (may just be a number but need to generalise).- Specified by:
getDeviceName
in classDaqSystem
- Returns:
-
interpretData
public boolean interpretData(Socket socket, short dataVersion2, short dataId1, int dataId2, int dataLen, byte[] duBuffer) -
interpretHeadInfo
Called when Network header data arrive. This is an xml string in the same format as sits in the header of x3a files and contains everything we need to know about the forthcoming data stream.- Parameters:
dataLen
-duBuffer
-buoyStatusDataUnit
-- Returns:
- true if decoded successfully.
-
interpretData
- Specified by:
interpretData
in interfaceNetworkDataUser
-
socketClosed
- Specified by:
socketClosed
in interfaceNetworkDataUser
-
getUnitName
- Specified by:
getUnitName
in interfaceSettingsNameProvider
- Returns:
- A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
-
getUnitType
- Specified by:
getUnitType
in interfacePamSettings
- Returns:
- A Name specific to the type, e.g. Click detector
-
getSettingsReference
- Specified by:
getSettingsReference
in interfacePamSettings
- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersion
in interfacePamSettings
- Returns:
- An integer version number for the settings
-
restoreSettings
- Specified by:
restoreSettings
in interfacePamSettings
- Returns:
- true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
-
getStallCheckSeconds
public long getStallCheckSeconds()- Overrides:
getStallCheckSeconds
in classDaqSystem
- Returns:
- how often its reasonable to check whether or not the system has stalled.
-
cRioCommandLineError
-
setSelected
public void setSelected(boolean select) Description copied from class:DaqSystem
Tell a DAQ system it's been selected or deselected.- Overrides:
setSelected
in classDaqSystem
-
getStatusBarComponent
- Overrides:
getStatusBarComponent
in classDaqSystem
-
getNiNetParams
- Returns:
- the niNetParams
-
newReceivedDataUnit
- Specified by:
newReceivedDataUnit
in interfaceNetworkDataUser
-