| 1234567891011121314151617181920212223242526272829303132333435 |
- #include <cstdint>
- #include <map>
- #include <iostream>
- #include <cstring>
- #include <cstdio>
- #include <string>
- #include <memory>
- #include "camera_log.h"
- class CommandExecutor
- {
- private:
- static std::string executeCommand(const std::string &command)
- {
- // 使用 popen 执行命令并捕获其输出
- std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(command.c_str(), "r"), pclose);
- if (!pipe)
- {
- IT3256_LOGI("it3256 Failed to execute command %{public}s", command.c_str());
- std::cerr << ": Failed to execute command: " << command << std::endl;
- return "-1";
- }
- // 读取命令的输出
- char buffer[128];
- std::string result;
- while (fgets(buffer, sizeof(buffer), pipe.get()) != nullptr)
- {
- result += buffer;
- }
- IT3256_LOGI("it3256 success to execute command %{public}s", result.c_str());
- return result;
- }
- public:
- static int getAIRange(unsigned char startChannel, unsigned char stopChannel, unsigned char *poutbuf);
- };
|