int CRealPlayXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (COleControl::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here //初始化网络SDK BOOL ret = CLIENT_Init(DisConnectFunc, (DWORD)this); if (!ret) { //初始化失败 } return 0; }
int main(void) { /* * 程序连接上设备后,用户可以通过拔网线或其他方式使设备断线,然后再恢复网络。 */ NET_DEVICEINFO deviceInfo ={0}; unsigned long lLogin; CLIENT_Init(DisConnectFunc,0);//初始化sdk,设置断线回调函数 CLIENT_SetAutoReconnect(AutoConnectFunc,0);//设置断线重连成功的回调函数。不调用此接口,sdk将不进行断线重连。 lLogin = CLIENT_Login("10.7.4.24",37777,"3","",&deviceInfo);//登陆设备,用户需另选设备。 if(lLogin <= 0) { cout<<"登陆设备失败"<<endl; } else { cout<<"登陆设备成功,按任意键退出程序。"<<endl; cout<<"网络故障1分钟如果没有恢复,sdk会认为断线,请耐心等待"<<endl; _getch(); } CLIENT_Logout(lLogin); CLIENT_Cleanup(); return 0; }
static int dah_init(service_template_t *self) { int ret = 0; dah_conn_t *conn_info; dah_service_basic_t *dah_basic; NMP_ASSERT(self); dah_basic = (dah_service_basic_t*)self; conn_info = &dah_basic->conn_info; if (!CLIENT_Init(conn_info->dis_conn, (DWORD)dah_basic)) { ret = -1; show_warn("NET_DVR_Init() failure!\n"); } else { CLIENT_SetConnectTime(conn_info->conn_wait_time, conn_info->conn_try_times); CLIENT_SetDVRMessCallBack(dah_message_call_back, (LDWORD)dah_basic); } return ret; }
/*---------------------------------- 函数功能:初始化设备SDK库 调用参数: 返回参数: 函数说明: -----------------------------------*/ _EXT_C_DEVCAM_API BOOL CAM_InitSDK(){ return CLIENT_Init(DisConnectFunc,0); }