Browse Source

just in case

AGP
Evgeny Gagua 3 years ago
parent
commit
92d3caf37d
  1. 125
      lib/App/common/deviceNodeCamera.cpp
  2. 3
      lib/App/common/deviceNodeCamera.h
  3. 6
      lib/App/common/kernelModuleEmbedVideo.cpp
  4. 2
      lib/App/common/kernelModuleEmbedVideo.h
  5. 11
      lib/App/mojo/mojoKernel.cpp
  6. 2
      lib/App/mojo/mojoKernel.h
  7. 4
      lib/data/protocol/protocol.cpp

125
lib/App/common/deviceNodeCamera.cpp

@ -11,7 +11,8 @@
#include "hardwareManager.h"
#include "hardwareResourceSerialProvider.h"
//#include "rgooseModuleEmbedVideo.h"
#include "kernelModuleEmbedVideo.h"
#include "../mojo/mojoKernel.h"
#define LOG( X ) deviceNode::m_pLog->Log( "RCAM", this, X )
@ -88,7 +89,7 @@ static const float cam_predef_focal_length[CAM_FOCAL_LENGTH_CNT]={
deviceNodeCamera::deviceNodeCamera( uint32_t NodeID ): deviceNode( NodeID ), basicThread(){
//m_pLog = basicLogCollection::getInstance();
m_pBEH = basicEventHeap::getInstance();
m_bSkeepPositioningWait = true;
m_tTimeTSeconds = 0;
m_pProtocol = NULL;
m_pTransport = NULL;
@ -109,7 +110,7 @@ deviceNodeCamera::deviceNodeCamera( uint32_t NodeID ): deviceNode( NodeID ), bas
deviceNodeCamera::deviceNodeCamera( DBC_NODE_DATA *Data ): deviceNode( Data ), basicThread(){
//m_pLog = basicLogCollection::getInstance();
m_pBEH = basicEventHeap::getInstance();
m_bSkeepPositioningWait = true;
m_tTimeTSeconds = 0;
m_pProtocol = NULL;
m_pTransport = NULL;
@ -450,6 +451,12 @@ bool deviceNodeCamera::create(){
#ifdef DEBUG
LOG("Proto is OK");
#endif
mojoKernel *tKRNL = mojoKernel::getInstance();
if( tKRNL ) {
m_bSkeepPositioningWait = (( tKRNL->getMediaMode() & EVE_OUTPUT_VIDEO ) == EVE_OUTPUT_VIDEO );
} else {
LOG_ERROR("No Kernel Instance!");
};
m_sCamData.online = init();
};
m_pDBC->updateCamOnlineStatus( m_sCamData.id, m_sCamData.online );
@ -964,79 +971,82 @@ void deviceNodeCamera::m_fThreadProc( void ){
m_fCP_Zoom = m_pCurrentROI->cam_orientation.zoom;
// Do Movement
LOG("GO ABS Movement -> INSTCAP??" );
if( !m_pProtocol->goAbsolute(
m_pCurrentROI->cam_orientation.pan,
m_pCurrentROI->cam_orientation.tilt,
( m_pCurrentROI->cam_orientation.zoom * m_fZoomCorrection )
)){
LOG_ERROR("Cannot Issue goAbsolute Command!->Restart Camera?");
setWM( CAM_WS_END );//CAM_WS_READY );
setWM( CAM_WS_END );
} else {
// Waiting Movement finish
setWM( CAM_WS_WAIT_ONPOS );
/*
// Send Capture event
DBC_SNAPSHOT_DATA *tData = fusion_translate_ROI( m_pCurrentROI );
if( tData != NULL ) {
if( m_pBEH ){
EVENT_CONTAINER *tEVT = createBasicEvent(
m_sNodeData.node_id,
EVT_CLASS_CAMERA_CTRL,
EVT_CAMERA_ON_POSITION,
NULL, NULL, tData );
if( tEVT ){
#ifdef DEBUG
LOG("BCAST CAM ONPOS");
#endif
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
m_pBEH->broadcast( tEVT );
if ( m_bSkeepPositioningWait ) {
// Send Capture event
DBC_SNAPSHOT_DATA *tData = fusion_translate_ROI( m_pCurrentROI );
utilizeROI( m_pCurrentROI );
setWM( CAM_WS_READY );
if( tData != NULL ) {
if( m_pBEH ){
EVENT_CONTAINER *tEVT = createBasicEvent(
m_sNodeData.node_id,
EVT_CLASS_CAMERA_CTRL,
EVT_CAMERA_ON_POSITION,
NULL, NULL, tData );
if( tEVT ){
#ifdef DEBUG
LOG("BCAST CAM ONPOS");
#endif
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
m_pBEH->broadcast( tEVT );
} else {
free( tData );
};
} else {
free( tData );
};
} else {
free( tData );
};
};
*/
} else {
setWM(CAM_WS_WAIT_ONPOS);
};
};
//utilizeROI( m_pCurrentROI );
} else setWM( CAM_WS_READY );
break;
};
case CAM_WS_WAIT_ONPOS:{
DBC_SNAPSHOT_DATA *tData = NULL;
if( m_pCurrentROI != NULL ){
m_pProtocol->waitMoveIsDone();
if( 0 ){
LOG_ERROR("Cannot Issue getPosition Command!->Restart Camera?");
setWM( CAM_WS_END );//CAM_WS_READY );
} else {
// Send Capture event
DBC_SNAPSHOT_DATA *tData = fusion_translate_ROI( m_pCurrentROI );
if( tData != NULL ) {
if( m_pBEH ){
EVENT_CONTAINER *tEVT = createBasicEvent(
m_sNodeData.node_id,
EVT_CLASS_CAMERA_CTRL,
EVT_CAMERA_ON_POSITION,
NULL, NULL, tData );
if( tEVT ){
#ifdef DEBUG
LOG("BCAST CAM ONPOS");
#endif
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
m_pBEH->broadcast( tEVT );
} else {
free( tData );
};
} else {
free( tData );
};
// Send Capture event
tData = fusion_translate_ROI( m_pCurrentROI );
utilizeROI(m_pCurrentROI);
};
// To Accept any new ROI's ??
setWM( CAM_WS_READY );
if (!m_pProtocol->waitMoveIsDone()) {
//Some Cameras does not upport that :(
//LOG_ERROR("Cannot Issue getPosition Command!->Restart Camera?");
//setWM( CAM_WS_END );
};
if( tData != NULL ) {
if( m_pBEH ){
EVENT_CONTAINER *tEVT = createBasicEvent(
m_sNodeData.node_id,
EVT_CLASS_CAMERA_CTRL,
EVT_CAMERA_ON_POSITION,
NULL, NULL, tData );
if( tEVT ){
#ifdef DEBUG
LOG("BCAST CAM ONPOS");
#endif
//tEVT->m_db_id = tTASK->source_evt_id; // EVT ids embed in DATA
m_pBEH->broadcast( tEVT );
} else {
free( tData );
};
} else {
free( tData );
};
utilizeROI( m_pCurrentROI );
tData = NULL;
};
setWM( CAM_WS_READY );
break;
};
case CAM_WS_GO_HOMING_PRESET:{
@ -1197,6 +1207,11 @@ void deviceNodeCamera::m_fThreadProc( void ){
#endif
};
bool deviceNodeCamera::setNoPositionWait( bool FL ){
m_bSkeepPositioningWait = FL;
return true;
};
bool deviceNodeCamera::testFOV( C3D_DECART L ){
//System Coords -> trans to local and go to funct
systemAnchor* tSystem = systemAnchor::getInstance();

3
lib/App/common/deviceNodeCamera.h

@ -151,6 +151,7 @@ class deviceNodeCamera: public deviceNode, public basicThread {
float m_fCP_Tilt;
float m_fCP_Zoom;
bool m_bSkeepPositioningWait;
/* Methotds Sutable to Control Camera */
bool relativeMove( float PanSPD, float TiltSPD, float ZoomSPD );
bool relativeStop();
@ -200,7 +201,7 @@ class deviceNodeCamera: public deviceNode, public basicThread {
virtual ~deviceNodeCamera();
bool create();
virtual bool validate();
bool setNoPositionWait( bool FL = true );
};
typedef std::vector<deviceNodeCamera *> vectorNodeCameras;

6
lib/App/common/kernelModuleEmbedVideo.cpp

@ -99,7 +99,7 @@ kernelModuleEmbedVideo::kernelModuleEmbedVideo( uint32_t moduleID ): kernelModul
sprintf( tB, "Frame: [%dx%d]", m_sEmbedVideoData.width, m_sEmbedVideoData.height );
LOG( tB );
if( m_sEmbedVideoData.output_mode & EVE_OUTPUT_PICTURES ) LOG("Output Pictures");
if( m_sEmbedVideoData.output_mode & EVE_OUTPUT_VIDEO ) LOG("Output Video");
if( ( m_sEmbedVideoData.output_mode & EVE_OUTPUT_VIDEO ) == EVE_OUTPUT_VIDEO ) LOG("Output Video");
if (m_sEmbedVideoData.show_ts) LOG("Show TimeStamp");
if( m_sEmbedVideoData.show_label ) LOG("Show Label");
if( m_sEmbedVideoData.show_logo ) LOG("Show Logo");
@ -241,6 +241,10 @@ void signal_pipe_handler( int SIG ){
// Web Client Disconnected!
};
uint8_t kernelModuleEmbedVideo::getMediaMode( void ){
return m_sEmbedVideoData.output_mode;
};
void *kernelModuleEmbedVideo::webClientProc( void *ptr ){

2
lib/App/common/kernelModuleEmbedVideo.h

@ -458,7 +458,7 @@ class kernelModuleEmbedVideo: public kernelModule, public basicDualThread {
int getHeight( void );
bool registerStream( uint32_t streamID );
bool unregisterStream( uint32_t streamID );
uint8_t getMediaMode( void );
friend class streamHandler;
};

11
lib/App/mojo/mojoKernel.cpp

@ -24,6 +24,7 @@
#include "../common/kernelEventFilterAPF.h"
#include "../common/kernelEventFilterTrain.h"
#include "../common/kernelModuleEmbedVideo.h"
#ifdef USE_MYSQL
#include "../common/MySQL_dataBinder.h"
@ -59,6 +60,7 @@ mojoKernel::mojoKernel( config_setting_t *ptr ):kernelPrototype( ptr ){
m_pSystemAnchor = NULL;
m_bSessionStarted = false;
m_bWorkWithRemoteServer = false;
m_bMediaMode = 0;
//setWM( WM_NONE );
};
@ -212,6 +214,15 @@ bool mojoKernel::create(){
LOG_ERROR("Module Factory Failure!");
return false;
};
// Read Media Mode ( Video/Pictures )
kernelModuleEmbedVideo *tMO = (kernelModuleEmbedVideo*) m_pModuleFactory->getModule( KERNEL_MODULE_EMBED_VIDEO );
if( tMO ) {
m_bMediaMode = tMO->getMediaMode();
} else {
LOG_ERROR("No Embed Video Processing Module!");
};
m_pNodeFactory = deviceNodeFactory::getInstance();
if( !m_pNodeFactory ){
LOG_ERROR("Node Factory Failure!");

2
lib/App/mojo/mojoKernel.h

@ -71,6 +71,7 @@ class mojoKernel: public kernelPrototype{
bool m_bDebugMode;
bool m_bWorkWithRemoteServer;
bool m_bSessionStarted;
uint8_t m_bMediaMode;
uint32_t m_nNoAlarmCounter;
@ -106,6 +107,7 @@ class mojoKernel: public kernelPrototype{
virtual bool create();
virtual void dispatchEvent( EVENT_CONTAINER *Evt );
inline bool getDebugMode(){ return m_bDebugMode; };
inline uint8_t getMediaMode(){ return m_bMediaMode; };
};
#endif // __MOJJO_KERNEL_H_INCL__

4
lib/data/protocol/protocol.cpp

@ -122,7 +122,7 @@ basicTransport *protocolParser::getCurrentTransport( void ){
bool protocolParser::parse( U8 *Buffer, size_t BufferSize ){
bool rv = false;
if( m_pParserBuffer != NULL ) {
#ifdef DEBUG
#ifdef DEBUG_EXTRA
char ttZZ[513];
sprintf( ttZZ, "New %d bytes to Parse (allredy have in buffer: %d)", BufferSize, m_nParserDataCount );
LOG(ttZZ);
@ -179,7 +179,9 @@ bool protocolParser::parse( U8 *Buffer, size_t BufferSize ){
free(tVal);
};
} else {
#ifdef DEBUG_EXTRA
LOG("Handler Consumed Data!");
#endif
dataEraser(tVal->m_pData);
free(tVal);
};

Loading…
Cancel
Save