fujuntang
2022-04-28 51ccd8155f029d66366d0df8e2baf886ffd50000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef __PROTO_COMM_H__
#define __PROTO_COMM_H__
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "soapH.h"
#include "soapStub.h"
#include "wsaapi.h"
 
#ifndef DIM
#define DIM(array)  (sizeof(array) / sizeof(array[0]))
#endif
 
#ifndef max
#define max(a,b)    (((a) > (b)) ? (a) : (b))
#endif
 
#ifndef min
#define min(a,b)    (((a) < (b)) ? (a) : (b))
#endif
 
#define SOAP_ASSERT     assert
#define SOAP_DBGERR     printf
 
#if defined(PROTO_DEBUG)
#define SOAP_DBGLOG     printf
#else 
#define SOAP_DBGLOG
#endif 
 
#define SOAP_TO         "urn:schemas-xmlsoap-org:ws:2005:04:discovery"
#define SOAP_ACTION     "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe"
 
#define SOAP_MCAST_ADDR "soap.udp://239.255.255.250:3702"                      
 
#define SOAP_ITEM       ""                                                      // Ñ°ÕÒµÄÉ豸·¶Î§
#define SOAP_TYPES      "dn:NetworkVideoTransmitter"                            // Ñ°ÕÒµÄÉ豸ÀàÐÍ
 
#define SOAP_SOCK_TIMEOUT    (10)                                               //sec
 
#define PARA_MIN              (-1)
#define PARA_MAX              (1)
 
#define PROTO_ADDRESS_SIZE   (128)                                              // URIµØÖ·³¤¶È
#define PROTO_TOKEN_SIZE     (65)                                               // token³¤¶È
 
/* ÊÓÆµ±àÂëÆ÷ÅäÖÃÐÅÏ¢ */
struct tagVideoEncoderConfiguration
{
  char token[PROTO_TOKEN_SIZE];                                               // Î¨Ò»±êʶ¸ÃÊÓÆµ±àÂëÆ÷µÄÁîÅÆ×Ö·û´®
  int Width;                                                                  // ·Ö±æÂÊ
  int Height;
};
 
struct tagVideoSourceConfiguration
{
  char token[PROTO_TOKEN_SIZE];
  char sourceToken[PROTO_TOKEN_SIZE];
  int x;
  int y;
  int Width;
  int Height;
};
 
#define SOAP_CHECK_ERROR(result, soap, str) \
    do { \
        if (SOAP_OK != (result) || SOAP_OK != (soap)->error) { \
            soap_perror((soap), (str)); \
            if (SOAP_OK == (result)) { \
                (result) = (soap)->error; \
            } \
            goto EXIT; \
        } \
    } while (0)
 
 
void            soap_perror(struct soap *soap, const char *str);
void *          proto_soap_malloc(struct soap *soap, unsigned int n);
struct soap *   proto_soap_new(int timeout);
void            proto_soap_delete(struct soap *soap);
 
int             proto_SetAuthInfo(struct soap *soap, const char *username, const char *password);
void            proto_init_header(struct soap *soap);
void            proto_init_ProbeType(struct soap *soap, struct wsdd__ProbeType *probe);
float           para_check(float data);
 
int             make_uri_withauth(char *src_uri, char *username, char *password, char *dest_uri, unsigned int size_dest_uri);
int             soap_wsse_add_UsernameTokenDigest(struct soap *soap, const char *id, const char *username, const char *password);
 
int proto_GetDeviceInformation(const char *DeviceXAddr, const char *username, const char *passwd);
int proto_GetSystemDateAndTime(const char *DeviceXAddr, const char *username, const char *passwd);
int proto_SetSystemDateAndTime(const char *DeviceXAddr, const char *username, const char *passwd);
int proto_GetVideoEncoderConfigurationOptions(const char *MediaXAddr, char *ConfigurationToken, const char *username, const char *passwd);
int proto_SetVideoEncoderConfiguration(const char *MediaXAddr, struct tagVideoEncoderConfiguration *venc, const char *username, const char *passwd);
int proto_GetVideoEncoderConfiguration(const char *MediaXAddr, char *ConfigurationToken, const char *username, const char *passwd);
int proto_GetSnapshotUri(const char *MediaXAddr, char *ProfileToken, char *uri, unsigned int sizeuri, const char *username, const char *passwd);
int proto_GetStreamUri(const char *MediaXAddr, char *ProfileToken, char *uri, unsigned int sizeuri, const char *username, const char *passwd);
 
#ifdef __cplusplus
}
#endif
 
#endif