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