ukui-screensaver/BiometricAuth/biometricproxy.h

140 lines
3.8 KiB
C
Raw Normal View History

/**
* 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 2, 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301, USA.
**/
#ifndef BIOMETRICPROXY_H
#define BIOMETRICPROXY_H
#include <QtDBus>
#include <QDBusAbstractInterface>
#include <QDBusUnixFileDescriptor>
#include "biometricdeviceinfo.h"
/**
* @brief UpdateStauts调用返回的结果
*/
struct StatusReslut
{
int result;
int enable;
int devNum;
int devStatus;
int opsStatus;
int notifyMessageId;
};
/**
* @brief USB设备插拔动作
*/
enum USBDeviceAction
{
ACTION_ATTACHED = 1,
ACTION_DETACHED = -1
};
/**
* @brief DBus代理类DBus接口
*/
class BiometricProxy : public QDBusAbstractInterface
{
Q_OBJECT
public:
explicit BiometricProxy(QObject *parent = nullptr);
public Q_SLOTS:
/**
* @brief 使id的设备进行用户认证
* @param drvid id
* @param uid id
* @param indexStart
* @param indexEnd
* @return <int result, int uid> id)
*/
QDBusPendingCall Identify(int drvid, int uid, int indexStart = 0, int indexEnd = -1);
/**
* @brief
* @param drvid id
* @param waiting
* @return
*/
int StopOps(int drvid, int waiting = 3000);
/**
* @brief
* @param uid id
* @param indexStart
* @param indexEnd
* @return
*/
int GetFeatureCount(int uid, int indexStart = 0, int indexEnd = -1);
/**
* @brief
* @return
*/
DeviceList GetDevList();
/**
* @brief
* @return
*/
int GetDevCount();
/**
* @brief
* @param drvid id
* @return
*/
QString GetDevMesg(int drvid);
/**
* @brief GetNotifyMesg
* @param drvid id
* @return
*/
QString GetNotifyMesg(int drvid);
/**
* @brief GetOpsMesg
* @param drvid id
* @return
*/
QString GetOpsMesg(int drvid);
/**
* @brief UpdateStatus
* @param drvid id
* @return <int result, int enable, int devNum,
* int devStatus, int opsStatus, notifyMessageId, ...>
*/
StatusReslut UpdateStatus(int drvid);
int GetUserDevCount(int uid);
int GetUserDevFeatureCount(int uid,int drvid);
Q_SIGNALS:
/**
* @brief
* @param drvid id
* @param status
*/
void StatusChanged(int drvid, int status);
/**
* @brief USB设备热插拔
* @param drvid id
* @param action 1-1
* @param deviceNum
*/
void USBDeviceHotPlug(int drvid, int action, int deviceNum);
void FrameWritten(int drvid);
};
#endif // BIOMETRICPROXY_H