ukui-biometric-auth/bioauth/include/bioauth.h

84 lines
2.7 KiB
C
Raw Normal View History

2022-06-02 16:34:46 +08:00
/*
* Copyright (C) 2023 KylinSoftCo., Ltd.
2022-06-02 16:34:46 +08:00
*
* 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 setUid(qint32 uid);
2023-04-26 22:02:24 +08:00
DeviceInfoPtr getDevice();
2022-06-02 16:34:46 +08:00
void startAuth();
2023-04-26 22:02:24 +08:00
void startUkeyAuth();
2022-06-02 16:34:46 +08:00
void startAuth(qint32 uid, const DeviceInfoPtr deviceInfo);
void stopAuth();
bool isAuthenticating();
void init();
2023-04-26 22:02:24 +08:00
/**
* @brief
* @param info_type ukey pincode认证时传 "pincode"
* @param extra_info ukey pincode认证时传PIN码内容
* @return <int result> )
*/
int SetExtraInfo(QString info_type, QString extra_info);
/**
* @brief
* @param uid id
* @param indexStart
* @param indexEnd
* @return ukey特征
*/
bool GetHasUkeyFeature(int uid, int indexStart = 0, int indexEnd = -1);
2022-06-02 16:34:46 +08:00
signals:
void authComplete(int uid, bool result, int retErrNo);
void authFinished();
2022-06-02 16:34:46 +08:00
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