ns.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 2003-2004 Neuroshare Project
  4. //
  5. // This library is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU Lesser General Public
  7. // License as published by the Free Software Foundation; either
  8. // version 2.1 of the License, or (at your option) any later version.
  9. //
  10. // This library is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. // Lesser General Public License for more details.
  14. //
  15. // A copy of the GNU Lesser General Public License can be obtained by writing to:
  16. // Free Software Foundation, Inc.,
  17. // 59 Temple Place, Suite 330,
  18. // Boston, MA 02111-1307
  19. // USA
  20. //
  21. // Contact information:
  22. // Kirk Korver
  23. // CyberKinetics, Inc.,
  24. // 391 G Chipeta Way
  25. // Salt Lake City, UT 84108
  26. // USA
  27. // kkorver at cyberkineticsinc.com
  28. //
  29. // Website:
  30. // sourceforge.net/projects/neuroshare
  31. //
  32. // All other copyrights on this material are replaced by this license agreeement.
  33. //
  34. ///////////////////////////////////////////////////////////////////////////////////////////////////
  35. //
  36. // $Author: putermutt $
  37. // $Date: 2007/01/24 00:50:10 $
  38. // $Revision: 1.2 $
  39. // $Source: /cvsroot/neuroshare/NSLibraries/ns/ns.h,v $
  40. //
  41. ///////////////////////////////////////////////////////////////////////////////////////////////////
  42. //
  43. // Specification : API definitions for the Neuroshare file format standard.
  44. //
  45. // Description : Neuroshare API Glue
  46. // Use the following files to access Neuroshare files:
  47. // ns.h -- API header file
  48. // ns.c -- API interface module
  49. //
  50. // A Neuroshare library is required in conjuction with this module.
  51. // For example:
  52. // ns_NEV.so -- Linux shared object
  53. // or
  54. // ns_NEV.dll -- Windows dynamic link library
  55. //
  56. // Authors : Gopal Santhanam
  57. //
  58. // $Date: 2007/01/24 00:50:10 $
  59. //
  60. ///////////////////////////////////////////////////////////////////////////////////////////////////
  61. #ifndef NS_H_INCLUDED // Include guards
  62. #define NS_H_INCLUDED
  63. /*=========================================================================
  64. | VERSION
  65. ========================================================================*/
  66. #define NS_HEADER_VERSION 0x0103 /* v1.03 */
  67. /*=========================================================================
  68. | C++ SUPPORT
  69. ========================================================================*/
  70. #ifdef __cplusplus
  71. extern "C" {
  72. #endif
  73. /*=========================================================================
  74. | TYPES
  75. ========================================================================*/
  76. #if defined(__GNUC__)
  77. typedef char INT8;
  78. typedef unsigned char UINT8;
  79. typedef short INT16;
  80. typedef unsigned short UINT16;
  81. typedef int INT32;
  82. typedef unsigned int UINT32;
  83. typedef unsigned long long UINT64;
  84. // Specify 4 byte structure alignment
  85. #define GCC_ALIGN_4 __attribute__((aligned(4)))
  86. #elif defined(_MSC_VER)
  87. #include <windows.h>
  88. // Copied from the Feb2003 SDK, just in case it isn't installed
  89. typedef signed char INT8, *PINT8;
  90. typedef signed short INT16, *PINT16;
  91. typedef signed int INT32, *PINT32;
  92. typedef signed __int64 INT64, *PINT64;
  93. typedef unsigned char UINT8, *PUINT8;
  94. typedef unsigned short UINT16, *PUINT16;
  95. typedef unsigned int UINT32, *PUINT32;
  96. typedef unsigned __int64 UINT64, *PUINT64;
  97. // specify 4-byte structure alignment
  98. #pragma pack(push, 4)
  99. #define GCC_ALIGN_4
  100. #endif
  101. ///////////////////////////////////////////////////////////////////////////////////////////////////
  102. //
  103. // Library Return Code Definitions
  104. //
  105. ///////////////////////////////////////////////////////////////////////////////////////////////////
  106. typedef INT32 ns_RESULT;
  107. typedef enum {
  108. ns_OK = 0, //Function Successful
  109. ns_LIBERROR = -1, //Linked Library Error
  110. ns_TYPEERROR = -2, //Library unable to open file type
  111. ns_FILEERROR = -3, //File access or read Error
  112. ns_BADFILE = -4, //Invalid file handle passed to function
  113. ns_BADENTITY = -5, //Invalid or inappropriate entity identifier specified
  114. ns_BADSOURCE = -6, //Invalid source identifier specified
  115. ns_BADINDEX = -7 //Invalid entity index or index range specified
  116. } ns_STATUS;
  117. ///////////////////////////////////////////////////////////////////////////////////////////////////
  118. //
  119. // Definitions of constants and flags
  120. //
  121. ///////////////////////////////////////////////////////////////////////////////////////////////////
  122. // Library description flags
  123. typedef enum {
  124. ns_LIBRARY_DEBUG = 0x01, // includes debug info linkage
  125. ns_LIBRARY_MODIFIED = 0x02, // file was patched or modified
  126. ns_LIBRARY_PRERELEASE = 0x04, // pre-release or beta version
  127. ns_LIBRARY_SPECIALBUILD = 0x08, // different from release version
  128. ns_LIBRARY_MULTITHREADED = 0x10, // library is multithread safe
  129. } ns_LIBRARY_FLAGS;
  130. //Definitions of Event Entity types
  131. typedef enum {
  132. ns_EVENT_TEXT = 0, // null-terminated ascii text string
  133. ns_EVENT_CSV = 1, // comma separated ascii text values
  134. ns_EVENT_BYTE = 2, // 8-bit value
  135. ns_EVENT_WORD = 3, // 16-bit value
  136. ns_EVENT_DWORD = 4, // 32-bit value
  137. } ns_EVENT_TYPE;
  138. //Definitions of entity types in the structure ns_ENTITYINFO
  139. typedef enum {
  140. ns_ENTITY_UNKNOWN = 0, // unknown entity type
  141. ns_ENTITY_EVENT = 1, // Event entity
  142. ns_ENTITY_ANALOG = 2, // Analog entity
  143. ns_ENTITY_SEGMENT = 3, // Segment entity
  144. ns_ENTITY_NEURALEVENT = 4, // Sorted Neural entity
  145. } ns_ENTITY_TYPE;
  146. //Flags used for locating data entries
  147. typedef enum {
  148. ns_BEFORE = -1, // less than or equal to specified time
  149. ns_CLOSEST = 0, // closest time
  150. ns_AFTER = +1, // greater than or equal to specified time
  151. } ns_LOCATION_FLAGS;
  152. ///////////////////////////////////////////////////////////////////////////////////////////////////
  153. //
  154. // DLL library version information functions
  155. //
  156. ///////////////////////////////////////////////////////////////////////////////////////////////////
  157. //File descriptor structure
  158. typedef struct
  159. {
  160. char szDescription[32]; // Text description of the file type or file family
  161. char szExtension[8]; // Extension used on PC, Linux, and Unix Platforms
  162. char szMacCodes[8]; // Application and Type Codes used on Mac Platforms
  163. char szMagicCode[16]; // Null-terminated code used at the file beginning
  164. } GCC_ALIGN_4 ns_FILEDESC;
  165. // Library information structure
  166. typedef struct
  167. {
  168. UINT32 dwLibVersionMaj; // Major version number of library
  169. UINT32 dwLibVersionMin; // Minor version number of library
  170. UINT32 dwAPIVersionMaj; // Major version number of API
  171. UINT32 dwAPIVersionMin; // Minor version number of API
  172. char szDescription[64]; // Text description of the library
  173. char szCreator[64]; // Name of library creator
  174. UINT32 dwTime_Year; // Year of last modification date
  175. UINT32 dwTime_Month; // Month (1-12; January = 1) of last modification date
  176. UINT32 dwTime_Day; // Day of the month (1-31) of last modification date
  177. UINT32 dwFlags; // Additional library flags
  178. UINT32 dwMaxFiles; // Maximum number of files library can simultaneously open
  179. UINT32 dwFileDescCount; // Number of valid description entries in the following array
  180. ns_FILEDESC FileDesc[16]; // Text descriptor of files that the DLL can interpret
  181. } GCC_ALIGN_4 ns_LIBRARYINFO;
  182. // File information structure (the time of file creation should be reported in GMT)
  183. typedef struct
  184. {
  185. char szFileType[32]; // Manufacturer's file type descriptor
  186. UINT32 dwEntityCount; // Number of entities in the data file.
  187. double dTimeStampResolution; // Minimum timestamp resolution
  188. double dTimeSpan; // Time span covered by the data file in seconds
  189. char szAppName[64]; // Name of the application that created the file
  190. UINT32 dwTime_Year; // Year the file was created
  191. UINT32 dwTime_Month; // Month (1-12; January = 1)
  192. UINT32 dwTime_DayofWeek; // Day of the week (0-6; Sunday = 0)
  193. UINT32 dwTime_Day; // Day of the month (1-31)
  194. UINT32 dwTime_Hour; // Hour since midnight (0-23)
  195. UINT32 dwTime_Min; // Minute after the hour (0-59)
  196. UINT32 dwTime_Sec; // Seconds after the minute (0-59)
  197. UINT32 dwTime_MilliSec; // Milliseconds after the second (0-1000)
  198. char szFileComment[256]; // Comments embedded in the source file
  199. } GCC_ALIGN_4 ns_FILEINFO;
  200. // General entity information structure
  201. typedef struct
  202. {
  203. char szEntityLabel[32]; // Specifies the label or name of the entity
  204. UINT32 dwEntityType; // One of the ns_ENTITY_* types defined above
  205. UINT32 dwItemCount; // Number of data items for the specified entity in the file
  206. } ns_ENTITYINFO;
  207. // Event entity information structure
  208. typedef struct
  209. {
  210. UINT32 dwEventType; // One of the ns_EVENT_* types defined above
  211. UINT32 dwMinDataLength; // Minimum number of bytes that can be returned for an Event
  212. UINT32 dwMaxDataLength; // Maximum number of bytes that can be returned for an Event
  213. char szCSVDesc[128]; // Description of the data fields for CSV Event Entities
  214. } GCC_ALIGN_4 ns_EVENTINFO;
  215. // Analog information structure
  216. typedef struct
  217. {
  218. double dSampleRate; // The sampling rate in Hz used to digitize the analog values
  219. double dMinVal; // Minimum possible value of the input signal
  220. double dMaxVal; // Maximum possible value of the input signal
  221. char szUnits[16]; // Specifies the recording units of measurement
  222. double dResolution; // Minimum resolvable step (.0000305 for a +/-1V 16-bit ADC)
  223. double dLocationX; // X coordinate in meters
  224. double dLocationY; // Y coordinate in meters
  225. double dLocationZ; // Z coordinate in meters
  226. double dLocationUser; // Additional position information (e.g. tetrode number)
  227. double dHighFreqCorner; // High frequency cutoff in Hz of the source signal filtering
  228. UINT32 dwHighFreqOrder; // Order of the filter used for high frequency cutoff
  229. char szHighFilterType[16]; // Type of filter used for high frequency cutoff (text format)
  230. double dLowFreqCorner; // Low frequency cutoff in Hz of the source signal filtering
  231. UINT32 dwLowFreqOrder; // Order of the filter used for low frequency cutoff
  232. char szLowFilterType[16]; // Type of filter used for low frequency cutoff (text format)
  233. char szProbeInfo[128]; // Additional text information about the signal source
  234. } GCC_ALIGN_4 ns_ANALOGINFO;
  235. //Segment Information structure
  236. typedef struct
  237. {
  238. UINT32 dwSourceCount; // Number of sources in the Segment Entity, e.g. 4 for a tetrode
  239. UINT32 dwMinSampleCount; // Minimum number of samples in each Segment data item
  240. UINT32 dwMaxSampleCount; // Maximum number of samples in each Segment data item
  241. double dSampleRate; // The sampling rate in Hz used to digitize source signals
  242. char szUnits[32]; // Specifies the recording units of measurement
  243. } GCC_ALIGN_4 ns_SEGMENTINFO;
  244. // Segment source information structure
  245. typedef struct
  246. {
  247. double dMinVal; // Minimum possible value of the input signal
  248. double dMaxVal; // Maximum possible value of the input signal
  249. double dResolution; // Minimum input step size that can be resolved
  250. double dSubSampleShift; // Time diff btn timestamp and actual sampling time of source
  251. double dLocationX; // X coordinate of source in meters
  252. double dLocationY; // Y coordinate of source in meters
  253. double dLocationZ; // Z coordinate of source in meters
  254. double dLocationUser; // Additional position information (e.g tetrode number)
  255. double dHighFreqCorner; // High frequency cutoff in Hz of the source signal filtering
  256. UINT32 dwHighFreqOrder; // Order of the filter used for high frequency cutoff
  257. char szHighFilterType[16]; // Type of filter used for high frequency cutoff (text format)
  258. double dLowFreqCorner; // Low frequency cutoff in Hz of the source signal filtering
  259. UINT32 dwLowFreqOrder; // Order of the filter used for low frequency cutoff
  260. char szLowFilterType[16]; // Type of filter used for low frequency cutoff (text format)
  261. char szProbeInfo[128]; // Additional text information about the signal source
  262. } GCC_ALIGN_4 ns_SEGSOURCEINFO;
  263. // Neural Information structure
  264. typedef struct
  265. {
  266. UINT32 dwSourceEntityID; // Optional ID number of a source entity
  267. UINT32 dwSourceUnitID; // Optional sorted unit ID number used in the source entity
  268. char szProbeInfo[128]; // Additional probe text information or source entity label
  269. } GCC_ALIGN_4 ns_NEURALINFO;
  270. typedef INT32 ns_DLLHANDLE;
  271. #if !defined(NS_COMPILING_LIB)
  272. # define NS_FIRST_ARG ns_DLLHANDLE nssDllHANDLE,
  273. # define ns_stdcall
  274. #else
  275. # define NS_FIRST_ARG
  276. # if defined(WIN32) || defined(_WIN32)
  277. # define ns_stdcall __stdcall
  278. # else
  279. # define ns_stdcall
  280. # endif
  281. #endif
  282. /*=========================================================================
  283. | PROTOTYPES
  284. ========================================================================*/
  285. ns_DLLHANDLE ns_stdcall ns_LoadLibrary (const char *libname);
  286. ns_RESULT ns_stdcall ns_CloseLibrary (ns_DLLHANDLE nsDllHandle);
  287. ///////////////////////////////////////////////////////////////////////////////////////////////////
  288. // ns_GetLibraryInfo
  289. //
  290. // Purpose:
  291. // Retrieves information about the loaded API library
  292. //
  293. // Parameters:
  294. // ns_LIBRARYINFO *pLibraryInfo pointer to ns_LIBRARYINFO structure to receive information
  295. // UINT32 dwLibraryInfoSize size in bytes of ns_LIBRARYINFO structure
  296. //
  297. // Return Values:
  298. // ns_OK ns_LIBIRARYINFO successfully retrieved
  299. // ns_LIBEERROR library error
  300. //
  301. ///////////////////////////////////////////////////////////////////////////////////////////////////
  302. ns_RESULT ns_stdcall ns_GetLibraryInfo
  303. (NS_FIRST_ARG ns_LIBRARYINFO *pLibraryInfo, UINT32 dwLibraryInfoSize);
  304. ///////////////////////////////////////////////////////////////////////////////////////////////////
  305. // ns_OpenFile
  306. //
  307. // Purpose:
  308. // Opens the data file and assigns a file handle for internal use by the library.
  309. //
  310. // Parameters:
  311. // char *pszFilename name of file to open
  312. // UINT32 *hFile pointer to a file handle
  313. //
  314. // Return Values:
  315. // ns_OK ns_LIBIRARYINFO successfully retrieved
  316. // ns_TYPEERROR library unable to open file type
  317. // ns_FILEERROR file access or read error
  318. // ns_LIBEERROR library error
  319. //
  320. ///////////////////////////////////////////////////////////////////////////////////////////////////
  321. ns_RESULT ns_stdcall ns_OpenFile
  322. (NS_FIRST_ARG const char *pszFilename, UINT32 *hFile);
  323. ///////////////////////////////////////////////////////////////////////////////////////////////////
  324. // ns_GetFileInfo
  325. //
  326. // Purpose:
  327. // Retrieve general information about the data file
  328. //
  329. // Parameters:
  330. // UINT32 hFile handle to NS data file
  331. // ns_FILEINFO *pFileInfo pointer to ns_FILEINFO structure that receives data
  332. // UINT32 dwFileInfoSize number of bytes returned in ns_FILEINFO
  333. //
  334. // Return Values:
  335. // ns_OK function succeeded
  336. // ns_BADFILE invalid file handle
  337. // ns_FILEERROR file access or read error
  338. // ns_LIBERROR library error, null pointer
  339. //
  340. ///////////////////////////////////////////////////////////////////////////////////////////////////
  341. ns_RESULT ns_stdcall ns_GetFileInfo
  342. (NS_FIRST_ARG UINT32 hFile, ns_FILEINFO *pFileInfo, UINT32 dwFileInfoSize);
  343. ///////////////////////////////////////////////////////////////////////////////////////////////////
  344. // ns_CloseFile
  345. //
  346. // Purpose:
  347. // Close the open data file
  348. //
  349. // Parameters:
  350. // UINT32 hFile handle to NS data file
  351. //
  352. // Return Values:
  353. // ns_OK function succeeded
  354. // ns_BADFILE invalid file handle
  355. //
  356. ///////////////////////////////////////////////////////////////////////////////////////////////////
  357. ns_RESULT ns_stdcall ns_CloseFile
  358. (NS_FIRST_ARG UINT32 hFile);
  359. ///////////////////////////////////////////////////////////////////////////////////////////////////
  360. // ns_GetEntityInfo
  361. //
  362. // Purpose:
  363. // Retrieve Entity information
  364. //
  365. // Parameters:
  366. // UINT32 hFile handle to NS data file
  367. // UINT32 dwEntityID entity ID
  368. // ns_ENTITYINFO *pEntityInfo pointer to ns_ENTITYINFO structure that receives information
  369. // UINT32 dwEntityInfoSize number of bytes returned in ns_ENTITYINFO
  370. //
  371. // Return Values:
  372. // ns_OK function succeeded
  373. // ns_BADFILE invalid file handle
  374. // ns_LIBERROR library error, null pointer
  375. //
  376. ///////////////////////////////////////////////////////////////////////////////////////////////////
  377. ns_RESULT ns_stdcall ns_GetEntityInfo
  378. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, ns_ENTITYINFO *pEntityInfo, UINT32 dwEntityInfoSize);
  379. ///////////////////////////////////////////////////////////////////////////////////////////////////
  380. // ns_GetEventInfo
  381. //
  382. // Purpose:
  383. // Retrieve information for Event entities.
  384. //
  385. // Parameters:
  386. // UINT32 hFile handle to NS data file
  387. // UINT32 dwEntityID Event entity ID
  388. // ns_EVENTINFO *pEventInfo pointer to ns_EVENTINFO structure to receive information
  389. // UINT32 dwEventInfoSize number of bytes returned in ns_EVENTINFO
  390. //
  391. // Return Values:
  392. // ns_OK function succeeded
  393. // ns_BADFILE invalid file handle
  394. // ns_BADENTITY inappropriate or invalid entity identifier
  395. // ns_LIBERROR library error, null pointer
  396. //
  397. ///////////////////////////////////////////////////////////////////////////////////////////////////
  398. ns_RESULT ns_stdcall ns_GetEventInfo
  399. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, ns_EVENTINFO *pEventInfo, UINT32 dwEventInfoSize);
  400. ///////////////////////////////////////////////////////////////////////////////////////////////////
  401. // ns_GetEventData
  402. //
  403. // Purpose:
  404. // Retrieve the timestamp and Event entity data items.
  405. //
  406. // Parameters:
  407. // UINT32 hFile handle to NS data file
  408. // UINT32 dwEntityID Event entity ID
  409. // UINT32 nIndex Event entity item number
  410. // double *pdTimeStamp pointer to double timestamp (in seconds)
  411. // void *pData pointer to data buffer to receive data
  412. // UINT32 *pdwDataSize pointer to number of bytes of data retrieved into data buffer
  413. //
  414. // Return Values:
  415. // ns_OK function succeeded
  416. // ns_BADFILE invalid file handle
  417. // ns_BADENTITY inappropriate or invalie entity identifier
  418. // ns_LIBERROR library error, null pointer
  419. //
  420. ///////////////////////////////////////////////////////////////////////////////////////////////////
  421. ns_RESULT ns_stdcall ns_GetEventData
  422. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, UINT32 nIndex, double *pdTimeStamp, void *pData,
  423. UINT32 dwDataSize, UINT32 *pdwDataRetSize);
  424. ///////////////////////////////////////////////////////////////////////////////////////////////////
  425. // ns_GetAnalogInfo
  426. //
  427. // Purpose:
  428. // Retrieve information for Analog entities
  429. //
  430. // Parameters:
  431. //
  432. // UINT32 hFile handle to NS data file
  433. // UINT32 dwEntityID Analog entity ID
  434. // ns_ANALOGINFO *pAnalogInfo pointer to ns_ANALOGINFO structure to receive data
  435. // UINT32 dwAnalogInfoSize number of bytes returned in ns_ANALOGINFO
  436. //
  437. // Return Values:
  438. // ns_OK function succeeded
  439. // ns_BADFILE invalid file handle
  440. // ns_BADENTITY inappropriate or invalie entity identifier
  441. // ns_LIBERROR library error, null pointer
  442. //
  443. ///////////////////////////////////////////////////////////////////////////////////////////////////
  444. ns_RESULT ns_stdcall ns_GetAnalogInfo
  445. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, ns_ANALOGINFO *pAnalogInfo, UINT32 dwAnalogInfoSize);
  446. ///////////////////////////////////////////////////////////////////////////////////////////////////
  447. // ns_GetAnalogData
  448. //
  449. // Purpose:
  450. // Retrieve analog data in the buffer at pData. If possible, dwIndexCount, analog data values are
  451. // returned in the buffer. As there may be time gaps in the sequential values, the number of
  452. // continuously sampled data items is returned in pdwContCount.
  453. //
  454. // Parameters:
  455. // UINT32 hFile handle to NS data file
  456. // UINT32 dwEntityID Analog entity ID
  457. // UINT32 dwStartIndex starting index to search for timestamp
  458. // UINT32 dwIndexCount number of timestamps to retrieve
  459. // UINT32 *pdwContCount pointer to count of the first non-sequential analog item
  460. // double *pData pointer of data buffer to receive data values
  461. //
  462. // Return Values:
  463. // ns_OK function succeeded
  464. // ns_BADFILE invalid file handle
  465. // ns_BADENTITY inappropriate or invalid entity identifier
  466. // ns_LIBERROR library error, null pointer
  467. //
  468. ///////////////////////////////////////////////////////////////////////////////////////////////////
  469. ns_RESULT ns_stdcall ns_GetAnalogData
  470. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, UINT32 dwStartIndex, UINT32 dwIndexCount,
  471. UINT32 *pdwContCount, double *pData);
  472. ///////////////////////////////////////////////////////////////////////////////////////////////////
  473. // ns_GetSegmentInfo
  474. //
  475. // Purpose:
  476. // Retrieve information for Segment entities.
  477. //
  478. // Parameters:
  479. // UINT32 hFile handle to NS data file
  480. // UINT32 dwEntityID Segment entity ID
  481. // ns_SEGMENTINFO *pSegmentInfo pointer to ns_SEGMENTINFO structure to receive information
  482. // UINT32 dwSegmentInfoSize size in bytes retrieved in ns_SEGMENTINFO structure
  483. //
  484. // Return Values:
  485. // ns_OK function succeeded
  486. // ns_BADFILE invalid file handle
  487. // ns_BADENTITY invalid or inappropriate entity identifier specified
  488. // ns_FILEERROR file access or read error
  489. // ns_LIBERROR library error
  490. //
  491. ///////////////////////////////////////////////////////////////////////////////////////////////////
  492. ns_RESULT ns_stdcall ns_GetSegmentInfo
  493. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, ns_SEGMENTINFO *pSegmentInfo, UINT32 dwSegmentInfoSize);
  494. ///////////////////////////////////////////////////////////////////////////////////////////////////
  495. // ns_GetSegmentSourceInfo
  496. //
  497. // Purpose:
  498. // Retrieve information on the source, dwSourceID, generating segment entity dwEntityID.
  499. //
  500. // Parameters:
  501. // UINT32 hFile handle to NS data file
  502. // UINT32 dwEntityID Segment entity ID
  503. // UINT32 dwSourceID entity ID of source
  504. // ns_SEGSOURCEINFO *pSourceInfo pointer to ns_SEGSOURCEINFO structure to receive information
  505. // UINT32 dwSourceInfoSize size in bytes retrieved in ns_SEGSOURCEINFO structure
  506. //
  507. // Return Values:
  508. // ns_OK function succeeded
  509. // ns_BADFILE invalid file handle
  510. // ns_BADENTITY invalid or inappropriate entity identifier specified
  511. // ns_FILEERROR file access or read error
  512. // ns_LIBERROR library error
  513. //
  514. ///////////////////////////////////////////////////////////////////////////////////////////////////
  515. ns_RESULT ns_stdcall ns_GetSegmentSourceInfo
  516. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, UINT32 dwSourceID, ns_SEGSOURCEINFO *pSourceInfo,
  517. UINT32 dwSourceInfoSize);
  518. ///////////////////////////////////////////////////////////////////////////////////////////////////
  519. // ns_GetSegmentData
  520. //
  521. // Purpose:
  522. // Retrieve segment data waveform and its timestamp.
  523. // The number of data points read is returned at pdwSampleCount.
  524. //
  525. // Parameters:
  526. // UINT32 hFile handle to NS data file
  527. // UINT32 dwEntityID Segment entity ID
  528. // INT32 nIndex Segment item index to retrieve
  529. // double *pdTimeStamp pointer to timestamp to retrieve
  530. // double *pData pointer to data buffer to receive data
  531. // UINT32 *pdwSampleCount pointer to number of data items retrieved
  532. // UINT32 *pdwUnitID pointer to unit ID of Segment data
  533. //
  534. // Return Values:
  535. // ns_OK function succeeded
  536. // ns_BADFILE invalid file handle
  537. // ns_BADENTITY invalid or inappropriate entity identifier specified
  538. // ns_FILEERROR file access or read error
  539. // ns_LIBERROR library error
  540. //
  541. ///////////////////////////////////////////////////////////////////////////////////////////////////
  542. ns_RESULT ns_stdcall ns_GetSegmentData
  543. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, UINT32 nIndex, double *pdTimeStamp, double *pdData,
  544. UINT32 dwDataBufferSize, UINT32 *pdwSampleCount, UINT32 *pdwUnitID );
  545. ///////////////////////////////////////////////////////////////////////////////////////////////////
  546. // ns_GetNeuralInfo
  547. //
  548. // Purpose:
  549. // Retrieve information on Neural Events.
  550. //
  551. // Parameters:
  552. // UINT32 hFile handle to NS data file
  553. // UINT32 dwEntityID Neural entity ID
  554. // ns_NEURALINFO *pNeuralInfo pointer to ns_NEURALINFO structure to receive information
  555. // UINT32 dwNeuralInfoSize number of bytes returned in ns_NEURALINFO
  556. //
  557. // Return Values:
  558. // ns_OK function succeeded
  559. // ns_BADFILE invalid file handle
  560. // ns_BADENTITY inappropriate or invalid entity identifier
  561. // ns_LIBERROR library error, null pointer
  562. //
  563. ///////////////////////////////////////////////////////////////////////////////////////////////////
  564. ns_RESULT ns_stdcall ns_GetNeuralInfo
  565. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, ns_NEURALINFO *pNeuralInfo, UINT32 dwNeuralInfoSize);
  566. ///////////////////////////////////////////////////////////////////////////////////////////////////
  567. // ns_GetNeuralData
  568. //
  569. // Purpose:
  570. // Retrieve requested number of Neural event timestamps (in sec)
  571. //
  572. // Parameters:
  573. // UINT32 hFile handle to NS data file
  574. // UINT32 dwEntityID Neural event entity ID
  575. // UINT32 dwStartIndex index of first Neural event item time to retrieve
  576. // UINT32 dwIndexCount number of Neural event items to retrieve
  577. // double *pData pointer to buffer to receive times
  578. //
  579. // Return Values:
  580. // ns_OK function succeeded
  581. // ns_BADFILE invalid file handle
  582. // ns_BADENTITY inappropriate or invalie entity identifier
  583. // ns_LIBERROR library error, null pointer
  584. //
  585. ///////////////////////////////////////////////////////////////////////////////////////////////////
  586. ns_RESULT ns_stdcall ns_GetNeuralData
  587. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, UINT32 dwStartIndex, UINT32 dwIndexCount, double *pdData);
  588. ///////////////////////////////////////////////////////////////////////////////////////////////////
  589. // ns_GetIndexByTime
  590. //
  591. // Purpose:
  592. // Given the time (sec), return the closest data item index, as specified by nFlag.
  593. // Finds the packet with the closest time to the requested time.
  594. //
  595. // Parameters:
  596. // UINT32 hFile handle to NS data file
  597. // UINT32 dwEntityID entity ID to search for
  598. // UINT32 dwSearchTimeStamp timestamp of item to search for
  599. // INT32 nFlag position of item relative to the requested timestamp
  600. // UINT32 *pdwIndex pointer to index of item to retrieve
  601. //
  602. // Return Values:
  603. // ns_OK function succeeded
  604. // ns_BADFILE invalid file handle
  605. // ns_LIBERROR library error, null pointer
  606. //
  607. ///////////////////////////////////////////////////////////////////////////////////////////////////
  608. ns_RESULT ns_stdcall ns_GetIndexByTime
  609. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, double dTime, INT32 nFlag, UINT32 *pdwIndex);
  610. ///////////////////////////////////////////////////////////////////////////////////////////////////
  611. // ns_GetTimeByIndex
  612. //
  613. // Purpose:
  614. // Given an index for an entity data item, return the time in seconds.
  615. //
  616. // Parameters:
  617. // UINT32 hFile handle to NS data file
  618. // UINT32 dwEntityID entity ID to search for
  619. // UINT32 dwIndex index of entity item to search for
  620. // double *pdTime time of entity to retrieve
  621. //
  622. // Return Values:
  623. // ns_OK function succeeded
  624. // ns_BADFILE invalid file handle
  625. // ns_LIBERROR library error, null pointer
  626. //
  627. ///////////////////////////////////////////////////////////////////////////////////////////////////
  628. ns_RESULT ns_stdcall ns_GetTimeByIndex
  629. (NS_FIRST_ARG UINT32 hFile, UINT32 dwEntityID, UINT32 dwIndex, double *pdTime);
  630. ///////////////////////////////////////////////////////////////////////////////////////////////////
  631. // ns_GetLastErrorMsg
  632. //
  633. // Purpose:
  634. // Retrieve the most recent error text message
  635. //
  636. // Parameters:
  637. // char *pszMsgBuffer pointer to text buffer to receive error message
  638. // UINT32 dwMsgBufferSize size in bytes of text buffer
  639. //
  640. // Return Values:
  641. // ns_OK function succeeded
  642. // ns_LIBERROR library error
  643. //
  644. ///////////////////////////////////////////////////////////////////////////////////////////////////
  645. ns_RESULT ns_stdcall ns_GetLastErrorMsg
  646. (NS_FIRST_ARG char *pszMsgBuffer, UINT32 dwMsgBufferSize);
  647. /*=========================================================================
  648. | PACKING
  649. ========================================================================*/
  650. #if defined(__GNUC__)
  651. #undef GCC_ALIGN_4
  652. #elif defined(_MSC_VER)
  653. #pragma pack(pop)
  654. #endif
  655. /*=========================================================================
  656. | C++ SUPPORT
  657. ========================================================================*/
  658. #ifdef __cplusplus
  659. }
  660. #endif
  661. #endif // include guards