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.
113 lines
3.6 KiB
113 lines
3.6 KiB
#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"
|
|
|
|
#ifndef CURL_MANAGER
|
|
#define CURL_MANAGER
|
|
#endif
|
|
|
|
// #define DEBUG_BRCP_PRINTOUT_MESSAGES
|
|
// #define DEBUG_BRCP_TRAFFIC
|
|
|
|
#define BRCP_DEFAULT_URI_TPL (CSTR) "http://%s:%s@%s/rcp.xml"
|
|
#define BRCP_DEFAULT_URI_TPL_NA (CSTR) "http://%s/rcp.xml"
|
|
|
|
#define BRCP_CMD_GET_CAM_NAME 0x0019
|
|
#define BRCP_CMD_GET_UNIT_NAME 0x0024
|
|
#define BRCP_CMD_GET_DEV_NAME 0x097c
|
|
|
|
#define BRCP_CMD_GET_SER_NUM 0x0ae7
|
|
#define BRCP_CMD_GET_PRO_NAME 0x0aea
|
|
|
|
#define BRCP_CMD_GET_DEV_MANUFAC 0x0d0b
|
|
#define BRCP_CMD_GET_DTS 0x0ba8
|
|
#define BRCP_CMD_PTZ_DRIVE 0x09A5
|
|
|
|
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_pBaseURI;
|
|
time_t m_nDeltaTime;
|
|
|
|
CSTR m_pProxyHost;
|
|
int m_nProxyPort;
|
|
CSTR m_pProxyUsername;
|
|
CSTR m_pProxyPassword;
|
|
CSTR m_pLastResponse;
|
|
bool m_bIntransingent;
|
|
volatile 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);
|
|
size_t createRequestString( CSTR buffer, uint16_t CMD, bool RW, int8_t pl_type= -1, void *pl = NULL );
|
|
bool updateDevURI(void);
|
|
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);
|
|
bool create(void);
|
|
|
|
struct tm * core_GetSystemDateAndTime(void);
|
|
|
|
bool ptz_GetStatus( ptzStatus * tStatus );
|
|
bool ptz_GotoPreset( CSTR presetToken, float speed_pantilt_x, float speed_pantilt_y, float speed_zoom_x );
|
|
bool ptz_AbsoluteMove( float position_pantilt_x, float position_pantilt_y, float zoom );
|
|
bool ptz_ContinuousMove( float velocity_pantilt_x, float velocity_pantilt_y );
|
|
bool ptz_ContinuousMoveZoom( float zoom );
|
|
bool ptz_RemovePreset( CSTR presetToken );
|
|
bool ptz_Stop( bool pantilt, bool zoom );
|
|
bool ptz_SetPreset( CSTR presetName);
|
|
private:
|
|
|
|
// 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 = NULL, bool mr = true);
|
|
bool _post_request(CSTR url, CSTR post_string);
|
|
};
|
|
|
|
#endif
|