Ejemplo n.º 1
0
PSMResult PSM_InitializeAsync(const char* host, const char* port)
{
    std::string s_host(host);
    std::string s_port(port);
    e_log_severity_level log_level = _log_severity_level_info;
    PSMResult result = ClientPSMoveAPI::startup(s_host, s_port, log_level) ? PSMResult_RequestSent : PSMResult_Error;

    memset(&g_controllers, 0, sizeof(PSMController)*PSMOVESERVICE_MAX_CONTROLLER_COUNT);
    memset(&g_controller_views, 0, sizeof(ClientControllerView *)*PSMOVESERVICE_MAX_CONTROLLER_COUNT);
    for (PSMControllerID controller_id= 0; controller_id < PSMOVESERVICE_MAX_CONTROLLER_COUNT; ++controller_id)    
    {
        g_controllers[controller_id].ControllerID= controller_id;
        g_controllers[controller_id].ControllerType= PSMController_None;
    }

    memset(g_trackers, 0, sizeof(PSMTracker)*PSMOVESERVICE_MAX_TRACKER_COUNT);
    memset(&g_tracker_views, 0, sizeof(ClientTrackerView *)*PSMOVESERVICE_MAX_TRACKER_COUNT);
    for (PSMTrackerID tracker_id= 0; tracker_id < PSMOVESERVICE_MAX_TRACKER_COUNT; ++tracker_id)    
    {
        g_trackers[tracker_id].tracker_info.tracker_id= tracker_id;
        g_trackers[tracker_id].tracker_info.tracker_type= PSMTracker_None;
    }

    g_bIsConnected= false;
    g_bHasConnectionStatusChanged= false;
    g_bHasControllerListChanged= false;
    g_bHasTrackerListChanged= false;

    return result;
}
Ejemplo n.º 2
0
void CIPCamGeniusDlg::OnBnClickedButtonAccessCamera()
{
	char buf[10];
	POSITION pos = m_list_cameras.GetFirstSelectedItemPosition();
	int idx = m_list_cameras.GetNextSelectedItem(pos);
	if (idx < 0) {
		msgbox("ÇëÏÈÑ¡ÔñÉãÏñ»ú");
		return;
	}
	
	IPCameraInfo ipcaminfo = network_controller.vec_info[idx];

	CString s_ip(ipcaminfo.ip), s_port(_itoa(ipcaminfo.port_http, buf, 10));
	CString url = _T("http://") + s_ip + _T(":") + s_port + _T("/");
	ShellExecute(m_hWnd, NULL, url, NULL, NULL, SW_SHOWMAXIMIZED);
}
Ejemplo n.º 3
0
    SocketConnector(std::string ip, std::string port) : connectOK(true)
    {
        SocketFD = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

        if (-1 == SocketFD)
        {
            perror("cannot create socket");
            exit(EXIT_FAILURE);
        }

        memset(&stSockAddr, 0, sizeof (stSockAddr));

        stSockAddr.sin_family = AF_INET;
        std::stringstream s_port(port);
        uint16_t portAsInt;
        s_port >> portAsInt;
        stSockAddr.sin_port = littleToBigEndian(portAsInt);

        Res = inet_pton(AF_INET, ip.c_str(), &stSockAddr.sin_addr);

        if (0 > Res)
        {
            perror("error: first parameter is not a valid address family");
            close(SocketFD);
            connectOK = false;
        }
        else if (0 == Res)
        {
            perror("char string (second parameter does not contain valid ipaddress)");
            close(SocketFD);
            connectOK = false;
        }

        if (-1 == connect(SocketFD, (struct sockaddr *) &stSockAddr, sizeof (stSockAddr)))
        {

            perror("connect failed");
            close(SocketFD);
            connectOK = false;
        }

    }