MCPcopy Create free account
hub / github.com/codestation/qcma / processNewConnection

Method processNewConnection

common/cmaclient.cpp:129–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void CmaClient::processNewConnection(vita_device_t *device)
130{
131 QMutexLocker locker(&mutex);
132 in_progress = true;
133
134 QTextStream(stdout) << "Vita connected, id: " << VitaMTP_Get_Identification(device) << Qt::endl;
135 DeviceCapability vita_info;
136
137 if(!vita_info.exchangeInfo(device)) {
138 qCritical("Error while exchanging info with the vita");
139 if(VitaMTP_Get_Device_Type(device) == VitaDeviceUSB) {
140 // reset the device
141 VitaMTP_USB_Reset(device);
142 }
143 } else {
144 QSettings settings;
145
146 // Conection successful, inform the user
147 if(vita_info.getOnlineId() != NULL) {
148 settings.setValue("lastOnlineId", vita_info.getOnlineId());
149 emit deviceConnected(QString(tr("Connected to %1 (PS Vita)")).arg(vita_info.getOnlineId()));
150 } else {
151 QString onlineId = settings.value("lastOnlineId", "default").toString();
152 emit deviceConnected(QString(tr("Connected to %1 (PS Vita)")).arg(onlineId));
153 }
154
155 enterEventLoop(device);
156 }
157
158 VitaMTP_SendHostStatus(device, VITA_HOST_STATUS_EndConnection);
159 qDebug("Releasing device...");
160 VitaMTP_Release_Device(device);
161
162 emit deviceDisconnected();
163
164 in_progress = false;
165 sema.release();
166}
167
168void CmaClient::registrationComplete()
169{

Callers

nothing calls this directly

Calls 3

exchangeInfoMethod · 0.80
getOnlineIdMethod · 0.80
valueMethod · 0.80

Tested by

no test coverage detected