Parse Regist Response

This commit is contained in:
Florian Märkl 2019-08-15 22:02:04 +02:00
commit 875e8b413e
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
11 changed files with 292 additions and 13 deletions

61
gui/include/host.h Normal file
View file

@ -0,0 +1,61 @@
/*
* This file is part of Chiaki.
*
* Chiaki is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Chiaki is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Chiaki. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CHIAKI_HOST_H
#define CHIAKI_HOST_H
#include <QMetaType>
#include <QString>
#include <chiaki/regist.h>
class HostMAC
{
private:
uint8_t mac[6];
public:
HostMAC() { memset(mac, 0, sizeof(mac)); }
explicit HostMAC(const uint8_t mac[6]) { memcpy(this->mac, mac, sizeof(this->mac)); }
const uint8_t *GetMAC() const { return mac; }
};
static bool operator==(const HostMAC &a, const HostMAC &b) { return memcmp(a.GetMAC(), b.GetMAC(), 6) == 0; }
class RegisteredHost
{
private:
QString ap_ssid;
QString ap_bssid;
QString ap_key;
QString ap_name;
HostMAC ps4_mac;
QString ps4_nickname;
char rp_regist_key[CHIAKI_SESSION_AUTH_SIZE];
uint32_t rp_key_type;
uint8_t rp_key[0x10];
public:
RegisteredHost();
RegisteredHost(const ChiakiRegisteredHost &chiaki_host);
const QString &GetPS4Nickname() const { return ps4_nickname; }
};
Q_DECLARE_METATYPE(RegisteredHost)
#endif //CHIAKI_HOST_H

View file

@ -18,6 +18,8 @@
#ifndef CHIAKI_REGISTDIALOG_H
#define CHIAKI_REGISTDIALOG_H
#include "host.h"
#include <chiaki/regist.h>
#include <QDialog>
@ -69,7 +71,7 @@ class RegistExecuteDialog: public QDialog
private slots:
void Log(ChiakiLogLevel level, QString msg);
void Success();
void Success(RegisteredHost host);
void Failed();
public: