main.cpp 607 B

123456789101112131415161718192021222324252627
  1. #include <QCoreApplication>
  2. #include "ytdhcam.h"
  3. #include "ytdhcamcore.h"
  4. SysConfShm *sysConfShm;
  5. bool load_shm(){
  6. int shmid;
  7. key_t key;
  8. if((key = ftok(SHM_PATH,static_cast<int>(SHM_PORT)))==-1)
  9. return false;
  10. if((shmid = shmget(key,sizeof(SysConfShm),IPC_CREAT|0666))==-1)
  11. return false;
  12. sysConfShm = static_cast<SysConfShm *>(shmat(shmid,nullptr,0));
  13. return true;
  14. }
  15. int main(int argc, char *argv[])
  16. {
  17. QCoreApplication a(argc, argv);
  18. if(load_shm()){
  19. ytDHCamCore *core = new ytDHCamCore(nullptr);
  20. core->start();
  21. }
  22. return a.exec();
  23. }