コード例 #1
0
ファイル: ThTesting.cpp プロジェクト: iqk168/3111
BOOL CThTesting::InitInstance()
{
	if(!InitialConnect())
		return FALSE;

	return TRUE;
}
コード例 #2
0
ファイル: ClientApp.cpp プロジェクト: cyril0108/samidevice
bool CClientApp::Initialize(QQmlEngine* pEngine)
{
    m_pEngine = pEngine;
    m_pSender = new DeviceEventSender(this);
    if (!m_pSender){ return false; }
    m_DevicesInfoListModel = new FakeDevicesInfoList(this);
    if (!m_DevicesInfoListModel){ return false; }
    m_DeviceCmdListModel = new FakeDeviceCmdList(m_DevicesInfoListModel);
    if (!m_DeviceCmdListModel){ return false; }
 //   m_qmlData = new CQMap();
 //   if (!m_qmlData){ return false; }

#ifdef TEST_CODE
    DeviceHandle ka = new DeviceHandle();
    ka.setUID("az10000");
    ka.setName("TV");
    ka.setIP("192.168.0.2");
    QList<QString> aa;
    aa.append("44444");
    aa.append("555555");
    aa.append("556666665555");
    ka.setCmdDisplayName(aa);
    ka.setCmdKeys(aa);

    m_DevicesInfoListModel->addDevice(ka);
    m_DeviceCmdListModel->addDevice(ka);
    ka.setUID("az10001");
    ka.setName("TV");
    ka.setIP("192.168.0.5");
    aa.clear();
    aa.append("444aaaa44");
    aa.append("55aa5555");
    aa.append("5566fff66665555");
    ka.setCmdDisplayName(aa);
    ka.setCmdKeys(aa);
    m_DevicesInfoListModel->addDevice(ka);
    m_DeviceCmdListModel->addDevice(ka);

    ka.setUID("az10002");
    ka.setName("TV");
    ka.setIP("192.168.0.3");
    aa.clear();
    aa.append("444gg44");
    aa.append("555hh555");
    aa.append("556yy666665555");
    ka.setCmdDisplayName(aa);
    ka.setCmdKeys(aa);
    m_DevicesInfoListModel->addDevice(ka);
    m_DeviceCmdListModel->addDevice(ka);

#endif

    m_pEngine->rootContext()->setContextProperty(QStringLiteral("FakeDevicesInfoList"), m_DevicesInfoListModel);
    m_pEngine->rootContext()->setContextProperty(QStringLiteral("FakeDeviceCmdList"), m_DeviceCmdListModel);
    m_pEngine->rootContext()->setContextProperty(QStringLiteral("FakeDeviceApp"), this);
    m_pEngine->rootContext()->setContextProperty(QStringLiteral("FakeDeviceEventSender"), m_pSender);
    //qmlRegisterType< CQmlPair >("com.azul.iot", 1, 0, "CQmlPair");
    InitialConnect();
    return true;
}