Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
dcdb
dcdb
Commits
284bb2b8
Commit
284bb2b8
authored
Nov 24, 2018
by
Micha Mueller
Browse files
BACnet plugin: Change BACnetClient* --> std::shared_ptr<BACnetClient>
parent
8aab4e4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/sensors/bacnet/BACnetConfigurator.cpp
View file @
284bb2b8
...
...
@@ -17,11 +17,7 @@ BACnetConfigurator::BACnetConfigurator() {
_baseName
=
"property"
;
}
BACnetConfigurator
::~
BACnetConfigurator
()
{
if
(
_bacClient
)
{
delete
_bacClient
;
}
}
BACnetConfigurator
::~
BACnetConfigurator
()
{}
void
BACnetConfigurator
::
sensorBase
(
BACnetSensorBase
&
s
,
CFG_VAL
config
)
{
ADD
{
...
...
@@ -40,10 +36,7 @@ void BACnetConfigurator::sensorGroup(BACnetSensorGroup& s, CFG_VAL config) {
}
void
BACnetConfigurator
::
global
(
CFG_VAL
config
)
{
if
(
_bacClient
)
{
delete
_bacClient
;
}
_bacClient
=
new
BACnetClient
();
_bacClient
=
std
::
make_shared
<
BACnetClient
>
();
std
::
string
address_cache
,
interface
;
unsigned
port
=
47808
,
timeout
=
1000
,
apdu_timeout
=
200
,
apdu_retries
=
0
;
...
...
@@ -74,7 +67,6 @@ void BACnetConfigurator::global(CFG_VAL config) {
_bacClient
->
init
(
interface
,
address_cache
,
port
,
timeout
,
apdu_timeout
,
apdu_retries
);
}
catch
(
const
std
::
exception
&
e
)
{
LOG
(
error
)
<<
"Could not initialize BACnetClient: "
<<
e
.
what
();
delete
_bacClient
;
_bacClient
=
nullptr
;
return
;
}
...
...
src/sensors/bacnet/BACnetConfigurator.h
View file @
284bb2b8
...
...
@@ -27,7 +27,7 @@ protected:
void
global
(
CFG_VAL
config
)
override
;
private:
BACnetClient
*
_bacClient
;
BACnetClient
Ptr
_bacClient
;
};
extern
"C"
ConfiguratorInterface
*
create
()
{
...
...
src/sensors/bacnet/BACnetSensorGroup.h
View file @
284bb2b8
...
...
@@ -11,6 +11,8 @@
#include
"BACnetSensorBase.h"
#include
"../../includes/SensorGroupTemplate.h"
using
BACnetClientPtr
=
std
::
shared_ptr
<
BACnetClient
>
;
class
BACnetSensorGroup
:
public
SensorGroupTemplate
<
BACnetSensorBase
>
{
public:
...
...
@@ -21,8 +23,8 @@ public:
void
start
()
override
;
void
stop
()
override
;
void
setBACnetClient
(
BACnetClient
*
bacClient
)
{
_bacClient
=
bacClient
;
}
BACnetClient
*
const
getBACnetClient
()
const
{
return
_bacClient
;
}
void
setBACnetClient
(
BACnetClient
Ptr
bacClient
)
{
_bacClient
=
bacClient
;
}
BACnetClient
Ptr
const
getBACnetClient
()
const
{
return
_bacClient
;
}
void
setDeviceInstance
(
const
std
::
string
&
deviceInstance
)
{
_deviceInstance
=
stoul
(
deviceInstance
);
}
uint32_t
getDeviceInstance
()
const
{
return
_deviceInstance
;
}
...
...
@@ -31,7 +33,7 @@ private:
void
read
()
override
;
void
readAsync
()
override
;
BACnetClient
*
_bacClient
;
BACnetClient
Ptr
_bacClient
;
uint32_t
_deviceInstance
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment