6 changed files with 7721 additions and 0 deletions
-
3741lib/App/common/streamHandler.cpp
-
366lib/App/common/streamHandler.h
-
2449lib/data/bosch_rcp/bosch_rcp.cpp
-
606lib/data/bosch_rcp/bosch_rcp.h
-
513lib/data/protocol/protocolPTZ_BRCP.cpp
-
46lib/data/protocol/protocolPTZ_BRCP.h
3741
lib/App/common/streamHandler.cpp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,366 @@ |
|||
#ifndef __STREAM_HANDLER_EMBED_VIDEO_HEADER__ |
|||
#define __STREAM_HANDLER_EMBED_VIDEO_HEADER__ |
|||
|
|||
|
|||
#include "../../components/base/basicDualThread.h" |
|||
#include "../../components/base/basicEventHeap.h" |
|||
#include "../../components/base/basicMutex.h" |
|||
#include "kernelModule.h" |
|||
#define EVE_SEQUENTAL_OUTPUT |
|||
|
|||
#ifndef EVE_SEQUENTAL_OUTPUT |
|||
//#define EVE_ENABLE_EASE_OUTPUT_FPS |
|||
#endif |
|||
|
|||
// #include "../../data/media/video/videoAVLIBDestination.h" |
|||
#include "../../components/base/basicMediaDestination.h" |
|||
#include "../../components/base/basicMediaSource.h" |
|||
|
|||
#define VIDEO_SCRATCHPAD_PATH (DB_SHMEM_POINT "/video_scratch") |
|||
|
|||
|
|||
//Predefine Classess |
|||
class kernelModuleEmbedVideo; |
|||
class streamHandler; |
|||
|
|||
#define FILESTREAMBUFFERSZ 1048576 |
|||
|
|||
#ifndef MEKOROT_PROJECT__ |
|||
#define EVE_ENABLE_VIDEO |
|||
#endif |
|||
|
|||
#define USE_SCALING_IN |
|||
// #define USE_CV_DENOISE |
|||
// #define USE_CV_TONEMAP |
|||
|
|||
#ifndef DB_SHMEM_POINT |
|||
#define DB_SHMEM_POINT "/dev/shm/argus" |
|||
#endif |
|||
|
|||
#ifdef EVE_ENABLE_VIDEO |
|||
#define VIDEO_OUTPUT_FPS 15 |
|||
|
|||
#ifndef EVE_SEQUENTAL_OUTPUT |
|||
// In case of sequental video files - no need two encoders |
|||
#define SEPARATED_VIDEO_ENCODERS |
|||
#endif |
|||
// #define EVE_DONT_DELETE_SEGMENTS |
|||
|
|||
/* Video CODECS */ |
|||
#define VC_VPX 0 |
|||
#define VC_X264 1 |
|||
#define VC_MP4 2 |
|||
#define VC_MJPEG 3 |
|||
#define VC_FLV 4 |
|||
|
|||
/* Video FORMATS */ |
|||
#define VF_WEBM 0 |
|||
#define VF_MP4 1 |
|||
#define VF_MP3 2 |
|||
#define VF_AAC 3 |
|||
#define VF_OGG 4 |
|||
#define VF_MJPEG 5 |
|||
#define VF_FLV 6 |
|||
|
|||
/* Encoder PROFILES */ |
|||
#define VP_ULTRAFAST 0 |
|||
#define VP_VERYFAST 1 |
|||
#define VP_FAST 2 |
|||
#define VP_MEDIUM 3 |
|||
#define VP_SLOW 4 |
|||
#define VP_VERYSLOW 5 |
|||
#define VP_ULTRASLOW 6 |
|||
|
|||
#define VO_MJPEG 1 |
|||
#define VO_MPEG4 2 |
|||
#define VO_H264 3 |
|||
#define VO_H265 4 |
|||
#define VO_FLV 5 |
|||
#define VO_DIRECT_MJPG 6 |
|||
|
|||
#define DIRECT_MJPEG_COMPOSING |
|||
|
|||
#ifdef DIRECT_MJPEG_COMPOSING |
|||
#define VIDEO_OUTPUT VO_DIRECT_MJPG |
|||
#else |
|||
#define OPENCV_VIDEO_OUTPUT |
|||
#define VIDEO_OUTPUT VO_DIRECT_MJPG |
|||
#ifndef OPENCV_VIDEO_OUTPUT |
|||
// #define VIDEO_OUTPUT VO_MJPEG |
|||
#define VIDEO_OUTPUT VO_MPEG4 |
|||
// #define VIDEO_OUTPUT VO_H264 |
|||
// #define VIDEO_OUTPUT VO_H265 |
|||
// #define VIDEO_OUTPUT VO_FLV |
|||
// #define VIDEO_OUTPUT_WIDTH 640 //1920 |
|||
// #define VIDEO_OUTPUT_HEIGHT 480 //1080 |
|||
// #define VIDEO_OUTPUT_FPS 10 |
|||
// #define VIDEO_OUTPUT_GOP 15 |
|||
#else // OPENCV_VIDEO_OUTPUT |
|||
#define VIDEO_OUTPUT VO_MJPEG // VO_CV_MP4 |
|||
#endif |
|||
#endif // DIRECT_MJPEG_COMPOSING |
|||
|
|||
#if (LIBAVCODEC_VERSION_MAJOR < 54) |
|||
#define VIDEO_OUTPUT_CODEC CODEC_ID_MJPEG |
|||
#define VIDEO_OUTPUT_PIX_FMT PIX_FMT_YUVJ422P |
|||
#else |
|||
#if VIDEO_OUTPUT == VO_MJPEG |
|||
#define VIDEO_OUTPUT_CODEC AV_CODEC_ID_MJPEG |
|||
#define VIDEO_OUTPUT_PIX_FMT AV_PIX_FMT_YUV420P // AV_PIX_FMT_YUVJ422P |
|||
#define VIDEO_OUTPUT_CONTAINER_LONG "mjpeg" |
|||
#define VIDEO_OUTPUT_BITRATE 4000000 |
|||
#define VIDEO_OUTPUT_CONTAINER "mjpeg" |
|||
#elif VIDEO_OUTPUT == VO_MPEG4 |
|||
#define VIDEO_OUTPUT_CODEC AV_CODEC_ID_MPEG4 |
|||
#define VIDEO_OUTPUT_PIX_FMT AV_PIX_FMT_YUV420P |
|||
#define VIDEO_OUTPUT_CONTAINER_LONG "mp4" |
|||
#define VIDEO_OUTPUT_BITRATE 4000000 |
|||
#define VIDEO_OUTPUT_CONTAINER "mp4" |
|||
#elif VIDEO_OUTPUT == VO_H264 |
|||
#define VIDEO_OUTPUT_CODEC AV_CODEC_ID_H264 |
|||
#define VIDEO_OUTPUT_PIX_FMT AV_PIX_FMT_YUV420P |
|||
#define VIDEO_OUTPUT_BITRATE 4000000 |
|||
#define VIDEO_OUTPUT_CONTAINER_LONG "mp4" |
|||
#define VIDEO_OUTPUT_CONTAINER "mp4" |
|||
#elif VIDEO_OUTPUT == VO_H265 |
|||
#define VIDEO_OUTPUT_CODEC AV_CODEC_ID_H265 |
|||
#define VIDEO_OUTPUT_PIX_FMT AV_PIX_FMT_YUV420P |
|||
#define VIDEO_OUTPUT_BITRATE 4000000 |
|||
#define VIDEO_OUTPUT_CONTAINER_LONG "mp4" |
|||
#define VIDEO_OUTPUT_CONTAINER "mp4" |
|||
#elif VIDEO_OUTPUT == VO_FLV |
|||
#define VIDEO_OUTPUT_CODEC AV_CODEC_ID_FLV1 |
|||
#define VIDEO_OUTPUT_PIX_FMT AV_PIX_FMT_YUV420P |
|||
#define VIDEO_OUTPUT_CONTAINER_LONG "flv" |
|||
#define VIDEO_OUTPUT_BITRATE 4000000 |
|||
#define VIDEO_OUTPUT_CONTAINER "flv" |
|||
#elif VIDEO_OUTPUT == VO_CV_MP4 |
|||
#define VIDEO_OUTPUT_PIX_FMT AV_PIX_FMT_YUV420P |
|||
#define VIDEO_OUTPUT_BITRATE 4000000 |
|||
#define VIDEO_OUTPUT_CONTAINER_LONG "mp4" |
|||
#define VIDEO_OUTPUT_CONTAINER "mp4" |
|||
#elif VIDEO_OUTPUT == VO_DIRECT_MJPG |
|||
#define VIDEO_OUTPUT_CONTAINER_LONG "mjpeg" |
|||
#define VIDEO_OUTPUT_CONTAINER "mjpeg" |
|||
#endif |
|||
#endif |
|||
#endif // EVE_ENABLE_VIDEO |
|||
|
|||
typedef struct S_buffer_data |
|||
{ |
|||
uint8_t * buf; |
|||
int size; |
|||
uint8_t * ptr; |
|||
size_t room; ///< size left in the buffer |
|||
} buffer_data; |
|||
|
|||
#define NR_COLORS 4 |
|||
#define AVIO_BUFFER_SIZE 4096 |
|||
#define BD_BUFFER_SIZE 1024 |
|||
|
|||
#define PRE_ALARM_TIME_MILSECONDS 5000 // 5 sec |
|||
#define POST_ALARM_TIME_MILSECONDS 5000 // 5 sec |
|||
#define ENCODING_SEGMENT_MILSECONDS 50000 // 50 sec |
|||
#define ENCODING_SEGMENT_LIMIT_MILSECONDS 60000 // 1 minute |
|||
// #define ENCODING_SEGMENT_LIMIT_MILSECONDS 900000 // 15 minutes |
|||
|
|||
|
|||
// #define ENCODER_DISABLED 0 |
|||
// #define ENCODER_ENABLED 1 |
|||
|
|||
#define EVE_ENABLE_DROP_OUTPUT_FPS |
|||
|
|||
#ifdef EVE_ENABLE_VIDEO |
|||
#ifdef DIRECT_MJPEG_COMPOSING |
|||
typedef struct S_ENCODING_BUFFER |
|||
{ |
|||
uint8_t * data; |
|||
size_t size; |
|||
} ENCODING_BUFFER; |
|||
#else //! DIRECT_MJPEG_COMPOSING |
|||
#ifdef OPENCV_VIDEO_OUTPUT |
|||
typedef struct S_ENCODING_BUFFER |
|||
{ |
|||
int cols; |
|||
int rows; |
|||
uint8_t * data; |
|||
size_t size; |
|||
} ENCODING_BUFFER; |
|||
#else //! OPENCV_VIDEO_OUTPUT |
|||
typedef struct S_ENCODING_BUFFER |
|||
{ |
|||
int linesize[2]; |
|||
int rows; |
|||
uint8_t * data[2]; |
|||
size_t size; |
|||
} ENCODING_BUFFER; |
|||
#endif //! OPENCV_VIDEO_OUTPUT |
|||
#endif //! DIRECT_MJPEG_COMPOSING |
|||
|
|||
typedef std::queue<ENCODING_BUFFER *> Q_ENCODING_BUFFER; |
|||
#endif // EVE_ENABLE_VIDEO |
|||
|
|||
class streamHandler : |
|||
public basicMediaDestination |
|||
#ifdef EVE_ENABLE_VIDEO |
|||
, public basicThread |
|||
#endif |
|||
{ |
|||
private: |
|||
|
|||
basicLogCollection * m_pLog; |
|||
basicMediaSource * m_pSource; |
|||
MEDIA_SOURCE_DESC m_sSourceDesc; |
|||
char m_cSourceType; |
|||
DBC_MEDIA_STREAM_DATA m_sStreamData; |
|||
basicMutex m_mProtector; |
|||
kernelModuleEmbedVideo * m_pMaster; |
|||
uint8_t m_bEvtMarkerCounter; |
|||
uint8_t m_bCamMoveCounter; |
|||
|
|||
dataBinder * m_pDBC; |
|||
MS_WORK_MODE m_eWM; |
|||
basicMutex m_mEvtIDS_Protector; |
|||
|
|||
#ifdef EVE_ENABLE_VIDEO |
|||
|
|||
#ifdef EVE_SEQUENTAL_OUTPUT |
|||
basicMutex m_mEventBindingBlocker; |
|||
#endif |
|||
|
|||
uint32_t m_nPreAlarmFrames; |
|||
uint32_t m_nPostAlarmFrames; |
|||
uint32_t m_nSegmentLimitFrames; |
|||
uint32_t m_nHardLimitFrames; |
|||
|
|||
basicMutex m_mFrameCounterProtector; |
|||
uint64_t m_nGlobalFrameCounter; |
|||
uint64_t m_nValidatorFrameCounter; |
|||
#ifndef EVE_SEQUENTAL_OUTPUT |
|||
uint32_t m_nSegAFrameCounter; |
|||
uint32_t m_nSegBFrameCounter; |
|||
uint32_t m_nSegAShiftFrames; |
|||
uint32_t m_nSegBShiftFrames; |
|||
uint32_t m_nSegASkippedFrames; |
|||
uint32_t m_nSegBSkippedFrames; |
|||
|
|||
uint8_t m_bActiveEncoderStream; |
|||
bool m_bSegAActive; |
|||
bool m_bSegADelete; |
|||
bool m_bSegBActive; |
|||
bool m_bSegBDelete; |
|||
VIDEO_SEGMENT_INFO m_sStreamSegmentInfo[2]; |
|||
#else |
|||
uint32_t m_nSegFrameCounter; |
|||
uint32_t m_nSegShiftFrames; |
|||
uint32_t m_nSegSkippedFrames; |
|||
bool m_bSegActive; |
|||
bool m_bSegDelete; |
|||
bool m_bNSegDelete; |
|||
VIDEO_SEGMENT_INFO m_sStreamSegmentInfo; |
|||
#endif |
|||
uint8_t m_bFlipMode; |
|||
basicMutex m_mCurrentOperationProtector; |
|||
uint8_t m_bCOP; |
|||
|
|||
|
|||
#ifdef DIRECT_MJPEG_COMPOSING |
|||
#ifndef EVE_SEQUENTAL_OUTPUT |
|||
FILE * m_pOutputFD[2]; |
|||
#else |
|||
FILE * m_pOutputFD; |
|||
#endif |
|||
#else // !DIRECT_MJPEG_COMPOSING |
|||
#ifdef OPENCV_VIDEO_OUTPUT |
|||
#ifndef EVE_SEQUENTAL_OUTPUT |
|||
cv::VideoWriter * m_pEncoderA; |
|||
cv::VideoWriter * m_pEncoderB; |
|||
#else |
|||
cv::VideoWriter * m_pEncoder; |
|||
#endif |
|||
#else //! OPENCV_VIDEO_OUTPUT |
|||
// char m_pVideoScratchPath[PATH_MAX]; |
|||
#ifdef SEPARATED_VIDEO_ENCODERS |
|||
// LibAV encoding video stuff |
|||
#ifndef EVE_SEQUENTAL_OUTPUT |
|||
// Stream A |
|||
AVCodec * m_pVideoACodec; |
|||
AVCodecContext * m_pCodecACtx; |
|||
AVFrame * m_pAVAFrame; |
|||
uint8_t * m_pOutABuffer; |
|||
// Stream B |
|||
AVCodec * m_pVideoBCodec; |
|||
AVCodecContext * m_pCodecBCtx; |
|||
AVFrame * m_pAVBFrame; |
|||
uint8_t * m_pOutBBuffer; |
|||
#else |
|||
AVCodec * m_pVideoCodec; |
|||
AVCodecContext * m_pCodecCtx; |
|||
AVFrame * m_pAVFrame; |
|||
uint8_t * m_pOutBuffer; |
|||
#endif |
|||
#else //! SEPARATED_VIDEO_ENCODERS |
|||
// LibAV encoding video stuff |
|||
AVCodec * m_pVideoCodec; |
|||
AVCodecContext * m_pCodecCtx; |
|||
AVFrame * m_pAVFrame; |
|||
uint8_t * m_pOutBuffer; |
|||
#endif //! SEPARATED_VIDEO_ENCODERS |
|||
// Common Pix Converter ( for both streams ) |
|||
SwsContext * m_pConvertCtx; |
|||
#endif //! OPENCV_VIDEO_OUTPUT |
|||
|
|||
// char m_cSegNameA[128]; |
|||
// char m_cSegMD5A[33]; |
|||
// char m_cSegNameB[128]; |
|||
// char m_cSegMD5B[33]; |
|||
|
|||
AVOutputFormat * m_pFormat; |
|||
#ifdef SEPARATED_VIDEO_ENCODERS |
|||
// File Context 2 units |
|||
AVFormatContext * m_pFormatCtxA; |
|||
AVFormatContext * m_pFormatCtxB; |
|||
AVStream * m_pVideoStrA; |
|||
AVStream * m_pVideoStrB; |
|||
#else |
|||
// File Context 1 units |
|||
AVFormatContext * m_pFormatCtx; |
|||
AVStream * m_pVideoStr; |
|||
#endif |
|||
// common output options |
|||
AVDictionary * m_pFormatOpts; |
|||
#endif //! DIRECT_MJPEG_COMPOSING |
|||
basicMutex m_mEncodingQueueProtector; |
|||
Q_ENCODING_BUFFER m_qEncodingQueue; |
|||
#ifndef EVE_SEQUENTAL_OUTPUT |
|||
bool openSegmentA(void); |
|||
void closeSegmentA(void); |
|||
bool openSegmentB(void); |
|||
void closeSegmentB(void); |
|||
void swapActiveStreams(void); |
|||
#endif |
|||
void closeAll(); |
|||
bool initVideoOutput(); |
|||
|
|||
protected: |
|||
|
|||
void m_fThreadProc(void); |
|||
#endif //! EVE_ENABLE_VIDEO |
|||
|
|||
public: |
|||
|
|||
explicit streamHandler(kernelModuleEmbedVideo * ptr, MS_WORK_MODE M = MS_MODE_DECODE_FRAMES, uint8_t flip_mode = 0); |
|||
virtual ~streamHandler(); |
|||
bool create(dataBinder * ptr, uint32_t stremID); |
|||
/* from Media Destination */ |
|||
virtual bool pushFrame(AVFrame * Frame, void * src = NULL); |
|||
// virtual void pushFrame( cv::Mat* Frame, void* src = NULL); |
|||
virtual bool pushFrame(cv::Mat & Frame, void * src = NULL); |
|||
bool triggerEvent(uint32_t eid, uint32_t & dbid, uint32_t & frame); |
|||
bool triggerCamMove(void); |
|||
bool validate(void); |
|||
}; |
|||
|
|||
typedef map<uint32_t, streamHandler *> mapSTREAMHANDLERS; |
|||
|
|||
#endif |
|||
2449
lib/data/bosch_rcp/bosch_rcp.cpp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,606 @@ |
|||
#ifndef __BOSCH_RCP_CLASS_HEADER__ |
|||
#define __BOSCH_RCP_CLASS_HEADER__ |
|||
|
|||
#include <curl/curl.h> |
|||
#include <openssl/sha.h> |
|||
#include <vector> |
|||
|
|||
#ifdef __linux__ |
|||
#include <arpa/inet.h> |
|||
#include <netdb.h> |
|||
#include <netinet/in.h> |
|||
#include <pthread.h> |
|||
#include <sys/socket.h> |
|||
#include <unistd.h> |
|||
#endif |
|||
|
|||
#include "../../alg/generic/base64.h" |
|||
#include "../../components/base/basicLogCollection.h" |
|||
#include "../../components/base/basicTypes.h" |
|||
#include "../curl/curlRequestsManager.h" |
|||
#include "../protocol/xmlParser.h" |
|||
|
|||
#define CURL_MANAGER |
|||
// #define DEBUG_BRCP_PRINTOUT_MESSAGES |
|||
// #define DEBUG_BRCP_TRAFFIC |
|||
|
|||
|
|||
#define BRCP_PACK_GET_SYS_DTS \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetSystemDateAndTime xmlns=\"http://www.onvif.org/ver10/device/wsdl\"/></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_CAPABILITIES \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetCapabilities xmlns=\"http://www.onvif.org/ver10/device/wsdl\"><Category>All</Category></GetCapabilities></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_VIDEO_SOURCES \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetVideoSources xmlns=\"http://www.onvif.org/ver10/media/wsdl\"/></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_PROFILES \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetProfiles xmlns=\"http://www.onvif.org/ver10/media/wsdl\"/></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_SERVICES \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetServices xmlns=\"http://www.onvif.org/ver10/device/wsdl\"><IncludeCapability>false</IncludeCapability></GetServices></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_DEV_INFO \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetDeviceInformation xmlns=\"http://www.onvif.org/ver10/device/wsdl\"/></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_STREAM_URI \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetStreamUri xmlns=\"http://www.onvif.org/ver10/media/wsdl\"><StreamSetup><Stream xmlns=\"http://www.onvif.org/ver10/schema\">%s</Stream><Transport xmlns=\"http://www.onvif.org/ver10/schema\"><Protocol>%s</Protocol></Transport></StreamSetup><ProfileToken>%s</ProfileToken></GetStreamUri></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_PICTURE_URI \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetSnapshotUri xmlns=\"http://www.onvif.org/ver10/media/wsdl\"><ProfileToken>%s</ProfileToken></GetSnapshotUri></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_PRESETS \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetPresets xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken></GetPresets></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_PTZ_NODE \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetNode xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><NodeToken>%s</NodeToken></GetNode></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GET_PTZ_STATUS \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GetStatus xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken></GetStatus></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_GOTO_PRESET \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><GotoPreset xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PresetToken>%s</PresetToken><Speed><PanTilt x=\"%0.3f\" y=\"%0.3f\" xmlns=\"http://www.onvif.org/ver10/schema\"/><Zoom x=\"%0.3f\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></GotoPreset></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_REMOVE_PRESET \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><RemovePreset xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PresetToken>%s</PresetToken></RemovePreset></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_SET_PRESET \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SetPreset xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PresetName>%s</PresetName></SetPreset></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_RELATIVE_MOVE \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><RelativeMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Translation><PanTilt x=\"%0.2f\" y=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Translation><Speed><PanTilt x=\"%0.2f\" y=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></RelativeMove></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_RELATIVE_ZOOM \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><RelativeMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Translation><Zoom x=\"%0.2f\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Translation><Speed><Zoom x=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></RelativeMove></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_ABSOLUTE_MOVE \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><AbsoluteMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Position><PanTilt x=\"%0.6f\" y=\"%0.6f\" xmlns=\"http://www.onvif.org/ver10/schema\"/><Zoom x=\"%0.6f\" space=\"http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Position><Speed><PanTilt x=\"1\" y=\"1\" xmlns=\"http://www.onvif.org/ver10/schema\"/><Zoom x=\"1\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Speed></AbsoluteMove></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_CONTINUOUS_MOVE \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Velocity><PanTilt x=\"%0.2f\" y=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>" |
|||
// #define BRCP_PACK_CONTINUOUS_MOVE_A (CSTR)"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:tptz=\"http://www.onvif.org/ver20/ptz/wsdl\" |
|||
// xmlns:tt=\"http://www.onvif.org/ver10/schema\"><soap:Body><tptz:ContinuousMove><tptz:ProfileToken>Profile_1</tptz:ProfileToken><tptz:Velocity><tt:PanTilt x=\"1\" y=\"1\"/><tt:Zoom |
|||
// x=\"1\"/></tptz:Velocity></tptz:ContinuousMove></soap:Body></soap:Envelope>" |
|||
#define BRCP_PACK_CONTINUOUS_ZOOM \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><Velocity><Zoom x=\"%0.2f\" space=\"http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>" |
|||
#define BRCP_PACK_PTZ_STOP \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><Stop xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>%s</ProfileToken><PanTilt>true</PanTilt><Zoom>true</Zoom></Stop></s:Body></s:Envelope>" |
|||
|
|||
#define BRCP_ENVELOPE_EXT \ |
|||
(CSTR)"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><e:Envelope xmlns:e=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:w=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" xmlns:d=\"http://schemas.xmlsoap.org/ws/2005/04/discovery\" xmlns:dn=\"http://www.onvif.org/ver10/network/wsdl\">%s%s</e:Envelope>" |
|||
#define PONVIF_ENVELOPE_SIM (CSTR) "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">%s%s</s:Envelope>" |
|||
#define PONVIF_BODY (CSTR) "<s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">%s</s:Body>" |
|||
#define BRCP_HEADER_PROBE \ |
|||
(CSTR)"<e:Header><w:MessageID>uuid:84ede3de-7dec-11d0-c360-f01234567890</w:MessageID><w:To e:mustUnderstand=\"true\">urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To><w:Action a:mustUnderstand=\"true\">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action></e:Header>" |
|||
#define BRCP_HEADER_SECUR \ |
|||
(CSTR)"<s:Header><Security s:mustUnderstand=\"1\" xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><UsernameToken><Username>%s</Username><Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">%s</Password><Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">%s</Nonce><Created xmlns=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">%s</Created></UsernameToken></Security></s:Header>" |
|||
|
|||
#define BRCP_PCK_GET_CAPABILITIES (CSTR) "<GetCapabilities xmlns=\"http://www.onvif.org/ver10/device/wsdl\"><Category>All</Category></GetCapabilities>" |
|||
|
|||
typedef struct S_accessToken |
|||
{ |
|||
char USERNAME[CTEXT]; |
|||
char PASSDIGEST[CTEXT]; // SHA_DIGEST_LENGTH]; |
|||
char NONCE[CTEXT]; // SHA_DIGEST_LENGTH]; |
|||
char TIMESTAMP[CTEXT]; |
|||
} accessToken; |
|||
|
|||
typedef struct S_videoSourceProfile |
|||
{ |
|||
char sourcetoken[CTEXT]; |
|||
char profiletoken[CTEXT]; |
|||
char profilename[CTEXT]; |
|||
char encoding[16]; |
|||
int width; |
|||
int height; |
|||
int fps; |
|||
int bitrate; |
|||
} videoSourceProfile; |
|||
|
|||
typedef struct S_onvifVideoResolution |
|||
{ |
|||
int Width; |
|||
int Height; |
|||
} onvifVideoResolution; |
|||
|
|||
typedef struct S_onvifBacklightCompensation |
|||
{ |
|||
bool Mode; |
|||
float Level; |
|||
} onvifBacklightCompensation; |
|||
|
|||
typedef enum E_onvifExposurePriority |
|||
{ |
|||
LowNoise = 0, |
|||
FrameRate |
|||
} onvifExposurePriority; |
|||
|
|||
typedef struct S_onvifRectangle |
|||
{ |
|||
int x; |
|||
int y; |
|||
int width; |
|||
int height; |
|||
} onvifRectangle; |
|||
|
|||
typedef struct S_onvifExposure |
|||
{ |
|||
bool Mode; |
|||
onvifExposurePriority Priority; |
|||
onvifRectangle Window; |
|||
float MinExposureTime; |
|||
float MaxExposureTime; |
|||
float MinGain; |
|||
float MaxGain; |
|||
float MinIris; |
|||
float MaxIris; |
|||
float ExposureTime; |
|||
float Gain; |
|||
float Iris; |
|||
} onvifExposure; |
|||
|
|||
typedef enum E_onvifOnOffAuto |
|||
{ |
|||
ON = 0, |
|||
OFF, |
|||
AUTO |
|||
} onvifOnOffAuto; |
|||
|
|||
typedef struct S_onvifFocusConfiguration |
|||
{ |
|||
bool AutoFocusMode; |
|||
float DefaultSpeed; |
|||
float NearLimit; |
|||
float FarLimit; |
|||
} onvifFocusConfiguration; |
|||
|
|||
typedef struct S_onvifWideDynamicRange |
|||
{ |
|||
bool Mode; |
|||
float Level; |
|||
} onvifWideDynamicRange; |
|||
|
|||
typedef struct S_onvifWhiteBalanceExtension |
|||
{ |
|||
} onvifWhiteBalanceExtension; |
|||
|
|||
typedef struct S_onvifWhiteBalance |
|||
{ |
|||
bool Mode; |
|||
float CrGain; |
|||
float CbGain; |
|||
onvifWhiteBalanceExtension * Extension; |
|||
} onvifWhiteBalance; |
|||
|
|||
typedef struct S_onvifImagingSettingsExtension |
|||
{ |
|||
} onvifImagingSettingsExtension; |
|||
|
|||
typedef struct S_onvifImagingSettings |
|||
{ |
|||
onvifBacklightCompensation * BacklightCompensation; |
|||
float Brightness; |
|||
float ColorSaturation; |
|||
float Contrast; |
|||
onvifExposure * Exposure; |
|||
onvifFocusConfiguration * Focus; |
|||
onvifOnOffAuto IrCutFilter; |
|||
float Sharpness; |
|||
onvifWideDynamicRange * WideDynamicRange; |
|||
onvifWhiteBalance * WhiteBalance; |
|||
onvifImagingSettingsExtension * Extension; |
|||
} onvifImagingSettings; |
|||
|
|||
typedef struct S_onvifVideoSourceExtension |
|||
{ |
|||
onvifImagingSettings * Imaging; |
|||
} onvifVideoSourceExtension; |
|||
|
|||
typedef struct S_onvifVideoSource |
|||
{ |
|||
char token[CTEXT]; |
|||
float Framerate; |
|||
onvifVideoResolution Resolution; |
|||
onvifImagingSettings * Imaging; |
|||
onvifVideoSourceExtension * Extension; |
|||
} videoSource; |
|||
|
|||
typedef struct S_onvifSupportedVersions |
|||
{ |
|||
int Major; |
|||
int Minor; |
|||
} onvifSupportedVersions; |
|||
|
|||
typedef struct S_onvifNetworkCapabilitiesExtension2 |
|||
{ |
|||
} onvifNetworkCapabilitiesExtension2; |
|||
|
|||
typedef struct S_onvifNetworkCapabilitiesExtension |
|||
{ |
|||
bool Dot11Configuration; |
|||
onvifNetworkCapabilitiesExtension2 * Extension; |
|||
} onvifNetworkCapabilitiesExtension; |
|||
|
|||
typedef struct S_onvifNetworkCapabilities |
|||
{ |
|||
bool IPFilter; |
|||
bool ZeroConfiguration; |
|||
bool IPVersion6; |
|||
bool DynDNS; |
|||
onvifNetworkCapabilitiesExtension * Extension; |
|||
} onvifNetworkCapabilities; |
|||
|
|||
typedef struct S_onvifIOCapabilitiesExtension2 |
|||
{ |
|||
} onvifIOCapabilitiesExtension2; |
|||
|
|||
typedef struct S_onvifIOAuxiliaryData |
|||
{ |
|||
} onvifIOAuxiliaryData; |
|||
|
|||
typedef struct S_onvifIOCapabilitiesExtension |
|||
{ |
|||
bool Auxiliary; |
|||
onvifIOAuxiliaryData * AuxiliaryCommands; |
|||
onvifIOCapabilitiesExtension2 * Extension; |
|||
} onvifIOCapabilitiesExtension; |
|||
|
|||
typedef struct S_onvifIOCapabilities |
|||
{ |
|||
int InputConnectors; |
|||
int RelayOutputs; |
|||
onvifIOCapabilitiesExtension * Extension; |
|||
} onvifIOCapabilities; |
|||
|
|||
typedef struct S_onvifSecurityCapabilitiesExtension2 |
|||
{ |
|||
bool Dot1X; |
|||
int SupportedEAPMethod; |
|||
bool RemoteUserHandling; |
|||
} onvifSecurityCapabilitiesExtension2; |
|||
|
|||
typedef struct S_onvifSecurityCapabilitiesExtension |
|||
{ |
|||
bool TLS1_0; |
|||
onvifSecurityCapabilitiesExtension2 * Extension; |
|||
} onvifSecurityCapabilitiesExtension; |
|||
|
|||
typedef struct S_onvifSecurityCapabilities |
|||
{ |
|||
bool TLS1_1; |
|||
bool TLS1_2; |
|||
bool OnboardKeyGeneration; |
|||
bool AccessPolicyConfig; |
|||
bool X_509Token; |
|||
bool SAMLToken; |
|||
bool KerberosToken; |
|||
bool RELToken; |
|||
onvifSecurityCapabilitiesExtension * Extension; |
|||
} onvifSecurityCapabilities; |
|||
|
|||
typedef struct S_onvifSystemCapabilitiesExtension2 |
|||
{ |
|||
} onvifSystemCapabilitiesExtension2; |
|||
|
|||
typedef struct S_onvifSystemCapabilitiesExtension |
|||
{ |
|||
bool HttpFirmwareUpgrade; |
|||
bool HttpSystemBackup; |
|||
bool HttpSystemLogging; |
|||
bool HttpSupportInformation; |
|||
onvifSystemCapabilitiesExtension2 * Extension; |
|||
} onvifSystemCapabilitiesExtension; |
|||
|
|||
typedef struct S_onvifSystemCapabilities |
|||
{ |
|||
bool DiscoveryResolve; |
|||
bool DiscoveryBye; |
|||
bool RemoteDiscovery; |
|||
bool SystemBackup; |
|||
bool SystemLogging; |
|||
bool FirmwareUpgrade; |
|||
onvifSupportedVersions * SupportedVersions; |
|||
onvifSystemCapabilitiesExtension * Extension; |
|||
} onvifSystemCapabilities; |
|||
|
|||
typedef struct S_onvifDeviceCapabilitiesExtension |
|||
{ |
|||
} onvifDeviceCapabilitiesExtension; |
|||
|
|||
typedef struct S_onvifAnalyticsCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
bool RuleSupport; |
|||
bool AnalyticsModuleSupport; |
|||
} onvifAnalyticsCapabilities; |
|||
|
|||
typedef struct S_onvifDeviceCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
onvifNetworkCapabilities * Network; |
|||
onvifSystemCapabilities * System; |
|||
onvifIOCapabilities * IO; |
|||
onvifSecurityCapabilities * Security; |
|||
onvifDeviceCapabilitiesExtension * Extension; |
|||
} onvifDeviceCapabilities; |
|||
|
|||
typedef struct S_onvifEventCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
bool WSSubscriptionPolicySupport; |
|||
bool WSPullPointSupport; |
|||
bool WSPausableSubscriptionManagerInterfaceSupport; |
|||
} onvifEventCapabilities; |
|||
|
|||
typedef struct S_onvifImagingCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
} onvifImagingCapabilities; |
|||
|
|||
typedef struct S_onvifRealTimeStreamingCapabilitiesExtension |
|||
{ |
|||
} onvifRealTimeStreamingCapabilitiesExtension; |
|||
|
|||
typedef struct S_onvifRealTimeStreamingCapabilities |
|||
{ |
|||
bool RTPMulticast; |
|||
bool RTP_TCP; |
|||
bool RTP_RTSP_TCP; |
|||
onvifRealTimeStreamingCapabilitiesExtension * Extension; |
|||
} onvifRealTimeStreamingCapabilities; |
|||
|
|||
typedef struct S_onvifProfileCapabilities |
|||
{ |
|||
int MaximumNumberOfProfiles; |
|||
} onvifProfileCapabilities; |
|||
|
|||
typedef struct S_onvifMediaCapabilitiesExtension |
|||
{ |
|||
onvifProfileCapabilities * ProfileCapabilities; |
|||
} onvifMediaCapabilitiesExtension; |
|||
|
|||
typedef struct S_onvifMediaCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
onvifRealTimeStreamingCapabilities * StreamingCapabilities; |
|||
onvifMediaCapabilitiesExtension * Extension; |
|||
} onvifMediaCapabilities; |
|||
|
|||
typedef struct S_onvifPTZCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
} onvifPTZCapabilities; |
|||
|
|||
typedef struct S_onvifDeviceIOCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
int VideoSources; |
|||
int VideoOutputs; |
|||
int AudioSources; |
|||
int AudioOutputs; |
|||
int RelayOutputs; |
|||
} onvifDeviceIOCapabilities; |
|||
|
|||
typedef struct S_onvifDisplayCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
bool FixedLayout; |
|||
} onvifDisplayCapabilities; |
|||
|
|||
typedef struct S_onvifRecordingCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
bool ReceiverSource; |
|||
bool MediaProfileSource; |
|||
bool DynamicRecordings; |
|||
bool DynamicTracks; |
|||
int MaxStringLength; |
|||
} onvifRecordingCapabilities; |
|||
|
|||
typedef struct S_onvifSearchCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
bool MetadataSearch; |
|||
} onvifSearchCapabilities; |
|||
|
|||
typedef struct S_onvifReplayCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
} onvifReplayCapabilities; |
|||
|
|||
typedef struct S_onvifReceiverCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
bool RTP_Multicast; |
|||
bool RTP_TCP; |
|||
bool RTP_RTSP_TCP; |
|||
int SupportedReceivers; |
|||
int MaximumRTSPURILength; |
|||
} onvifReceiverCapabilities; |
|||
|
|||
typedef struct S_onvifAnalyticsDeviceExtension |
|||
{ |
|||
} onvifAnalyticsDeviceExtension; |
|||
|
|||
typedef struct S_onvifAnalyticsDeviceCapabilities |
|||
{ |
|||
char XAddr[CTEXT]; |
|||
bool RuleSupport; |
|||
onvifAnalyticsDeviceExtension * Extension; |
|||
} onvifAnalyticsDeviceCapabilities; |
|||
|
|||
typedef struct S_onvifCapabilitiesExtension2 |
|||
{ |
|||
} onvifCapabilitiesExtension2; |
|||
|
|||
typedef struct S_onvifCapabilitiesExtension |
|||
{ |
|||
onvifDeviceIOCapabilities * DeviceIO; |
|||
onvifDisplayCapabilities * Display; |
|||
onvifRecordingCapabilities * Recording; |
|||
onvifSearchCapabilities * Search; |
|||
onvifReplayCapabilities * Replay; |
|||
onvifReceiverCapabilities * Receiver; |
|||
onvifAnalyticsDeviceCapabilities * AnalyticsDevice; |
|||
onvifCapabilitiesExtension2 * Extensions; |
|||
} onvifCapabilitiesExtension; |
|||
|
|||
typedef struct S_nodeCapability |
|||
{ |
|||
onvifAnalyticsCapabilities * Analytics; |
|||
onvifDeviceCapabilities * Device; |
|||
onvifEventCapabilities * Events; |
|||
onvifImagingCapabilities * Imaging; |
|||
onvifMediaCapabilities * Media; |
|||
onvifPTZCapabilities * PTZ; |
|||
onvifCapabilitiesExtension * Extension; |
|||
} nodeCapability; |
|||
|
|||
typedef struct S_discoveryNodeInfo |
|||
{ |
|||
char endpoint_uid[64]; |
|||
char types[CTEXT]; |
|||
char scopes[CTEXT]; |
|||
char x_addrs[CTEXT]; |
|||
char meta_version[10]; |
|||
char ip_addrs[32]; |
|||
} discoveryNodeInfo; |
|||
|
|||
typedef struct S_ptzStatus |
|||
{ |
|||
float pan; |
|||
float tilt; |
|||
float zoom; |
|||
bool hasMoveStatus; |
|||
bool PanTiltIdle; |
|||
bool ZoomIdle; |
|||
} ptzStatus; |
|||
|
|||
class boschRCP; |
|||
|
|||
typedef std::vector<videoSourceProfile *> videoSourceProfiles; |
|||
typedef std::vector<videoSource *> videoSources; |
|||
typedef std::vector<discoveryNodeInfo *> discoveryResults; |
|||
|
|||
class boschRCP{ |
|||
private: |
|||
curlRequestsManager * m_pHttpAccessManager; |
|||
basicMutex m_mResponseProtector; |
|||
CURL * m_pCURL; |
|||
basicLogCollection * m_pLog; |
|||
CSTR m_pIpAddress; |
|||
CSTR m_pUsername; |
|||
CSTR m_pPassword; |
|||
CSTR m_pDeviceURI; |
|||
int m_pLastIndex; |
|||
CSTR m_pMediaURI; |
|||
CSTR m_pSnapshotURI; |
|||
|
|||
CSTR m_pPTZURI; |
|||
CSTR m_pBaseURI; |
|||
onvifSupportedVersions m_sOnvifVersion; |
|||
time_t m_nDeltaTime; |
|||
videoSources m_vVideoSources; |
|||
videoSourceProfiles m_vVideoProfiles; |
|||
videoSourceProfiles m_vActiveSources; |
|||
nodeCapability m_sCapabilities; |
|||
CSTR m_pProxyHost; |
|||
int m_nProxyPort; |
|||
CSTR m_pProxyUsername; |
|||
CSTR m_pProxyPassword; |
|||
CSTR m_pLastResponse; |
|||
bool m_bIntransingent; |
|||
time_t m_nDiscoveryTimeout; |
|||
CSTR m_pDiscoveryBindIP; |
|||
CSTR m_pDiscoveryMCastIP; |
|||
int m_nDiscoveryMCastPort; |
|||
bool m_bDiscoveryHideDuplicates; |
|||
bool parser_done; |
|||
uint8_t m_bAuthMode; |
|||
#ifndef CURL_MANAGER |
|||
static int _writer(char * data, size_t size, size_t nmemb, pOnvif * Ptr); |
|||
#endif |
|||
static void * parser(void * obj, void * ptr); |
|||
|
|||
public: |
|||
|
|||
boschRCP(); |
|||
~boschRCP(); |
|||
bool setProxyHost(CSTR proxyHost); |
|||
CSTR getProxyHost(void); |
|||
bool setProxyPort(int proxyPort); |
|||
int getProxyPort(void); |
|||
bool setProxyUsername(CSTR proxyUsername); |
|||
CSTR getProxyUsername(void); |
|||
bool setProxyPassword(CSTR proxyPassword); |
|||
CSTR getProxyPassword(void); |
|||
bool setUsername(CSTR username); |
|||
CSTR getUsername(void); |
|||
bool setPassword(CSTR password); |
|||
bool setAuthMode(uint8_t Mode); |
|||
CSTR getPassword(void); |
|||
CSTR getDeviceUri(void); |
|||
bool setDeviceUri(CSTR deviceUri); |
|||
CSTR getIPAddress(void); |
|||
bool setIPAddress(CSTR ipAddress); |
|||
videoSources * getSources(void); |
|||
videoSourceProfiles * getProfiles(void); |
|||
videoSourceProfiles * getActiveProfiles(void); |
|||
CSTR getMediaUri(void); |
|||
CSTR getPTZUri(void); |
|||
CSTR getBaseUrl(void); |
|||
void getSupportedVersion(void); |
|||
nodeCapability * getCapabilities(void); |
|||
bool setBreakOnError(bool intransingent); |
|||
CSTR getLastResponse(void); |
|||
bool setDiscoveryTimeout(int discoverytimeout); |
|||
bool setDiscoveryBindIp(CSTR discoverybindip); |
|||
bool setDiscoveryMcastIp(CSTR discoverymcastip); |
|||
bool setDiscoveryMcastPort(int discoverymcastport); |
|||
bool setDiscoveryHideDuplicates(bool discoveryhideduplicates); |
|||
CSTR getSnapshotUri(void); |
|||
|
|||
discoveryResults discover(void); |
|||
bool create(void); |
|||
|
|||
struct tm * core_GetSystemDateAndTime(void); |
|||
bool core_GetCapabilities(); |
|||
bool core_GetDeviceInformation(); |
|||
|
|||
bool media_GetVideoSources(); |
|||
bool media_GetProfiles(); |
|||
bool media_GetServices(); |
|||
CSTR media_GetStreamUri(CSTR profileToken, CSTR stream = (CSTR) "RTP-Unicast", CSTR protocol = (CSTR) "RTSP"); |
|||
CSTR media_GetSnapshotUri(CSTR profileToken); |
|||
|
|||
bool ptz_GetPresets(CSTR profileToken); |
|||
bool ptz_GetNode(CSTR ptzNodeToken); |
|||
bool ptz_GetStatus(CSTR profileToken, ptzStatus * tStatus); |
|||
bool ptz_GotoPreset(CSTR profileToken, CSTR presetToken, float speed_pantilt_x, float speed_pantilt_y, float speed_zoom_x); |
|||
bool ptz_RemovePreset(CSTR profileToken, CSTR presetToken); |
|||
bool ptz_SetPreset(CSTR profileToken, CSTR presetName); |
|||
bool ptz_RelativeMove(CSTR profileToken, float translation_pantilt_x, float translation_pantilt_y, float speed_pantilt_x, float speed_pantilt_y); |
|||
bool ptz_RelativeMoveZoom(CSTR profileToken, float zoom, float speedZoom); |
|||
bool ptz_AbsoluteMove(CSTR profileToken, float position_pantilt_x, float position_pantilt_y, float zoom); |
|||
bool ptz_ContinuousMove(CSTR profileToken, float velocity_pantilt_x, float velocity_pantilt_y); |
|||
bool ptz_ContinuousMoveZoom(CSTR profileToken, float zoom); |
|||
bool ptz_Stop(CSTR profileToken, bool pantilt, bool zoom); |
|||
/* |
|||
Internal functions |
|||
*/ |
|||
private: |
|||
|
|||
accessToken _makeToken(void); |
|||
void _getBRCPVersion(nodeCapability & capabilities); |
|||
void _getActiveSources(videoSourceProfiles & videoSources, videoSourceProfiles profiles); |
|||
void _getProfileData(videoSourceProfiles & videoSources, videoSourceProfiles profiles); |
|||
// protected function _xml2array($response); |
|||
accessToken _passwordDigest(CSTR username, CSTR password, time_t timestamp = 0, uint32_t nonce = 0); |
|||
bool _send_request(CSTR url, CSTR post_string, bool mr = true); |
|||
bool _post_request(CSTR url, CSTR post_string); |
|||
}; |
|||
|
|||
#endif |
|||
@ -0,0 +1,513 @@ |
|||
#include "protocolPTZ_BRCP.h"
|
|||
|
|||
#include "../../hardware/uart/serialPort.h"
|
|||
|
|||
#define LOG(X) m_pLog->Log("BRCP", this, X)
|
|||
#define LOG_ERROR(X) m_pLog->Log("BRCP", this, _LOG_ERROR, X)
|
|||
|
|||
protocolPTZ_BRCP::protocolPTZ_BRCP(config_setting_t * Settings) : |
|||
protocolPTZ(), |
|||
m_mInquiryMutex() |
|||
{ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_bLastCommandIssued = CMD_PTZ_NOOP; |
|||
m_pSettings = Settings; |
|||
m_bAuthMode = 0; |
|||
boschRCP = NULL; |
|||
m_pProfile = NULL; |
|||
memset(m_pDeviceURI, 0, MAX_PATH_LEN); |
|||
memset(m_pUser, 0, MAX_CRED_LEN); |
|||
memset(m_pPassword, 0, MAX_CRED_LEN); |
|||
} |
|||
|
|||
protocolPTZ_BRCP::protocolPTZ_BRCP(CSTR ip, uint16_t port, CSTR username, CSTR password, uint8_t AuthMode) : |
|||
protocolPTZ(), |
|||
m_mInquiryMutex() |
|||
{ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_bLastCommandIssued = CMD_PTZ_NOOP; |
|||
m_pSettings = NULL; |
|||
boschRCP = NULL; |
|||
m_pProfile = NULL; |
|||
LOG(ip); |
|||
LOG(username); |
|||
LOG(password); |
|||
m_bAuthMode = AuthMode; |
|||
sprintf(m_pDeviceURI, "Auth Mode: [%d]", m_bAuthMode); |
|||
LOG(m_pDeviceURI); |
|||
if (port == 80) |
|||
{ |
|||
sprintf(m_pDeviceURI, "http://%s/onvif/device_service", ip); |
|||
} |
|||
else |
|||
{ |
|||
sprintf(m_pDeviceURI, "http://%s:%d/onvif/device_service", ip, port); |
|||
} |
|||
LOG(m_pDeviceURI); |
|||
strncpy(m_pUser, username, MAX_CRED_LEN); |
|||
strncpy(m_pPassword, password, MAX_CRED_LEN); |
|||
} |
|||
|
|||
protocolPTZ_BRCP::protocolPTZ_BRCP(CSTR ctl_url, CSTR username, CSTR password, uint8_t AuthMode) : |
|||
protocolPTZ(), |
|||
m_mInquiryMutex() |
|||
{ |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_bLastCommandIssued = CMD_PTZ_NOOP; |
|||
m_pSettings = NULL; |
|||
boschRCP = NULL; |
|||
m_pProfile = NULL; |
|||
LOG(ctl_url); |
|||
LOG(username); |
|||
LOG(password); |
|||
m_bAuthMode = AuthMode; |
|||
sprintf(m_pDeviceURI, "Auth Mode: [%d]", m_bAuthMode); |
|||
LOG(m_pDeviceURI); |
|||
strncpy(m_pDeviceURI, ctl_url, 250); |
|||
strncpy(m_pUser, username, MAX_CRED_LEN); |
|||
strncpy(m_pPassword, password, MAX_CRED_LEN); |
|||
} |
|||
|
|||
protocolPTZ_BRCP::~protocolPTZ_BRCP() {} |
|||
|
|||
bool protocolPTZ_BRCP::setIPAddress(CSTR ip) |
|||
{ |
|||
if (ip == NULL) |
|||
{ |
|||
return false; |
|||
} |
|||
if (strlen(ip) == 0) |
|||
{ |
|||
return false; |
|||
} |
|||
sprintf(m_pDeviceURI, "http://%s/onvif/device_service", ip); |
|||
// strncpy( m_pDeviceURI, ip, MAX_PATH_LEN );
|
|||
return true; |
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::setUsername(CSTR username) |
|||
{ |
|||
if (username == NULL) |
|||
{ |
|||
return false; |
|||
} |
|||
if (strlen(username) == 0) |
|||
{ |
|||
return false; |
|||
} |
|||
strncpy(m_pUser, username, MAX_CRED_LEN); |
|||
return true; |
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::setPassword(CSTR password) |
|||
{ |
|||
if (password == NULL) |
|||
{ |
|||
return false; |
|||
} |
|||
if (strlen(password) == 0) |
|||
{ |
|||
return false; |
|||
} |
|||
strncpy(m_pPassword, password, MAX_CRED_LEN); |
|||
return true; |
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::setAuthMode(uint8_t Mode) |
|||
{ |
|||
m_bAuthMode = Mode; |
|||
return true; |
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::create(void) |
|||
{ |
|||
if (! protocolPTZ::create()) |
|||
{ |
|||
return false; |
|||
} |
|||
if (m_pSettings != NULL) |
|||
{ |
|||
config_setting_t * pSetting; |
|||
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_ONVIF_USER); |
|||
if (pSetting == NULL) |
|||
{ |
|||
return false; |
|||
} |
|||
sprintf(m_pUser, "%s", config_setting_get_string(pSetting)); |
|||
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_ONVIF_PASS); |
|||
if (pSetting == NULL) |
|||
{ |
|||
return false; |
|||
} |
|||
sprintf(m_pPassword, "%s", config_setting_get_string(pSetting)); |
|||
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_ONVIF_DEV_URI); |
|||
if (pSetting == NULL) |
|||
{ |
|||
return false; |
|||
} |
|||
sprintf(m_pDeviceURI, "%s", config_setting_get_string(pSetting)); |
|||
}; |
|||
#ifdef DEBUG
|
|||
LOG(m_pDeviceURI); |
|||
#endif
|
|||
if (strlen(m_pDeviceURI) < 4) |
|||
{ |
|||
LOG_ERROR("No Device URI Is Set!"); |
|||
return false; |
|||
}; |
|||
#ifdef USE_PONVIF
|
|||
boschRCP = new boschRCP(); |
|||
if (boschRCP == NULL) |
|||
{ |
|||
LOG_ERROR("boschRCP NEW FAILURE!"); |
|||
m_bStatus = 0; |
|||
return false; |
|||
}; |
|||
boschRCP->setDeviceUri(m_pDeviceURI); |
|||
boschRCP->setUsername(m_pUser); |
|||
boschRCP->setPassword(m_pPassword); |
|||
boschRCP->setAuthMode(m_bAuthMode); |
|||
LOG("PROTOCREATE"); |
|||
if (boschRCP->create()) |
|||
{ |
|||
m_pProfile = boschRCP->getProfiles()->at(0); |
|||
LOG("DONE"); |
|||
m_bStatus = 1; |
|||
return true; |
|||
} else { |
|||
LOG_ERROR("pOnvif CREATE FAILURE!"); |
|||
delete(m_pOnVif); |
|||
m_pOnVif = NULL; |
|||
m_bStatus = 0; |
|||
return false; |
|||
}; |
|||
#else
|
|||
std::string A(m_pUser); |
|||
std::string B(m_pPassword); |
|||
std::string C(m_pDeviceURI); |
|||
m_pDevice = new OnvifClientDevice(C, A, B); |
|||
if (m_pDevice != NULL) |
|||
{ |
|||
m_pPTZ = new OnvifClientPTZ(*m_pDevice); |
|||
if (m_pPTZ != NULL) |
|||
{ |
|||
_tptz__GetNodesResponse tNodes; |
|||
int RetVal; |
|||
RetVal = m_pPTZ->GetNodes(tNodes); |
|||
if (RetVal == 0) |
|||
{ |
|||
OnvifClientMedia media(*m_pDevice); |
|||
_trt__GetProfilesResponse profiles; |
|||
media.GetProfiles(profiles); |
|||
m_pPTZToken = profiles.Profiles.at(0)->token; // PTZConfiguration->token;
|
|||
// m_pPTZToken = tNodes.PTZNode.at(0)->token;
|
|||
//_tptz__GetConfigurationOptionsResponse COResp;
|
|||
// int RetVal = m_pPTZ->GetConfigurationOptions(COResp, m_pToken);
|
|||
//_tptz__GetConfigurationResponse configResponce;
|
|||
// configResponce.PTZConfiguration = new tt__PTZConfiguration();
|
|||
// m_pPTZ->GetConfiguration(configResponce);
|
|||
// m_pToken = configResponce.PTZConfiguration->token;
|
|||
setConnectionStatus(CS_CONNECTED); |
|||
m_bStatus = 1; |
|||
return true; |
|||
}; |
|||
}; |
|||
}; |
|||
#endif
|
|||
return false; |
|||
} |
|||
|
|||
#ifndef USE_PONVIF
|
|||
bool protocolPTZ_BRCP::initCamera(void) |
|||
{ |
|||
if (m_bStatus == 0) |
|||
{ |
|||
return false; |
|||
} |
|||
// if (m_bReplyRequired) if ( m_bLastCommandIssued != CMD_PTZ_NOOP ) return false;
|
|||
m_bLastCommandIssued = CMD_PTZ_INIT; |
|||
m_pPTZ->Initialize(); |
|||
return true; |
|||
} |
|||
#endif
|
|||
|
|||
bool protocolPTZ_BRCP::move(uint32_t MoveMatrix) |
|||
{ |
|||
// if( m_bStatus == 0 ) return false;
|
|||
#ifdef USE_PONVIF
|
|||
if (m_pProfile == NULL) |
|||
{ |
|||
return false; |
|||
} |
|||
// if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
|
|||
float Speed_x, Speed_y, Speed_z; |
|||
if (MoveMatrix > 0) |
|||
{ |
|||
if ((MoveMatrix & PTZ_DRIVE_PAN_MASK) == 0) |
|||
{ |
|||
Speed_x = 0.0f; |
|||
} |
|||
else if ((MoveMatrix & PTZ_DRIVE_PAN_LEFT) != 0) |
|||
{ |
|||
Speed_x = -m_dPanSpeed; |
|||
} |
|||
else |
|||
{ |
|||
Speed_x = m_dPanSpeed; |
|||
}; |
|||
if ((MoveMatrix & PTZ_DRIVE_TILT_MASK) == 0) |
|||
{ |
|||
Speed_y = 0.0; |
|||
} |
|||
else if ((MoveMatrix & PTZ_DRIVE_TILT_UP) != 0) |
|||
{ |
|||
Speed_y = m_dTiltSpeed; |
|||
} |
|||
else |
|||
{ |
|||
Speed_y = -m_dTiltSpeed; |
|||
}; |
|||
if ((MoveMatrix & PTZ_DRIVE_ZOOM_MASK) == 0) |
|||
{ |
|||
Speed_z = 0.0; |
|||
} |
|||
else if ((MoveMatrix & PTZ_DRIVE_ZOOM_WIDE) != 0) |
|||
{ |
|||
Speed_z = m_dZoomSpeed; |
|||
} |
|||
else |
|||
{ |
|||
Speed_z = -m_dZoomSpeed; |
|||
}; |
|||
bool res = true; |
|||
if ((MoveMatrix & (PTZ_DRIVE_PAN_MASK | PTZ_DRIVE_TILT_MASK)) != 0) |
|||
{ |
|||
res = m_pOnVif->ptz_ContinuousMove(m_pProfile->profiletoken, Speed_x, Speed_y); |
|||
}; |
|||
if (res) |
|||
{ |
|||
if ((MoveMatrix & PTZ_DRIVE_ZOOM_MASK) != 0) |
|||
{ |
|||
res = m_pOnVif->ptz_ContinuousMoveZoom(m_pProfile->profiletoken, Speed_z); |
|||
}; |
|||
}; |
|||
m_bStatus = (res) ? 1 : 0; |
|||
} |
|||
else |
|||
{ |
|||
|
|||
m_bStatus = (m_pOnVif->ptz_Stop(m_pProfile->profiletoken, true, true)) ? 1 : 0; |
|||
}; |
|||
return (m_bStatus > 0); |
|||
#else
|
|||
if (m_bStatus == 0) |
|||
{ |
|||
return false; |
|||
} |
|||
// if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
|
|||
_tptz__ContinuousMoveResponse ContMoveResponse; |
|||
tt__PTZSpeed tSpeed; |
|||
tSpeed.PanTilt = new tt__Vector2D(); |
|||
tSpeed.Zoom = new tt__Vector1D(); |
|||
LONG64 to = 1000; |
|||
int RetVal; |
|||
if ((MoveMatrix & PTZ_DRIVE_PAN_MASK) == 0) |
|||
{ |
|||
tSpeed.PanTilt->x = 0.0; |
|||
} |
|||
else if ((MoveMatrix & PTZ_DRIVE_PAN_LEFT) != 0) |
|||
{ |
|||
tSpeed.PanTilt->x = -m_dPanSpeed; |
|||
} |
|||
else |
|||
{ |
|||
tSpeed.PanTilt->x = m_dPanSpeed; |
|||
}; |
|||
if ((MoveMatrix & PTZ_DRIVE_TILT_MASK) == 0) |
|||
{ |
|||
tSpeed.PanTilt->y = 0.0; |
|||
} |
|||
else if ((MoveMatrix & PTZ_DRIVE_TILT_UP) != 0) |
|||
{ |
|||
tSpeed.PanTilt->y = m_dTiltSpeed; |
|||
} |
|||
else |
|||
{ |
|||
tSpeed.PanTilt->y = -m_dTiltSpeed; |
|||
}; |
|||
if ((MoveMatrix & PTZ_DRIVE_ZOOM_MASK) == 0) |
|||
{ |
|||
tSpeed.Zoom->x = 0.0; |
|||
} |
|||
else if ((MoveMatrix & PTZ_DRIVE_ZOOM_WIDE) != 0) |
|||
{ |
|||
tSpeed.Zoom->x = m_dZoomSpeed; |
|||
} |
|||
else |
|||
{ |
|||
tSpeed.Zoom->x = -m_dZoomSpeed; |
|||
}; |
|||
RetVal = m_pPTZ->ContinuousMove(ContMoveResponse, tSpeed, to, m_pPTZToken); |
|||
delete(tSpeed.PanTilt); |
|||
delete(tSpeed.Zoom); |
|||
if (RetVal) |
|||
{ |
|||
return false; |
|||
} |
|||
return true; |
|||
#endif
|
|||
} |
|||
|
|||
#include <math.h>
|
|||
|
|||
bool protocolPTZ_BRCP::waitMoveIsDone(void) |
|||
{ |
|||
ptzStatus tVal; |
|||
uint8_t TO = 12; // 3.6 second max
|
|||
while (m_pOnVif->ptz_GetStatus(m_pProfile->profiletoken, &tVal) && TO) |
|||
{ |
|||
if (tVal.hasMoveStatus) |
|||
{ |
|||
if (tVal.PanTiltIdle && tVal.ZoomIdle) |
|||
{ |
|||
break; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
// if( ( fabs(tVal.pan - dPan) < 0.0005 ) && ( fabs( tVal.tilt - dTilt) < 0.0005 ) ) break;//&& ( fabs( tVal.zoom - dZoom ) < 0.05 ) ) break;
|
|||
}; |
|||
SLEEP(333); |
|||
TO--; |
|||
}; |
|||
if (TO) |
|||
{ |
|||
#ifdef DEBUG_EXTRA
|
|||
LOG("Finished Move!"); |
|||
#endif
|
|||
return true; |
|||
#ifdef DEBUG_EXTRA
|
|||
} |
|||
else |
|||
{ |
|||
LOG_ERROR("Error Fetching PTZ Status!"); |
|||
#endif
|
|||
}; |
|||
return false; |
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::goAbsolute(float dPan, float dTilt, float dZoom) |
|||
{ |
|||
#ifdef USE_PONVIF
|
|||
// if (m_bStatus == 0) return false;
|
|||
#ifdef DEBUG_EXTRA
|
|||
LOG("ABS Move"); |
|||
#endif
|
|||
if (m_pProfile == NULL) |
|||
{ |
|||
LOG_ERROR("No PTZ Profile!!"); |
|||
return false; |
|||
}; |
|||
if (dZoom < 0.0f) |
|||
{ |
|||
dZoom = 0.0f; |
|||
} |
|||
|
|||
if (m_pOnVif->ptz_AbsoluteMove(m_pProfile->profiletoken, dPan, dTilt, dZoom)) |
|||
{ |
|||
}; |
|||
return true; |
|||
#else
|
|||
if (m_bStatus == 0) |
|||
{ |
|||
return false; |
|||
} |
|||
// if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
|
|||
_tptz__AbsoluteMoveResponse AbsMoveResponse; |
|||
tt__PTZSpeed tSpeed; |
|||
tt__PTZVector tPos; |
|||
tSpeed.PanTilt = new tt__Vector2D(); |
|||
tSpeed.Zoom = new tt__Vector1D(); |
|||
tSpeed.PanTilt->x = 1.f; |
|||
tSpeed.PanTilt->y = 1.f; |
|||
tSpeed.Zoom->x = 1.f; |
|||
|
|||
tPos.PanTilt = new tt__Vector2D(); |
|||
tPos.Zoom = new tt__Vector1D(); |
|||
tPos.PanTilt->x = dPan; |
|||
tPos.PanTilt->y = dTilt; |
|||
tPos.Zoom->x = dZoom; |
|||
|
|||
int RetVal; |
|||
RetVal = m_pPTZ->AbsoluteMove(AbsMoveResponse, tSpeed, tPos, m_pPTZToken); |
|||
delete(tSpeed.PanTilt); |
|||
delete(tSpeed.Zoom); |
|||
delete(tPos.PanTilt); |
|||
delete(tPos.Zoom); |
|||
return true; |
|||
#endif
|
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::getCameraPresets(void) |
|||
{ |
|||
LOG("GET PRESETS!"); |
|||
return m_pOnVif->ptz_GetPresets(m_pProfile->profiletoken); |
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::goPreset(char * PresetToken) |
|||
{ |
|||
#ifdef USE_PONVIF
|
|||
// if (m_bStatus == 0) return false;
|
|||
#ifdef DEBUG_EXTRA
|
|||
LOG("Preset Move"); |
|||
#endif
|
|||
if (m_pProfile == NULL) |
|||
{ |
|||
LOG_ERROR("No PTZ Profile!!"); |
|||
return false; |
|||
}; |
|||
if (! m_pOnVif->ptz_GotoPreset(m_pProfile->profiletoken, PresetToken, 1.0f, 1.0f, 1.0f)) |
|||
{ |
|||
m_bStatus = 0; |
|||
} |
|||
return (m_bStatus > 0); |
|||
#else
|
|||
if (m_bStatus == 0) |
|||
{ |
|||
return false; |
|||
} |
|||
// if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
|
|||
/*
|
|||
_tptz__AbsoluteMoveResponse AbsMoveResponse; |
|||
tt__PTZSpeed tSpeed; |
|||
tt__PTZVector tPos; |
|||
tSpeed.PanTilt = new tt__Vector2D(); |
|||
tSpeed.Zoom = new tt__Vector1D(); |
|||
tSpeed.PanTilt->x = 1.f; |
|||
tSpeed.PanTilt->y = 1.f; |
|||
tSpeed.Zoom->x = 1.f; |
|||
|
|||
tPos.PanTilt = new tt__Vector2D(); |
|||
tPos.Zoom = new tt__Vector1D(); |
|||
tPos.PanTilt->x = dPan; |
|||
tPos.PanTilt->y = dTilt; |
|||
tPos.Zoom->x = dZoom; |
|||
|
|||
int RetVal; |
|||
RetVal = m_pPTZ->AbsoluteMove(AbsMoveResponse, tSpeed, tPos, m_pPTZToken); |
|||
delete(tSpeed.PanTilt); |
|||
delete(tSpeed.Zoom); |
|||
delete(tPos.PanTilt); |
|||
delete(tPos.Zoom); |
|||
*/ |
|||
return true; |
|||
#endif
|
|||
} |
|||
|
|||
bool protocolPTZ_BRCP::validate() |
|||
{ |
|||
return (m_bStatus > 0); |
|||
} |
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
@ -0,0 +1,46 @@ |
|||
#ifndef __PROTOCOL_PTZ_BRCP_HEADER__ |
|||
#define __PROTOCOL_PTZ_BRCP_HEADER__ |
|||
|
|||
#include "protocolPTZ.h" |
|||
|
|||
#include "../bosch_rcp/bosch_rcp.h" |
|||
|
|||
|
|||
class protocolPTZ_BRCP : public protocolPTZ |
|||
{ |
|||
private: |
|||
|
|||
basicLogCollection * m_pLog; |
|||
char m_pUser[MAX_CRED_LEN]; |
|||
char m_pPassword[MAX_CRED_LEN]; |
|||
char m_pDeviceURI[MAX_PATH_LEN]; |
|||
uint8_t m_bAuthMode; |
|||
boschRCP * m_pBRCP; |
|||
videoSourceProfile * m_pProfile; |
|||
config_setting_t * m_pSettings; |
|||
basicMutex m_mInquiryMutex; |
|||
|
|||
public: |
|||
|
|||
explicit protocolPTZ_BRCP(config_setting_t * Settings = NULL); |
|||
protocolPTZ_BRCP(CSTR ip, uint16_t port, CSTR username, CSTR password, uint8_t AuthMode = 0); |
|||
protocolPTZ_BRCP(CSTR ctl_url, CSTR username, CSTR password, uint8_t AuthMode = 0); |
|||
virtual ~protocolPTZ_BRCP(); |
|||
virtual bool create(void); |
|||
#ifndef USE_PONVIF |
|||
bool initCamera(void); |
|||
#endif |
|||
virtual bool move(uint32_t MoveMatrix); |
|||
virtual bool goAbsolute(float dPan, float dTilt, float dZoom); |
|||
virtual bool goPreset(char * PresetToken); |
|||
virtual bool getCameraPresets(void); |
|||
|
|||
bool setIPAddress(CSTR ip); |
|||
bool setUsername(CSTR username); |
|||
bool setPassword(CSTR password); |
|||
bool setAuthMode(uint8_t Mode); |
|||
virtual bool waitMoveIsDone(void); |
|||
virtual bool validate(); |
|||
}; |
|||
|
|||
#endif |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue