cbsdk_cython.pxd 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. '''
  2. @date March 9, 2014
  3. @author: dashesy
  4. Purpose: Cython interface for cbsdk_small
  5. '''
  6. from libc.stdint cimport uint32_t, int32_t, uint16_t, int16_t, uint8_t
  7. from libcpp cimport bool
  8. cdef extern from "cbhwlib.h":
  9. cdef char* cbNET_UDP_ADDR_INST "cbNET_UDP_ADDR_INST" # Cerebus default address
  10. cdef char* cbNET_UDP_ADDR_CNT "cbNET_UDP_ADDR_CNT" # NSP default control address
  11. cdef char* cbNET_UDP_ADDR_BCAST "cbNET_UDP_ADDR_BCAST" # NSP default broadcast address
  12. cdef int cbNET_UDP_PORT_BCAST "cbNET_UDP_PORT_BCAST" # Neuroflow Data Port
  13. cdef int cbNET_UDP_PORT_CNT "cbNET_UDP_PORT_CNT" # Neuroflow Control Port
  14. # Have to put constants that are used as array sizes in an enum,
  15. # otherwise they are considered non-const and can't be used.
  16. cdef enum cbhwlib_consts:
  17. cbNUM_FE_CHANS = 128
  18. cbNUM_ANAIN_CHANS = 16
  19. cbNUM_ANALOG_CHANS = (cbNUM_FE_CHANS + cbNUM_ANAIN_CHANS)
  20. cbNUM_ANAOUT_CHANS = 4
  21. cbNUM_AUDOUT_CHANS = 2
  22. cbNUM_ANALOGOUT_CHANS = (cbNUM_ANAOUT_CHANS + cbNUM_AUDOUT_CHANS)
  23. cbNUM_DIGIN_CHANS = 1
  24. cbNUM_SERIAL_CHANS = 1
  25. cbNUM_DIGOUT_CHANS = 4
  26. cbMAXCHANS = (cbNUM_ANALOG_CHANS + cbNUM_ANALOGOUT_CHANS + cbNUM_DIGIN_CHANS + cbNUM_SERIAL_CHANS + cbNUM_DIGOUT_CHANS)
  27. cbMAXUNITS = 5
  28. MAX_CHANS_DIGITAL_IN = (cbNUM_FE_CHANS+cbNUM_ANAIN_CHANS+4+2+1)
  29. MAX_CHANS_SERIAL = (MAX_CHANS_DIGITAL_IN+1)
  30. cbMAXTRACKOBJ = 20 # maximum number of trackable objects
  31. cbMAXHOOPS = 4
  32. cbPKT_SPKCACHEPKTCNT = 400
  33. cbMAX_PNTS = 128 # make large enough to track longest possible spike width in samples
  34. cdef enum cbwlib_strconsts:
  35. cbLEN_STR_UNIT = 8
  36. cbLEN_STR_LABEL = 16
  37. #cbLEN_STR_FILT_LABEL = 16
  38. cbLEN_STR_IDENT = 64
  39. cdef enum cbStateCCF:
  40. CCFSTATE_READ = 0 # Reading in progress
  41. CCFSTATE_WRITE = 1 # Writing in progress
  42. CCFSTATE_SEND = 2 # Sendign in progress
  43. CCFSTATE_CONVERT = 3 # Conversion in progress
  44. CCFSTATE_THREADREAD = 4 # Total threaded read progress
  45. CCFSTATE_THREADWRITE = 5 # Total threaded write progress
  46. CCFSTATE_UNKNOWN = 6 # (Always the last) unknown state
  47. # TODO: use cdef for each item instead?
  48. cdef enum cbhwlib_cbFILECFG:
  49. cbFILECFG_OPT_NONE = 0x00000000
  50. cbFILECFG_OPT_KEEPALIVE = 0x00000001
  51. cbFILECFG_OPT_REC = 0x00000002
  52. cbFILECFG_OPT_STOP = 0x00000003
  53. cbFILECFG_OPT_NMREC = 0x00000004
  54. cbFILECFG_OPT_CLOSE = 0x00000005
  55. cbFILECFG_OPT_SYNCH = 0x00000006
  56. cbFILECFG_OPT_OPEN = 0x00000007
  57. ctypedef struct cbSCALING:
  58. int16_t digmin # digital value that cooresponds with the anamin value
  59. int16_t digmax # digital value that cooresponds with the anamax value
  60. int32_t anamin # the minimum analog value present in the signal
  61. int32_t anamax # the maximum analog value present in the signal
  62. int32_t anagain # the gain applied to the default analog values to get the analog values
  63. char anaunit[cbLEN_STR_UNIT+0] # the unit for the analog signal (eg, "uV" or "MPa")
  64. ctypedef struct cbFILTDESC:
  65. char label[cbLEN_STR_LABEL+0]
  66. uint32_t hpfreq # high-pass corner frequency in milliHertz
  67. uint32_t hporder # high-pass filter order
  68. uint32_t hptype # high-pass filter type
  69. uint32_t lpfreq # low-pass frequency in milliHertz
  70. uint32_t lporder # low-pass filter order
  71. uint32_t lptype # low-pass filter type
  72. ctypedef struct cbMANUALUNITMAPPING:
  73. int16_t nOverride
  74. int16_t afOrigin[3]
  75. int16_t afShape[3][3]
  76. int16_t aPhi
  77. uint32_t bValid # is this unit in use at this time?
  78. ctypedef struct cbHOOP:
  79. uint16_t valid # 0=undefined, 1 for valid
  80. int16_t time # time offset into spike window
  81. int16_t min # minimum value for the hoop window
  82. int16_t max # maximum value for the hoop window
  83. ctypedef struct cbPKT_CHANINFO:
  84. uint32_t time # system clock timestamp
  85. uint16_t chid # 0x8000
  86. uint8_t type # cbPKTTYPE_AINP*
  87. uint8_t dlen # cbPKT_DLENCHANINFO
  88. uint32_t chan # actual channel id of the channel being configured
  89. uint32_t proc # the address of the processor on which the channel resides
  90. uint32_t bank # the address of the bank on which the channel resides
  91. uint32_t term # the terminal number of the channel within it's bank
  92. uint32_t chancaps # general channel capablities (given by cbCHAN_* flags)
  93. uint32_t doutcaps # digital output capablities (composed of cbDOUT_* flags)
  94. uint32_t dinpcaps # digital input capablities (composed of cbDINP_* flags)
  95. uint32_t aoutcaps # analog output capablities (composed of cbAOUT_* flags)
  96. uint32_t ainpcaps # analog input capablities (composed of cbAINP_* flags)
  97. uint32_t spkcaps # spike processing capabilities
  98. cbSCALING physcalin # physical channel scaling information
  99. cbFILTDESC phyfiltin # physical channel filter definition
  100. cbSCALING physcalout # physical channel scaling information
  101. cbFILTDESC phyfiltout # physical channel filter definition
  102. char label[cbLEN_STR_LABEL+0]# Label of the channel (null terminated if <16 characters)
  103. uint32_t userflags # User flags for the channel state
  104. int32_t position[4] # reserved for future position information
  105. cbSCALING scalin # user-defined scaling information for AINP
  106. cbSCALING scalout # user-defined scaling information for AOUT
  107. uint32_t doutopts # digital output options (composed of cbDOUT_* flags)
  108. uint32_t dinpopts # digital input options (composed of cbDINP_* flags)
  109. uint32_t aoutopts # analog output options
  110. uint32_t eopchar # digital input capablities (given by cbDINP_* flags)
  111. uint32_t monsource
  112. int32_t outvalue # output value
  113. uint16_t lowsamples # address of channel to monitor
  114. uint16_t highsamples # address of channel to monitor
  115. int32_t offset
  116. uint8_t trigtype # trigger type (see cbDOUT_TRIGGER_*)
  117. uint16_t trigchan # trigger channel
  118. uint16_t trigval # trigger value
  119. uint32_t ainpopts # analog input options (composed of cbAINP* flags)
  120. uint32_t lncrate # line noise cancellation filter adaptation rate
  121. uint32_t smpfilter # continuous-time pathway filter id
  122. uint32_t smpgroup # continuous-time pathway sample group
  123. int32_t smpdispmin # continuous-time pathway display factor
  124. int32_t smpdispmax # continuous-time pathway display factor
  125. uint32_t spkfilter # spike pathway filter id
  126. int32_t spkdispmax # spike pathway display factor
  127. int32_t lncdispmax # Line Noise pathway display factor
  128. uint32_t spkopts # spike processing options
  129. int32_t spkthrlevel # spike threshold level
  130. int32_t spkthrlimit
  131. uint32_t spkgroup # NTrodeGroup this electrode belongs to - 0 is single unit, non-0 indicates a multi-trode grouping
  132. int16_t amplrejpos # Amplitude rejection positive value
  133. int16_t amplrejneg # Amplitude rejection negative value
  134. uint32_t refelecchan # Software reference electrode channel
  135. cbMANUALUNITMAPPING unitmapping[cbMAXUNITS+0] # manual unit mapping
  136. cbHOOP spkhoops[cbMAXUNITS+0][cbMAXHOOPS+0] # spike hoop sorting set
  137. ctypedef struct cbFILTDESC:
  138. char label[cbLEN_STR_LABEL+0]
  139. uint32_t hpfreq # high-pass corner frequency in milliHertz
  140. uint32_t hporder # high-pass filter order
  141. uint32_t hptype # high-pass filter type
  142. uint32_t lpfreq # low-pass frequency in milliHertz
  143. uint32_t lporder # low-pass filter order
  144. uint32_t lptype # low-pass filter type
  145. ctypedef struct cbPKT_SPK:
  146. uint32_t time # system clock timestamp
  147. uint16_t chid # channel identifier
  148. uint8_t unit # unit identification (0=unclassified, 1-5=classified, 255=artifact, 254=background)
  149. uint8_t dlen # length of what follows ... always cbPKTDLEN_SPK
  150. float fPattern[3] # values of the pattern space (Normal uses only 2, PCA uses third)
  151. int16_t nPeak
  152. int16_t nValley
  153. int16_t wave[cbMAX_PNTS+0] # Room for all possible points collected
  154. # wave must be the last item in the structure because it can be variable length to a max of cbMAX_PNTS
  155. ctypedef struct cbSPKCACHE:
  156. uint32_t chid # ID of the Channel
  157. uint32_t pktcnt # # of packets which can be saved
  158. uint32_t pktsize # Size of an individual packet
  159. uint32_t head # Where (0 based index) in the circular buffer to place the NEXT packet.
  160. uint32_t valid # How many packets have come in since the last configuration
  161. cbPKT_SPK spkpkt[cbPKT_SPKCACHEPKTCNT+0] # Circular buffer of the cached spikes
  162. cdef extern from "cbsdk.h":
  163. cdef int cbSdk_CONTINUOUS_DATA_SAMPLES = 102400
  164. cdef int cbSdk_EVENT_DATA_SAMPLES = (2 * 8192)
  165. cdef int cbSdk_MAX_UPOLOAD_SIZE = (1024 * 1024 * 1024)
  166. cdef float cbSdk_TICKS_PER_SECOND = 30000.0
  167. cdef float cbSdk_SECONDS_PER_TICK = 1.0 / cbSdk_TICKS_PER_SECOND
  168. ctypedef enum cbSdkResult:
  169. CBSDKRESULT_WARNCONVERT = 3 # If file conversion is needed
  170. CBSDKRESULT_WARNCLOSED = 2 # Library is already closed
  171. CBSDKRESULT_WARNOPEN = 1 # Library is already opened
  172. CBSDKRESULT_SUCCESS = 0 # Successful operation
  173. CBSDKRESULT_NOTIMPLEMENTED = -1 # Not implemented
  174. CBSDKRESULT_UNKNOWN = -2 # Unknown error
  175. CBSDKRESULT_INVALIDPARAM = -3 # Invalid parameter
  176. CBSDKRESULT_CLOSED = -4 # Interface is closed cannot do this operation
  177. CBSDKRESULT_OPEN = -5 # Interface is open cannot do this operation
  178. CBSDKRESULT_NULLPTR = -6 # Null pointer
  179. CBSDKRESULT_ERROPENCENTRAL = -7 # Unable to open Central interface
  180. CBSDKRESULT_ERROPENUDP = -8 # Unable to open UDP interface (might happen if default)
  181. CBSDKRESULT_ERROPENUDPPORT = -9 # Unable to open UDP port
  182. CBSDKRESULT_ERRMEMORYTRIAL = -10 # Unable to allocate RAM for trial cache data
  183. CBSDKRESULT_ERROPENUDPTHREAD = -11 # Unable to open UDP timer thread
  184. CBSDKRESULT_ERROPENCENTRALTHREAD = -12 # Unable to open Central communication thread
  185. CBSDKRESULT_INVALIDCHANNEL = -13 # Invalid channel number
  186. CBSDKRESULT_INVALIDCOMMENT = -14 # Comment too long or invalid
  187. CBSDKRESULT_INVALIDFILENAME = -15 # Filename too long or invalid
  188. CBSDKRESULT_INVALIDCALLBACKTYPE = -16 # Invalid callback type
  189. CBSDKRESULT_CALLBACKREGFAILED = -17 # Callback register/unregister failed
  190. CBSDKRESULT_ERRCONFIG = -18 # Trying to run an unconfigured method
  191. CBSDKRESULT_INVALIDTRACKABLE = -19 # Invalid trackable id, or trackable not present
  192. CBSDKRESULT_INVALIDVIDEOSRC = -20 # Invalid video source id, or video source not present
  193. CBSDKRESULT_ERROPENFILE = -21 # Cannot open file
  194. CBSDKRESULT_ERRFORMATFILE = -22 # Wrong file format
  195. CBSDKRESULT_OPTERRUDP = -23 # Socket option error (possibly permission issue)
  196. CBSDKRESULT_MEMERRUDP = -24 # Socket memory assignment error
  197. CBSDKRESULT_INVALIDINST = -25 # Invalid range or instrument address
  198. CBSDKRESULT_ERRMEMORY = -26 # library memory allocation error
  199. CBSDKRESULT_ERRINIT = -27 # Library initialization error
  200. CBSDKRESULT_TIMEOUT = -28 # Conection timeout error
  201. CBSDKRESULT_BUSY = -29 # Resource is busy
  202. CBSDKRESULT_ERROFFLINE = -30 # Instrument is offline
  203. CBSDKRESULT_INSTOUTDATED = -31 # The instrument runs an outdated protocol version
  204. CBSDKRESULT_LIBOUTDATED = -32 # The library is outdated
  205. ctypedef enum cbSdkConnectionType:
  206. CBSDKCONNECTION_DEFAULT = 0 # Try Central then UDP
  207. CBSDKCONNECTION_CENTRAL = 1 # Use Central
  208. CBSDKCONNECTION_UDP = 2 # Use UDP
  209. CBSDKCONNECTION_CLOSED = 3 # Closed
  210. ctypedef enum cbSdkInstrumentType:
  211. CBSDKINSTRUMENT_NSP = 0 # NSP
  212. CBSDKINSTRUMENT_NPLAY = 1 # Local nPlay
  213. CBSDKINSTRUMENT_LOCALNSP = 2 # Local NSP
  214. CBSDKINSTRUMENT_REMOTENPLAY = 3 # Remote nPlay
  215. # cbSdkCCFEvent. Skipping because it depends on cbStateCCF
  216. ctypedef enum cbSdkTrialType:
  217. CBSDKTRIAL_CONTINUOUS = 0
  218. CBSDKTRIAL_EVENTS = 1
  219. CBSDKTRIAL_COMMETNS = 2
  220. CBSDKTRIAL_TRACKING = 3
  221. ctypedef enum cbSdkWaveformType:
  222. cbSdkWaveform_NONE = 0
  223. cbSdkWaveform_PARAMETERS = 1
  224. cbSdkWaveform_SINE = 2
  225. cbSdkWaveform_COUNT = 3
  226. ctypedef enum cbSdkWaveformTriggerType:
  227. cbSdkWaveformTrigger_NONE = 0 # Instant software trigger
  228. cbSdkWaveformTrigger_DINPREG = 1 # digital input rising edge trigger
  229. cbSdkWaveformTrigger_DINPFEG = 2 # digital input falling edge trigger
  230. cbSdkWaveformTrigger_SPIKEUNIT = 3 # spike unit
  231. cbSdkWaveformTrigger_COMMENTCOLOR = 4 # custom colored event (e.g. NeuroMotive event)
  232. cbSdkWaveformTrigger_SOFTRESET = 5 # Soft-reset trigger (e.g. file recording start)
  233. cbSdkWaveformTrigger_EXTENSION = 6 # Extension trigger
  234. cbSdkWaveformTrigger_COUNT = 7 # Always the last value
  235. ctypedef struct cbSdkVersion:
  236. # Library version
  237. uint32_t major
  238. uint32_t minor
  239. uint32_t release
  240. uint32_t beta
  241. # Protocol version
  242. uint32_t majorp
  243. uint32_t minorp
  244. # NSP version
  245. uint32_t nspmajor
  246. uint32_t nspminor
  247. uint32_t nsprelease
  248. uint32_t nspbeta
  249. # NSP protocol version
  250. uint32_t nspmajorp
  251. uint32_t nspminorp
  252. ctypedef struct cbSdkCCFEvent:
  253. cbStateCCF state # CCF state
  254. cbSdkResult result # Last result
  255. const char * szFileName # CCF filename under operation
  256. uint8_t progress # Progress (in percent)
  257. ctypedef struct cbSdkTrialEvent:
  258. uint16_t count
  259. uint16_t chan[cbNUM_ANALOG_CHANS + 2]
  260. uint32_t num_samples[cbNUM_ANALOG_CHANS + 2][cbMAXUNITS + 1]
  261. void * timestamps[cbNUM_ANALOG_CHANS + 2][cbMAXUNITS + 1]
  262. void * waveforms[cbNUM_ANALOG_CHANS + 2]
  263. ctypedef struct cbSdkConnection:
  264. int nInPort # Client port number
  265. int nOutPort # Instrument port number
  266. int nRecBufSize # Receive buffer size (0 to ignore altogether)
  267. const char * szInIP # Client IPv4 address
  268. const char * szOutIP # Instrument IPv4 address
  269. cdef cbSdkConnection cbSdkConnection_DEFAULT = {cbNET_UDP_PORT_BCAST, cbNET_UDP_PORT_CNT, (4096 * 2048), "", ""}
  270. # Trial continuous data
  271. ctypedef struct cbSdkTrialCont:
  272. uint16_t count # Number of valid channels in this trial (up to cbNUM_ANALOG_CHANS)
  273. uint16_t chan[cbNUM_ANALOG_CHANS+0] # channel numbers (1-based)
  274. uint16_t sample_rates[cbNUM_ANALOG_CHANS+0] # current sample rate (samples per second)
  275. uint32_t num_samples[cbNUM_ANALOG_CHANS+0] # number of samples
  276. uint32_t time # start time for trial continuous data
  277. void * samples[cbNUM_ANALOG_CHANS+0] # Buffer to hold sample vectors
  278. ctypedef struct cbSdkTrialComment:
  279. uint16_t num_samples # Number of comments
  280. uint8_t * charsets # Buffer to hold character sets
  281. uint32_t * rgbas # Buffer to hold rgba values
  282. uint8_t * * comments # Pointer to comments
  283. void * timestamps # Buffer to hold time stamps
  284. # Trial video tracking data
  285. ctypedef struct cbSdkTrialTracking:
  286. uint16_t count # Number of valid trackable objects (up to cbMAXTRACKOBJ)
  287. uint16_t ids[cbMAXTRACKOBJ+0] # Node IDs (holds count elements)
  288. uint16_t max_point_counts[cbMAXTRACKOBJ+0] # Maximum point counts (holds count elements)
  289. uint16_t types[cbMAXTRACKOBJ+0] # Node types (can be cbTRACKOBJ_TYPE_* and determines coordinate counts) (holds count elements)
  290. uint8_t names[cbMAXTRACKOBJ+0][16 + 1] # Node names (holds count elements)
  291. uint16_t num_samples[cbMAXTRACKOBJ+0] # Number of samples
  292. uint16_t * point_counts[cbMAXTRACKOBJ+0] # Buffer to hold number of valid points (up to max_point_counts) (holds count*num_samples elements)
  293. void * * coords[cbMAXTRACKOBJ+0] # Buffer to hold tracking points (holds count*num_samples tarackables, each of max_point_counts points
  294. uint32_t * synch_frame_numbers[cbMAXTRACKOBJ+0] # Buffer to hold synch frame numbers (holds count*num_samples elements)
  295. uint32_t * synch_timestamps[cbMAXTRACKOBJ+0] # Buffer to hold synchronized tracking time stamps (in milliseconds) (holds count*num_samples elements)
  296. void * timestamps[cbMAXTRACKOBJ+0] # Buffer to hold tracking time stamps (holds count*num_samples elements)
  297. ctypedef struct cbSdkAoutMon:
  298. uint16_t chan # (1-based) channel to monitor
  299. bint bTrack # If should monitor last tracked channel
  300. bint bSpike # If spike or continuous should be monitored
  301. ctypedef struct cbSdkWaveformData:
  302. cbSdkWaveformType type
  303. uint32_t repeats
  304. cbSdkWaveformTriggerType trig
  305. uint16_t trigChan
  306. uint16_t trigValue
  307. uint8_t trigNum
  308. int16_t offset
  309. uint16_t sineFrequency
  310. int16_t sineAmplitude
  311. uint16_t phases
  312. uint16_t* duration
  313. int16_t* amplitude
  314. cbSdkResult cbSdkGetVersion(uint32_t nInstance, cbSdkVersion * version)
  315. # Read and write CCF requires a lot of baggage from cbhwlib.h. Skipping.
  316. cbSdkResult cbSdkOpen(uint32_t nInstance, cbSdkConnectionType conType, cbSdkConnection con) nogil
  317. cbSdkResult cbSdkGetType(uint32_t nInstance, cbSdkConnectionType * conType, cbSdkInstrumentType * instType) # Get connection and instrument type
  318. cbSdkResult cbSdkClose(uint32_t nInstance) # Close the library
  319. cbSdkResult cbSdkGetTime(uint32_t nInstance, uint32_t * cbtime) # Get the instrument sample clock time
  320. cbSdkResult cbSdkGetSpkCache(uint32_t nInstance, uint16_t channel, cbSPKCACHE **cache)
  321. #cbSdkGetTrialConfig and cbSdkSetTrialConfig are better handled by cbsdk_helper due to optional arguments.
  322. cbSdkResult cbSdkUnsetTrialConfig(uint32_t nInstance, cbSdkTrialType type)
  323. cbSdkResult cbSdkGetChannelLabel(int nInstance, uint16_t channel, uint32_t * bValid, char * label, uint32_t * userflags, int32_t * position)
  324. cbSdkResult cbSdkSetChannelLabel(uint32_t nInstance, uint16_t channel, const char * label, uint32_t userflags, int32_t * position)
  325. # Retrieve data of a trial (NULL means ignore), user should allocate enough buffers beforehand, and trial should not be closed during this call
  326. cbSdkResult cbSdkGetTrialData( uint32_t nInstance,
  327. uint32_t bActive, cbSdkTrialEvent * trialevent, cbSdkTrialCont * trialcont,
  328. cbSdkTrialComment * trialcomment, cbSdkTrialTracking * trialtracking)
  329. # Initialize the structures (and fill with information about active channels, comment pointers and samples in the buffer)
  330. cbSdkResult cbSdkInitTrialData( uint32_t nInstance,
  331. cbSdkTrialEvent * trialevent, cbSdkTrialCont * trialcont,
  332. cbSdkTrialComment * trialcomment, cbSdkTrialTracking * trialtracking)
  333. #cbSdkSetFileConfig
  334. cbSdkResult cbSdkGetFileConfig(uint32_t nInstance, char * filename, char * username, bool * pbRecording)
  335. cbSdkResult cbSdkSetPatientInfo(uint32_t nInstance, const char * ID, const char * firstname, const char * lastname, uint32_t DOBMonth, uint32_t DOBDay, uint32_t DOBYear)
  336. cbSdkResult cbSdkInitiateImpedance(uint32_t nInstance)
  337. cbSdkResult cbSdkSendPoll(uint32_t nInstance, const char* appname, uint32_t mode, uint32_t flags, uint32_t extra)
  338. #cbSdkSendPacket
  339. #cbSdkSetSystemRunLevel
  340. cbSdkResult cbSdkSetDigitalOutput(uint32_t nInstance, uint16_t channel, uint16_t value)
  341. cbSdkResult cbSdkSetSynchOutput(uint32_t nInstance, uint16_t channel, uint32_t nFreq, uint32_t nRepeats)
  342. #cbSdkExtDoCommand
  343. cbSdkResult cbSdkSetAnalogOutput(uint32_t nInstance, uint16_t channel, cbSdkWaveformData* wf, cbSdkAoutMon* mon)
  344. cbSdkResult cbSdkSetChannelMask(uint32_t nInstance, uint16_t channel, uint32_t bActive)
  345. cbSdkResult cbSdkSetComment(uint32_t nInstance, uint32_t rgba, uint8_t charset, const char * comment)
  346. cbSdkResult cbSdkSetChannelConfig(uint32_t nInstance, uint16_t channel, cbPKT_CHANINFO * chaninfo)
  347. cbSdkResult cbSdkGetChannelConfig(uint32_t nInstance, uint16_t channel, cbPKT_CHANINFO * chaninfo)
  348. cbSdkResult cbSdkGetFilterDesc(uint32_t nInstance, uint32_t proc, uint32_t filt, cbFILTDESC * filtdesc)
  349. cbSdkResult cbSdkGetSampleGroupList(uint32_t nInstance, uint32_t proc, uint32_t group, uint32_t *length, uint32_t *list)
  350. cbSdkResult cbSdkGetSampleGroupInfo(uint32_t nInstance, uint32_t proc, uint32_t group, char *label, uint32_t *period, uint32_t *length)
  351. cbSdkResult cbSdkSetSpikeConfig(uint32_t nInstance, uint32_t spklength, uint32_t spkpretrig)
  352. cbSdkResult cbSdkGetSysConfig(uint32_t nInstance, uint32_t * spklength, uint32_t * spkpretrig, uint32_t * sysfreq)
  353. cdef extern from "cbsdk_helper.h":
  354. ctypedef struct cbSdkConfigParam:
  355. uint32_t bActive
  356. uint16_t Begchan
  357. uint32_t Begmask
  358. uint32_t Begval
  359. uint16_t Endchan
  360. uint32_t Endmask
  361. uint32_t Endval
  362. int bDouble
  363. uint32_t uWaveforms
  364. uint32_t uConts
  365. uint32_t uEvents
  366. uint32_t uComments
  367. uint32_t uTrackings
  368. int bAbsolute
  369. cbSdkResult cbsdk_get_trial_config(int nInstance, cbSdkConfigParam * pcfg_param)
  370. cbSdkResult cbsdk_set_trial_config(int nInstance, const cbSdkConfigParam * pcfg_param)
  371. cbSdkResult cbsdk_init_trial_event(int nInstance, int reset, cbSdkTrialEvent * trialevent)
  372. cbSdkResult cbsdk_get_trial_event(int nInstance, int reset, cbSdkTrialEvent * trialevent)
  373. cbSdkResult cbsdk_init_trial_cont(int nInstance, int reset, cbSdkTrialCont * trialcont)
  374. cbSdkResult cbsdk_get_trial_cont(int nInstance, int reset, cbSdkTrialCont * trialcont)
  375. cbSdkResult cbsdk_init_trial_data(int nInstance, int reset, cbSdkTrialEvent * trialevent, cbSdkTrialCont * trialcont)
  376. cbSdkResult cbsdk_get_trial_data(int nInstance, int reset, cbSdkTrialEvent * trialevent, cbSdkTrialCont * trialcont)
  377. cbSdkResult cbsdk_init_trial_comment(int nInstance, int reset, cbSdkTrialComment * trialcomm)
  378. cbSdkResult cbsdk_get_trial_comment(int nInstance, int reset, cbSdkTrialComment * trialcomm)
  379. cbSdkResult cbsdk_file_config(int instance, const char * filename, const char * comment, int start, unsigned int options)