cbsdk_helper.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Implementation of helper API for easy Cython wrapping.
  3. *
  4. * @date March 9, 2014
  5. * @author: dashesy
  6. */
  7. #include <string.h>
  8. #include "cbsdk_helper.h"
  9. cbSdkResult cbsdk_get_trial_config(uint32_t nInstance, cbSdkConfigParam * pcfg_param)
  10. {
  11. cbSdkResult sdkres = cbSdkGetTrialConfig(nInstance, &pcfg_param->bActive,
  12. &pcfg_param->Begchan, &pcfg_param->Begmask, &pcfg_param->Begval,
  13. &pcfg_param->Endchan, &pcfg_param->Endmask, &pcfg_param->Endval,
  14. &pcfg_param->bDouble, &pcfg_param->uWaveforms,
  15. &pcfg_param->uConts, &pcfg_param->uEvents, &pcfg_param->uComments,
  16. &pcfg_param->uTrackings,
  17. &pcfg_param->bAbsolute);
  18. return sdkres;
  19. }
  20. cbSdkResult cbsdk_set_trial_config(uint32_t nInstance, const cbSdkConfigParam * pcfg_param)
  21. {
  22. cbSdkResult sdkres = cbSdkSetTrialConfig(nInstance, pcfg_param->bActive,
  23. pcfg_param->Begchan,pcfg_param->Begmask, pcfg_param->Begval,
  24. pcfg_param->Endchan, pcfg_param->Endmask, pcfg_param->Endval,
  25. pcfg_param->bDouble, pcfg_param->uWaveforms,
  26. pcfg_param->uConts, pcfg_param->uEvents, pcfg_param->uComments,
  27. pcfg_param->uTrackings,
  28. pcfg_param->bAbsolute);
  29. return sdkres;
  30. }
  31. cbSdkResult cbsdk_init_trial_event(uint32_t nInstance, int reset, cbSdkTrialEvent * trialevent)
  32. {
  33. memset(trialevent, 0, sizeof(*trialevent));
  34. cbSdkResult sdkres = cbSdkInitTrialData(nInstance, reset, trialevent, 0, 0, 0);
  35. return sdkres;
  36. }
  37. cbSdkResult cbsdk_get_trial_event(uint32_t nInstance, int reset, cbSdkTrialEvent * trialevent)
  38. {
  39. cbSdkResult sdkres = cbSdkGetTrialData(nInstance, reset, trialevent, 0, 0, 0);
  40. return sdkres;
  41. }
  42. cbSdkResult cbsdk_init_trial_cont(uint32_t nInstance, int reset, cbSdkTrialCont * trialcont)
  43. {
  44. memset(trialcont, 0, sizeof(*trialcont));
  45. cbSdkResult sdkres = cbSdkInitTrialData(nInstance, reset, 0, trialcont, 0, 0);
  46. return sdkres;
  47. }
  48. cbSdkResult cbsdk_get_trial_cont(uint32_t nInstance, int reset, cbSdkTrialCont * trialcont)
  49. {
  50. cbSdkResult sdkres = cbSdkGetTrialData(nInstance, reset, 0, trialcont, 0, 0);
  51. return sdkres;
  52. }
  53. cbSdkResult cbsdk_init_trial_data(uint32_t nInstance, int reset, cbSdkTrialEvent * trialevent, cbSdkTrialCont * trialcont)
  54. {
  55. memset(trialevent, 0, sizeof(*trialevent));
  56. memset(trialcont, 0, sizeof(*trialcont));
  57. cbSdkResult sdkres = cbSdkInitTrialData(nInstance, reset, trialevent, trialcont, 0, 0);
  58. return sdkres;
  59. }
  60. cbSdkResult cbsdk_get_trial_data(uint32_t nInstance, int reset, cbSdkTrialEvent * trialevent, cbSdkTrialCont * trialcont)
  61. {
  62. cbSdkResult sdkres = cbSdkGetTrialData(nInstance, reset, trialevent, trialcont, 0, 0);
  63. return sdkres;
  64. }
  65. cbSdkResult cbsdk_init_trial_comment(uint32_t nInstance, int reset, cbSdkTrialComment * trialcomm)
  66. {
  67. memset(trialcomm, 0, sizeof(*trialcomm));
  68. cbSdkResult sdkres = cbSdkInitTrialData(nInstance, reset, 0, 0, trialcomm, 0);
  69. return sdkres;
  70. }
  71. cbSdkResult cbsdk_get_trial_comment(uint32_t nInstance, int reset, cbSdkTrialComment * trialcomm)
  72. {
  73. cbSdkResult sdkres = cbSdkGetTrialData(nInstance, reset, 0, 0, trialcomm, 0);
  74. return sdkres;
  75. }
  76. cbSdkResult cbsdk_file_config(uint32_t instance, const char * filename, const char * comment, int start, unsigned int options)
  77. {
  78. cbSdkResult sdkres = cbSdkSetFileConfig(instance, filename == NULL ? "" : filename, comment == NULL ? "" : comment, start, options);
  79. return sdkres;
  80. }