BPS C++ API  2.24.4
bpsmdesession.h
Go to the documentation of this file.
1 
4 #ifndef BPSMDESESSION_H
5 #define BPSMDESESSION_H
6 
7 #include "bpscore_global.h"
8 #include <QObject>
9 #include <QVariantMap>
10 
11 class BpsBarcode;
12 class BpsDatastore;
13 class BpsLicenseToken;
14 class BpsMdeApplication;
15 class BpsOrderUtils;
16 class QHostAddress;
17 class QDateTime;
18 
24 {
25  Q_OBJECT
27 
28 public:
34  enum SaveMode {
37  S_CentralUser
38  };
39 
46  BpsMdeSession(const QHostAddress& aAddress, QObject* aParent);
47 
48  virtual ~BpsMdeSession();
49 
58  void login(const QString& aConnection, int aUserId, int aPinCode);
59 
66  void logout();
67 
74  void addLicenseToken(BpsMdeApplication* aApplication, BpsLicenseToken* aLicenseToken);
75 
90  bool isLicensedFor(BpsMdeApplication* aApplication);
91 
97  void validateLicense(BpsMdeApplication* aApplication);
98 
103  void clearLicense(BpsMdeApplication* aApplication);
104 
109 
113  void touch();
114 
118  QString myName() const;
119 
123  QString connName() const;
124 
129 
134 
138  qlonglong sessionId() const;
139 
144 
148  BpsBarcode* barcode() const;
149 
154 
160  void setUid(const QString& aUid);
161 
165  QString uid() const;
166 
173  QVariant value(const QString& aKey) const;
174 
182  QVariant value(const QString& aKey, const QVariant& aDefValue) const;
183 
190  QVariant value(const QString& aGroup, const QString& aKey) const;
191 
199  QVariant value(const QString& aGroup, const QString& aKey, const QVariant& aDefValue) const;
200 
208  void setValue(const QString& aKey, const QVariant& aValue, SaveMode aSaveMode = S_DontSave);
209 
217  void setValue(const QString& aGroup, const QString& aKey, const QVariant& aValue, SaveMode aSaveMode = S_DontSave);
218 
223 
234 
239  void emitError(const QString& aText);
240 
247  int zoneCount() const;
248 
254  QVariant zoneKey(int aIndex) const;
255 
261  QString zoneName(int aIndex) const;
262 
269  QString zoneCond(const QString& aKeyCol, bool aNullOk=false) const;
270 
271 
272 signals:
273 
278  void logError(const QString& aText);
279 
284  void logWarning(const QString& aText);
285 
290  void logInformation(const QString& aText);
291 
296  void logSuccess(const QString& aText);
297 };
298 
299 #endif // BPSMDESESSION_H
Public include file for BPS CORE library macros.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
Utility class to process scanned bar codes.
Definition: bpsbarcode.h:53
BPS datastore class.
Definition: bpsdatastore.h:61
The license token is used to check permission of software usage, and maintains the list in table t_li...
Definition: bpslicensetoken.h:25
Virtual class for MDE applications.
Definition: bpsmdeapplication.h:21
BPS MDE session object.
Definition: bpsmdesession.h:24
BpsBarcode * barcode() const
QString formToken() const
QString uid() const
QString zoneName(int aIndex) const
Get name of a zone the current user has permission for.
void logWarning(const QString &aText)
Emitted when a warning should get logged.
QString myName() const
void emitError(const QString &aText)
Emitted en error.
QVariant value(const QString &aKey) const
Get a session data global value.
void logout()
Log out from database.
QVariant value(const QString &aGroup, const QString &aKey, const QVariant &aDefValue) const
Get a session data value providing a default value.
QString zoneCond(const QString &aKeyCol, bool aNullOk=false) const
Create zone condition for a given query column based on the zones the current user has permission for...
BpsMdeSession(const QHostAddress &aAddress, QObject *aParent)
Creates a disconnected session.
void logError(const QString &aText)
Emitted when a error should get logged.
void logInformation(const QString &aText)
Emitted when a information should get logged.
QVariant value(const QString &aKey, const QVariant &aDefValue) const
Get a session data global value providing a default value.
QDateTime lastAccess() const
BpsDatastore * datastore() const
QVariant value(const QString &aGroup, const QString &aKey) const
Get a session data value.
void setUid(const QString &aUid)
Set the unique terminal identifier.
bool isLicensedFor(BpsMdeApplication *aApplication)
Checks if the session has a license token for the application allowing module usage,...
QString connName() const
void setValue(const QString &aKey, const QVariant &aValue, SaveMode aSaveMode=S_DontSave)
Set a session global value.
QList< BpsMdeApplication * > licenseApplications() const
QHostAddress address() const
void login(const QString &aConnection, int aUserId, int aPinCode)
Log into the database with the given credentials.
void logSuccess(const QString &aText)
Emitted when a success should get logged.
QVariant zoneKey(int aIndex) const
Get key of a zone the current user has permission for.
QString nextFormToken()
Creates a new form token.
void touch()
Touch the client.
SaveMode
Save mode for session values.
Definition: bpsmdesession.h:34
@ S_LocalServer
Save in the local user settings of the MDE server. Requires a UUID support the device and browser,...
Definition: bpsmdesession.h:36
@ S_DontSave
Do not save the to the settings.
Definition: bpsmdesession.h:35
BpsOrderUtils * orderUtils() const
void validateLicense(BpsMdeApplication *aApplication)
Validates and updates the license token.
int zoneCount() const
Get number of zones the current user has permissions for.
qlonglong sessionId() const
void addLicenseToken(BpsMdeApplication *aApplication, BpsLicenseToken *aLicenseToken)
Add a application license token after logging in.
void clearLicense(BpsMdeApplication *aApplication)
Clears a distinct license freeing it for others to use.
void setValue(const QString &aGroup, const QString &aKey, const QVariant &aValue, SaveMode aSaveMode=S_DontSave)
Set a session value.
BPS order utilities.
Definition: bpsorderutils.h:19