Browse Source

refs #1 Synchronizing with release commit: 5fc505896d

qt5
parent
commit
ebaeb39656
100 changed files with 1510 additions and 831 deletions
  1. +19
    -0
      3.0/src/includes/Hardware/CardReaders/MifareReaderModelDataTypes.h
  2. +1
    -1
      3.0/src/includes/Hardware/CashAcceptors/ModelData.h
  3. +1
    -0
      3.0/src/includes/Hardware/Common/CommandResults.h
  4. +5
    -5
      3.0/src/includes/Hardware/Common/DataPointer.h
  5. +21
    -0
      3.0/src/includes/Hardware/Common/DeviceModelDataTypes.h
  6. +1
    -0
      3.0/src/includes/Hardware/Common/LibUSBDeviceBase.h
  7. +44
    -13
      3.0/src/includes/Hardware/Common/Specifications.h
  8. +1
    -54
      3.0/src/includes/Hardware/Common/USBDeviceModelData.h
  9. +41
    -0
      3.0/src/includes/Hardware/Common/USBDeviceModelDataTypes.h
  10. +22
    -0
      3.0/src/includes/Hardware/Common/USBDeviceVendors.h
  11. +22
    -6
      3.0/src/includes/Hardware/FR/FRBaseConstants.h
  12. +5
    -2
      3.0/src/includes/Hardware/IOPorts/LibUSBDeviceDataTypes.h
  13. +58
    -20
      3.0/src/includes/Hardware/Plugins/CommonParameters.h
  14. +42
    -0
      3.0/src/includes/Hardware/Printers/PortPOSPrinters.h
  15. +0
    -1
      3.0/src/includes/Hardware/Printers/PortPrinterBase.h
  16. +5
    -7
      3.0/src/includes/Hardware/Printers/PortPrintersBase.h
  17. +1
    -0
      3.0/src/includes/Hardware/Printers/PrinterDevices.h
  18. +0
    -1
      3.0/src/includes/Hardware/Printers/SerialPrinterBase.h
  19. +1
    -0
      3.0/src/includes/Hardware/Protocols/CashAcceptor/SSPDataTypes.h
  20. +31
    -12
      3.0/src/includes/SDK/Drivers/FR/FiscalDataTypes.h
  21. +2
    -0
      3.0/src/includes/SDK/Drivers/HardwareConstants.h
  22. +31
    -22
      3.0/src/modules/DeviceManager/src/DeviceManager.cpp
  23. +1
    -1
      3.0/src/modules/Hardware/Cardreaders/msvc/CardReaders.vcxproj
  24. +1
    -1
      3.0/src/modules/Hardware/Cardreaders/msvc/CardReaders.vcxproj.filters
  25. +3
    -13
      3.0/src/modules/Hardware/Cardreaders/src/Creator/CreatorReader.cpp
  26. +2
    -9
      3.0/src/modules/Hardware/Cardreaders/src/Creator/CreatorReaderDetectingData.h
  27. +55
    -26
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.cpp
  28. +6
    -0
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.h
  29. +25
    -4
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptorConstants.h
  30. +12
    -9
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPModelData.h
  31. +1
    -17
      3.0/src/modules/Hardware/Common/Common.qbs
  32. +4
    -1
      3.0/src/modules/Hardware/Common/msvc/Common.vcxproj
  33. +12
    -3
      3.0/src/modules/Hardware/Common/msvc/Common.vcxproj.filters
  34. +2
    -2
      3.0/src/modules/Hardware/Common/src/Base/DeviceBase.cpp
  35. +1
    -1
      3.0/src/modules/Hardware/Common/src/Base/DeviceBase.h
  36. +3
    -0
      3.0/src/modules/Hardware/Common/src/Meta/MetaDevice.h
  37. +3
    -3
      3.0/src/modules/Hardware/Common/src/Port/LibUSB/LibUSBDeviceBase.cpp
  38. +6
    -1
      3.0/src/modules/Hardware/Common/src/Port/PortDeviceBase.cpp
  39. +3
    -3
      3.0/src/modules/Hardware/Common/src/Port/USB/USBDeviceBase.cpp
  40. +96
    -0
      3.0/src/modules/Hardware/Common/src/Port/USB/USBDeviceModelData.cpp
  41. +58
    -0
      3.0/src/modules/Hardware/Common/src/Port/USB/USBDeviceModelData.h
  42. +2
    -2
      3.0/src/modules/Hardware/FR/src/Atol/Base/Atol3/Atol3FRBase.cpp
  43. +7
    -0
      3.0/src/modules/Hardware/FR/src/Atol/Base/Atol3/Atol3FRBaseConstants.h
  44. +51
    -16
      3.0/src/modules/Hardware/FR/src/Atol/Online/AtolOnlineFRBase.cpp
  45. +7
    -1
      3.0/src/modules/Hardware/FR/src/Atol/Online/AtolOnlineFRBase.h
  46. +7
    -1
      3.0/src/modules/Hardware/FR/src/Atol/Online/AtolOnlineFRConstants.h
  47. +16
    -7
      3.0/src/modules/Hardware/FR/src/Base/FRBase.cpp
  48. +2
    -2
      3.0/src/modules/Hardware/FR/src/Base/Port/PortFRBase.cpp
  49. +9
    -5
      3.0/src/modules/Hardware/FR/src/Base/Port/PortFRBase.h
  50. +2
    -2
      3.0/src/modules/Hardware/FR/src/Kasbi/KasbiFRBase.cpp
  51. +59
    -31
      3.0/src/modules/Hardware/FR/src/MStar/Online/AFPFR.cpp
  52. +3
    -0
      3.0/src/modules/Hardware/FR/src/MStar/Online/AFPFR.h
  53. +4
    -3
      3.0/src/modules/Hardware/FR/src/MStar/Online/AFPFRConstants.h
  54. +1
    -1
      3.0/src/modules/Hardware/FR/src/MStar/Online/ModelData.h
  55. +1
    -1
      3.0/src/modules/Hardware/FR/src/Prim/Ejector/PrimEjectorFR.cpp
  56. +3
    -3
      3.0/src/modules/Hardware/FR/src/Prim/Online/PrimOnlineFRBase.cpp
  57. +11
    -12
      3.0/src/modules/Hardware/FR/src/Shtrih/Online/ShtrihOnlineFRBase.cpp
  58. +1
    -1
      3.0/src/modules/Hardware/FR/src/Shtrih/Online/ShtrihOnlineFRBase.h
  59. +2
    -0
      3.0/src/modules/Hardware/IOPorts/IOPorts.qbs
  60. +2
    -4
      3.0/src/modules/Hardware/IOPorts/src/Base/IOPortBase.cpp
  61. +4
    -1
      3.0/src/modules/Hardware/IOPorts/src/COM/windows/AsyncSerialPort.cpp
  62. +20
    -27
      3.0/src/modules/Hardware/IOPorts/src/LibUSB/LibUSBPort.cpp
  63. +14
    -0
      3.0/src/modules/Hardware/IOPorts/src/LibUSB/LibUSBPort.h
  64. +186
    -84
      3.0/src/modules/Hardware/IOPorts/src/LibUSB/LibUSBUtils.cpp
  65. +22
    -5
      3.0/src/modules/Hardware/IOPorts/src/LibUSB/LibUSBUtils.h
  66. +2
    -1
      3.0/src/modules/Hardware/Printers/msvc/Printers.vcxproj
  67. +9
    -9
      3.0/src/modules/Hardware/Printers/msvc/Printers.vcxproj.filters
  68. +3
    -3
      3.0/src/modules/Hardware/Printers/src/AV268/AV268.cpp
  69. +1
    -1
      3.0/src/modules/Hardware/Printers/src/AV268/AV268.h
  70. +1
    -0
      3.0/src/modules/Hardware/Printers/src/Base/Port/PortPrinterBase.cpp
  71. +1
    -0
      3.0/src/modules/Hardware/Printers/src/Base/Port/PortPrinterBase.h
  72. +2
    -0
      3.0/src/modules/Hardware/Printers/src/Base/PrinterBase.cpp
  73. +1
    -1
      3.0/src/modules/Hardware/Printers/src/Fujitsu/FujitsuPrinters.h
  74. +1
    -1
      3.0/src/modules/Hardware/Printers/src/GeBe/GeBe.h
  75. +4
    -6
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenBase.h
  76. +36
    -23
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenCBM1000II.h
  77. +17
    -18
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenCPP8001.h
  78. +20
    -16
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenCTS2000.h
  79. +13
    -15
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenCTS310II.h
  80. +1
    -2
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenPPU231/CitizenPPU231.cpp
  81. +2
    -2
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenPPU231/CitizenPPU231.h
  82. +34
    -34
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenPPU700/CitizenPPU700.cpp
  83. +37
    -2
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenPPU700/CitizenPPU700.h
  84. +0
    -52
      3.0/src/modules/Hardware/Printers/src/POSPrinters/CitizenBase.h
  85. +5
    -9
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Common/POSParameters.cpp
  86. +24
    -12
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Common/POSParameters.h
  87. +39
    -77
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Common/POSPrinter.cpp
  88. +7
    -6
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Common/POSPrinter.h
  89. +35
    -26
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Custom/CustomPrinters.cpp
  90. +7
    -2
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Custom/CustomPrinters.h
  91. +18
    -8
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Custom/CustomTG2480H.h
  92. +33
    -25
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Custom/CustomVKP/CustomVKP80.cpp
  93. +15
    -1
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Custom/CustomVKP/CustomVKP80.h
  94. +16
    -7
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Custom/CustomVKP/CustomVKP80III.cpp
  95. +6
    -1
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Custom/CustomVKP/CustomVKP80III.h
  96. +10
    -3
      3.0/src/modules/Hardware/Printers/src/POSPrinters/EjectorPOS/EjectorPOS.cpp
  97. +8
    -2
      3.0/src/modules/Hardware/Printers/src/POSPrinters/EjectorPOS/EjectorPOS.h
  98. +15
    -16
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Epson/EpsonEUT400.cpp
  99. +2
    -2
      3.0/src/modules/Hardware/Printers/src/POSPrinters/Epson/EpsonEUT400.h
  100. +1
    -1
      3.0/src/modules/Hardware/Printers/src/PrimexNP2511/PrimexNP2511.h

+ 19
- 0
3.0/src/includes/Hardware/CardReaders/MifareReaderModelDataTypes.h View File

@@ -0,0 +1,19 @@
/* @file Типы данных моделей Mifare-ридеров ACS. */
#pragma once

#include "Hardware/Common/USBDeviceModelData.h"

//------------------------------------------------------------------------------
namespace CMifareReader
{
struct SModelData: public CUSBDevice::SProductData
{
int SAM;
bool CCID;

SModelData() : SAM(0), CCID(true) {}
SModelData(const QString & aModel, int aSAM, bool aCCID, bool aVerified) : CUSBDevice::SProductData(aModel, aVerified), SAM(aSAM), CCID(aCCID) {}
};
}

//------------------------------------------------------------------------------

+ 1
- 1
3.0/src/includes/Hardware/CashAcceptors/ModelData.h View File

@@ -17,7 +17,7 @@ struct SBaseModelData
bool verified;
bool updatable;

SBaseModelData() : verified(false), updatable(false) {}
SBaseModelData(const QString & aName = "") : name(aName), verified(false), updatable(false) {}
SBaseModelData(const QString & aName, bool aVerified, bool aUpdatable = false) : name(aName), verified(aVerified), updatable(aUpdatable) {}
};



+ 1
- 0
3.0/src/includes/Hardware/Common/CommandResults.h View File

@@ -29,6 +29,7 @@ namespace CommandResult

typedef QSet<int> TResults;
const TResults ProtocolErrors = TResults() << Port << Transport << Protocol << Driver << NoAnswer << Id << CRC;
const TResults PresenceErrors = TResults() << OK << Id << CRC << Answer << Device; // Устройство присутствует.
}

#define CORRECT(aResult) !CommandResult::ProtocolErrors.contains(aResult)


+ 5
- 5
3.0/src/includes/Hardware/Common/DataPointer.h View File

@@ -7,21 +7,21 @@ template <class T>
struct SPData
{
public:
SPData<T>() : mData(nullptr) {}
SPData<T>() : mData(0) {}

operator T * ()
operator T ()
{
return mData;
}

SPData<T> & operator = (T * aResult)
SPData<T> & operator = (T aResult)
{
mData = aResult;

return *this;
}

T ** operator & ()
T * operator & ()
{
return &mData;
}
@@ -32,7 +32,7 @@ public:
}

private:
T * mData;
T mData;
};

//--------------------------------------------------------------------------------

+ 21
- 0
3.0/src/includes/Hardware/Common/DeviceModelDataTypes.h View File

@@ -0,0 +1,21 @@
/* @file Типы данных моделей устройств. */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QString>
#include <Common/QtHeadersEnd.h>

//--------------------------------------------------------------------------------
/// Данные устройства.
struct SModelDataBase
{
QString model;
bool verified;

SModelDataBase(): verified(false) {}
SModelDataBase(const QString & aModel, bool aVerified): model(aModel), verified(aVerified) {}
};

//--------------------------------------------------------------------------------

+ 1
- 0
3.0/src/includes/Hardware/Common/LibUSBDeviceBase.h View File

@@ -0,0 +1 @@
#include "../../../modules/Hardware/Common/src/Port/LibUSB/LibUSBDeviceBase.h"

+ 44
- 13
3.0/src/includes/Hardware/Common/Specifications.h View File

@@ -10,35 +10,64 @@
#include <Common/QtHeadersEnd.h>

//--------------------------------------------------------------------------------
// базовый класс для хранения данных в виде пар ключ-значение
// Базовый класс для хранения данных в виде пар ключ-значение
template <class T1, class T2>
class CSpecification
{
public:
CSpecification(const T2 & aDefault = T2()) : mDefaultValue(aDefault) {}
const T2 operator[](const T1 & aKey) const {return value(aKey);}
T1 key(const T2 & aValue) {return mBuffer.key(aValue);}
virtual T2 value(const T1 & aKey) const {return mBuffer.value(aKey, mDefaultValue);}
void append(const T1 & aKey, const T2 & aParameter) {mBuffer.insert(aKey, aParameter);}
QMap<T1, T2> & data() {return mBuffer;}
void setDefault(const T2 & aDefaultValue) {mDefaultValue = aDefaultValue;}
T2 getDefault() {return mDefaultValue;}
const T2 operator[](const T1 & aKey) const { return value(aKey); }
T1 key(const T2 & aValue) { return mBuffer.key(aValue); }
virtual T2 value(const T1 & aKey) const { return mBuffer.value(aKey, mDefaultValue); }
void append(const T1 & aKey, const T2 & aParameter) { mBuffer.insert(aKey, aParameter); }
QMap<T1, T2> & data() { return mBuffer; }
QMap<T1, T2> constData() const { return mBuffer; }
void setDefault(const T2 & aDefaultValue) { mDefaultValue = aDefaultValue; }
T2 getDefault() { return mDefaultValue; }

protected:
QMap<T1, T2> mBuffer;
T2 mDefaultValue;
};

// класс для хранения произвольных описателей данных
//--------------------------------------------------------------------------------
// Класс для хранения произвольных описателей данных
template <class T>
class CDescription : public CSpecification<T, QString>
{
public:
void append(const T & aKey, const char * aParameter) {mBuffer.insert(aKey, QString::fromUtf8(aParameter));}
void append(const T & aKey, const QString & aParameter) {mBuffer.insert(aKey, aParameter);}
void append(const T & aKey, const char * aParameter) { mBuffer.insert(aKey, QString::fromUtf8(aParameter)); }
void append(const T & aKey, const QString & aParameter) { mBuffer.insert(aKey, aParameter); }
void setDefault(const char * aDefaultValue) { mDefaultValue = QString::fromUtf8(aDefaultValue); }
};

//--------------------------------------------------------------------------------
// Базовый класс для хранения данных в виде пар ключ-значение со статическим заполнением.
// При использовании для хранения статических сущностей следить за временем их создания.
template <class T1, class T2>
class CStaticSpecification : public CSpecification<T1, T2>
{
public:
CStaticSpecification()
{
mBuffer = process(T1(), T2(), true);
}

static QMap<T1, T2> & process(const T1 & aKey, const T2 aValue, bool aControl = false)
{
static QMap<T1, T2> data;

if (!aControl)
{
data.insert(aKey, aValue);
}

return data;
}
};

// класс для хранения произвольных описателей данных в виде битовой маски
//--------------------------------------------------------------------------------
// Класс для хранения произвольных описателей данных в виде битовой маски
template <class T>
class CBitmapDescription : public CDescription<T>
{
@@ -65,10 +94,12 @@ protected:
}
};

//--------------------------------------------------------------------------------
#define APPEND(aKey) append(aKey, #aKey)
#define ADD(aKey) add(aKey, #aKey)

// базовый класс для хранения данных в виде пар ключ-значение со статическим заполнением данных
//--------------------------------------------------------------------------------
// Базовый класс для хранения данных в виде пар ключ-значение со статическим заполнением данных
template <class T1, class T2>
class CSSpecification: public CSpecification<T1, T2>
{


+ 1
- 54
3.0/src/includes/Hardware/Common/USBDeviceModelData.h View File

@@ -1,54 +1 @@
/* @file Спецификация данных моделей USB-устройств для автопоиска. */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QSharedPointer>
#include <Common/QtHeadersEnd.h>

// Modules
#include "Hardware/Common/Specifications.h"

//--------------------------------------------------------------------------------
namespace CUSBDevice
{
/// Данные устройства.
struct SData
{
QString model;
bool verified;

SData(): verified(false) {}
SData(const QString & aModel, bool aVerified): model(aModel), verified(aVerified) {}
};

/// данные моделей по PID-ам.
class CData : public CSpecification<quint16, SData>
{
public:
void add(quint16 aPID, const QString & aModel, bool aVerified = false)
{
append(aPID, SData(aModel, aVerified));
}

void setDefaultModel(const QString & aModel)
{
setDefault(SData(aModel, false));
}
};

/// Данные моделей по VID-ам.
class CDetectingData : public CSpecification<quint16, CData>
{
public:
void add(quint16 aVID, quint16 aPID, const QString & aModel, bool aVerified = false)
{
data()[aVID].append(aPID, SData(aModel, aVerified));
}
};

typedef QSharedPointer<CDetectingData> PDetectingData;
}

//--------------------------------------------------------------------------------
#include "../../../modules/Hardware/Common/src/Port/USB/USBDeviceModelData.h"

+ 41
- 0
3.0/src/includes/Hardware/Common/USBDeviceModelDataTypes.h View File

@@ -0,0 +1,41 @@
/* @file Типы данных моделей USB-устройств. */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QString>
#include <QtCore/QMap>
#include <Common/QtHeadersEnd.h>

// Project
#include "Hardware/Common/DeviceModelDataTypes.h"

//--------------------------------------------------------------------------------
namespace CUSBDevice
{
typedef SModelDataBase SProductData;
typedef QMap<quint16, SProductData> TProductData;

//--------------------------------------------------------------------------------
struct SDetectingData
{
QString vendor;
quint16 PID;
QString model;

SDetectingData(): PID(0) {}
SDetectingData(const QString & aVendor, quint16 aPID, const QString & aModel): vendor(aVendor), PID(aPID), model(aModel) {}

QString getModel() const
{
return vendor + " " + model;
}
};

/// Вызывается из статического функционала. Если будет константа - на момент вызова она не будет создана.
#define DECLARE_USB_MODEL(aVar, aVendor, aPID, aName) struct aVar: public CUSBDevice::SDetectingData \
{ aVar() : CUSBDevice::SDetectingData(CUSBVendors::aVendor, aPID, aName) {} };
}

//--------------------------------------------------------------------------------

+ 22
- 0
3.0/src/includes/Hardware/Common/USBDeviceVendors.h View File

@@ -0,0 +1,22 @@
/* @file Спецификация производителей USB-устройств. */

#pragma once

#include "Hardware/Common/Specifications.h"

//--------------------------------------------------------------------------------
namespace CUSBVendors
{
class Data : public CStaticSpecification<QString, quint16> {};

#define ADD_USB_VENDOR(aName, aVID) const char aName[] = #aName; namespace VID { const quint16 aName = CUSBVendors::Data::process(#aName, aVID).value(#aName); }

ADD_USB_VENDOR(ACS, 0x072F); // Advanced Card Systems Ltd.
ADD_USB_VENDOR(HHP, 0x0536); // Hand Held Products, Inc
ADD_USB_VENDOR(Creator, 0x23d8);
ADD_USB_VENDOR(Custom, 0x0dd4);
ADD_USB_VENDOR(Citizen1, 0x1d90);
ADD_USB_VENDOR(Citizen2, 0x2730);
}

//--------------------------------------------------------------------------------

+ 22
- 6
3.0/src/includes/Hardware/FR/FRBaseConstants.h View File

@@ -103,12 +103,12 @@ namespace CFR
/// Количество миллисекунд в сутках.
const int MSecsInDay = SecsInDay * 1000;
/// Признак способа расчета по умолчанию для платежей (тег 1214) (не интернет-магазинов) - Полный расчет.
const SDK::Driver::EPayOffSubjectMethodTypes::Enum PayOffSubjectMethodType = SDK::Driver::EPayOffSubjectMethodTypes::Full;
/// Дата и время одноразового закрытия смены перед применением НДС 20% в 2019 году.
const QDateTime ClosingSessionDTVAT20 = QDateTime(QDate(2018, 12, 31), QTime(23, 57));
/// Формальная дата окончания ФН.
inline QString FSValidityDateOff(const QDate & aDate) { return aDate.addDays(-3).toString(CFR::DateLogFormat); }
/// Результаты запроса статуса.
namespace Result
{
@@ -347,9 +347,25 @@ namespace CFR
{
using namespace SDK::Driver::EPayOffSubjectTypes;
append(Unit, "ТОВАР");
append(Payment, "ПЛАТЕЖ");
append(AgentFee, "АГЕНТСКОЕ ВОЗНАГРАЖДЕНИЕ");
append(Unit, "ТОВАР");
append(ExciseUnit, "ПОДАКЦИЗНЫЙ ТОВАР");
append(Job, "РАБОТА");
append(Service, "УСЛУГА");
append(GamblingBet, "СТАВКА АЗАРТНОЙ ИГРЫ");
append(GamblingWin, "ВЫИГРЫШ АЗАРТНОЙ ИГРЫ");
append(LotteryTicket, "ЛОТЕРЕЙНЫЙ БИЛЕТ");
append(LotteryWin, "ВЫИГРЫШ ЛОТЕРЕИ");
append(RIARightsProvision, "ПРЕДОСТАВЛЕНИЕ РИД");
append(Payment, "ПЛАТЕЖ");
append(AgentFee, "АГЕНТСКОЕ ВОЗНАГРАЖДЕНИЕ");
append(Composite, "СОСТАВНОЙ ПРЕДМЕТ РАСЧЕТА");
append(Other, "ИНОЙ ПРЕДМЕТ РАСЧЕТА");
append(PropertyRight, "ИМУЩЕСТВЕННОЕ ПРАВО");
append(NonSalesIncome, "ВНЕРЕАЛИЗАЦИОННЫЙ ДОХОД");
append(InsuranceСontribution, "СТРАХОВЫЕ ВЗНОСЫ");
append(TradeTax, "ТОРГОВЫЙ СБОР");
append(ResortTax, "КУРОРТНЫЙ СБОР");
append(Deposit, "ЗАЛОГ");
}
};


+ 5
- 2
3.0/src/includes/Hardware/IOPorts/LibUSBDeviceDataTypes.h View File

@@ -20,6 +20,8 @@

namespace CLibUSB
{
typedef int (LIBUSB_CALL * TProcessIO) (libusb_device_handle *, unsigned char, unsigned char *, int, int *, unsigned int);

/// Данные конечной точки.
struct SEndPoint
{
@@ -27,13 +29,14 @@ namespace CLibUSB
char data;
int maxPacketSize;
int pollingInterval;
TProcessIO processIO;

SEndPoint(): transferType(LIBUSB_TRANSFER_TYPE_CONTROL), data(ASCII::NUL), maxPacketSize(0), pollingInterval(0) {}
SEndPoint(): transferType(LIBUSB_TRANSFER_TYPE_CONTROL), data(ASCII::NUL), maxPacketSize(0), pollingInterval(0), processIO(nullptr) {}
SEndPoint(libusb_transfer_type aTransferType, char aData, int aMaxPacketSize, int aPollingInterval):
transferType(aTransferType), data(aData), maxPacketSize(aMaxPacketSize), pollingInterval(aPollingInterval) {}

bool getDirection() { return bool(data & LIBUSB_ENDPOINT_DIR_MASK); }
bool valid() { return maxPacketSize && ~(data & (LIBUSB_ENDPOINT_DIR_MASK | LIBUSB_ENDPOINT_ADDRESS_MASK)) &&
bool valid() { return maxPacketSize && processIO && ~(data & (LIBUSB_ENDPOINT_DIR_MASK | LIBUSB_ENDPOINT_ADDRESS_MASK)) &&
((transferType == LIBUSB_TRANSFER_TYPE_BULK) || (transferType == LIBUSB_TRANSFER_TYPE_INTERRUPT)); }
char operator()() { return data; }
};


+ 58
- 20
3.0/src/includes/Hardware/Plugins/CommonParameters.h View File

@@ -77,6 +77,38 @@ inline QStringList sortParameters(QStringList (* aGetParameters)())
}
//------------------------------------------------------------------------------
inline TParameterList modifyValue(const TParameterList & aParameterList, const QString & aName, const QVariant & aValue, const QString & aOldValue = "")
{
TParameterList parameterList(aParameterList);
auto it = std::find_if(parameterList.begin(), parameterList.end(), [&aName] (const SPluginParameter & aParameter) { return aParameter.name == aName; });
if (it != parameterList.end())
{
it->defaultValue = aValue;
QVariantMap & possibleValues = it->possibleValues;
if (possibleValues.contains(aName))
{
possibleValues[aName] = aValue;
}
else if (possibleValues.contains(aOldValue) && (possibleValues[aOldValue] == aOldValue))
{
possibleValues.remove(aOldValue);
possibleValues.insert(aValue.toString(), aValue);
}
}
return parameterList;
}
//------------------------------------------------------------------------------
inline TParameterList modifyPriority(const TParameterList & aParameterList, SDK::Driver::EDetectingPriority::Enum aPriority)
{
return modifyValue(aParameterList, CHardwareSDK::DetectingPriority, aPriority);
}
//------------------------------------------------------------------------------
/// Создать список параметров с именем модели.
template <class T>
inline TParameterList createNamedList(const QStringList & aModels, const QString & aDefault)
@@ -137,6 +169,17 @@ struct SNamedList<T1, DSDKIT::ItUSB>
//------------------------------------------------------------------------------
template <class T1>
struct SNamedList<T1, DSDKIT::ItLibUSB>
{
TParameterList create(const QStringList & aModels, const QString & aDefault)
{
return modifyValue(createSimpleNamedList<T1>(aModels, aDefault), CHardwareSDK::InteractionType, CInteractionTypes::USB, CInteractionTypes::LibUSB)
<< setMultipleExistence();
}
};
//------------------------------------------------------------------------------
template <class T1>
struct SNamedList<T1, DSDKIT::ItTCP>
{
TParameterList create(const QStringList & aModels, const QString & aDefault)
@@ -194,19 +237,14 @@ inline SPluginParameter setNormalPriority()
return SPluginParameter(CHardwareSDK::DetectingPriority, SPluginParameter::Text, false, QString(), QString(), SDK::Driver::EDetectingPriority::Normal, possibleValues, true);
}
inline TParameterList modifyPriority(const TParameterList & aParameterList, SDK::Driver::EDetectingPriority::Enum aPriority)
//------------------------------------------------------------------------------
/// Модифицированные имена ключей.
inline SPluginParameter setModifiedKeys(const QString & aOldParameterName, const QString & aNewParameterName)
{
TParameterList parameterList(aParameterList);
auto it = std::find_if(parameterList.begin(), parameterList.end(), [] (const SPluginParameter & aParameter) { return aParameter.name == CHardwareSDK::DetectingPriority; });
if (it != parameterList.end())
{
it->defaultValue = aPriority;
it->possibleValues[CHardwareSDK::DetectingPriority] = aPriority;
}
QVariantMap modifiedKeys;
modifiedKeys.insert(aOldParameterName, aNewParameterName);
return parameterList;
return SPluginParameter(CPlugin::ModifiedKeys, SPluginParameter::Set, false, QString(), QString(), QString(), modifiedKeys, true);
}
//------------------------------------------------------------------------------
@@ -217,20 +255,20 @@ inline SPluginParameter setModifiedValues(const QString & aParameterValue, const
}
//------------------------------------------------------------------------------
/// Множественный тип атвопоиска устройства.
inline SPluginParameter setMultipleExistence()
/// Модифицированные значения параметров.
inline SPluginParameter setModifiedValues(const QString & aParameterValue, const QString & aValueFrom, const QString & aValueTo)
{
return SPluginParameter(CHardwareSDK::Existence, false, QString(), QString(), CHardwareSDK::ExistenceTypes::Multiple, QStringList() << CHardwareSDK::ExistenceTypes::Multiple, true);
QVariantMap possibleValues;
possibleValues.insert(aValueFrom, aValueTo);
return SPluginParameter(CPlugin::ModifiedValues, SPluginParameter::Set, false, aParameterValue, QString(), QString(), possibleValues, true);
}
//------------------------------------------------------------------------------
/// Модифицированные имена параметров.
inline SPluginParameter setModifiedKeys(const QString & aOldParameterName, const QString & aNewParameterName)
/// Множественный тип атвопоиска устройства.
inline SPluginParameter setMultipleExistence()
{
QVariantMap modifiedKeys;
modifiedKeys.insert(aOldParameterName, aNewParameterName);
return SPluginParameter(CPlugin::ModifiedKeys, SPluginParameter::Set, false, QString(), QString(), QString(), modifiedKeys, true);
return SPluginParameter(CHardwareSDK::Existence, false, QString(), QString(), CHardwareSDK::ExistenceTypes::Multiple, QStringList() << CHardwareSDK::ExistenceTypes::Multiple, true);
}
//------------------------------------------------------------------------------


+ 42
- 0
3.0/src/includes/Hardware/Printers/PortPOSPrinters.h View File

@@ -0,0 +1,42 @@
/* @file POS-принтер на COM-порту. */

#pragma once

#include "POSPrinter.h"

//--------------------------------------------------------------------------------
template <class T>
class SerialPOSPrinter: public T
{
public:
SerialPOSPrinter()
{
using namespace SDK::Driver::IOPort::COM;

// параметры порта
mPortParameters.clear();
mPortParameters.insert(EParameters::BaudRate, POSPrinters::TSerialDevicePortParameter()
<< EBaudRate::BR115200
<< EBaudRate::BR19200
<< EBaudRate::BR57600
<< EBaudRate::BR38400
<< EBaudRate::BR9600
<< EBaudRate::BR4800);
mPortParameters.insert(EParameters::Parity, POSPrinters::TSerialDevicePortParameter()
<< EParity::No
<< EParity::Even
<< EParity::Odd);
mPortParameters.insert(EParameters::ByteSize, POSPrinters::TSerialDevicePortParameter()
<< 8);
mPortParameters.insert(EParameters::RTS, POSPrinters::TSerialDevicePortParameter()
<< ERTSControl::Toggle);
mPortParameters.insert(EParameters::DTR, POSPrinters::TSerialDevicePortParameter()
<< EDTRControl::Handshake);
}
};

//--------------------------------------------------------------------------------
typedef SerialPOSPrinter<POSPrinter<TSerialPrinterBase>> TSerialPOSPrinter;
typedef POSPrinter<TLibUSBPrinterBase> TLibUSBPOSPrinter;

//--------------------------------------------------------------------------------

+ 0
- 1
3.0/src/includes/Hardware/Printers/PortPrinterBase.h View File

@@ -1 +0,0 @@
#include "../../../modules/Hardware/Printers/src/Base/Port/PortPrinterBase.h"

3.0/src/modules/Hardware/Printers/src/Base/Port/Serial/SerialPrinterBase.h → 3.0/src/includes/Hardware/Printers/PortPrintersBase.h View File

@@ -1,19 +1,15 @@
/* @file Базовый принтер � COM-портовой реализацией протокола. */
/* @file Áŕçîâűĺ ďđčíňĺđű ń ďîđňîâűěč đĺŕëčçŕöč˙ěč ďđîňîęîëîâ. */

#pragma once

// Modules
#include "Hardware/FR/ProtoFR.h"

// Project
#include "Hardware/Printers/PortPrinterBase.h"
#include "../../../modules/Hardware/Printers/src/Base/Port/PortPrinterBase.h"

//--------------------------------------------------------------------------------
template <class T>
class SerialPrinterBase : public PortPrinterBase<T>
{
public:
/// Пол�чение �пи�ка на�троек порта, необязательных для редактирования пользователем.
/// Ďîëó÷ĺíčĺ ńďčńęŕ íŕńňđîĺę ďîđňŕ, íĺîá˙çŕňĺëüíűő äë˙ đĺäŕęňčđîâŕíč˙ ďîëüçîâŕňĺëĺě.
static QStringList getOptionalPortSettings()
{
return QStringList()
@@ -25,6 +21,8 @@ public:
}
};

//--------------------------------------------------------------------------------
typedef SerialPrinterBase<PrinterBase<SerialDeviceBase<PortPollingDeviceBase<ProtoPrinter>>>> TSerialPrinterBase;
typedef PortPrinterBase<PrinterBase<LibUSBDeviceBase<PortPollingDeviceBase<ProtoPrinter>>>> TLibUSBPrinterBase;

//--------------------------------------------------------------------------------

+ 1
- 0
3.0/src/includes/Hardware/Printers/PrinterDevices.h View File

@@ -1,4 +1,5 @@
#include "../../../../modules/Hardware/Printers/src/POSPrinters/Common/POSPrinter.h"
#include "../../../../includes/Hardware/Printers/PortPOSPrinters.h"
#include "../../../../modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenPPU700/CitizenPPU700.h"
#include "../../../../modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenCPP8001.h"
#include "../../../../modules/Hardware/Printers/src/POSPrinters/Citizen/CitizenCBM1000II.h"


+ 0
- 1
3.0/src/includes/Hardware/Printers/SerialPrinterBase.h View File

@@ -1 +0,0 @@
#include "../../../modules/Hardware/Printers/src/Base/Port/Serial/SerialPrinterBase.h"

+ 1
- 0
3.0/src/includes/Hardware/Protocols/CashAcceptor/SSPDataTypes.h View File

@@ -0,0 +1 @@
#include "../../../../modules/Hardware/Protocols/CashAcceptor/SSP/src/SSPDataTypes.h"

+ 31
- 12
3.0/src/includes/SDK/Drivers/FR/FiscalDataTypes.h View File

@@ -114,10 +114,26 @@ namespace EPayOffSubjectTypes
{
enum Enum
{
None = 0, /// Отсутствует
Unit, /// Товар
Payment = 10, /// Платеж
AgentFee /// Агентское вознаграждение
None = 0, /// Отсутствует
Unit, /// Товар
ExciseUnit, /// Подакцизный товар
Job, /// Работа
Service, /// Услуга
GamblingBet, /// Ставка азартной игры
GamblingWin, /// Выигрыш азартной игры
LotteryTicket, /// Лотерейный билет
LotteryWin, /// Выигрыш лотереи
RIARightsProvision, /// Предоставление прав на использование результатов интеллектуальной деятельности (РИД, RIA)
Payment, /// Платеж
AgentFee, /// Агентское вознаграждение
Composite, /// Составной
Other, /// Иной
PropertyRight, /// Имущественное право
NonSalesIncome, /// Внереализационный доход
InsuranceСontribution, /// Страховой взнос
TradeTax, /// Торговый сбор
ResortTax, /// Курортный сбор
Deposit /// Залог
};
}
@@ -162,16 +178,18 @@ typedef double TSum;
struct SUnitData
{
TSum sum; /// Сумма платежа.
TVAT VAT; /// НДС (value added tax).
QString name; /// Локализованное название платежа (товар).
QString providerINN; /// ИНН поставщика товара (оператор/дилер/Платина).
EPayOffSubjectTypes::Enum payOffSubjectType; /// Признак предмета расчета (1212).
int section; /// Отдел.
TSum sum; /// Сумма платежа.
TVAT VAT; /// НДС (value added tax).
QString name; /// Локализованное название платежа (товар).
QString providerINN; /// ИНН поставщика товара (оператор/дилер/Платина).
EPayOffSubjectTypes::Enum payOffSubjectType; /// Признак предмета расчета (1212).
EPayOffSubjectMethodTypes::Enum payOffSubjectMethodType; /// Признак способа расчета (1214).
int section; /// Отдел.
SUnitData() : sum(0), VAT(0), payOffSubjectType(EPayOffSubjectTypes::None), section(-1) {}
SUnitData(double aSum, TVAT aVAT, const QString & aName, const QString & aProviderINN, EPayOffSubjectTypes::Enum aPayOffSubjectType, int aSection = -1):
sum(aSum), VAT(aVAT), name(aName), providerINN(aProviderINN), payOffSubjectType(aPayOffSubjectType), section(aSection) {}
SUnitData(double aSum, TVAT aVAT, const QString & aName, const QString & aProviderINN, EPayOffSubjectTypes::Enum aPayOffSubjectType, int aSection = -1,
EPayOffSubjectMethodTypes::Enum aPayOffSubjectMethodType = EPayOffSubjectMethodTypes::Full):
sum(aSum), VAT(aVAT), name(aName), providerINN(aProviderINN), payOffSubjectType(aPayOffSubjectType), payOffSubjectMethodType(aPayOffSubjectMethodType), section(aSection) {}
};
typedef QList<SUnitData> TUnitDataList;
@@ -207,6 +225,7 @@ typedef QMap<int, QString> TSectionNames;
Q_DECLARE_METATYPE(SDK::Driver::TTaxSystemData);
Q_DECLARE_METATYPE(SDK::Driver::TAgentFlagsData);
Q_DECLARE_METATYPE(QList<SDK::Driver::EAgentFlags::Enum>);
Q_DECLARE_METATYPE(SDK::Driver::TSectionNames);
Q_DECLARE_METATYPE(SDK::Driver::TFiscalFieldData);


+ 2
- 0
3.0/src/includes/SDK/Drivers/HardwareConstants.h View File

@@ -22,6 +22,7 @@ namespace CAllHardware
const char InteractionType[] = "interaction_type";
const char WaitUpdatingTimeout[] = "wait_updating_timeout";
const char OperatorPresence[] = "operator_presence";
const char FiscalServerPresence[] = "fiscal_server_presence";
const char OptionalPortSettings[] = "optional_port_settings";
const char OptionalPortSettingsEnable[] = "optional_port_settings_enable";
const char SerialNumber[] = "serial_number";
@@ -62,6 +63,7 @@ namespace CAllHardware
const char FSSerialNumber[] = "fs_serial_number";
const char TaxSystems[] = "tax_systems";
const char AgentFlags[] = "agent_flags";
const char AgentFlagsData[] = "agent_flags_data";
const char SectionNames[] = "section_names";
const char DealerTaxSystem[] = "dealer_tax_system";
const char DealerAgentFlag[] = "dealer_agent_flag";


+ 31
- 22
3.0/src/modules/DeviceManager/src/DeviceManager.cpp View File

@@ -69,7 +69,7 @@ bool DeviceManager::initialize()
if (!systemNames.isEmpty())
{
foreach(auto systemName, systemNames)
foreach (auto systemName, systemNames)
{
mRDSystemNames.insert(pluginPath, systemName);
mFreeSystemNames.insert(systemName);
@@ -224,7 +224,7 @@ void DeviceManager::releaseDevice(IDevice * aDevice)
mDevicesLogData.remove(aDevice);
foreach(auto device, mDeviceDependencyMap.values(aDevice))
foreach (auto device, mDeviceDependencyMap.values(aDevice))
{
// Освобождаем зависимый ресурс.
releaseDevice(device);
@@ -425,7 +425,7 @@ TNamedDevice DeviceManager::findDevice(IDevice * aRequired, const QStringList &
}
}
foreach(const QString & driverName, nonMarketDetectedDriverNames)
foreach (const QString & driverName, nonMarketDetectedDriverNames)
{
markDetected(driverName);
}
@@ -531,21 +531,30 @@ void DeviceManager::findSimpleDevice(const QString & aDriverName, QStringList &
//--------------------------------------------------------------------------------
void DeviceManager::logRequiedDeviceData()
{
QStringList requiredDriverName = mRDSystemNames.keys().toSet().toList();
QStringList interactionTypes = QStringList()
<< CInteractionTypes::COM
<< CInteractionTypes::USB
<< CInteractionTypes::LibUSB;
foreach(const QString & driverName, requiredDriverName)
{
QVariantMap config;
QString systemName = *mRDSystemNames.values(driverName).begin();
config[CHardwareSDK::SystemName] = systemName;
IDevice * required = createDevice(driverName, QVariantMap(), true).second;
QStringList driverList = mDriverList.keys();
if (required)
foreach (const QString & interactionType, interactionTypes)
{
foreach (const QString & driverName, driverList)
{
ILog * log = ILog::getInstance("autodetect/IOPorts");
required->setLog(log);
required->initialize();
releaseDevice(required);
if (driverName.split('.').last() == interactionType)
{
IDevice * required = createDevice(driverName, QVariantMap(), true).second;
if (required)
{
QString logName = QString("autodetect/%1 ports").arg(interactionType);
ILog * log = ILog::getInstance(logName);
required->setLog(log);
required->initialize();
releaseDevice(required);
};
}
}
}
}
@@ -587,7 +596,7 @@ QStringList DeviceManager::detect(const QString & /*aDeviceType*/)
}
}
foreach(const QString & driverName, nonMarketDetectedDriverNames)
foreach (const QString & driverName, nonMarketDetectedDriverNames)
{
markDetected(driverName);
}
@@ -968,7 +977,7 @@ void DeviceManager::stopDetection()
//--------------------------------------------------------------------------------
void DeviceManager::saveConfiguration(IDevice * aDevice)
{
foreach(auto device, mDeviceDependencyMap.values(aDevice))
foreach (auto device, mDeviceDependencyMap.values(aDevice))
{
saveConfiguration(device);
}
@@ -984,7 +993,7 @@ void DeviceManager::setDeviceConfiguration(IDevice * aDevice, const QVariantMap
QString newSystemName;
// Приверка свободности системного устройства
foreach(IDevice * systemDevice, mDeviceDependencyMap.values(aDevice))
foreach (IDevice * systemDevice, mDeviceDependencyMap.values(aDevice))
{
// При изменении имени системного устройства меняем его доступность
oldSystemName = systemDevice->getDeviceConfiguration()[CHardwareSDK::SystemName].toString();
@@ -1006,7 +1015,7 @@ void DeviceManager::setDeviceConfiguration(IDevice * aDevice, const QVariantMap
}
// Применяем конфигурацию к системным устройствам
foreach(IDevice * systemDevice, mDeviceDependencyMap.values(aDevice))
foreach (IDevice * systemDevice, mDeviceDependencyMap.values(aDevice))
{
// При изменении имени системного устройства меняем его доступность
if (oldSystemName != newSystemName)
@@ -1145,14 +1154,14 @@ QString DeviceManager::getSimpleDeviceLogName(IDevice * aDevice, bool aDetecting
IPlugin * plugin = dynamic_cast<IPlugin *>(aDevice);
QString configPath = plugin->getConfigurationName().section(CPlugin::InstancePathSeparator, 0, 0);
if (interactionType == CInteractionTypes::USB)
if (interactionType.contains(CInteractionTypes::USB))
{
for (auto it = mDevicesLogData.begin(); it != mDevicesLogData.end(); ++it)
{
QVariantMap localParameters = it.key()->getDeviceConfiguration();
QString localInteractionType = localParameters[CHardwareSDK::InteractionType].toString();
if ((localInteractionType == CInteractionTypes::USB) && it->contains(aDetecting))
if (localInteractionType.contains(CInteractionTypes::USB) && it->contains(aDetecting))
{
logIndexes << it->value(aDetecting);
}
@@ -1189,7 +1198,7 @@ QString DeviceManager::getSimpleDeviceLogName(IDevice * aDevice, bool aDetecting
result.prepend("autodetect/");
}
if (interactionType == CInteractionTypes::USB)
if (interactionType.contains(CInteractionTypes::USB))
{
result += QString(" on USB%1").arg(logIndex);
}


+ 1
- 1
3.0/src/modules/Hardware/Cardreaders/msvc/CardReaders.vcxproj View File

@@ -132,7 +132,7 @@
<ClInclude Include="..\src\Creator\CreatorReader.h" />
<ClInclude Include="..\src\Creator\CreatorReaderConstants.h" />
<ClInclude Include="..\src\Creator\CreatorReaderDataTypes.h" />
<ClInclude Include="..\src\Creator\CreatorReaderModelData.h" />
<ClInclude Include="..\src\Creator\CreatorReaderDetectingData.h" />
<ClInclude Include="..\src\EMV\EMVAdapter.h" />
<ClInclude Include="..\src\EMV\EMVConstants.h" />
<ClInclude Include="..\src\EMV\TLV.h" />


+ 1
- 1
3.0/src/modules/Hardware/Cardreaders/msvc/CardReaders.vcxproj.filters View File

@@ -52,7 +52,7 @@
<ClInclude Include="..\src\Creator\CreatorReaderDataTypes.h">
<Filter>Creator</Filter>
</ClInclude>
<ClInclude Include="..\src\Creator\CreatorReaderModelData.h">
<ClInclude Include="..\src\Creator\CreatorReaderDetectingData.h">
<Filter>Creator</Filter>
</ClInclude>
<ClInclude Include="..\src\EMV\EMVAdapter.h">


+ 3
- 13
3.0/src/modules/Hardware/Cardreaders/src/Creator/CreatorReader.cpp View File

@@ -7,7 +7,7 @@
#include "CreatorReader.h"
#include "../EMV/EMVAdapter.h"
#include "CreatorReaderConstants.h"
#include "CreatorReaderModelData.h"
#include "CreatorReaderDetectingData.h"

using namespace SDK::Driver;

@@ -20,7 +20,7 @@ CreatorReader::CreatorReader()
mICCPUType = CCreatorReader::CardTypes::EICCPU::Unknown;
mMaxBadAnswers = 1;

mDetectingData = CUSBDevice::PDetectingData(new CCreatorReader::ModelData());
mDetectingData->set(CCreatorReader::DetectingData());

mStatusCodesSpecification = DeviceStatusCode::PSpecifications(new CardReaderStatusCode::CSpecifications());
}
@@ -28,17 +28,7 @@ CreatorReader::CreatorReader()
//--------------------------------------------------------------------------------
QStringList CreatorReader::getModelList()
{
QStringList models;

foreach (CUSBDevice::CData modelData, CCreatorReader::ModelData().data())
{
foreach (CUSBDevice::SData data, modelData.data())
{
models << data.model;
}
}

return models;
return QStringList() << CCreatorReader::DetectingData().getModel();
}

//--------------------------------------------------------------------------------


3.0/src/modules/Hardware/Cardreaders/src/Creator/CreatorReaderModelData.h → 3.0/src/modules/Hardware/Cardreaders/src/Creator/CreatorReaderDetectingData.h View File

@@ -10,15 +10,8 @@ namespace CCreatorReader
/// Название кардридера Creator по умолчанию.
const char DefaultName[] = "Unknown Creator cardreader";

/// Данные моделей.
class ModelData : public CUSBDevice::CDetectingData
{
public:
ModelData()
{
add(0x23d8, 0x0285, "Creator CRT-288K", true);
}
};
/// Данные модели.
DECLARE_USB_MODEL(DetectingData, Creator, 0x0285, "CRT-288K");
}

//--------------------------------------------------------------------------------

+ 55
- 26
3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.cpp View File

@@ -2,6 +2,7 @@
// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QRegExp>
#include <QtCore/qmath.h>
#include <Common/QtHeadersEnd.h>
@@ -13,6 +14,7 @@
using namespace SDK::Driver;
using namespace SDK::Driver::IOPort::COM;
using namespace ProtocolUtils;
//---------------------------------------------------------------------------
SSPCashAcceptor::SSPCashAcceptor()
@@ -25,10 +27,10 @@ SSPCashAcceptor::SSPCashAcceptor()
mPortParameters[EParameters::RTS].append(ERTSControl::Disable);
// данные устройства
mDeviceName = "SSP cash acceptor";
mDeviceName = CSSP::DefaultModel;
mEscrowPosition = 1;
mResetOnIdentification = true;
mResetWaiting = EResetWaiting::Available;
mLastConnectionOK = false;
// параметры протокола
mProtocol.setAddress(CSSP::Addresses::Validator);
@@ -82,6 +84,11 @@ bool SSPCashAcceptor::checkStatuses(TStatusData & aData)
//---------------------------------------------------------------------------------
TResult SSPCashAcceptor::execCommand(const QByteArray & aCommand, const QByteArray & aCommandData, QByteArray * aAnswer)
{
if (!mLastConnectionOK && (aCommand != QByteArray(1, CSSP::Commands::Sync)) && !processCommand(CSSP::Commands::Sync))
{
return false;
}
MutexLocker locker(&mExternalMutex);
mProtocol.setPort(mIOPort);
@@ -89,7 +96,8 @@ TResult SSPCashAcceptor::execCommand(const QByteArray & aCommand, const QByteArr
QByteArray answer;
QByteArray request = aCommand + aCommandData;
TResult result = mProtocol.processCommand(request, answer, aCommand.startsWith(CSSP::Commands::Sync));
TResult result = mProtocol.processCommand(request, answer, CSSP::Commands::Data[aCommand[0]]);
mLastConnectionOK = CommandResult::PresenceErrors.contains(result);
if (!result)
{
@@ -115,31 +123,29 @@ TResult SSPCashAcceptor::execCommand(const QByteArray & aCommand, const QByteArr
//--------------------------------------------------------------------------------
bool SSPCashAcceptor::processReset()
{
return processCommand(CSSP::Commands::Reset) && waitReady(CSSP::ReadyWaiting);
}
//--------------------------------------------------------------------------------
bool SSPCashAcceptor::isConnected()
{
QByteArray answer;
if (!processCommand(CSSP::Commands::Sync))
if (!processCommand(CSSP::Commands::Reset))
{
return false;
}
if (!processReset())
{
return false;
}
waitReady(CSSP::NotReadyWaiting, false);
int protocolNumber = CSSP::StartingProtocolNumber;
TStatusCodes statusCodes;
auto poll = [&] () -> bool { statusCodes.clear(); return getStatus(std::ref(statusCodes)); };
while (processCommand(CSSP::Commands::SetProtocolVersion, QByteArray(1, uchar(protocolNumber++))))
if (!PollingExpector().wait<bool>(poll, [&] () -> bool { return !statusCodes.isEmpty() && !statusCodes.contains(DeviceStatusCode::OK::Initialization); }, CSSP::ReadyWaiting))
{
toLog(LogLevel::Error, mDeviceName + ": Failed to wait not initialization status after reset command");
return false;
}
setDeviceParameter(CDeviceData::ProtocolVersion, protocolNumber - 2);
return true;
}
//--------------------------------------------------------------------------------
bool SSPCashAcceptor::isConnected()
{
QByteArray answer;
if (!processCommand(CSSP::Commands::GetVersion, &answer))
{
@@ -147,7 +153,19 @@ bool SSPCashAcceptor::isConnected()
return false;
}
SBaseModelData modelData = CSSP::ModelData[answer.left(6)];
QMap<QString, SBaseModelData>::const_iterator it = CSSP::ModelData.data().begin();
SBaseModelData modelData(CSSP::DefaultModel);
while (it != CSSP::ModelData.data().end())
{
if (QRegExp(it.key()).indexIn(answer.left(6)) != -1)
{
modelData = it.value();
}
it++;
}
mDeviceName = modelData.name;
mUpdatable = modelData.updatable;
mVerified = modelData.verified;
@@ -155,10 +173,23 @@ bool SSPCashAcceptor::isConnected()
if (answer.size() >= 9)
{
setDeviceParameter(CDeviceData::Firmware, answer.mid(6, 3).insert(1, ASCII::Dot));
setDeviceParameter(CDeviceData::CashAcceptors::ModificationNumber, answer.mid(9));
}
setDeviceParameter(CDeviceData::Revision, answer.mid(9, 4));
setDeviceParameter(CDeviceData::CashAcceptors::ModificationNumber, answer.mid(13));
return true;
}
//--------------------------------------------------------------------------------
void SSPCashAcceptor::processDeviceData()
{
int protocolNumber = 1;
while (!processCommand(CSSP::Commands::SetProtocolVersion, QByteArray(1, uchar(protocolNumber++)))) {}
while ( processCommand(CSSP::Commands::SetProtocolVersion, QByteArray(1, uchar(protocolNumber++)))) {}
setDeviceParameter(CDeviceData::ProtocolVersion, protocolNumber - 2);
QByteArray answer;
if (processCommand(CSSP::Commands::GetSerial, &answer) && !answer.isEmpty())
{
@@ -169,8 +200,6 @@ bool SSPCashAcceptor::isConnected()
{
setDeviceParameter(CDeviceData::Firmware, answer.mid(1, 4).insert(1, ASCII::Dot));
}
return true;
}
//--------------------------------------------------------------------------------
@@ -256,13 +285,13 @@ bool SSPCashAcceptor::loadParTable()
return false;
}
double multiplier = CSSP::NominalMultiplier * ProtocolUtils::hexToBCD(answer.mid(12 + 2 * channels, 3)).toInt();
double multiplier = CSSP::NominalMultiplier * hexToBCD(answer.mid(12 + 2 * channels, 3)).toInt();
for (int i = 0; i < channels; ++i)
{
int index = answer[12 + i];
QString currency = answer.mid(16 + 2 * channels, 3);
double nominal = multiplier * ProtocolUtils::revert(answer.mid(16 + 5 * channels + 4 * i, 4)).toHex().toInt(0, 16);
double nominal = multiplier * revert(answer.mid(16 + 5 * channels + 4 * i, 4)).toHex().toInt(0, 16);
MutexLocker locker(&mResourceMutex);


+ 6
- 0
3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.h View File

@@ -32,6 +32,9 @@ protected:
/// Установка параметров по умолчанию.
virtual bool setDefaultParameters();

/// Запросить и сохранить параметры устройства.
virtual void processDeviceData();

/// Применить таблицу номиналов.
virtual bool applyParTable();

@@ -52,6 +55,9 @@ protected:

/// Протокол.
SSPProtocol mProtocol;

/// Удачна ли была последняя транзакция связи с устройством.
bool mLastConnectionOK;
};

//--------------------------------------------------------------------------------

+ 25
- 4
3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptorConstants.h View File

@@ -5,6 +5,7 @@
// Modules
#include "Hardware/Common/DeviceCodeSpecification.h"
#include "Hardware/Common/WaitingData.h"
#include "Hardware/Protocols/CashAcceptor/SSPDataTypes.h"
// Project
#include "Hardware/CashAcceptors/CashAcceptorStatusCodes.h"
@@ -15,9 +16,10 @@ namespace CSSP
/// Адреса устройств
namespace Addresses
{
const char Validator = 0x00; /// Купюроприемник.
const char Hopper = 0x10; /// Хоппер.
const char Printer = 0x40; /// Принтер Smart Ticket.
const char Validator = 0x00; /// Купюроприемник, диспенсер (пристегивается к купюрнику).
const char Hopper = 0x10; /// Хоппер.
const char Printer1 = 0x40; /// Принтер Smart Ticket (печать по шаблонам или "на лету" (?).
const char Printer2 = 0x41; /// Принтер Coupon Printer (печатает на фальцованной бумаге) и Flatbed Printer (обычный термопринтер).
}
namespace Result
@@ -61,8 +63,11 @@ namespace CSSP
/// Таймаут после Reset-а, [мс].
const double NominalMultiplier = 0.01;
/// Ожидание отвала после резета, [мс].
const SWaitingData NotReadyWaiting = SWaitingData(150, 1000);
/// Ожидание готовности, [мс].
const SWaitingData ReadyWaiting = SWaitingData(150, 3 * 1000);
const SWaitingData ReadyWaiting = SWaitingData(150, 5 * 1000);
/// Виртуальный статус Enabled.
const char EnabledStatus[] = "Enabled status";
@@ -84,6 +89,22 @@ namespace CSSP
const char Sync = '\x11'; /// Синхронизация байта последовательности.
const char GetVersion = '\x20'; /// Запрос версии прошивки.
const char Stack = '\x43'; /// Уложить в стекер.
class CData: public CSpecification<char, SData>
{
public:
CData()
{
add(GetSetupData, 1000);
add(Sync, true);
}
private:
void add(char aCommand, int aTimeout) { append(aCommand, SData(aTimeout, false)); }
void add(char aCommand, bool aSetSync) { append(aCommand, SData(DefaultTimeout, aSetSync)); }
};
static CData Data;
}
//--------------------------------------------------------------------------------


+ 12
- 9
3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPModelData.h View File

@@ -7,20 +7,23 @@
//--------------------------------------------------------------------------------
namespace CSSP
{
/// Название устройства по умолчанию.
const char DefaultModel[] = "SSP cash acceptor";

class CModelData : public CSpecification<QString, SBaseModelData>
{
public:
CModelData()
{
add("BV0020", "ITL BV20");
add("BV0050", "ITL BV50");
add("BV0100", "ITL BV100");
add("NV0150", "ITL NV150");
add("NV0200", "ITL NV200", true, false);
add("NV0009", "ITL NV9 USB");
add("NV0010", "ITL NV10 USB");
add("SH0003", "ITL SH3");
add("SH0004", "ITL SH4");
add("BV0020", "ITL BV20");
add("BV0050", "ITL BV50");
add("BV0100", "ITL BV100");
add("NV0150", "ITL NV150");
add("NV\\w200", "ITL NV200", true, false);
add("NV0009", "ITL NV9 USB");
add("NV0010", "ITL NV10 USB");
add("SH0003", "ITL SH3");
add("SH0004", "ITL SH4");
}
private:
void add(const QString & aId, const QString & aModelName, bool aVerified = false, bool aUpdatable = false)


+ 1
- 17
3.0/src/modules/Hardware/Common/Common.qbs View File

@@ -30,23 +30,7 @@ Project {
"../../../includes/Hardware/Dispensers/ProtoDispenser.h",
"../../../includes/Hardware/Watchdogs/ProtoWatchdog.h",

"../../../includes/Hardware/Common/ProtoDevice.h",
"../../../includes/Hardware/Common/ProtoDevices.h",
"../../../includes/Hardware/Common/DeviceCodeSpecification.h",
"../../../includes/Hardware/Common/ProtocolBase.h",
"../../../includes/Hardware/Common/CommandResultData.h",
"../../../includes/Hardware/Common/StatusCache.h",
"../../../includes/Hardware/Common/USBDeviceModelData.h",
"../../../includes/Hardware/Common/CommandResults.h",
"../../../includes/Hardware/Common/LoggingType.h",
"../../../includes/Hardware/Common/DeviceCodeSpecificationBase.h",
"../../../includes/Hardware/Common/ASCII.h",
"../../../includes/Hardware/Common/BaseStatus.h",
"../../../includes/Hardware/Common/BaseStatusDescriptions.h",
"../../../includes/Hardware/Common/CodecDescriptions.h",
"../../../includes/Hardware/Common/HystoryList.h",
"../../../includes/Hardware/Common/HardwareConstants.h",
"../../../includes/Hardware/Common/Specifications.h"
"../../../includes/Hardware/Common/*.*"
]
}



+ 4
- 1
3.0/src/modules/Hardware/Common/msvc/Common.vcxproj View File

@@ -134,6 +134,7 @@
<ClCompile Include="..\src\Port\Serial\SerialDeviceBase.cpp" />
<ClCompile Include="..\src\Port\TCP\TCPDeviceBase.cpp" />
<ClCompile Include="..\src\Port\USB\USBDeviceBase.cpp" />
<ClCompile Include="..\src\Port\USB\USBDeviceModelData.cpp" />
<ClCompile Include="..\src\SafePerformer\SafePerformer.cpp" />
<ClCompile Include="..\src\Utils\DeviceUtils.cpp" />
<ClCompile Include="..\src\Utils\ProtocolUtils.cpp" />
@@ -297,6 +298,8 @@
<ClInclude Include="..\..\..\..\includes\Hardware\Common\ProtoDevices.h" />
<ClInclude Include="..\..\..\..\includes\Hardware\Common\CommandResultData.h" />
<ClInclude Include="..\..\..\..\includes\Hardware\Common\StatusCache.h" />
<ClInclude Include="..\..\..\..\includes\Hardware\Common\USBDeviceModelDataTypes.h" />
<ClInclude Include="..\..\..\..\includes\Hardware\Common\USBDeviceVendors.h" />
<ClInclude Include="..\..\..\..\includes\Hardware\Common\WaitingData.h" />
<ClInclude Include="..\..\..\..\includes\Hardware\Plugins\CommonParameters.h" />
<CustomBuild Include="..\src\WorkingThreadProxy.h">
@@ -355,7 +358,6 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ProjectName)\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ProjectName)\$(ConfigurationName)\moc_%(Filename).cpp" -DWINVER=0x0502 -D_WIN32_WINNT=0x0502 -DUNICODE -DWIN32 -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQCOMPORTWIN_LIB -DCYBERPLAT_DRIVER "-I$(TC_DIR)\." "-I$(TC_INCLUDE_DIR)\." "-I$(THIRDPARTY_DIR)\." "-I.\src" "-I$(QTDIR)\include"</Command>
</CustomBuild>
<ClInclude Include="..\..\..\..\includes\Hardware\Common\USBDeviceModelData.h" />
<ClInclude Include="..\..\..\..\includes\Hardware\Plugins\DevicePluginBase.h" />
<ClInclude Include="..\src\Codec\CodecBase.h" />
<ClInclude Include="..\src\ConfigManager\DeviceConfigManager.h" />
@@ -379,6 +381,7 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ProjectName)\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ProjectName)\$(ConfigurationName)\moc_%(Filename).cpp" -DWINVER=0x0502 -D_WIN32_WINNT=0x0502 -DUNICODE -DWIN32 -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQCOMPORTWIN_LIB -DCYBERPLAT_DRIVER "-I$(TC_DIR)\." "-I$(TC_INCLUDE_DIR)\." "-I$(THIRDPARTY_DIR)\." "-I.\src" "-I$(QTDIR)\include"</Command>
</CustomBuild>
<ClInclude Include="..\src\Port\USB\USBDeviceModelData.h" />
<ClInclude Include="..\src\Utils\DeviceUtils.h" />
<ClInclude Include="..\src\Utils\ProtocolUtils.h" />
<ClInclude Include="..\src\Virtual\VirtualDeviceBase.h" />


+ 12
- 3
3.0/src/modules/Hardware/Common/msvc/Common.vcxproj.filters View File

@@ -244,6 +244,9 @@
<ClCompile Include="..\src\Port\LibUSB\LibUSBDeviceBase.cpp">
<Filter>Port\LibUSB</Filter>
</ClCompile>
<ClCompile Include="..\src\Port\USB\USBDeviceModelData.cpp">
<Filter>Port\USB</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\includes\Hardware\Common\ASCII.h">
@@ -288,9 +291,6 @@
<ClInclude Include="..\src\Port\USB\USBDeviceBase.h">
<Filter>Port\USB</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\includes\Hardware\Common\USBDeviceModelData.h">
<Filter>Port\USB</Filter>
</ClInclude>
<ClInclude Include="..\src\Meta\MetaDevice.h">
<Filter>Meta</Filter>
</ClInclude>
@@ -363,6 +363,15 @@
<ClInclude Include="..\src\Port\LibUSB\LibUSBDeviceBase.h">
<Filter>Port\LibUSB</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\includes\Hardware\Common\USBDeviceVendors.h">
<Filter>Port\USB</Filter>
</ClInclude>
<ClInclude Include="..\src\Port\USB\USBDeviceModelData.h">
<Filter>Port\USB</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\includes\Hardware\Common\USBDeviceModelDataTypes.h">
<Filter>Port\USB</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\src\locale\common_ru.ts">


+ 2
- 2
3.0/src/modules/Hardware/Common/src/Base/DeviceBase.cpp View File

@@ -510,10 +510,10 @@ void DeviceBase<T>::applyStatusBuffer(TStatusCodes & aStatusCodes)
//--------------------------------------------------------------------------------
template <class T>
bool DeviceBase<T>::waitReady(const SWaitingData & aWaitingData)
bool DeviceBase<T>::waitReady(const SWaitingData & aWaitingData, bool aReady)
{
TStatusCodes statusCodes;
auto poll = [&] () -> bool { statusCodes.clear(); return getStatus(std::ref(statusCodes)) && !statusCodes.contains(DeviceStatusCode::Error::NotAvailable); };
auto poll = [&] () -> bool { statusCodes.clear(); return aReady == (getStatus(std::ref(statusCodes)) && !statusCodes.contains(DeviceStatusCode::Error::NotAvailable)); };
return PollingExpector().wait(poll, aWaitingData);
}


+ 1
- 1
3.0/src/modules/Hardware/Common/src/Base/DeviceBase.h View File

@@ -160,7 +160,7 @@ protected:
virtual bool environmentChanged();
/// Подождать готовность.
bool waitReady(const SWaitingData & aWaitingData);
bool waitReady(const SWaitingData & aWaitingData, bool aReady = true);
/// Получить уровень тревожности по буферу статус-кодов.
virtual SDK::Driver::EWarningLevel::Enum getWarningLevel(const TStatusCollection & aStatusCollection);


+ 3
- 0
3.0/src/modules/Hardware/Common/src/Meta/MetaDevice.h View File

@@ -162,6 +162,9 @@ protected:
/// Драйвера запускаются из под модуля платежей.
bool mOperatorPresence;
/// Драйвера запускаются из под фискального сервера.
bool mFiscalServerPresence;
/// Таймаут ожидания потока при его завершении.
unsigned long mExitTimeout;


+ 3
- 3
3.0/src/modules/Hardware/Common/src/Port/LibUSB/LibUSBDeviceBase.cpp View File

@@ -28,7 +28,7 @@ LibUSBDeviceBase<T>::LibUSBDeviceBase()
{
mIOPort = &mLibUSBPort;

mDetectingData = CUSBDevice::PDetectingData(new CUSBDevice::CDetectingData());
mDetectingData = CUSBDevice::PDetectingData(new CUSBDevice::DetectingData());
mReplaceableStatuses << DeviceStatusCode::Error::PowerSupply;
}

@@ -105,7 +105,7 @@ bool LibUSBDeviceBase<T>::setUsageData(libusb_device * aDevice)
return false;
}

QMap<quint16, CUSBDevice::SData> & PIDData = mDetectingData->value(properties.VID).data();
QMap<quint16, CUSBDevice::SProductData> & PIDData = mDetectingData->value(properties.VID).data();

if (!PIDData.contains(properties.PID))
{
@@ -113,7 +113,7 @@ bool LibUSBDeviceBase<T>::setUsageData(libusb_device * aDevice)
return false;
}

CUSBDevice::SData data = PIDData[properties.PID];
CUSBDevice::SProductData data = PIDData[properties.PID];
mDeviceName = data.model;
mVerified = data.verified;



+ 6
- 1
3.0/src/modules/Hardware/Common/src/Port/PortDeviceBase.cpp View File

@@ -94,6 +94,11 @@ void PortDeviceBase<T>::setDeviceConfiguration(const QVariantMap & aConfiguratio
TVoidMethod forwardingTask = isAutoDetecting() ? TVoidMethod() : std::bind(&DeviceBase::initialize, this);
configuration.insert(CHardware::Port::OpeningContext, QVariant::fromValue(forwardingTask));

if (aConfiguration.contains(CHardwareSDK::SearchingType))
{
configuration.insert(CHardwareSDK::SearchingType, aConfiguration[CHardwareSDK::SearchingType]);
}

mIOPort->setDeviceConfiguration(configuration);
}
}
@@ -199,7 +204,7 @@ bool PortDeviceBase<T>::processStatus(TStatusCodes & aStatusCodes)
{
if (mIOPortStatusCodes.isEmpty())
{
checkError(IOPortStatusCode::Error::Busy, [&] () -> bool { return mIOPort->open(); }, "device cannot open port after getting status");
checkError(IOPortStatusCode::Error::Busy, [&] () -> bool { return mIOPort->open(); }, "device cannot open port before getting status");
}

return false;


+ 3
- 3
3.0/src/modules/Hardware/Common/src/Port/USB/USBDeviceBase.cpp View File

@@ -28,7 +28,7 @@ USBDeviceBase<T>::USBDeviceBase() : mPDODetecting(false), mPortUsing(true)
{
mIOPort = &mUSBPort;

mDetectingData = CUSBDevice::PDetectingData(new CUSBDevice::CDetectingData());
mDetectingData = CUSBDevice::PDetectingData(new CUSBDevice::DetectingData());
mReplaceableStatuses << DeviceStatusCode::Error::PowerSupply;
}

@@ -105,7 +105,7 @@ bool USBDeviceBase<T>::setPDOName(const QString & aPDOName)
return false;
}

QMap<quint16, CUSBDevice::SData> & PIDData = mDetectingData->value(properties.VID).data();
QMap<quint16, CUSBDevice::SProductData> & PIDData = mDetectingData->value(properties.VID).data();

if (!PIDData.contains(properties.PID))
{
@@ -113,7 +113,7 @@ bool USBDeviceBase<T>::setPDOName(const QString & aPDOName)
return false;
}

CUSBDevice::SData data = PIDData[properties.PID];
CUSBDevice::SProductData data = PIDData[properties.PID];
mDeviceName = data.model;
mVerified = data.verified;



+ 96
- 0
3.0/src/modules/Hardware/Common/src/Port/USB/USBDeviceModelData.cpp View File

@@ -0,0 +1,96 @@
/* @file Спецификация данных моделей USB-устройств для автопоиска. */

#pragma once

// Modules
#include "Hardware/Common/ASCII.h"
#include "Hardware/CardReaders/MifareReaderModelDataTypes.h"

// Project
#include "USBDeviceModelData.h"

namespace CUSBDevice
{

//--------------------------------------------------------------------------------
template class ProductDataBase<SProductData>;
template class ProductDataBase<CMifareReader::SModelData>;

CUSBVendors::Data DetectingData::mVendorData;

//--------------------------------------------------------------------------------
template <class T>
QStringList ProductDataBase<T>::getModelList(const QString & aVendor)
{
QStringList result;

foreach (const T & data, mBuffer)
{
result << aVendor + " " + data.model;
}

return result;
}

//--------------------------------------------------------------------------------
template <class T>
void ProductDataBase<T>::setDefaultModel(const QString & aModel)
{
T data;
data.model = aModel;
data.verified = false;

setDefault(data);
}

//--------------------------------------------------------------------------------
template <class T>
TProductData ProductDataBase<T>::getProductData()
{
return mProductData;
}

//--------------------------------------------------------------------------------
void DetectingData::set(const QString & aVendor, quint16 aPID, const QString & aModel, bool aVerified)
{
data().clear();

quint16 VID = mVendorData[aVendor];
data()[VID].append(aPID, SProductData(aVendor + " " + aModel, aVerified));
}

//--------------------------------------------------------------------------------
void DetectingData::set(const QString & aVendor, const QString & aDeviceName, quint16 aPID)
{
data().clear();

quint16 VID = mVendorData[aVendor];
data()[VID].append(aPID, SProductData(aDeviceName, true));
}

//--------------------------------------------------------------------------------
void DetectingData::set(const SDetectingData & aDetectingData)
{
data().clear();

quint16 VID = mVendorData[aDetectingData.vendor];
data()[VID].append(aDetectingData.PID, SProductData(aDetectingData.vendor + " " + aDetectingData.model, true));
}

//--------------------------------------------------------------------------------
void DetectingData::set(const QString & aVendor, const TProductData & aProductData)
{
data().clear();

quint16 VID = mVendorData[aVendor];
TProductData & productData = data()[VID].data();

for (auto it = aProductData.begin(); it != aProductData.end(); ++it)
{
productData.insert(it.key(), SProductData(aVendor + " " + it->model, it->verified));
}
}

} // CUSBDevice

//--------------------------------------------------------------------------------

+ 58
- 0
3.0/src/modules/Hardware/Common/src/Port/USB/USBDeviceModelData.h View File

@@ -0,0 +1,58 @@
/* @file Спецификация данных моделей USB-устройств для автопоиска. */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QSharedPointer>
#include <Common/QtHeadersEnd.h>

// Modules
#include "Hardware/Common/Specifications.h"
#include "Hardware/Common/USBDeviceModelDataTypes.h"
#include "Hardware/Common/USBDeviceVendors.h"

//--------------------------------------------------------------------------------
namespace CUSBDevice
{
/// данные моделей по PID-ам.
template <class T>
class ProductDataBase : public CSpecification<quint16, T>
{
public:
QStringList getModelList(const QString & aVendor);
void setDefaultModel(const QString & aModel);
TProductData getProductData();

protected:
TProductData mProductData;
};

//--------------------------------------------------------------------------------
class ProductData: public ProductDataBase<SProductData>
{
public:
void add(quint16 aPID, const QString & aModel, bool aVerified = false)
{
append(aPID, SProductData(aModel, aVerified));
}
};

//--------------------------------------------------------------------------------
/// Данные моделей по VID-ам.
class DetectingData : public CSpecification<quint16, ProductData>
{
public:
void set(const QString & aVendor, quint16 aPID, const QString & aModel, bool aVerified = false);
void set(const QString & aVendor, const QString & aDeviceName, quint16 aPID);
void set(const SDetectingData & aDetectingData);
void set(const QString & aVendor, const TProductData & aProductData);

protected:
static CUSBVendors::Data mVendorData;
};

typedef QSharedPointer<DetectingData> PDetectingData;
}

//--------------------------------------------------------------------------------

+ 2
- 2
3.0/src/modules/Hardware/FR/src/Atol/Base/Atol3/Atol3FRBase.cpp View File

@@ -31,7 +31,7 @@ TResult Atol3FRBase::performCommand(const QByteArray & aCommandData, QByteArray
clockTimer.start();

mTId = (mTId == uchar(CAtol3FR::LastTId)) ? ASCII::NUL : ++mTId;
TResult result = mProtocol.processCommand(mTId, aCommandData, aAnswer, aTimeout);
TResult result = mProtocol.processCommand(mTId, aCommandData, aAnswer);

using namespace CAtol3FR;

@@ -39,7 +39,7 @@ TResult Atol3FRBase::performCommand(const QByteArray & aCommandData, QByteArray
{
do
{
result = mProtocol.waitForAnswer(aAnswer);
result = mProtocol.waitForAnswer(aAnswer, CAtol3FR::Timeouts::WaitForAnswer);
}
while ((clockTimer.elapsed() < aTimeout) && ((result == CommandResult::NoAnswer) || (aAnswer[0] == States::InProgress)));
}


+ 7
- 0
3.0/src/modules/Hardware/FR/src/Atol/Base/Atol3/Atol3FRBaseConstants.h View File

@@ -20,6 +20,13 @@ namespace CAtol3FR
const char AsyncError = '\xA7'; /// В асинхронном ответе - исполнено, есть ошибка.
const char Waiting = '\xA8'; /// Исполняется в фоновом режиме. ждем данные от внешнего устройства.
}

/// Таймауты, [мс].
namespace Timeouts
{
/// На единичное ожидание ответа.
const int WaitForAnswer = 500;
}
}

//--------------------------------------------------------------------------------

+ 51
- 16
3.0/src/modules/Hardware/FR/src/Atol/Online/AtolOnlineFRBase.cpp View File

@@ -43,7 +43,9 @@ AtolOnlineFRBase<T>::AtolOnlineFRBase()
// ошибки
mErrorData = PErrorData(new CAtolOnlineFR::Errors::Data());
mUnprocessedErrorData.add(CAtolOnlineFR::Commands::FS::GetFiscalTLVData, CAtolOnlineFR::Errors::NoRequiedDataInFS);
mUnprocessedErrorData.add(CAtolOnlineFR::Commands::FS::GetFiscalTLVData, TErrors()
<< CAtolOnlineFR::Errors::NoRequiedDataInFS
<< CAtolOnlineFR::Errors::NeedExtendedErrorCode);
}
//--------------------------------------------------------------------------------
@@ -175,7 +177,7 @@ void AtolOnlineFRBase<T>::processDeviceData()
if (date.isValid())
{
setDeviceParameter(CDeviceData::FS::ValidityData, date.toString(CFR::DateLogFormat));
setDeviceParameter(CDeviceData::FS::ValidityData, CFR::FSValidityDateOff(date));
}
if (data.size() > 6)
@@ -424,19 +426,7 @@ bool AtolOnlineFRBase<T>::processAnswer(const QByteArray & aCommand, char aError
}
case CAtolOnlineFR::Errors::NeedExtendedErrorCode:
{
QByteArray data;
if (getRegister(CAtolOnlineFR::Registers::ExtendedErrorData, data))
{
char command = char(data.left(2).toHex().toInt(0, 16));
if (command == aCommand[0])
{
ushort error = data.mid(2, 2).toHex().toUShort(0, 16);
toLog(LogLevel::Error, mDeviceName + ": Extended error: " + CAtolOnlineFR::Errors::ExtraData[error]);
}
}
getExtendedErrorCode(aCommand);
break;
}
@@ -453,6 +443,34 @@ bool AtolOnlineFRBase<T>::processAnswer(const QByteArray & aCommand, char aError
//---------------------------------------------------------------------------
template<class T>
bool AtolOnlineFRBase<T>::getExtendedErrorCode(const QByteArray & aCommand)
{
QByteArray data;
QString registerName = CAtolOnlineFR::Registers::ExtendedErrorData;
char registerNumber = mRegisterData[registerName].number;
if (!getRegister(registerName, data))
{
return false;
}
char command = char(data.left(2).toHex().toInt(0, 16));
if (command != aCommand[0])
{
toLog(LogLevel::Error, mDeviceName + QString(": Wrong command = %1 in register %2 (%3), need %4")
.arg(toHexLog(command)).arg(toHexLog(registerNumber)).arg(registerName).arg(toHexLog(aCommand[0])));
return false;
}
ushort error = data.mid(2, 2).toHex().toUShort(0, 16);
toLog(LogLevel::Error, mDeviceName + ": Extended error: " + CAtolOnlineFR::Errors::ExtraData[error]);
return true;
}
//---------------------------------------------------------------------------
template<class T>
bool AtolOnlineFRBase<T>::checkTaxes()
{
if (mFRBuild >= mFRBuildUnifiedTaxes)
@@ -490,7 +508,7 @@ bool AtolOnlineFRBase<T>::sale(const SUnitData & aUnitData)
char section = (aUnitData.section == -1) ? ASCII::NUL : char(aUnitData.section);
QByteArray sum = getBCD(aUnitData.sum / 10.0, 7, 2, 3);
QByteArray payOffSubjectType = getBCD(aUnitData.payOffSubjectType, 1);
QByteArray payOffSubjectMethodType = getBCD(CFR::PayOffSubjectMethodType, 1);
QByteArray payOffSubjectMethodType = getBCD(aUnitData.payOffSubjectMethodType, 1);
QByteArray commandData;
commandData.append(CAtolOnlineFR::SaleFlags); // флаги
@@ -611,3 +629,20 @@ void AtolOnlineFRBase<T>::setErrorFlags(const QByteArray & aCommand, char aError
}
//--------------------------------------------------------------------------------
template <class T>
bool AtolOnlineFRBase<T>::isErrorUnprocessed(const QByteArray & aCommand, char aError)
{
if (!T::isErrorUnprocessed(aCommand, aError))
{
return false;
}
if (aError == CAtolOnlineFR::Errors::NeedExtendedErrorCode)
{
getExtendedErrorCode(aCommand);
}
return true;
}
//--------------------------------------------------------------------------------

+ 7
- 1
3.0/src/modules/Hardware/FR/src/Atol/Online/AtolOnlineFRBase.h View File

@@ -4,7 +4,7 @@
// Modules
#include "Hardware/Common/TCPDeviceBase.h"
#include "Hardware/Printers/PortPrinterBase.h"
#include "Hardware/Printers/PortPrintersBase.h"
// Project
#include "Hardware/FR/AtolOnlinePrinters.h"
@@ -86,6 +86,12 @@ protected:
/// Софтварная перезагрузка.
bool reboot();
/// Является ли ошибка необрабатываемой?
virtual bool isErrorUnprocessed(const QByteArray & aCommand, char aError);
/// Получить расширенный код ошибки в регистре 55. При необходимости можно отдавать наружу.
bool getExtendedErrorCode(const QByteArray & aCommand);
/// Версия ПО ФР, начиная с которой унифицирован порядок налоговых ставок.
int mFRBuildUnifiedTaxes;
};


+ 7
- 1
3.0/src/modules/Hardware/FR/src/Atol/Online/AtolOnlineFRConstants.h View File

@@ -299,6 +299,7 @@ namespace CAtolOnlineFR
append(0x0107, "Недопустима регистрация подакцизного товара");
append(0x0108, "При передаче налога на единицу запрещены скидки на позицию");
append(0x0109, "При передаче скидки для печати запрещена регистрация скидки");
append(0x010A, "Попытка провести регистрацию со СНО отличной от СНО с которым открыт чек");
append(0x0201, "Реквизит уже был записан в чеке, повтор запрещен");
append(0x0202, "Программирование реквизитов запрещено в данном режиме работы ФН (ФН отсутствует или закрыт архив)");
append(0x0203, "Реквизит недопустимо перепрограммировать для перерегистрации");
@@ -307,7 +308,12 @@ namespace CAtolOnlineFR
append(0x0206, "Не задан необходимый реквизит для совершения операции");
append(0x0207, "Невозможно записать данные в буфер позиции (не была подана команда EAh)");
append(0x0208, "Невозможно записать реквизит чека, начато формирование позиции (была подана команда EAh)");
append(0x0209, "Невозможно запрограммировать реквизит, он уже непечатан");
append(0x0209, "Невозможно запрограммировать реквизит, он уже напечатан");
append(0x020A, "Переполнен буфер реквизитов");
append(0x020B, "Некорректный код причины перерегистрации (тег 1205)");
append(0x0301, "Печать фискального отчета прервана, необходим повтор команды печати отчета (есть доп. данные)");
append(0x0302, "Неисправимая ошибка ФН");
append(0x0303, "Получение документа из ФН прервано (есть доп. данные)");
setDefault("Неизвестная");
}


+ 16
- 7
3.0/src/modules/Hardware/FR/src/Base/FRBase.cpp View File

@@ -18,7 +18,7 @@
#include "PaymentProcessor/PrintConstants.h"
#include "Hardware/Common/OPOSPollingDeviceBase.h"
#include "Hardware/Common/WorkingThreadProxy.h"
#include "Hardware/Printers/SerialPrinterBase.h"
#include "Hardware/Printers/PortPrintersBase.h"
#include "Hardware/FR/ProtoFR.h"
// Project
@@ -122,6 +122,8 @@ void FRBase<T>::setInitialData()
mFSSerialNumber.clear();
mFFEngine.setDeviceName(mDeviceName);
removeDeviceParameter(CHardwareSDK::FR::AgentFlags);
}
//--------------------------------------------------------------------------------
@@ -202,9 +204,18 @@ void FRBase<T>::finaliseOnlineInitialization()
taxSystemData.insert(ETaxSystems::Enum(taxSystem), CFR::TaxSystems[taxSystem]);
}
TAgentFlagsData agentFlagsData;
for (auto it = CFR::AgentFlags.data().begin(); it != CFR::AgentFlags.data().end(); ++it)
{
agentFlagsData.insert(EAgentFlags::Enum(it.key()), it.value());
}
setConfigParameter(CHardwareSDK::FR::AgentFlagsData, QVariant().fromValue(agentFlagsData));
if (!mAgentFlags.isEmpty())
{
TAgentFlagsData agentFlagsData;
agentFlagsData.clear();
foreach(char agentFlag, mAgentFlags)
{
@@ -212,7 +223,7 @@ void FRBase<T>::finaliseOnlineInitialization()
}
setDeviceParameter( CDeviceData::FR::AgentFlags, QStringList(agentFlagsData.values()).join(", "));
setConfigParameter(CHardwareSDK::FR::AgentFlags, QVariant().fromValue(agentFlagsData));
setConfigParameter(CHardwareSDK::FR::AgentFlags, QVariant().fromValue(agentFlagsData.keys()));
}