main.cpp 858 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "command.h"
  5. #define DO_CH_NUM 14
  6. int main(int argc, char *argv[])
  7. {
  8. unsigned char startChannel = 0;
  9. unsigned char stopChannel = 1;
  10. unsigned char *poutbuf = new unsigned char[2]{0, 0};
  11. int result = CommandExecutor::getAIRange(startChannel, stopChannel, poutbuf);
  12. // 检查返回值
  13. if (result != 0) {
  14. printf("Error: getAIRange failed with code %d\n", result);
  15. return result;
  16. }
  17. // 检查 poutbuf 是否为空
  18. if (poutbuf == nullptr) {
  19. printf("Error: poutbuf is null\n");
  20. return -1;
  21. }
  22. // 打印 poutbuf 的值
  23. printf("poutbuf[0] = %u, poutbuf[1] = %u\n", poutbuf[0], poutbuf[1]);
  24. // 释放 poutbuf 的内存(假设 CommandExecutor::getAIRange 分配了内存)
  25. delete[] poutbuf;
  26. return 0;
  27. }