Jump to content

Programming Reference:NatusADC: Difference between revisions

From BCI2000 Wiki
No edit summary
No edit summary
Line 1: Line 1:
NatusADC module has 3 main classes - NatusPackageInterface, NatusDataServer and NatusClient.
NatusADC module has 3 main classes - NatusPackageInterface, NatusDataServer and NatusClient.
'''Need to add image'''


== NatusPackageInterface ==
== NatusPackageInterface ==
This class handles the communication between the server/device and the client. It should be included with both - NatusDataServer and NatusClient Class. The class performs the following functions
- constructing TCP and UDP packets, calculating the CRC of a packet and checking the CRC on the receiving side, sending the packets over TCP/UDP port, receiving packets over TCP/UDP Port, reconstructing the data from the packets and listening for connections on device/server-side.
<br/>
The format of the packets constructed is as follows:
'''Need to add image'''
Length of the packet, command, payload, payload-length, CRC


== NatusDataServer ==
== NatusDataServer ==
This class handles the server-side processing. It performs the following functions - starts-up the TCP and UDP server, check for new connections, gracefully disconnects from the client, registers various callbacks on client connection and deregister the callbacks when the client disconnects and responds to the following commands from the client via TCP protocol:
* CMD_Ping
* CMD_GetInformation
* CMD_GetChannelNames
* CMD_StartStream
* CMD_StopStream
* CMD_SelectChannels
* CMD_SetBlockSize
* CMD_GetDecimationFactor
* CMD_SetDecimationFactor


== NatusClient ==
== NatusClient ==
This class handles the client-side processing. It connects with the server/device, gets data from the operator module of the NatusADC and sends it to the server/device. It uses various commands as described in the NatusDataServer to set different parameters. Another important function of this class is to interpolate the missing UDP packets.

Revision as of 16:58, 22 May 2019

NatusADC module has 3 main classes - NatusPackageInterface, NatusDataServer and NatusClient. Need to add image

NatusPackageInterface

This class handles the communication between the server/device and the client. It should be included with both - NatusDataServer and NatusClient Class. The class performs the following functions

- constructing TCP and UDP packets, calculating the CRC of a packet and checking the CRC on the receiving side, sending the packets over TCP/UDP port, receiving packets over TCP/UDP Port, reconstructing the data from the packets and listening for connections on device/server-side.


The format of the packets constructed is as follows: Need to add image Length of the packet, command, payload, payload-length, CRC

NatusDataServer

This class handles the server-side processing. It performs the following functions - starts-up the TCP and UDP server, check for new connections, gracefully disconnects from the client, registers various callbacks on client connection and deregister the callbacks when the client disconnects and responds to the following commands from the client via TCP protocol:

  • CMD_Ping
  • CMD_GetInformation
  • CMD_GetChannelNames
  • CMD_StartStream
  • CMD_StopStream
  • CMD_SelectChannels
  • CMD_SetBlockSize
  • CMD_GetDecimationFactor
  • CMD_SetDecimationFactor

NatusClient

This class handles the client-side processing. It connects with the server/device, gets data from the operator module of the NatusADC and sends it to the server/device. It uses various commands as described in the NatusDataServer to set different parameters. Another important function of this class is to interpolate the missing UDP packets.