/* * 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 . * **/ #ifndef BIODEVICES_H #define BIODEVICES_H #include #include #include #include "biotypes.h" class QDBusInterface; #define SHARE_BIOMETRIC_CONFIG_PATH "/var/lib/lightdm-data/%1/ukui-biometric.conf" //greeter、screensaver、polkit share conf /*! * \brief The BioDevices class * this class saves the list of all device information * and list of available devices' info list for each uid */ class BioDevices : public QObject { Q_OBJECT public: explicit BioDevices(bool isIgnoreQrCode = false, QObject *parent = nullptr); int count(); QMap> getAllDevices(); QMap> getUserDevices(int uid); QList getDevices(int type); DeviceInfoPtr getDefaultDevice(uid_t uid); int GetLastDevice(const QString &userName); void SetLastDevice(const QString &userName, int drvid); DeviceInfoPtr findDevice(const QString &deviceName); DeviceInfoPtr findDevice(const int id); DeviceInfoPtr getFirstDevice(int uid); DeviceList GetDevList(); int getFeatureCount(int uid, int indexStart = 0, int indexEnd = -1); static QString bioTypeToString_tr(int type); void setIsShowHotPlug(bool isShow); int GetUserDevFeatureCount(int uid,int drvid); int GetUserDevCount(int uid); bool getUseFirstDevice(); int getFailedTimes(); bool GetHiddenSwitchButton(); bool GetQRCodeEnable(); bool GetBioAuthEnable(); /** * @brief UpdateStatus 获取更新的设备状态 * @param drvid 驱动id * @return 结果: */ StatusReslut UpdateStatus(int drvid); private: void connectToService(); void getDevicesList(); signals: void deviceCountChanged(int newNum); private slots: void onUSBDeviceHotPlug(int deviceId, int action, int devNumNow); private: QDBusInterface *serviceInterface; DeviceList deviceInfos; //the list of al device info bool isShowHotPlug; bool useFirstDevice; bool m_isIgnoreQrCode = false; }; #endif // BIODEVICES_H