Help Working with an unknown SDK

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi All,
I have been given the task of creating a program in C++ 2008 that connects to a remote DVR device, gets some information and updates a database with that information. I have built a few smaller apps previously (mostly integrating with Sage in some form)
but I am really struggling with the provided .h, .dll and .lib files. Initially I couldnt get them to load at all, but with some much appreciated help from this forum I managed to get them loading.

Unfortunately the documentation and code comments are very limited (mostly in chinese :( ) and now I am struggling to get started with the first couple of functions i need to call. I think its my understanding of structs and pointers where im going wrong,The
project loads an api and the first function to call is NVAPI_Initialise but I cant seem to set the paramaters properly, i think its something to do with pointers
<span style="text-decoration:underline I have the following <span style="text-decoration:underline in my .h file..
typedef struct s_NV_NetWorkParameter<br/>
{<br/>
bool bUsed; //ÊÇ·ñʹÓÃ<br/>
unsigned short usPort; //Á´ ·¼àÌý¶Ë¿Ú<br/>
unsigned int uiReceivedTimeOut; //½ÓÊÕÊý¾Ý³¬Ê±Ê±¼ä(10~120Ãë,ĬÈÏΪ30Ãë)<br/>
unsigned int uiHeartBeatInterval;//ÐÄÌøʱ¼ä¼ä¸ô(1~30Ãë,ĬÈÏΪ5Ãë)<br/>
unsigned int uiReceivedBufferLength;//½ÓÊÕ»º³åÇø´óС(>=0x2000)<br/>
unsigned int uiSendBufferLength; //·¢ËÍ»º³åÇø´óС(>=0x2000)<br/>
}s_NV_NetWorkParameter;<br/>
<br/>
//sdk¿â¹¤×÷²ÎÊý<br/>
typedef struct s_NV_WorkParamter<br/>
{<br/>
s_NV_NetWorkParameter stSignalNet; //ÐÅÁîÁ´ ·Íø ç²ÎÊý(ÈôÐÅÁîºÍýÌåÐèÒª²ÉÓÃͬһ¸ö¶Ë¿Ú£¬ÔòÇë²ÉÓô˲ÎÊý£¬ÁíÒ»Á´ ·µÄʹÓÃ״̬ÖÃΪfalse)<br/>
s_NV_NetWorkParameter stMediaNet; //ýÌåÁ´ ·Íø ç²ÎÊý<br/>
<br/>
NV_EventDataCallback pEventCallback; //Ê ¼þÊý¾Ý»Øµ÷º¯Êý<br/>
unsigned int uiEventCallbackUserData1;//Ê ¼þÊý¾Ý»Øµ÷º¯ÊýÓû§Êý¾Ý1<br/>
unsigned int uiEventCallbackUserData2;//Ê ¼þÊý¾Ý»Øµ÷º¯ÊýÓû§Êý¾Ý2<br/>
<br/>
}s_NV_WorkParamter;

<span style="text-decoration:underline The documentation provided

2.2.1 Initialize resources<br/>
NVAPI_Initialize(s_NV_WorkParamter* pParamter);<br/>
Parameters:<br/>
pParamter[in]: Work parameters<br/>
Return Values:<br/>
0: succeed; Others: error code<br/>
Notes:<br/>
The singal-link network parameter and the media link network parameter in the work<br/>
parameters can use same or different ports. If use the same ports, the enable flag will be<br/>
set ‘false’ in the media link parameter. But we recommend different ports, as it needs<br/>
alloc too much buffer if use the same ports.<br/>
NVAPI_Initialize(s_NV_WorkParamter* pParamter);

<span style="text-decoration:underline My current (and failing code) to test

s_NV_WorkParamter workParam;<br/>
workParam.stMediaNet.usPort = 1234;<br/>
workParam.stSignalNet.usPort = 1234;<br/>
<br/>
NVAPI_Initialize(workParam);

<span style="text-decoration:underline And finally the error
error C2664: NVAPI_Initialize : cannot convert parameter 1 from s_NV_WorkParamter to s_NV_WorkParamter *
Could anyone point me in the right direction? It would be much appreciated

Thank you
<br/>

View the full article
 
Back
Top