houxiao
2016-12-19 2a9d202a06befdc24569e70c9e643711f2d16e8a
add config for hcnetsdk

git-svn-id: http://192.168.1.226/svn/proxy@20 454eff88-639b-444f-9e54-f578c98de674
2个文件已修改
29 ■■■■■ 已修改文件
ProxyConsole/config.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ProxyConsole/proxyconsole-hc.cpp 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ProxyConsole/config.json
@@ -1,4 +1,11 @@
{
    "hcsdk" : {
        "serverIP" : "192.168.1.101",
        "serverport" : 8000,
        "username" : "admin",
        "passwd" : "a1234567"
    },
    "equipments" : [
    
        {
ProxyConsole/proxyconsole-hc.cpp
@@ -58,6 +58,16 @@
    ET__LAST
};
struct HCNetSDKConfig
{
    std::string serverIP;
    int serverport;
    std::string username;
    std::string passwd;
};
HCNetSDKConfig g_hcnetsdkconfig;
struct HCNetCameraConfig
{
    int lUserID;
@@ -432,14 +442,15 @@
    LONG lUserID;
    NET_DVR_DEVICEINFO_V30 struDeviceInfo;
    lUserID = NET_DVR_Login_V30("192.168.1.101", 8000, "admin", "a1234567", &struDeviceInfo);
    lUserID = NET_DVR_Login_V30((char*)g_hcnetsdkconfig.serverIP.c_str(), g_hcnetsdkconfig.serverport,
        (char*)g_hcnetsdkconfig.username.c_str(), (char*)g_hcnetsdkconfig.passwd.c_str(), &struDeviceInfo);
    if (lUserID < 0) {
        printf("NET_DVR_Login_V30 failed, err: %d\n", NET_DVR_GetLastError());
        NET_DVR_Cleanup();
        return -1;
    }
    
    g_hcnetsdk_user.insert(std::make_pair("192.168.1.101", int(lUserID)));
    g_hcnetsdk_user.insert(std::make_pair(g_hcnetsdkconfig.serverIP, int(lUserID)));
    
    return lUserID;
}
@@ -785,6 +796,13 @@
        std::cout << "open config.json error" << std::endl;
        exit(EXIT_FAILURE);
    }
    //HCNetSDKConfig
    Json::Value jsonHcsdk = root["hcsdk"];
    g_hcnetsdkconfig.serverIP = jsonHcsdk["serverIP"].asString();
    g_hcnetsdkconfig.serverport = jsonHcsdk["serverport"].asInt();
    g_hcnetsdkconfig.username = jsonHcsdk["username"].asString();
    g_hcnetsdkconfig.passwd = jsonHcsdk["passwd"].asString();
    Json::Value jsonEquipments = root["equipments"];
    for (int i = 0; i < jsonEquipments.size() && i < sizeof(equipments) / sizeof(sockinfo); i++)