123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include <QCoreApplication>
- #include "videocore.h"
- #include "ytvideo.h"
- #include "../ytUserInfoProcess/userinfo.h"
- #include "../DataPrecessDog/dataprecess.h"
- UserInfoShm *userinfoShm;
- SysConfShm *sysConfShm;
- DataProcessShm *dataProcessShm;
- VideosensorList *vSensorList;
- bool shm_load(){
- int shmid;
- key_t key;
- if((key = ftok(SHM_PATH,static_cast<int>(SHM_PORT)))==-1)
- return false;
- if((shmid = shmget(key,sizeof(DataProcessShm),IPC_CREAT|0666))==-1)
- return false;
- dataProcessShm = static_cast<DataProcessShm *>(shmat(shmid,nullptr,0));
- if((key = ftok(UISHM_PATH,static_cast<int>(UISHM_PORT)))==-1)
- return false;
- if((shmid = shmget(key,sizeof(UserInfoShm),IPC_CREAT|0666))==-1)
- return false;
- userinfoShm = static_cast<UserInfoShm *>(shmat(shmid,nullptr,0));
- if((key = ftok(UISHM_PATH,static_cast<int>(SYSCONF_PORT)))==-1)
- return false;
- if((shmid = shmget(key,sizeof(SysConfShm),IPC_CREAT|0666))==-1)
- return false;
- sysConfShm = static_cast<SysConfShm *>(shmat(shmid,nullptr,0));
- if((key=ftok(VASHM_PATH,static_cast<int>(VASHM_PORT)))==-1)
- return false;
- if((shmid=shmget(key,sizeof(VideosensorList),IPC_CREAT|0666))==-1)
- return false;
- vSensorList = static_cast<VideosensorList *>(shmat(shmid,nullptr,0));
- return true;
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- if(shm_load()){
- VideoCore *core = new VideoCore(nullptr);
- core->start();
- }else
- exit(1);
- return a.exec();
- }
|