| 127 | } |
| 128 | |
| 129 | void 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 | |
| 168 | void CmaClient::registrationComplete() |
| 169 | { |
nothing calls this directly
no test coverage detected