Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
3691dee0
Commit
3691dee0
authored
Dec 27, 2020
by
Pavel Vainerman
Committed by
Pavel Vainerman
May 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[uwebsocketgate]: prototype
parent
f228ac53
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
138 additions
and
12 deletions
+138
-12
test.xml
conf/test.xml
+2
-0
configure.ac
configure.ac
+1
-0
Makefile.am
extensions/Makefile.am
+1
-1
Makefile.am
extensions/UWebSocketGate/Makefile.am
+5
-0
UWebSocketGate.cc
extensions/UWebSocketGate/UWebSocketGate.cc
+0
-0
UWebSocketGate.h
extensions/UWebSocketGate/UWebSocketGate.h
+0
-0
UWebSocketGateSugar.h
extensions/UWebSocketGate/UWebSocketGateSugar.h
+43
-0
main.cc
extensions/UWebSocketGate/main.cc
+47
-0
start_fg.sh
extensions/UWebSocketGate/start_fg.sh
+5
-0
test.xml
extensions/UWebSocketGate/test.xml
+2
-0
uniset2-functions.sh
extensions/UWebSocketGate/uniset2-functions.sh
+2
-0
uniset2-start.sh
extensions/UWebSocketGate/uniset2-start.sh
+2
-0
uniset2-stop.sh
extensions/UWebSocketGate/uniset2-stop.sh
+2
-0
SMonitor.h
include/SMonitor.h
+2
-0
SMonitor.cc
src/Various/SMonitor.cc
+19
-11
uniset2.files
uniset2.files
+5
-0
No files found.
conf/test.xml
View file @
3691dee0
...
...
@@ -48,6 +48,7 @@
</LogDB>
<BackendOpenTSDB
name=
"BackendOpenTSDB"
host=
"localhost"
filter_field=
"tsdb"
filter_value=
"1"
tags=
"host=localhost uniset=1"
prefix=
"uniset"
/>
<UWebSocketGate
name=
"UWebSocketGate1"
/>
<settings>
...
...
@@ -5502,6 +5503,7 @@
<item
id=
"6088"
name=
"TestGroup"
/>
<item
id=
"6089"
name=
"MQTTPublisher1"
/>
<item
id=
"6090"
name=
"BackendOpenTSDB"
/>
<item
id=
"6091"
name=
"UWebSocketGate1"
/>
<item
id=
"6101"
name=
"MBTCP1"
/>
<item
id=
"6102"
name=
"MBTCP2"
/>
<item
id=
"6103"
name=
"MBTCP3"
/>
...
...
configure.ac
View file @
3691dee0
...
...
@@ -593,6 +593,7 @@ AC_CONFIG_FILES([Makefile
extensions/LogDB/tests/Makefile
extensions/HttpResolver/Makefile
extensions/HttpResolver/tests/Makefile
extensions/UWebSocketGate/Makefile
testsuite/Makefile
wrappers/Makefile
wrappers/python/lib/Makefile
...
...
extensions/Makefile.am
View file @
3691dee0
...
...
@@ -7,7 +7,7 @@ SUBDIRS = lib include SharedMemory SharedMemory/tests IOControl IOControl/tests
ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP UNetUDP/tests
\
DBServer-MySQL DBServer-SQLite DBServer-PostgreSQL MQTTPublisher
\
RRDServer tests ModbusMaster/tests ModbusSlave/tests LogDB LogDB/tests
\
Backend-OpenTSDB HttpResolver HttpResolver/tests
Backend-OpenTSDB HttpResolver HttpResolver/tests
UWebSocketGate
pkgconfigdir
=
$(libdir)
/pkgconfig
...
...
extensions/UWebSocketGate/Makefile.am
0 → 100644
View file @
3691dee0
bin_PROGRAMS
=
@PACKAGE@-wsgate
@PACKAGE@
_wsgate_LDADD
=
$(top_builddir)
/lib/libUniSet2.la
@PACKAGE@
_wsgate_SOURCES
=
UWebSocketGate.cc main.cc
include
$(top_builddir)/include.mk
extensions/UWebSocketGate/UWebSocketGate.cc
0 → 100644
View file @
3691dee0
This diff is collapsed.
Click to expand it.
extensions/UWebSocketGate/UWebSocketGate.h
0 → 100644
View file @
3691dee0
This diff is collapsed.
Click to expand it.
extensions/UWebSocketGate/UWebSocketGateSugar.h
0 → 100644
View file @
3691dee0
#ifndef UWebSocketGateSugar_H_
#define UWebSocketGateSugar_H_
// "синтаксический сахар"..
#ifndef myinfo
#define myinfo if( mylog->debugging(Debug::INFO) ) mylog->info()
#endif
#ifndef mywarn
#define mywarn if( mylog->debugging(Debug::WARN) ) mylog->warn()
#endif
#ifndef mycrit
#define mycrit if( mylog->debugging(Debug::CRIT) ) mylog->crit()
#endif
#ifndef mylog1
#define mylog1 if( mylog->debugging(Debug::LEVEL1) ) mylog->level1()
#endif
#ifndef mylog2
#define mylog2 if( mylog->debugging(Debug::LEVEL2) ) mylog->level2()
#endif
#ifndef mylog3
#define mylog3 if( mylog->debugging(Debug::LEVEL3) ) mylog->level3()
#endif
#ifndef mylog4
#define mylog4 if( mylog->debugging(Debug::LEVEL4) ) mylog->level4()
#endif
#ifndef mylog5
#define mylog5 if( mylog->debugging(Debug::LEVEL5) ) mylog->level5()
#endif
#ifndef mylog6
#define mylog6 if( mylog->debugging(Debug::LEVEL6) ) mylog->level6()
#endif
#ifndef mylog7
#define mylog7 if( mylog->debugging(Debug::LEVEL7) ) mylog->level7()
#endif
#ifndef mylog8
#define mylog8 if( mylog->debugging(Debug::LEVEL8) ) mylog->level8()
#endif
#ifndef mylog9
#define mylog9 if( mylog->debugging(Debug::LEVEL9) ) mylog->level9()
#endif
#ifndef mylogany
#define mylogany mylog->any()
#endif
#endif
extensions/UWebSocketGate/main.cc
0 → 100644
View file @
3691dee0
#include "Configuration.h"
#include "UWebSocketGate.h"
#include "Configuration.h"
#include "UniSetActivator.h"
// --------------------------------------------------------------------------
using
namespace
uniset
;
using
namespace
std
;
// --------------------------------------------------------------------------
int
main
(
int
argc
,
char
**
argv
)
{
// std::ios::sync_with_stdio(false);
try
{
if
(
argc
>
1
&&
(
!
strcmp
(
argv
[
1
],
"--help"
)
||
!
strcmp
(
argv
[
1
],
"-h"
))
)
{
cout
<<
"--confile filename - configuration file. Default: configure.xml"
<<
endl
;
UWebSocketGate
::
help_print
();
return
0
;
}
auto
conf
=
uniset_init
(
argc
,
argv
);
auto
ws
=
UWebSocketGate
::
init_wsgate
(
argc
,
argv
,
"ws-"
);
if
(
!
ws
)
return
1
;
auto
act
=
UniSetActivator
::
Instance
();
act
->
add
(
ws
);
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
->
broadcast
(
sm
.
transport_msg
()
);
act
->
run
(
false
);
return
0
;
}
catch
(
const
std
::
exception
&
ex
)
{
cerr
<<
"(UWebSocketGate::main): "
<<
ex
.
what
()
<<
endl
;
}
catch
(...)
{
cerr
<<
"(UWebSocketGate::main): catch ..."
<<
endl
;
}
return
1
;
}
extensions/UWebSocketGate/start_fg.sh
0 → 100755
View file @
3691dee0
#!/bin/sh
ulimit
-Sc
1000000
uniset2-start.sh
-f
./uniset2-wsgate
--confile
test.xml
--ws-name
UWebSocketGate1
--ws-log-add-levels
any
$*
extensions/UWebSocketGate/test.xml
0 → 120000
View file @
3691dee0
../../conf/test.xml
\ No newline at end of file
extensions/UWebSocketGate/uniset2-functions.sh
0 → 120000
View file @
3691dee0
../../Utilities/scripts/uniset2-functions.sh
\ No newline at end of file
extensions/UWebSocketGate/uniset2-start.sh
0 → 120000
View file @
3691dee0
../../Utilities/scripts/uniset2-start.sh
\ No newline at end of file
extensions/UWebSocketGate/uniset2-stop.sh
0 → 120000
View file @
3691dee0
../../Utilities/scripts/uniset2-stop.sh
\ No newline at end of file
include/SMonitor.h
View file @
3691dee0
...
...
@@ -33,6 +33,8 @@ namespace uniset
~
SMonitor
();
// -----
static
std
::
string
printEvent
(
const
uniset
::
SensorMessage
*
sm
);
protected
:
virtual
void
sysCommand
(
const
uniset
::
SystemMessage
*
sm
)
override
;
virtual
void
sensorInfo
(
const
uniset
::
SensorMessage
*
si
)
override
;
...
...
src/Various/SMonitor.cc
View file @
3691dee0
...
...
@@ -95,25 +95,33 @@ void SMonitor::sysCommand( const SystemMessage* sm )
}
}
// ------------------------------------------------------------------------------------------
void
SMonitor
::
sensorInfo
(
const
SensorMessage
*
si
)
std
::
string
SMonitor
::
printEvent
(
const
uniset
::
SensorMessage
*
sm
)
{
auto
conf
=
uniset_conf
();
ostringstream
s
;
string
s_sup
(
""
);
if
(
s
i
->
supplier
==
uniset
::
AdminID
)
if
(
s
m
->
supplier
==
uniset
::
AdminID
)
s_sup
=
"uniset-admin"
;
else
s_sup
=
ORepHelpers
::
getShortName
(
conf
->
oind
->
getMapName
(
s
i
->
supplier
));
s_sup
=
ORepHelpers
::
getShortName
(
conf
->
oind
->
getMapName
(
s
m
->
supplier
));
cout
<<
"("
<<
setw
(
6
)
<<
si
->
id
<<
"):"
<<
"[("
<<
std
::
right
<<
setw
(
5
)
<<
si
->
supplier
<<
")"
s
<<
"("
<<
setw
(
6
)
<<
sm
->
id
<<
"):"
<<
"[("
<<
std
::
right
<<
setw
(
5
)
<<
sm
->
supplier
<<
")"
<<
std
::
left
<<
setw
(
20
)
<<
s_sup
<<
"] "
<<
std
::
right
<<
setw
(
8
)
<<
timeToString
(
si
->
sm_tv
.
tv_sec
,
":"
)
<<
"("
<<
setw
(
6
)
<<
si
->
sm_tv
.
tv_nsec
<<
"): "
<<
std
::
right
<<
setw
(
45
)
<<
conf
->
oind
->
getMapName
(
si
->
id
)
<<
" value:"
<<
std
::
right
<<
setw
(
9
)
<<
si
->
value
<<
" fvalue:"
<<
std
::
right
<<
setw
(
12
)
<<
(
(
float
)
si
->
value
/
pow
(
10.0
,
si
->
ci
.
precision
)
)
<<
endl
;
<<
std
::
right
<<
setw
(
8
)
<<
timeToString
(
sm
->
sm_tv
.
tv_sec
,
":"
)
<<
"("
<<
setw
(
6
)
<<
sm
->
sm_tv
.
tv_nsec
<<
"): "
<<
std
::
right
<<
setw
(
45
)
<<
conf
->
oind
->
getMapName
(
sm
->
id
)
<<
" value:"
<<
std
::
right
<<
setw
(
9
)
<<
sm
->
value
<<
" fvalue:"
<<
std
::
right
<<
setw
(
12
)
<<
(
(
float
)
sm
->
value
/
pow
(
10.0
,
sm
->
ci
.
precision
)
)
<<
endl
;
return
s
.
str
();
}
// ------------------------------------------------------------------------------------------
void
SMonitor
::
sensorInfo
(
const
SensorMessage
*
si
)
{
cout
<<
printEvent
(
si
)
<<
endl
;
if
(
!
script
.
empty
()
)
{
...
...
@@ -124,7 +132,7 @@ void SMonitor::sensorInfo( const SensorMessage* si )
if
(
script
[
0
]
==
'.'
||
script
[
0
]
==
'/'
)
cmd
<<
script
;
else
cmd
<<
conf
->
getBinDir
()
<<
script
;
cmd
<<
uniset_conf
()
->
getBinDir
()
<<
script
;
cmd
<<
" "
<<
si
->
id
<<
" "
<<
si
->
value
<<
" "
<<
si
->
sm_tv
.
tv_sec
<<
" "
<<
si
->
sm_tv
.
tv_nsec
;
...
...
uniset2.files
View file @
3691dee0
...
...
@@ -295,6 +295,11 @@
./extensions/UniNetwork/UniExchange.cc
./extensions/UniNetwork/UniExchange.h
./extensions/UniNetwork/uninet.cc
./extensions/UWebSocketGate/main.cc
./extensions/UWebSocketGate/Makefile.am
./extensions/UWebSocketGate/UWebSocketGate.cc
./extensions/UWebSocketGate/UWebSocketGate.h
./extensions/UWebSocketGate/UWebSocketGateSugar.h
./IDL/Makefile.am
./IDL/Processes/Makefile.am
./IDL/UniSetTypes/Makefile.am
...
...
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