libvisiontransfer  6.4.0
scenescanparameters.cpp
1 /*******************************************************************************
2  * Copyright (c) 2019 Nerian Vision GmbH
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *******************************************************************************/
14 
15 #include "visiontransfer/scenescanparameters.h"
16 #include "visiontransfer/parametertransfer.h"
17 
18 using namespace visiontransfer;
19 using namespace visiontransfer::internal;
20 
21 /*************** Pimpl class containing all private members ***********/
22 
23 class SceneScanParameters::Pimpl {
24 public:
25  Pimpl(const DeviceInfo& device);
26  Pimpl(const char* address, const char* service);
27 
28  int readIntParameter(int id);
29  double readDoubleParameter(int id);
30  bool readBoolParameter(int id);
31 
32  void writeIntParameter(int id, int value);
33  void writeDoubleParameter(int id, double value);
34  void writeBoolParameter(int id, bool value);
35 
36 private:
37  ParameterTransfer paramTrans;
38 };
39 
40 /******************** Stubs for all public members ********************/
41 
43  pimpl(new Pimpl(device)) {
44  // All initialization in the pimpl class
45 }
46 
47 SceneScanParameters::SceneScanParameters(const char* address, const char* service):
48  pimpl(new Pimpl(address, service)) {
49  // All initialization in the pimpl class
50 }
51 
52 SceneScanParameters::~SceneScanParameters() {
53  delete pimpl;
54 }
55 
56 int SceneScanParameters::readIntParameter(int id) {
57  return pimpl->readIntParameter(id);
58 }
59 
60 double SceneScanParameters::readDoubleParameter(int id) {
61  return pimpl->readDoubleParameter(id);
62 }
63 
64 bool SceneScanParameters::readBoolParameter(int id) {
65  return pimpl->readBoolParameter(id);
66 }
67 
68 void SceneScanParameters::writeIntParameter(int id, int value) {
69  pimpl->writeIntParameter(id, value);
70 }
71 
72 void SceneScanParameters::writeDoubleParameter(int id, double value) {
73  pimpl->writeDoubleParameter(id, value);
74 }
75 
76 void SceneScanParameters::writeBoolParameter(int id, bool value) {
77  pimpl->writeBoolParameter(id, value);
78 }
79 
80 /******************** Implementation in pimpl class *******************/
81 
82 SceneScanParameters::Pimpl::Pimpl(const char* address, const char* service)
83  : paramTrans(address, service) {
84 }
85 
86 SceneScanParameters::Pimpl::Pimpl(const DeviceInfo& device)
87  : paramTrans(device.getIpAddress().c_str(), "7683") {
88 }
89 
90 int SceneScanParameters::Pimpl::readIntParameter(int id) {
91  return paramTrans.readIntParameter(id);
92 }
93 
94 double SceneScanParameters::Pimpl::readDoubleParameter(int id) {
95  return paramTrans.readDoubleParameter(id);
96 }
97 
98 bool SceneScanParameters::Pimpl::readBoolParameter(int id) {
99  return paramTrans.readBoolParameter(id);
100 }
101 
102 void SceneScanParameters::Pimpl::writeIntParameter(int id, int value) {
103  paramTrans.writeIntParameter(id, value);
104 }
105 
106 void SceneScanParameters::Pimpl::writeDoubleParameter(int id, double value) {
107  paramTrans.writeDoubleParameter(id, value);
108 }
109 
110 void SceneScanParameters::Pimpl::writeBoolParameter(int id, bool value) {
111  paramTrans.writeBoolParameter(id, value);
112 }
Allows a configuration of device parameters over the network.
std::string getIpAddress() const
Gets the IP address of the device.
Definition: deviceinfo.h:65
Aggregates information about a discovered device.
Definition: deviceinfo.h:25
SceneScanParameters(const DeviceInfo &device)
Connects to SceneScan's parameter server by using the device information from device enumeration...
Nerian Vision Technologies