65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
/*
|
||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||
*
|
||
* This program 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, or (at your option)
|
||
* any later version.
|
||
*
|
||
* This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
|
||
*
|
||
**/
|
||
#ifndef BIOAUTH_H
|
||
#define BIOAUTH_H
|
||
|
||
#include <QObject>
|
||
#include "biotypes.h"
|
||
|
||
class QDBusInterface;
|
||
|
||
/*!
|
||
* \brief The BioAuth class
|
||
* 负责真正的生物识别操作,通过startAuth开始认证,
|
||
* 认证完成后会发出携带结果的authComplete信号
|
||
*/
|
||
class BioAuth : public QObject
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
explicit BioAuth(qint32 uid, const DeviceInfoPtr deviceInfo, QObject *parent = nullptr);
|
||
explicit BioAuth(QObject *parent = nullptr);
|
||
~BioAuth();
|
||
void setDevice(const DeviceInfoPtr deviceInfo);
|
||
void startAuth();
|
||
void startAuth(qint32 uid, const DeviceInfoPtr deviceInfo);
|
||
void stopAuth();
|
||
bool isAuthenticating();
|
||
void init();
|
||
|
||
signals:
|
||
void authComplete(int uid, bool result, int retErrNo);
|
||
void notify(const QString &message);
|
||
void notifyDetail(int deviceId, const QString &message);
|
||
void frameWritten(int deviceId);
|
||
|
||
private slots:
|
||
void onIdentityComplete(QDBusPendingCallWatcher *watcher);
|
||
void onStatusChanged(int deviceId, int statusType);
|
||
void onFrameWritten(int drvid);
|
||
|
||
private:
|
||
QDBusInterface *serviceInterface;
|
||
|
||
qint32 uid;
|
||
DeviceInfoPtr deviceInfo = nullptr;
|
||
bool isInAuthentication;
|
||
};
|
||
|
||
#endif // BIOAUTH_H
|