FuJuntang
2022-07-06 e795b6226a92961ae10d5ef497d2f78fe88fb918
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef __PROTO_COMM_H__
#define __PROTO_COMM_H__
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include <signal.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 WT_TIME         5
#define STOP_WT_TIME    3
#define WT_MAX_TIME     (60 * 20)
 
#define SOAP_ASSERT     assert
#define SOAP_DBGERR     printf
 
#if defined(PROTO_DEBUG)
#define SOAP_DBGLOG     printf
#else 
#define SOAP_DBGLOG
#endif 
 
#define USERNAME        "On_admin"                                                
#define PASSWORD        "a12345678"
 
#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"                            //device type
 
#define ADDR_PREFIX     "http://"
#define ADDR_LAST       "/"
 
#define NAME_BRIDGE     "_"
#define NAME_DOT        "."
#define NAME_MID        "-"
 
#define SOAP_SOCK_TIMEOUT    (10)                                               //sec
 
#define TRUE                  1
#define FALSE                 0
 
#define ENABLE          0
#define DISABLE         1
 
#define PARA_MIN              (-1)
#define PARA_MAX              (1)
 
#define PROTO_ADDRESS_SIZE   (128)
#define PROTO_TOKEN_SIZE     (65)                                               //token size
#define PTOTO_ADDRESS_ADD    (65)
 
#define MAX_BUF_SIZE    600
 
/*video encoder configurations */
struct tagVideoEncoderConfiguration
{
  char token[PROTO_TOKEN_SIZE];                                               //video token
  int Width;                                                                  //resolution
  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)
 
int timer_init(timer_t *timer_index, void (*timer_handler)(union sigval para));
int timer_start(timer_t timer_index, int sec);
int timer_stop(timer_t timer_index);
int timer_destroy(timer_t timer_index);
 
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             bridge_uri(char *src_uri, const char *username, const 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