📄 memorycam.c~
字号:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <pthread.h>
#include "error.h"
#include "memorycam.h"
#include "panel.h"
#include "state.h"
#include "../common/nvram_linux.h"
#define TEST_MD
time_t TimeNow;
//struct tm *tmTimeNow, *tmTimePrev;
struct tm tmTimeNow, tmTimePrev;
pthread_t pidMDThreadID;
//clock_t ClockNow, ClockPrev;
int iHalfSec=0;
int iKey = KEY_NO_KEY;
time_t *tTimetoMemCam; // KCHong test
int iErrCode = ERR_NO_ERR;
int iVIOSD;
int iMAGE;
int iMD;
int iFileType;
int iBitRate;
int Year_Chg;
int Month_Chg;
int Day_Chg;
int Hour_Chg;
int Min_Chg;
int Sec_Chg;
int iFrameRate;
int iSchRec;
//static char wkDir[] = "/mnt";
extern volatile unsigned int bCtrlCReceived;
struct _mcmode mcontrol;
int MD_Result=0;
int main(int argc, char *argv[])
{
// int shmid;
// long *shmptr;
// key_t keytest;
mcontrol.md_mode = MD_OFF;
mcontrol.md_state = MD_START;
PANEL_Initial();
iStateNow = STATE_POWER_ON;
if (argc > 1)
{
if (!strncmp(argv[1], "logo", 4))
{
// PANEL_CloseHIU_GPIO ();
UTL_CloseHIU ();
UTL_CloseGPIO ();
return 0;
}
}
PANEL_Output (LCM_LINE_1, "Qpixel Memory Cam");
iStateNow = STATE_STANDBY;
iStateNext = STATE_NO_CHANGE;
iVIOSD = VIOSD_DISABLE;
iMD = MD_DISABLE;
iFileType = FILE_TYPE_PS;
iBitRate = BITRATE_1500;
iFrameRate = FRAMERATE_30;
Year_Chg=YEAR_2006;
//Month_Chg=MONTH_01;
Day_Chg=DAY_01;
Hour_Chg=HOUR_00;
Min_Chg=MIN_00;
Sec_Chg=SEC_00;
iSchRec = SCHREC_DISABLE;
extern int MD_Value;
extern int Rec_Status;
//keytest = ftok("/var", 0x5a);
// if (shmid = shmget (0, 4, (SHM_R | SHM_W)) < 0)
// printf ("\nshmget error");
// if ((shmptr = shmat (shmid, 0, 0)) == (void *) -1)
// printf ("\nshmat error");
// printf ("\nSHM MC from %x", shmptr);
tTimetoMemCam = ((volatile time_t *)(0x3600000)); // KCHong test
nv_sch_get();
while (1)
{
iKey = PANEL_KeyScan ();
if (iKey != KEY_NO_KEY)
printf ("\nReceived KEY = %d\n", iKey);
iKey = STATE_FindNextState (iKey);
getDeviceFreeMb(&wkDir[0]);
//rober motion test 071127
//rober motion test 071127
MD_Service();
//MD_RECFUN();
pthread_create(&pidMDThreadID,NULL,MD_RECFUN,NULL);
schedule_rec();
STATE_ExitCurrentState ();
STATE_EnterNextState ();
/* if(bCtrlCReceived){
get_motion_detection_vi();
}*/
time (&TimeNow);
gmtime_r (&TimeNow, &tmTimeNow);
// ClockNow = clock ();
if ((tmTimeNow.tm_sec != tmTimePrev.tm_sec))
{
tmTimePrev.tm_sec = tmTimeNow.tm_sec;
// printf ("\n%d, %d", ClockPrev, ClockNow);
// ClockPrev = ClockNow;
// iColFlag = 1;
iHalfSec = 1;
PANEL_Trigger ();
}
/*
if (iHalfSec && (abs (ClockNow - ClockPrev) > 500000)) // 0.5 sec
{
printf ("(%d)", ClockNow);
iHalfSec = 0;
iColFlag = 0;
ClockPrev = ClockNow;
//PANEL_Trigger ();
PANEL_ShowTime();
}
*/ usleep(100);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -