|
|
@@ -37,7 +37,7 @@ public:
|
|
|
class CFaceTrackingEntity : public CEntityBase, public CHostApi , public CVideoMonitorEvent, public ISysVarListener, public ITimerListener,public ILogListener
|
|
|
{
|
|
|
public:
|
|
|
- CFaceTrackingEntity() : m_facecapture(NULL), bIsSessionChange(FALSE),strCustomerID(false),strSessionID(false),bIsCustomerChange(FALSE)
|
|
|
+ CFaceTrackingEntity() : m_facecapture(NULL), bIsSessionChange(false),strCustomerID(false),strSessionID(false),bIsCustomerChange(false), m_bSingleCamera(false)
|
|
|
{
|
|
|
// note: this object initialize at DllMain, so it suggests keep your code simple here.
|
|
|
// 1) do simple initializing here
|
|
|
@@ -50,7 +50,7 @@ public:
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
ErrorCodeEnum Error;
|
|
|
- BOOL bRet = FALSE;
|
|
|
+ bool bRet = false;
|
|
|
m_facecapture = new Clibfacecapture(&bRet, this, this, REC_COMMON_VIDEO_ENV_SHM_RTP_QUEUE, REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE, REC_COMMON_VIDEO_OPT_SHM_RTP_QUEUE);
|
|
|
if (!bRet)
|
|
|
{
|
|
|
@@ -114,19 +114,10 @@ public:
|
|
|
//is Pad Version
|
|
|
CSystemStaticInfo stStaticinfo;
|
|
|
spFunction->GetSystemStaticInfo(stStaticinfo);
|
|
|
- if (stricmp(stStaticinfo.strMachineType,"RVC.PAD")==0)
|
|
|
- {
|
|
|
- m_bIsPadType = TRUE;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_bIsPadType = FALSE;
|
|
|
+ if (stricmp(stStaticinfo.strMachineType,"RVC.Stand1SPlus")==0){
|
|
|
+ m_bSingleCamera = true;
|
|
|
}
|
|
|
|
|
|
- if (!m_bIsPadType)
|
|
|
- {
|
|
|
- spFunction->SetTimer(1, this, 500);
|
|
|
- }
|
|
|
spFunction->SubscribeLog(m_UUid1, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_HEADLIGHT_GREEN_OFF,NULL,false);
|
|
|
spFunction->SubscribeLog(m_UUid2, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED,NULL,false);
|
|
|
spFunction->SubscribeLog(m_UUid3, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED,NULL,false);
|
|
|
@@ -136,7 +127,6 @@ public:
|
|
|
virtual void OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<ITransactionContext> pTransactionContext)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
- spFunction->KillTimer(1); // if timer 1 not exist also ok
|
|
|
delete m_facecapture;
|
|
|
m_facecapture = NULL;
|
|
|
spFunction->UnsubscribeLog(m_UUid1);
|
|
|
@@ -179,6 +169,7 @@ public:
|
|
|
}
|
|
|
else if (dwUserCode == LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED)
|
|
|
{
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED event");
|
|
|
CSimpleStringA strValue;
|
|
|
GetFunction()->GetSysVar("CameraState", strValue);
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
@@ -186,7 +177,8 @@ public:
|
|
|
if (3 != iState) {
|
|
|
m_facecapture->SetCameraState(iState);
|
|
|
m_facecapture->StartFaceCapture();
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
m_facecapture->SetCameraState(3);
|
|
|
}
|
|
|
#else
|
|
|
@@ -209,19 +201,25 @@ public:
|
|
|
m_facecapture->SetCameraState(3);
|
|
|
}
|
|
|
#endif //RVC_OS_WIN
|
|
|
+ if (!m_bSingleCamera) {
|
|
|
+ GetFunction()->SetTimer(1, this, 1000);
|
|
|
+ }
|
|
|
}
|
|
|
else if (dwUserCode == LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED)
|
|
|
{
|
|
|
-#if defined(RVC_OS_LINUX)
|
|
|
- m_facecapture->SetCameraState(3);
|
|
|
-#endif //RVC_OS_LINUX
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED event");
|
|
|
+
|
|
|
m_facecapture->StopFaceCapture();
|
|
|
-#if defined(RVC_OS_WIN)
|
|
|
CSimpleStringA strValue;
|
|
|
GetFunction()->GetSysVar("CameraState", strValue);
|
|
|
int iState = TransCameraStateToInt(strValue[0]);
|
|
|
m_facecapture->SetCameraState(iState);
|
|
|
-#endif //RVC_OS_WIN
|
|
|
+
|
|
|
+ if (!m_bSingleCamera) {
|
|
|
+ GetFunction()->KillTimer(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ GetFunction()->SetSysVar(SYSVAR_ACTIVETRACKINGCAMERA, ACTIVETRACKINGCAMERA_ENV); // from Operation -> Environment
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -266,7 +264,6 @@ public:
|
|
|
|
|
|
virtual void OnTimeout(DWORD dwTimerID)
|
|
|
{
|
|
|
- //LOG_FUNCTION();
|
|
|
__int64 uid;
|
|
|
CCustomerStatus status;
|
|
|
//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("before GetMainCustomerStatus");
|
|
|
@@ -280,7 +277,7 @@ public:
|
|
|
{
|
|
|
if (strValue[0] == 'O')
|
|
|
{
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ActiveTrackingCamera change from Opt->Env!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ActiveTrackingCamera change from Opt->Env!");
|
|
|
spFunction->SetSysVar(SYSVAR_ACTIVETRACKINGCAMERA, ACTIVETRACKINGCAMERA_ENV); // from Operation -> Environment
|
|
|
}
|
|
|
}
|
|
|
@@ -288,7 +285,7 @@ public:
|
|
|
{
|
|
|
if (strValue[0] == 'E')
|
|
|
{
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ActiveTrackingCamera change from Env->Opt!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ActiveTrackingCamera change from Env->Opt!");
|
|
|
spFunction->SetSysVar(SYSVAR_ACTIVETRACKINGCAMERA, ACTIVETRACKINGCAMERA_OPT); // from Environment -> Operation
|
|
|
}
|
|
|
}
|
|
|
@@ -307,9 +304,9 @@ public:
|
|
|
return m_lastUUID;
|
|
|
}
|
|
|
|
|
|
- virtual BOOL IsCustomerChange()
|
|
|
+ virtual bool IsCustomerChange()
|
|
|
{
|
|
|
- BOOL bChange = bIsSessionChange||bIsCustomerChange;
|
|
|
+ bool bChange = bIsSessionChange||bIsCustomerChange;
|
|
|
return bChange;
|
|
|
}
|
|
|
|
|
|
@@ -336,20 +333,21 @@ public:
|
|
|
snprintf(FaceName, uLen, "%s%s%s_%s", (LPCSTR)strPath, SPLIT_SLASH_STR, strSessionID.GetData(), strCustomerID.GetData());
|
|
|
#endif // RVC_OS_WIN
|
|
|
}
|
|
|
- bIsSessionChange = FALSE;
|
|
|
- bIsCustomerChange = FALSE;
|
|
|
+ bIsSessionChange = false;
|
|
|
+ bIsCustomerChange = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("getpath uploadphoto failed!");
|
|
|
}
|
|
|
}
|
|
|
- virtual BOOL LoadConfig(CFaceCaptureConfig &config)
|
|
|
+
|
|
|
+ virtual bool LoadConfig(CFaceCaptureConfig &config)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> spFunction = GetFunction();
|
|
|
CSmartPointer<IConfigInfo> spConfig;
|
|
|
ErrorCodeEnum Error(Error_Succeed);
|
|
|
- if (FALSE && (Error = spFunction->OpenConfig(Config_CenterSetting, spConfig)) == Error_Succeed) {
|
|
|
+ if (false && (Error = spFunction->OpenConfig(Config_CenterSetting, spConfig)) == Error_Succeed) {
|
|
|
SpIniMappingTable table;
|
|
|
table.AddEntryInt("general", "PrimCamera", config.nPrimCamera, 0);
|
|
|
table.AddEntryInt("general", "ContourMinAera", config.nContourMinAera, 0);
|
|
|
@@ -414,29 +412,18 @@ public:
|
|
|
{
|
|
|
va_list arg;
|
|
|
va_start(arg, fmt);
|
|
|
-
|
|
|
-#if defined(RVC_OS_WIN)
|
|
|
- int n = _vscprintf(fmt, arg);
|
|
|
-#else
|
|
|
int n = vsnprintf(NULL, 0, fmt, arg);
|
|
|
-#endif //RVC_OS_WIN
|
|
|
+
|
|
|
if (n >= MAX_LOG_LEN) {
|
|
|
char* buf = (char*)malloc((size_t)(n + 1));
|
|
|
-#if defined(RVC_OS_WIN)
|
|
|
- _vsnprintf(buf, n + 1, fmt, arg);
|
|
|
-#else
|
|
|
vsnprintf(buf, n + 1, fmt, arg);
|
|
|
-#endif //RVC_OS_WIN
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
|
|
|
free(buf);
|
|
|
}
|
|
|
else{
|
|
|
char strlog[MAX_LOG_LEN] = {0};
|
|
|
-#if defined(RVC_OS_WIN)
|
|
|
- _vsnprintf(strlog, MAX_LOG_LEN, fmt, arg);
|
|
|
-#else
|
|
|
vsnprintf(strlog, MAX_LOG_LEN, fmt, arg);
|
|
|
-#endif //RVC_OS_WIN
|
|
|
+
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
|
|
|
}
|
|
|
va_end(arg);
|
|
|
@@ -492,14 +479,14 @@ private:
|
|
|
{
|
|
|
GetFunction()->GetSysVar("SessionID",strSessionID);
|
|
|
//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sessionID change to %s",strSessionID);
|
|
|
- bIsSessionChange = TRUE;
|
|
|
+ bIsSessionChange = true;
|
|
|
}
|
|
|
|
|
|
if (_stricmp(pszKey,"CustomerID") == 0)
|
|
|
{
|
|
|
GetFunction()->GetSysVar("CustomerID",strCustomerID);
|
|
|
//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("customerID change to %s",strCustomerID);
|
|
|
- bIsCustomerChange = TRUE;
|
|
|
+ bIsCustomerChange = true;
|
|
|
}
|
|
|
|
|
|
if (_stricmp(pszKey,"CameraState") == 0)
|
|
|
@@ -529,14 +516,14 @@ private:
|
|
|
|
|
|
private:
|
|
|
CUUID m_UUid1,m_UUid2,m_UUid3;
|
|
|
- BOOL bIsSessionChange;
|
|
|
- BOOL bIsCustomerChange;
|
|
|
- BOOL m_bIsPadType;
|
|
|
+ bool bIsSessionChange;
|
|
|
+ bool bIsCustomerChange;
|
|
|
CSimpleStringA strCustomerID;
|
|
|
CSimpleStringA strSessionID;
|
|
|
CUUID m_lastUUID;
|
|
|
ChannelClient *m_pChannelClient;
|
|
|
Clibfacecapture *m_facecapture;
|
|
|
+ bool m_bSingleCamera;
|
|
|
};
|
|
|
|
|
|
void ChannelClient::OnMessage( ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData )
|