Files
RkApp/StartService/src/start.cpp

62 lines
1.3 KiB
C++
Raw Normal View History

2025-12-18 14:40:00 +08:00
/*
BSD服务启动程序,BSD系统的服务启动
*/
#include <iostream>
using namespace std;
void StartDeep();
int main(int argc, char **argv)
{
if (argc != 2)
{
cout << "Using:./start start/stop" << endl;
return -1;
}
string commnd = "";
string action(argv[1]);
if (action == "start")
{
commnd = "echo 'orangepi' | sh /home/orangepi/RKApp/StartService/bin/start.sh";
}
else if (action == "stop")
{
commnd = "echo 'orangepi' | sh /home/orangepi/RKApp/StartService/bin/stop.sh";
}
else
{
cout << "Unknown action: " << action << "\nUsing: ./start start|stop" << endl;
return -1;
}
system(commnd.c_str());
// StartDeep();
return 0;
}
void StartDeep()
{
// string cmd = "/home/orangepi/miniconda3/bin/python3 /opt/rknn-yolov11/src/yolov11_stereo_distance.py \
// --enable-v4l2-out \
// --v4l2-device /dev/video10 \
// --v4l2-out-pix-fmt rgb24 > /dev/null 2>&1";
string cmd = "python3 /opt/rknn-yolov11/src/yolov11_stereo_distance.py \
--enable-v4l2-out \
--v4l2-device /dev/video10 \
--v4l2-out-pix-fmt rgb24 > /dev/null 2>&1";
try
{
system(cmd.c_str());
}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
}
}