CVB++ 14.1
msi_plessey.hpp
1#pragma once
2
3#include "reader_common_1d_config_base.hpp"
4
5namespace Cvb
6{
7 CVB_BEGIN_INLINE_NS
8
9 namespace Barcode
10 {
11 using namespace Internal;
12
13
15
18 {
19 public:
20
22
28 {
29 if(checkDigit_ != checkDigit)
30 SetDirty();
31 checkDigit_ = checkDigit;
32 }
33
35
41 {
42 return checkDigit_;
43 }
44
45
46 protected:
47 MsiPlesseyCheckDigit checkDigit_;
48
49 public:
50 virtual Symbology Type() const override { return Symbology::MsiPlessey; }
51
53
59 static std::unique_ptr<MsiPlessey> FromHandle(const HandleGuard<ReaderConfig>& guard, bool& isActiveOut)
60 {
61 auto pConfig = std::unique_ptr<MsiPlessey>(new MsiPlessey());
62 isActiveOut = pConfig->ReadFromHandle(guard);
63 return pConfig;
64 }
65
66 protected:
67 virtual bool ReadFromHandle_(const HandleGuard<ReaderConfig>& guard) override
68 {
69 CExports::cvbbool_t active;
70 short tmpCheckDigit;
71 CVB_CALL_CAPI(CvcBcGetMSIPlessey(reinterpret_cast<std::intptr_t>(guard.Handle()),
72 &active,
73 &minDigits_,
74 &maxDigits_,
75 checkQuietzone_.Ptr(),
76 &tmpCheckDigit,
77 transmitCheckDigit_.Ptr(),
78 inverse_.Ptr()
79 ));
80 checkDigit_ = static_cast<MsiPlesseyCheckDigit>(tmpCheckDigit);
81 return SmartBool(active);
82 }
83
84 virtual void WriteToHandle_(bool active, HandleGuard<ReaderConfig>& guard) override
85 {
86 Internal::DoResCall([&]()
87 {
88 return CVB_CALL_CAPI(CvcBcSetMSIPlessey(reinterpret_cast<std::intptr_t>(guard.Handle()),
89 SmartBool(active),
90 minDigits_,
91 maxDigits_,
92 checkQuietzone_,
93 static_cast<short>(checkDigit_),
94 transmitCheckDigit_,
95 inverse_
96 ));
97 });
98 }
99 protected:
100 MsiPlessey()
101 : ReaderCommon1DConfigBase()
102 {
103 }
104
105 };
106
107 using MsiPlesseyPtr = std::shared_ptr<MsiPlessey>;
108 }
109
110 CVB_END_INLINE_NS
111}
Configuration to access parameters of ReaderCommon1DConfigBase.
Definition: reader_common_1d_config_base.hpp:19
Configuration to access parameters of MsiPlessey.
Definition: msi_plessey.hpp:18
MsiPlesseyCheckDigit CheckDigit() const
Returns whether to evaluate/ignore check digit.
Definition: msi_plessey.hpp:40
static std::unique_ptr< MsiPlessey > FromHandle(const HandleGuard< ReaderConfig > &guard, bool &isActiveOut)
Create object from handle.
Definition: msi_plessey.hpp:59
void SetCheckDigit(MsiPlesseyCheckDigit checkDigit)
Evaluate/ignore check digit.
Definition: msi_plessey.hpp:27
Symbology
The symbologies supported by Barcode.
Definition: barcode.hpp:97
@ MsiPlessey
MSI Plessey Barcode.
MsiPlesseyCheckDigit
Available check digits for MSI Plessey codes.
Definition: barcode.hpp:164
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24