Beispiel #1
0
bool SessionInfo::ParseHandshakeResponse(const string& response)
{
    // The handshake response will contain a bunch of legacy fields for
    // backward-compatibility, and then a Config field with a JSON object
    // holding the information we want.

    static const char* CONFIG_PREFIX = "Config: ";

    stringstream stream(response);
    string item;

    while (getline(stream, item, '\n'))
    {
        if (0 == item.find(CONFIG_PREFIX))
        {
            item.erase(0, strlen(CONFIG_PREFIX));
            if (!ProcessConfig(item))
            {
                return false;
            }
            break;
        }
    }

    return true;
}
STDMETHODIMP CSensatronicsModelF::GetConfig(void)
{
	HRESULT hr = S_OK;

	CString sTrace(_T(""));

	CComPtr<IDataConnector> pDataConnector = 0;
	hr = pDataConnector.CoCreateInstance(__uuidof(DataConnector));

	if(SUCCEEDED(hr))
	{
		CXMLSensatronicsConfig XMLSensatronicsConfig;
		LONG* plConfigHandler = (LONG*)&XMLSensatronicsConfig;	// so we can pass this through to

		hr = pDataConnector->RequestModelFSerialComConfigData(m_bstrName.Copy(), m_bstrComPort.Copy(), plConfigHandler);

		if(SUCCEEDED(hr))
		{
			hr = ProcessConfig(&XMLSensatronicsConfig);
		}
	}

	return hr;
}