#ifndef __PROTO_COMM_H__ #define __PROTO_COMM_H__ #ifdef __cplusplus extern "C" { #endif #include #include #include #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