BPNGClientLib
Library for accessing the Telemotive data logger devices
TSLClusterImpl.hh
Go to the documentation of this file.
1 //************************************************************
2 //
3 // TSLClusterImpl.hh
4 //
9 //************************************************************
10 
11 #ifndef TSLCLUSTERIMPL_HH
12 #define TSLCLUSTERIMPL_HH
13 
14 #include <vector>
15 #include <cstdlib>
16 #include <iostream>
17 
18 #include "BPNGDefines.h"
19 
24 {
25 public:
26 
29  {
35  };
36 
37 
40  {
41  }
42 
48  {
49  addDevice(firstDevice);
50  }
51 
57  {
58  if (m_tslChain.empty())
59  {
60  m_tslNetworkId = device.tslNetworkId;
61  }
62 
63  m_tslChain.push_back(device);
64  }
65 
70  void deleteDevice(size_t index)
71  {
72  if (m_tslChain.size() > index)
73  {
74  m_tslChain.erase(m_tslChain.begin() + index);
75  }
76  }
77 
82  std::string getTSLName()
83  {
84  std::string name(m_tslChain[0].tslName);
85  return name.empty() ? m_tslChain[0].name : name;
86  }
87 
88 
90  void print()
91  {
92  for (size_t i = 0; i < m_tslChain.size(); ++i)
93  {
94  OnlineLoggerInfo device = m_tslChain[i];
95  std::cout << "--Dev: [" << device.name << "] IP[" << device.ip << "]\n";
96  }
97  }
98 
103  std::vector<OnlineLoggerInfo>::iterator begin() { return m_tslChain.begin(); }
104 
109  std::vector<OnlineLoggerInfo>::iterator end() { return m_tslChain.end(); }
110 
111  TSLCluster getTSLCluster()
112  {
113  TSLCluster cluster;
114  cluster.numDevices = m_tslChain.size();
115  cluster.loggerArray = m_tslChain.empty() ? nullptr : &m_tslChain[0];
116  return cluster;
117  }
118 
120  size_t getTSLSize() { return m_tslChain.size(); }
121 
122 private:
123 
125  std::vector<OnlineLoggerInfo> m_tslChain;
126 
128  int m_tslNetworkId;
129 };
130 
131 #endif // TSLCLUSTERIMPL_HH
Configuration tasks.
Definition: TSLClusterImpl.hh:32
void deleteDevice(size_t index)
Definition: TSLClusterImpl.hh:70
Struct with information about a logger found in LAN/WLAN used to notify IBPNGClientListener about det...
Definition: BPNGDefines.h:663
Definition: TSLClusterImpl.hh:23
TSLClusterImpl()
Constructor.
Definition: TSLClusterImpl.hh:39
make Firmware update
Definition: TSLClusterImpl.hh:34
Defines for Telemotive Client Library.
Create bug report.
Definition: TSLClusterImpl.hh:33
Representation of a chain of Telemotive devices combined via Telemotive System Link (TSL) ...
Definition: BPNGDefines.h:693
void addDevice(OnlineLoggerInfo device)
Definition: TSLClusterImpl.hh:56
size_t getTSLSize()
get size of TSL chain
Definition: TSLClusterImpl.hh:120
Conversion tasks.
Definition: TSLClusterImpl.hh:31
TSLClusterImpl(OnlineLoggerInfo firstDevice)
Definition: TSLClusterImpl.hh:47
Download tasks.
Definition: TSLClusterImpl.hh:30
std::string getTSLName()
Definition: TSLClusterImpl.hh:82
int32_t tslNetworkId
id of tsl network, -1 = no TSL, all devices with same tslNetworkId belong to the same TSL ...
Definition: BPNGDefines.h:676
ConnectionType
A enumaration of types of which task the connection will be used for.
Definition: TSLClusterImpl.hh:28
const char * ip
the logger&#39;s ip address, obligatory if OnlineLoggerInfo is used with IBPNGClient::setDevice() ...
Definition: BPNGDefines.h:665
const char * name
the logger&#39;s name
Definition: BPNGDefines.h:666
void print()
Stream the TSLCluster to cout.
Definition: TSLClusterImpl.hh:90
std::vector< OnlineLoggerInfo >::iterator end()
Definition: TSLClusterImpl.hh:109
std::vector< OnlineLoggerInfo >::iterator begin()
Definition: TSLClusterImpl.hh:103