BPNGClientLib
Library for accessing the Telemotive data logger devices
BPNGLoggerDetector.hh
Go to the documentation of this file.
1 //************************************************************
2 //
3 // BPNGLoggerDetector.hh
4 //
9 //************************************************************
10 
11 #ifndef BPNGLOGGERDETECTOR_HH
12 #define BPNGLOGGERDETECTOR_HH
13 
14 // sys
15 #include <vector>
16 
17 // client
18 #include <IBPNGClientListener.h>
19 #include <IBPNGClient.h>
20 #include <BPNGDefines.h>
22 
23 // Test
24 #include <TSLClusterImpl.hh>
25 
26 
27 //************************************************************
28 //
29 // BPNGLoggerDetector
30 //
31 //************************************************************
32 
34 {
35 public:
36 
38  template <typename IP>
39  BPNGLoggerDetector(IP &&_ip, unsigned int _debug);
40 
42  {
43  }
44 
45  // Listener functions from IBPNGClientListener
46  virtual void onBPNGDeviceDetected(OnlineLoggerInfo *info);
47  virtual void onBPNGDeviceDisappeared(OnlineLoggerInfo *info);
48  virtual void onBPNGDeviceStateChange(OnlineLoggerInfo *info);
49  virtual int onProgressDataDownload(int percentCompleted);
50  virtual int onProgressDataDownload(int percentCompleted, uint64_t downloadedSize, uint64_t totalSize);
51  virtual int onProgressConversion(int percentCompleted, const char *status);
52  virtual int onProgressDeletion(int percentCompleted);
53  virtual int onTargetPathTooLong(char *newTarget, int maxSize);
54  virtual int getOverwritingPermission(const char *filePath);
55  virtual void onFirmwareUpdateProgress(int percentage, int step, int substep, const char *desc);
56  virtual void onFirmwareUpdateError(int errorId);
57  virtual int onCriticalDiskSpace(uint64_t freeSpace, uint64_t neededSpace, const char *drive, const char *msg);
58  virtual void onLoggerConnected(bool isConnected);
59  virtual void onStatusMessage(const char *statusMsg);
60  virtual int onGetLogReportProgress(int percentage, const char *desc);
61  virtual void onWarning(BPNGWarningCode warningCode, const char *warnMsg);
62  virtual void onInvalidPwConfigFound(const char *);
63  virtual void onDownloadStart(int64_t totalAmountOfBytes);
64  virtual void onLogInDataFailed();
65  virtual void onResetLogInDataFailed();
66  virtual void onFuncAccessDenied();
67  virtual void onConversionStart(int64_t totalAmountOfBytes);
68  virtual int onDataRecoverProgress(const char *test1, int test2) { return 0; }
69  virtual const char * onLogInDataRequired(unsigned int test1) { return nullptr; }
70  virtual void onInvalidPwConfigFound(unsigned int) {}
71  virtual const char * onExtractionPasswordRequired(unsigned int) { return nullptr; }
72  virtual bool isTerminateLiveDownloadRequest() { return false; }
73 
74  OnlineLoggerInfo getLoggerInfoForIP(const char *ip) const;
75 
76  const std::string & getIP() const
77  {
78  return ip;
79  }
80 
87  std::vector<OnlineLoggerInfoWrapper> getLoggerList(unsigned searchTimeOut);
88 
96  std::vector<TSLClusterImpl> getTSLs(const std::vector<OnlineLoggerInfoWrapper> &tslChain);
97 
103  void excludeRCTFromTSL(TSLClusterImpl &loggersInNetwork);
104 
105 
106 private:
107 
108  std::string ip;
109  int oldpercent;
110 
111  std::vector<OnlineLoggerInfoWrapper> loggerList;
112 
114  static void logFunc(const char *s);
115 };
116 
117 
118 // inline and template functions
119 
120 template <typename IP>
121 inline
122 BPNGLoggerDetector::BPNGLoggerDetector(IP &&_ip, unsigned int _debug)
123  : ip(std::forward<IP>(_ip)),
124  oldpercent(-1),
125  loggerList()
126 {
127  if (_debug > 0)
128  addLogListener(logFunc);
129 }
130 
131 #endif // BPNGLOGGERDETECTOR_HH
BPNGWarningCode
Warning codes.
Definition: BPNGDefines.h:267
virtual void onInvalidPwConfigFound(unsigned int)
Called if invalid pw file found on device.
Definition: BPNGLoggerDetector.hh:70
Struct with information about a logger found in LAN/WLAN used to notify IBPNGClientListener about det...
Definition: BPNGDefines.h:655
virtual int onDataRecoverProgress(const char *test1, int test2)
Called to send additional information of the current data recovery progress.
Definition: BPNGLoggerDetector.hh:68
virtual int onProgressDataDownload(int percentCompleted)
Called to indicate the current progress of a data transfer.
Definition: TSLClusterImpl.hh:23
virtual void onConversionStart(int64_t totalAmountOfBytes)
Notifies the listeners before the conversion starts about the total amount of bytes to be converted...
void excludeRCTFromTSL(TSLClusterImpl &loggersInNetwork)
Definition: IBPNGClientListener.h:25
virtual const char * onExtractionPasswordRequired(unsigned int)
Definition: BPNGLoggerDetector.hh:71
Interface class for the BPNGClient listener.
Defines for Telemotive Client Library.
virtual int onGetLogReportProgress(int percentage, const char *desc)
virtual void onWarning(BPNGWarningCode warningCode, const char *warnMsg)
Called to inform about a warning.
virtual int onTargetPathTooLong(char *newTarget, int maxSize)
Called on a too long target directory.
C++ wrapper around brain dead OnlineLoggerInfo.
virtual void onBPNGDeviceStateChange(OnlineLoggerInfo *info)
Called to notify a logger&#39;s state change.
virtual void onFirmwareUpdateProgress(int percentage, int step, int substep, const char *desc)
Called on firmware update progress.
DECLDIR void WINAPI addLogListener(onLogRequest logFunc)
Adds a log listener to the library.
virtual int getOverwritingPermission(const char *filePath)
Called on existing output trace files.
Definition: BPNGLoggerDetector.hh:33
virtual int onCriticalDiskSpace(uint64_t freeSpace, uint64_t neededSpace, const char *drive, const char *msg)
Called in case of not enough free diskspace.
TSLCluster wrapper.
virtual void onDownloadStart(int64_t totalAmountOfBytes)
Notifies the listeners before the download starts about the total amount of bytes to be downloaded...
virtual bool isTerminateLiveDownloadRequest()
Called periodically on live download to query whether the permanent download should be finished...
Definition: BPNGLoggerDetector.hh:72
Interface class for the BPNGClient DLL.
std::vector< TSLClusterImpl > getTSLs(const std::vector< OnlineLoggerInfoWrapper > &tslChain)
virtual void onBPNGDeviceDisappeared(OnlineLoggerInfo *info)
Called to notify a disappeared logger.
virtual int onProgressDeletion(int percentCompleted)
Called to indicate the current progress of file deletion.
BPNGLoggerDetector(IP &&_ip, unsigned int _debug)
CTOR.
Definition: BPNGLoggerDetector.hh:122
virtual int onProgressConversion(int percentCompleted, const char *status)
Called to indicate the current progress of file conversion.
std::vector< OnlineLoggerInfoWrapper > getLoggerList(unsigned searchTimeOut)
virtual void onBPNGDeviceDetected(OnlineLoggerInfo *info)
Called to notify a detected logger in network.
virtual void onStatusMessage(const char *statusMsg)
Called to send additional information of the current process to the calling app.