Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
gm_kerbal_adaptor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christopher Reis
gm_kerbal_adaptor
Commits
bde7bdde
Commit
bde7bdde
authored
Apr 26, 2017
by
Christopher Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Info for use in Containers
parent
d1942a0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
PublishThread.cpp
PublishThread.cpp
+11
-1
PublishThread.hpp
PublishThread.hpp
+2
-0
dictionary_adaptor.json
dictionary_adaptor.json
+0
-0
No files found.
PublishThread.cpp
View file @
bde7bdde
...
...
@@ -15,6 +15,8 @@
#include "PublishThread.hpp"
#include <cstdlib>
#include <chrono>
#include <string>
#include <curl/curl.h>
...
...
@@ -62,7 +64,7 @@ void CALL_TYPE PublishThread::run()
//o Delay to allow subscriber thread to set up
example
::
millisleep
(
100
);
std
::
ifstream
myfile
(
"
dictionary
.json"
);
std
::
ifstream
myfile
(
"
/GMSEC_API/bin/dictionary_adaptor
.json"
);
std
::
string
str
((
std
::
istreambuf_iterator
<
char
>
(
myfile
)),
(
std
::
istreambuf_iterator
<
char
>
()));
dictionary
=
json
::
parse
(
str
);
for
(
size_t
i
=
0
;
i
<
dictionary
[
"subsystems"
].
size
();
i
++
)
{
...
...
@@ -138,6 +140,11 @@ void PublishThread::publish(const char* subject)
// document.rapidjson::ParseStream(is);
//
// }
unsigned
long
PublishThread
::
get_time
(){
using
namespace
std
::
chrono
;
unsigned
long
millis
=
duration_cast
<
milliseconds
>
(
system_clock
::
now
().
time_since_epoch
()).
count
();
return
millis
;
}
void
PublishThread
::
get_v
(){
CURL
*
curl
;
...
...
@@ -154,6 +161,7 @@ void PublishThread::get_v(){
//std::cout << readBuffer << std::endl;
std
::
string
subject
=
"GMSEC.KSP.MSG.TLM.PROCESSED.V"
;
Message
message
(
subject
.
c_str
(),
Message
::
PUBLISH
);
message
.
addField
(
"PUBLISH-TIME-UL"
,
(
GMSEC_I64
)
get_time
());
for
(
json
::
iterator
it
=
js
.
begin
();
it
!=
js
.
end
();
++
it
)
{
if
(
it
.
value
().
is_string
())
{
std
::
string
field
(
it
.
key
());
...
...
@@ -183,6 +191,7 @@ void PublishThread::get_o(){
//std::cout << readBuffer << std::endl;
std
::
string
subject
=
"GMSEC.KSP.MSG.TLM.PROCESSED.O"
;
Message
message
(
subject
.
c_str
(),
Message
::
PUBLISH
);
message
.
addField
(
"PUBLISH-TIME-UL"
,
(
GMSEC_I64
)
get_time
());
for
(
json
::
iterator
it
=
js
.
begin
();
it
!=
js
.
end
();
++
it
)
{
if
(
it
.
value
().
is_string
())
{
std
::
string
field
(
it
.
key
());
...
...
@@ -211,6 +220,7 @@ void PublishThread::get_n(){
json
js
=
json
::
parse
(
readBuffer
);
std
::
string
subject
=
"GMSEC.KSP.MSG.TLM.PROCESSED.N"
;
Message
message
(
subject
.
c_str
(),
Message
::
PUBLISH
);
message
.
addField
(
"PUBLISH-TIME-UL"
,
(
GMSEC_I64
)
get_time
());
for
(
json
::
iterator
it
=
js
.
begin
();
it
!=
js
.
end
();
++
it
)
{
if
(
it
.
value
().
is_string
())
{
std
::
string
field
(
it
.
key
());
...
...
PublishThread.hpp
View file @
bde7bdde
...
...
@@ -32,6 +32,8 @@ public:
void
get_o
();
void
get_n
();
unsigned
long
get_time
();
void
CALL_TYPE
run
();
void
CALL_TYPE
shutdown
();
...
...
dictionary.json
→
dictionary
_adaptor
.json
View file @
bde7bdde
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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