Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DidacticNetwork
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
letsgoING
Libraries
DidacticNetwork
Commits
c871d105
Verified
Commit
c871d105
authored
1 year ago
by
Anian Bühler
Browse files
Options
Downloads
Patches
Plain Diff
added Broker -verbose Mode
parent
6b459b62
No related branches found
No related tags found
1 merge request
!10
Dev verbose
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/DidacticNet.cpp
+31
-0
31 additions, 0 deletions
src/DidacticNet.cpp
src/DidacticNet.h
+7
-1
7 additions, 1 deletion
src/DidacticNet.h
with
38 additions
and
1 deletion
src/DidacticNet.cpp
+
31
−
0
View file @
c871d105
...
@@ -515,6 +515,9 @@ bool DidacticPSNetBroker::handleData()
...
@@ -515,6 +515,9 @@ bool DidacticPSNetBroker::handleData()
int
currentTopicNr
=
0
;
int
currentTopicNr
=
0
;
int
topicLength
=
0
;
int
topicLength
=
0
;
int
dataLength
=
0
;
int
dataLength
=
0
;
printVerbose
(
_readBufferMessage
);
if
(
_readBufferMessage
[
1
]
==
MSG_PUBLISH
)
if
(
_readBufferMessage
[
1
]
==
MSG_PUBLISH
)
{
{
topicLength
=
extractData
(
2
,
MAX_LEN_TOPICS
,
_bufferTopic
,
MSG_SEPARATOR
);
topicLength
=
extractData
(
2
,
MAX_LEN_TOPICS
,
_bufferTopic
,
MSG_SEPARATOR
);
...
@@ -604,6 +607,34 @@ int DidacticPSNetBroker::getFreeTopicNr()
...
@@ -604,6 +607,34 @@ int DidacticPSNetBroker::getFreeTopicNr()
return
-
1
;
return
-
1
;
}
}
void
DidacticPSNetBroker
::
setVerbose
(
Stream
&
verbosePort
)
// TEST: new & untested
{
_isVerbose
=
true
;
_verbosePort
=
&
verbosePort
;
}
void
DidacticPSNetBroker
::
setNoneVerbose
()
// TEST: new & untested
{
_isVerbose
=
false
;
}
bool
DidacticPSNetBroker
::
printVerbose
(
char
*
recievedData
)
// TEST: new & untested
{
char
signBuffer
=
0
;
int
signCounter
=
0
;
if
(
_isVerbose
)
{
while
(
signBuffer
!=
MSG_DELIMITER
)
{
signBuffer
=
recievedData
[
signCounter
];
_verbosePort
->
write
(
signBuffer
);
signCounter
++
;
}
}
return
_isVerbose
;
}
//**************************************************************************
//**************************************************************************
// LITTLE HELPERS FOR CLIENTS ;-)
// LITTLE HELPERS FOR CLIENTS ;-)
//*************************************************************************
//*************************************************************************
...
...
This diff is collapsed.
Click to expand it.
src/DidacticNet.h
+
7
−
1
View file @
c871d105
...
@@ -223,21 +223,27 @@ public:
...
@@ -223,21 +223,27 @@ public:
class
DidacticPSNetBroker
:
public
DidacticPSNet
class
DidacticPSNetBroker
:
public
DidacticPSNet
{
{
private:
private:
Stream
*
_verbosePort
;
char
_topic
[
MAX_NR_TOPICS_BROKER
][
MAX_LEN_TOPICS
+
1
]
=
{{
0
}};
char
_topic
[
MAX_NR_TOPICS_BROKER
][
MAX_LEN_TOPICS
+
1
]
=
{{
0
}};
char
_data
[
MAX_NR_TOPICS_BROKER
][
MAX_LEN_PAYLOAD
+
1
]
=
{{
0
}};
char
_data
[
MAX_NR_TOPICS_BROKER
][
MAX_LEN_PAYLOAD
+
1
]
=
{{
0
}};
bool
_isVerbose
=
false
;
bool
savePayload
(
char
*
,
int
);
bool
savePayload
(
char
*
,
int
);
bool
getMessageFilter
(
char
);
bool
getMessageFilter
(
char
);
void
writeDataToTopic
(
int
,
char
*
,
char
*
);
void
writeDataToTopic
(
int
,
char
*
,
char
*
);
bool
handleData
();
bool
handleData
();
int
getTopicNr
(
char
*
);
int
getTopicNr
(
char
*
);
int
getFreeTopicNr
();
int
getFreeTopicNr
();
bool
update
(
char
*
,
int
,
char
*
,
int
);
// TEST: moved from public
bool
printVerbose
(
char
*
);
// TEST: new & untested
public
:
public
:
DidacticPSNetBroker
();
DidacticPSNetBroker
();
~
DidacticPSNetBroker
();
~
DidacticPSNetBroker
();
bool
update
(
char
*
,
int
,
char
*
,
int
);
void
setVerbose
(
Stream
&
_port
);
// TEST: new & untested
void
setNoneVerbose
();
// TEST: new & untested
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment