You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
512 lines
13 KiB
512 lines
13 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 05/04/2000
|
|
// Last modification: 08/10/2003
|
|
// Project Intruder Position Indicator
|
|
// SUBSYSTEM: Application
|
|
// FILE: Application.h
|
|
// AUTHOR: Chizhevskiy Sergey
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Header file of class CApplication
|
|
//----------------------------------------------------------------------------
|
|
|
|
#ifndef __APPLICATION__H__INCLUDED_
|
|
#define __APPLICATION__H__INCLUDED_
|
|
|
|
#include "ServiceDlg.h" // Added by ClassView
|
|
#include "EventWnd.h" // Added by ClassView
|
|
#define WM_ADD_TARGET (WM_USER+100)
|
|
#define WM_SYNCHRONIZATION (WM_USER+101)
|
|
|
|
//#define USE_FORCED_TIMER
|
|
|
|
#ifdef USE_FORCED_TIMER
|
|
#define WM_TIMER_FORCE (WM_USER+102)
|
|
#endif
|
|
|
|
#include "VideoForWindowsWnd.h"
|
|
#include "VideoStaticWnd.h"
|
|
#include "CameraDlg.h"
|
|
#include "LogFiles.h"
|
|
#include "Locator.h"
|
|
#include "Preview.h"
|
|
#include "Lgs.h"
|
|
#include "LgsBR.h"
|
|
#include "Profile.h"
|
|
#include "Alarm.h"
|
|
#include "ReportView.h"
|
|
//#include "Polygon.h"
|
|
#include "MessageDlg.h"
|
|
#include "Fence.h"
|
|
#include "AboutDlg.h"
|
|
#include "SetupDlg.h"
|
|
#include "EventQueue.h" // Added by ClassView
|
|
#include "TransferDlg.h" // Added by ClassView
|
|
#include "Transform.h"
|
|
//#include "Spinner.h" // 23/04/2001
|
|
#include "CameraPTZ.h" // 10/12/2001
|
|
#include "..\LgLib\Remote\LgRemoteServerTcpIp.h" // 10/12/2001
|
|
#include "..\LgLib\Remote\LgRemoteClientTcpIpMaster.h" // 10/12/2001
|
|
#include "..\LgLib\Remote\LgRemoteClientTcpIpBoardReceiverClient.h" // 10/12/2001
|
|
#include "..\lglib\Remote\LgRemoteInterface.h"
|
|
#include "PhoneCallCenter.h"
|
|
#include "ReportServer.h" // Added by ClassView
|
|
#include "HZMaskDlg.h" // Added by ClassView
|
|
#include "ImageButton.h" // Added by ClassView
|
|
#include "..\LgLib\Net\LgNetDeviceGPIOLPT.h"
|
|
#include "..\LgLib\Net\LgNetDeviceGPIOPCI1762.h"
|
|
#include "..\LgLib\Net\LgNetDeviceGPIOCOM.h"
|
|
#include "..\Lglib\MaskSchedule\LgMaskSchedule.h" // Added by ClassView
|
|
#include "VideoDirectShowStation.h" // Added by ClassView
|
|
#include "CalibratePTZDlg.h"
|
|
#include "LgWatchDog.h"
|
|
|
|
enum { MODE_NONE = 0,
|
|
MODE_PREALARM = 1,
|
|
MODE_MANUAL = 2,
|
|
MODE_TARGET_AUTO = 3,
|
|
MODE_TARGET_MANUAL = 4 };
|
|
|
|
struct FLAGS_HOLDER {
|
|
volatile BOOL bNeedReboot:1;
|
|
volatile BOOL bNeedHome:1;
|
|
volatile BOOL bNeedRotate:1;
|
|
volatile BOOL bNeedStop:1;
|
|
volatile BOOL bNeedTargetCapture:1;
|
|
volatile BOOL bNeedPrealarmCapture:1;
|
|
volatile BOOL bNeedPtzInquare:1;
|
|
volatile BOOL bNeedPtzSave:1;
|
|
volatile BOOL bNeedIris:1;
|
|
volatile BOOL bNeedWiper:1;
|
|
volatile BOOL bNeedDopler : 1;
|
|
volatile BOOL bNeedDoplerOFF : 1;
|
|
volatile BOOL bIrisMode:1;
|
|
volatile BOOL bNeedSwitchNight:1;
|
|
volatile BOOL bNeedSwitchDay:1;
|
|
volatile BOOL bAlarmMode:1;
|
|
volatile BOOL bViewZoneMode[6];
|
|
volatile BOOL bConnected:1;
|
|
volatile BOOL bFenceMode:1;
|
|
volatile BOOL bFenceModeAuto:1;
|
|
volatile BOOL bQuit:1;
|
|
volatile BOOL bSetupMode:1;
|
|
volatile BOOL bEditMode:1;
|
|
volatile BOOL bDebugMode:1;
|
|
volatile BOOL bNeedRestart:1;
|
|
volatile BOOL bFogMode:1;
|
|
volatile BOOL bNeedCancelDRD:1;
|
|
volatile BOOL bShowWide;
|
|
volatile BOOL bShowNormal: 1; // 11/05/2001, Capture video
|
|
volatile BOOL bWiperOn : 1;
|
|
volatile BOOL bPerformAutoLgsReset : 1;
|
|
volatile BOOL bSuperUserMode : 1;
|
|
volatile BOOL bVoltageOk : 1;
|
|
volatile BOOL bDoplerOn : 1;
|
|
};
|
|
|
|
struct CLASSES_HOLDER {
|
|
CVideoWnd *pVideoWnd;
|
|
CVideoWnd *pFixedVideoWnd;
|
|
// Spinner *pIndicator; // Instend of class CIndicator class Spinner 23/04/2001
|
|
CCameraDlg *pCameraDlg;
|
|
CLgsRadarWnd *pLocator;
|
|
CPreview *pPreview;
|
|
CLogFiles *pLog;
|
|
CCameraPtz *pPTZ;
|
|
CLgs *pLgs;
|
|
CProfile *pProfile;
|
|
CAlarm *pAlarm;
|
|
CReportView *pReportView;
|
|
CMessageDlg *pMessageDlg;
|
|
CFence *pFence;
|
|
CSetupDlg *pSetupDlg;
|
|
transform_3* pTransformMaster; // For remote camera master, 10/04/2001
|
|
transform_3* pTransformSlave; // For remote camera slave,10/04/2001
|
|
|
|
};
|
|
|
|
|
|
typedef struct INTERFACE_SKIN
|
|
{
|
|
RECT rMainVideo[2][2];
|
|
RECT rMainFixedVideo[2];
|
|
RECT rMainLocatorSmall;
|
|
RECT rMainLocatorBig;
|
|
RECT rMainEvent;
|
|
RECT rMainMask;
|
|
RECT rMainService;
|
|
RECT rMainCamera;
|
|
RECT rMainButtonReset;
|
|
RECT rMainButtonResetLGS;
|
|
RECT rMainButtonReport;
|
|
RECT rMainButtonSound;
|
|
RECT rMainButtonScale[3];
|
|
RECT rMainDate;
|
|
RECT rMainTime;
|
|
HBITMAP hMainBackground;
|
|
HBITMAP hMainService;
|
|
HBITMAP hMainMask;
|
|
HBITMAP hMainCamera;
|
|
HBITMAP hMainButtonReset;
|
|
HBITMAP hMainButtonResetLGS;
|
|
HBITMAP hMainButtonReport;
|
|
HBITMAP hMainButtonSoundOn;
|
|
HBITMAP hMainButtonSoundOff;
|
|
HBITMAP hMainButtonScale[3];
|
|
|
|
|
|
RECT rReportImage;
|
|
RECT rReportImageSlider;
|
|
RECT rReportPreview;
|
|
RECT rReportPreviewSlider;
|
|
RECT rReportText;
|
|
RECT rReportTree;
|
|
RECT rReportLocator;
|
|
RECT rReportDate;
|
|
RECT rReportTime;
|
|
RECT rReportButtonDetection;
|
|
HBITMAP hReportBackground;
|
|
HBITMAP hReportButtonDetection;
|
|
}INTERFACE_SKIN;
|
|
|
|
typedef struct PROGRAM_OPTIONS
|
|
{
|
|
BOOL bShowCommunicationErrors;
|
|
BOOL bShowAll;
|
|
}PROGRAM_OPTIONS;
|
|
|
|
class CApplication;
|
|
|
|
class CHZMaskSchedule : public CLgMaskSchedule
|
|
{
|
|
public:
|
|
CHZMaskSchedule() { m_pApplication = NULL; }
|
|
|
|
public:
|
|
BOOL Create( CApplication *pApplication );
|
|
|
|
protected:
|
|
virtual void MaskSwitch( CLgMaskScheduleLgsSwitch &arrSwitch );
|
|
|
|
private:
|
|
CApplication *m_pApplication;
|
|
};
|
|
|
|
class CApplication :
|
|
public CLgRemoteInterfaceLGS,
|
|
public CLgRemoteInterfaceInfo
|
|
#ifdef USE_FORCED_TIMER
|
|
,private CLgThread
|
|
#endif
|
|
{
|
|
private:
|
|
static LRESULT CALLBACK WndProc_(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
public:
|
|
CApplication();
|
|
~CApplication();
|
|
|
|
public:
|
|
void ChangeWiper( BOOL bOn );
|
|
void ChangeDopler( BOOL bOn );
|
|
CLgDeviceLGS::PLGS_BORDER GetBorder();
|
|
BOOL DrawMap( HWND );
|
|
void ReloadBitmaps();
|
|
void RestartLgs(HWND hWnd);
|
|
void EnableLgs(BOOL bEnable);
|
|
void ResetLgs( BOOL bAsk = TRUE );
|
|
void OptionsDlg();
|
|
void AddFenceEvent(INT n);
|
|
void SetIrisMode(BOOL fDay);
|
|
BOOL GetIrisMode();
|
|
void ChangeEditMode();
|
|
void ChangeSetupMode();
|
|
void ShowRotatingIcon();
|
|
void ShowReportView();
|
|
void SetShowNormal(BOOL fEnable);
|
|
void SetFenceMode(BOOL fEnable);
|
|
void SetScale(INT n); // 13/05/2001
|
|
void AddTarget(char master, const double& angle, const double& range, __int32 device, LONG nWidth );
|
|
void Reset( LPCTSTR pReason, BOOL bOnFullReset = TRUE );
|
|
void SetMode(INT nMode);
|
|
void ChangeCameraMode();
|
|
void ChangeViewZoneMode(INT n);
|
|
void SetViewZoneMode( INT nMode, BOOL bOn );
|
|
void ChangeAlarmMode();
|
|
void ChangeFenceMode();
|
|
void CaptureImage();
|
|
void SetPtz();
|
|
BOOL WndMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
|
|
HWND GetSafeHwnd() const;
|
|
CTargetQueue* GetTargetQueue();
|
|
CLgs *GetLgs() { return m_Classes.pLgs; }
|
|
CProfile *GetProfile() { return m_Classes.pProfile; }
|
|
|
|
BOOL CheckStartPassword();
|
|
|
|
private:
|
|
void OnPaint( HWND hWnd );
|
|
void OnDraw( HDC hDC );
|
|
void OnDrawTime( HDC hDC );
|
|
void OnTimer();
|
|
void ReadSkin( HINSTANCE hInstance );
|
|
void DeleteSkin();
|
|
BOOL OnCreate();
|
|
BOOL OnClose();
|
|
LRESULT OnPowerBroadcast( HWND, WPARAM, LPARAM );
|
|
|
|
void OnConnection(SYSTEMTIME& st, BOOL bConnected );
|
|
void OnPower(SYSTEMTIME& st, BOOL bPowered );
|
|
void OnOperationMode( SYSTEMTIME &st, BOOL bDetectionMode );
|
|
|
|
void CheckIrisSwitchTime(SYSTEMTIME& st);
|
|
void CheckFenceSwitchTime(LARGE_INTEGER& li);
|
|
void CheckDoplerOFF( LARGE_INTEGER& li );
|
|
void CheckFogSwitchTime(LARGE_INTEGER& li);
|
|
void CheckReset(SYSTEMTIME& st, LARGE_INTEGER& li);
|
|
void CheckPtzCommands(SYSTEMTIME& st, LARGE_INTEGER& li);
|
|
void CheckShowTime(SYSTEMTIME& st, LARGE_INTEGER& li);
|
|
|
|
private:
|
|
// volatile LARGE_INTEGER m_LastSyncTime;
|
|
volatile LARGE_INTEGER m_LastTargetTime;
|
|
volatile LARGE_INTEGER m_FirstTargetTime;
|
|
volatile LARGE_INTEGER m_LastFenceTime;
|
|
volatile LARGE_INTEGER m_LastFogTime;
|
|
volatile LARGE_INTEGER m_LastWideTime;
|
|
volatile LARGE_INTEGER m_LastBlindTime;
|
|
// volatile INT m_LastSyncVolume;
|
|
// volatile INT m_SyncErrorCount;
|
|
|
|
public:
|
|
FLAGS_HOLDER m_Flags;
|
|
|
|
private:
|
|
TARGET_DESCRIPTION m_CaptureTD;
|
|
CLASSES_HOLDER m_Classes;
|
|
CTargetQueue m_TargetQueue;
|
|
CTransferDlg m_TransferDlg;
|
|
// SYSTEMTIME m_LastSyncSysTime;
|
|
// CPolygons m_Polygons;
|
|
DWORD m_nLastSnapShot;
|
|
double m_LastTargetAngle;
|
|
// double m_LastCameraPan;
|
|
HANDLE m_hThreadTimer;
|
|
DWORD m_dwThreadID;
|
|
DWORD m_LastCaptureTime;
|
|
DWORD m_PreviewTime;
|
|
HWND m_hWnd;
|
|
HWND hwndVideo;
|
|
BOOL m_bLgsEnabled;
|
|
INT m_nPresetCount;
|
|
INT m_CurrentMode;
|
|
INT m_CurrentScale;
|
|
BOOL m_bSnapShotEnabled;
|
|
|
|
BOOL m_bFirstTarget;
|
|
|
|
public:
|
|
CCameraPtz* GetCameraPTZ() { return m_Classes.pPTZ; }
|
|
|
|
public:
|
|
BOOL m_bInSetupMode;
|
|
|
|
public:
|
|
CHZMaskSchedule& GetHZMaskSchedule() { return m_HZMaskSchedule; }
|
|
|
|
private:
|
|
virtual BOOL OnRemoteInfoConnect( BOOL bConnected ) { return TRUE; }
|
|
virtual BOOL DoRemoteInfoTransfer() { return TRUE; }
|
|
virtual BOOL OnRemoteInfoTransfer( PLARGE_INTEGER pTX, PLARGE_INTEGER pRX ) { return TRUE; }
|
|
|
|
private:
|
|
CLgRemoteServerTcpIp m_RemoteServer;
|
|
CLgRemoteClientTcpIpMultiIPI m_RemoteClientMaster;
|
|
// CLgRemoteClientTcpIpBoardReceiverClient m_BoardReceiverClient;
|
|
// CLgsBR m_BoardReceiverLgs;
|
|
|
|
|
|
private:
|
|
CReportServer m_ReportServer;
|
|
virtual BOOL DoRemoteLgsReset();
|
|
virtual BOOL DoRemoteLgsClear();
|
|
virtual BOOL DoRemoteLgsBorder();
|
|
virtual BOOL DoRemoteLgsSensitivity( BYTE bSensitivity );
|
|
virtual BOOL DoRemoteLgsHiddenOn( BOOL bSet, BYTE bHiddenOn );
|
|
virtual BOOL DoRemoteLgsConnect();
|
|
virtual BOOL DoRemoteLgsPhoto();
|
|
virtual BOOL DoRemoteLgsVoltage();
|
|
|
|
private:
|
|
CServiceDlg m_ServiceDlg;
|
|
CHZMaskDlg m_MaskDlg;
|
|
CEventWnd m_EventWnd;
|
|
TCHAR m_pCommandLine[MAX_PATH];
|
|
|
|
private:
|
|
CImageButton m_ButtonReset;
|
|
CImageButton m_ButtonReport;
|
|
CImageButton m_ButtonSound;
|
|
CImageButton m_ButtonResetLGS;
|
|
CImageButton m_ButtonScale[3];
|
|
|
|
private:
|
|
INTERFACE_SKIN m_Skin;
|
|
|
|
public:
|
|
INTERFACE_SKIN& GetSkin() { return m_Skin; }
|
|
|
|
private:
|
|
void SetAlarmCheck(BOOL fEnable);
|
|
void EnableScales(BOOL fEnable);
|
|
void SetScaleCheck(INT n);
|
|
void EnableResetLgs( BOOL fEnable );
|
|
|
|
private:
|
|
virtual void OnEvtInputChange( INT nInput, BOOL bOn );
|
|
virtual void OnEvtGetInputAll( CLgDeviceGPIO::PGPIO_PINS pPins );
|
|
|
|
private:
|
|
void OnWmDrawMap( HWND hWnd, WPARAM wParam, LPARAM lParam );
|
|
void OnWmFullDrawMap( HWND hWnd, WPARAM wParam, LPARAM lParam );
|
|
|
|
private:
|
|
void OnWmLgsResetNotify( HWND hWnd, WPARAM wParam, LPARAM lParam );
|
|
|
|
private:
|
|
void CheckExternalAlarm( LARGE_INTEGER *liTime );
|
|
void AddExternalAlarm( double dAngle, LARGE_INTEGER *liTime );
|
|
typedef struct PARALEL_PORT_ALARM
|
|
{
|
|
LARGE_INTEGER liTime;
|
|
BOOL bOn;
|
|
}PARALEL_PORT_ALARM;
|
|
PARALEL_PORT_ALARM m_ParallelAlarm[9];
|
|
|
|
private:
|
|
BOOL m_bExternalAlarmInitiated;
|
|
|
|
private:
|
|
BOOL Capture( TARGET_DESCRIPTION& td );
|
|
DWORD m_LastFixedCaptureTime;
|
|
|
|
private:
|
|
CVideoDirectShowStation m_VideoDirectShowStation;
|
|
CHZMaskSchedule m_HZMaskSchedule;
|
|
|
|
public:
|
|
CPhoneCallCenter& GetCallCenter() { return m_PhoneCallCenter; }
|
|
|
|
private:
|
|
CPhoneCallCenter m_PhoneCallCenter;
|
|
|
|
public:
|
|
BOOL DrawBorder( BOOL bFast, BOOL bMaster, BOOL bSlave );
|
|
void DrawFixedVideo( HDC hDC, RECT& rect, double scale );
|
|
|
|
private:
|
|
BOOL m_bExternalDrawInProgress;
|
|
BOOL m_bExternalResetInProgress;
|
|
|
|
private:
|
|
void CheckMessageGPIO( SYSTEMTIME &st, LARGE_INTEGER &li );
|
|
|
|
private:
|
|
CLgNetDeviceGPIOLPT m_GPIOLPT;
|
|
CLgNetDeviceGPIOPCI1762 m_GPIOPCI1762;
|
|
CLgNetObject m_GPIOMsgSink;
|
|
|
|
#ifdef USE_FORCED_TIMER
|
|
private:
|
|
virtual DWORD ThreadProc();
|
|
#endif
|
|
|
|
private:
|
|
CCalibratePTZDlg m_CalibratePTZDlg;
|
|
|
|
private:
|
|
void CheckClientTask();
|
|
typedef struct CLIENT_TASK
|
|
{
|
|
enum
|
|
{
|
|
DO_LGS_BORDER,
|
|
DO_LGS_CLEAR,
|
|
DO_LGS_HIDDEN_ON,
|
|
DO_LGS_PHOTO,
|
|
DO_LGS_RESET,
|
|
DO_LGS_SENSITIVITY,
|
|
DO_LGS_VOLTAGE
|
|
} task;
|
|
union
|
|
{
|
|
BYTE bSensitivity;
|
|
struct
|
|
{
|
|
BOOL bSet;
|
|
BYTE bHiddenOn;
|
|
};
|
|
};
|
|
}CLIENT_TASK, *PCLIENT_TASK;
|
|
CLgQueueP<CLIENT_TASK,100> m_ClientTaskArray;
|
|
|
|
public:
|
|
CLgWatchDog *GetWatchDog() { return m_pWatchDog; }
|
|
|
|
private:
|
|
CLgWatchDog *m_pWatchDog;
|
|
|
|
public:
|
|
PROGRAM_OPTIONS& GetProgramOptions() { return m_ProgramOptions; }
|
|
|
|
private:
|
|
PROGRAM_OPTIONS m_ProgramOptions;
|
|
|
|
private:
|
|
INT m_nRotatingIconStep;
|
|
};
|
|
|
|
inline
|
|
HWND CApplication::GetSafeHwnd() const
|
|
{
|
|
return m_hWnd;
|
|
}
|
|
|
|
inline
|
|
CTargetQueue* CApplication::GetTargetQueue()
|
|
{
|
|
return &m_TargetQueue;
|
|
}
|
|
|
|
inline
|
|
void CApplication::RestartLgs(HWND hWnd)
|
|
{
|
|
m_Classes.pLgs->CmdRestartLgs(hWnd);
|
|
}
|
|
|
|
inline
|
|
void CApplication::ReloadBitmaps()
|
|
{
|
|
m_Classes.pLocator->LoadBitmaps(m_Classes.pProfile);
|
|
|
|
SetScale(m_CurrentScale);
|
|
}
|
|
|
|
/*
|
|
NOTE: CHECK!!!
|
|
inline
|
|
void CApplication::CheckSnapshot()
|
|
{
|
|
if((GetTickCount() - m_nLastSnapShot) > (DWORD)m_Classes.pProfile->PtzTime() && m_bSnapShotEnabled )
|
|
{
|
|
if(m_Classes.pVideoWnd)
|
|
m_Classes.pVideoWnd->Snapshot();
|
|
|
|
m_nLastSnapShot = GetTickCount();
|
|
}
|
|
}
|
|
*/
|
|
|
|
#endif
|