Made new sim for webserver tests

This commit is contained in:
Caleb Herpin 2021-07-29 12:19:36 -05:00
parent acad74137f
commit 3b66d4ec45
41 changed files with 854 additions and 31 deletions

View File

@ -40,7 +40,7 @@ class Params:
def get_trick_home(self):
return self.__trick_home
def get_path_to_sim(self):
return os.path.join(self.get_trick_home(), "trick_sims", "Cannon", "SIM_cannon_numeric")
return os.path.join(self.get_trick_home(), "trick_sims", "Cannon", "SIM_cannon_webserver")
def get_input_folder(self):
return self.__input_folder
def get_test_input_file(self):

View File

@ -7,5 +7,5 @@ trick.itimer_enable()
trick.exec_set_enable_freeze(True)
trick.exec_set_freeze_command(True)
#simControlPanel = trick.SimControlPanel()
#trick.add_external_application(simControlPanel)
simControlPanel = trick.SimControlPanel()
trick.add_external_application(simControlPanel)

View File

@ -3,17 +3,9 @@ exec(open("Modified_data/realtime.py").read())
#==========================================
# Start the Cannonball Graphics Client
#==========================================
web.server.enable = True
# web.server.debug = True
# web.server.port = 8888
# web.server.document_root = "www"
trick.var_server_set_port(5001);
varServerPort = trick.var_server_get_port();
CannonDisplay_path = "../models/graphics/dist/CannonDisplay.jar"
print("pos: ", dyn.cannon.pos[0])
if (os.path.isfile(CannonDisplay_path)) :
CannonDisplay_cmd = "java -jar " \
+ CannonDisplay_path \

View File

@ -1,14 +1,3 @@
web.server.enable = True
web.server.debug = True
web.server.ssl_enable = False
#web.server.path_to_ssl_cert = '/home/cherpin/.ssl/server.pem1'
#web.server.path_to_ssl_cert = '/home/cherpin/.ssl/temp/server.pem'
#web.server.path_to_ssl_cert = '/home/cherpin/git/trick_fork/share/trick/pymods/trick/tests/civet_server/temp1/server.pem'
#web.server.path_to_ssl_cert = "server.pem"
web.server.error_log_file = "log.error"
web.server.port = 9000
trick.var_server_set_port(9001)
exec(open("Modified_data/realtime.py").read())
exec(open("Modified_data/cannon.dr").read())

View File

@ -5,16 +5,12 @@ LIBRARY DEPENDENCIES:
(
(cannon/gravity/src/cannon_init.c)
(cannon/gravity/src/cannon_numeric.c)
(httpMethods/handle_HTTP_GET_hello.c)
(httpMethods/TimeSession.cpp)
)
*************************************************************/
#include "sim_objects/default_trick_sys.sm"
#include "sim_objects/CivetServer.sm"
// #include "sim_objects/WebServer.sm"
##include "cannon/gravity/include/cannon_numeric.h"
##include "httpMethods/handle_HTTP_GET_hello.h"
##include "httpMethods/TimeSession.hh"
class CannonSimObject : public Trick::SimObject {
@ -35,6 +31,4 @@ IntegLoop dyn_integloop (0.01) dyn;
void create_connections() {
dyn_integloop.getIntegrator(Runge_Kutta_4, 5);
web.server.installHTTPGEThandler( "hello", &handle_HTTP_GET_hello );
web.server.installWebSocketSessionMaker( "Time", &makeTimeSession );
}
}

View File

@ -1,3 +1,2 @@
TRICK_CFLAGS += -I../models
TRICK_CXXFLAGS += -I../models

View File

@ -0,0 +1,17 @@
global DR_GROUP_ID
global drg
try:
if DR_GROUP_ID >= 0:
DR_GROUP_ID += 1
except NameError:
DR_GROUP_ID = 0
drg = []
drg.append(trick.DRAscii("cannon"))
drg[DR_GROUP_ID].set_freq(trick.DR_Always)
drg[DR_GROUP_ID].set_cycle(0.01)
drg[DR_GROUP_ID].set_single_prec_only(False)
drg[DR_GROUP_ID].add_variable("dyn.cannon.pos[0]")
drg[DR_GROUP_ID].add_variable("dyn.cannon.pos[1]")
trick.add_data_record_group(drg[DR_GROUP_ID], trick.DR_Buffer)
drg[DR_GROUP_ID].enable()

View File

@ -0,0 +1,11 @@
trick.frame_log_on()
trick.real_time_enable()
trick.exec_set_software_frame(0.1)
trick.itimer_enable()
trick.exec_set_enable_freeze(True)
trick.exec_set_freeze_command(True)
#simControlPanel = trick.SimControlPanel()
#trick.add_external_application(simControlPanel)

View File

@ -0,0 +1,31 @@
# SIM\_cannon\_numeric
---
This is the second in a series example cannon ball simulations that one builds in the Trick Tutorial (Sections 9, 10). It's purpose is to introduce Trick supported numerical methods.
Rather than using the analytic solutions of SIM\_cannon\_analytic, this simulation uses Trick's numerical integration, and root-finding methods to:
* Determine the cannon ball state (velocity, position) at each time step, and
* Determine when and where the cannon ball impacts the ground.
The simulation is otherwise the same as SIM\_cannon\_analytic.
![CannonPicture](images/CannonInit.png)
## Parameterization
Same as in SIM\_cannon\_analytic.
## Initialization
Same as in SIM\_cannon\_analytic.
## State Propagation
This Trick simulation calculates the cannonball state by numerical integration.
Acceleration is calculated in the "derivative" job **cannon\_deriv**. It is then
used in "integration" job **cannon\_integ** to calculate the cannonball's velocity and
position, using the Trick **integrate** function.
## When and Where the Ball Impacts the Ground
The time and position of impact is determined by the "dynamic\_event" event job
**cannon\_impact**, using the Trick **regula_falsi** function.

View File

@ -0,0 +1,27 @@
exec(open("Modified_data/realtime.py").read())
#==========================================
# Start the Cannonball Graphics Client
#==========================================
web.server.enable = True
# web.server.debug = True
# web.server.port = 8888
# web.server.document_root = "www"
trick.var_server_set_port(5001);
varServerPort = trick.var_server_get_port();
CannonDisplay_path = "../models/graphics/dist/CannonDisplay.jar"
print("pos: ", dyn.cannon.pos[0])
if (os.path.isfile(CannonDisplay_path)) :
CannonDisplay_cmd = "java -jar " \
+ CannonDisplay_path \
+ " " + str(varServerPort) + " &" ;
print(CannonDisplay_cmd)
os.system( CannonDisplay_cmd);
else :
print('==================================================================================')
print('CannonDisplay needs to be built. Please \"cd\" into ../models/graphics and type \"make\".')
print('==================================================================================')

View File

@ -0,0 +1,14 @@
web.server.enable = True
web.server.debug = True
web.server.ssl_enable = False
#web.server.path_to_ssl_cert = '/home/cherpin/.ssl/server.pem1'
#web.server.path_to_ssl_cert = '/home/cherpin/.ssl/temp/server.pem'
#web.server.path_to_ssl_cert = '/home/cherpin/git/trick_fork/share/trick/pymods/trick/tests/civet_server/temp1/server.pem'
#web.server.path_to_ssl_cert = "server.pem"
web.server.error_log_file = "log.error"
web.server.port = 9000
trick.var_server_set_port(9001)
exec(open("Modified_data/realtime.py").read())
exec(open("Modified_data/cannon.dr").read())

View File

@ -0,0 +1,3 @@
dyn_integloop.getIntegrator(trick.Runge_Kutta_4, 5)
trick.exec_set_terminate_time(5.2)

View File

@ -0,0 +1,40 @@
/***********************TRICK HEADER*************************
PURPOSE:
(Cannon Numeric)
LIBRARY DEPENDENCIES:
(
(cannon/gravity/src/cannon_init.c)
(cannon/gravity/src/cannon_numeric.c)
(httpMethods/handle_HTTP_GET_hello.c)
(httpMethods/TimeSession.cpp)
)
*************************************************************/
#include "sim_objects/default_trick_sys.sm"
#include "sim_objects/CivetServer.sm"
##include "cannon/gravity/include/cannon_numeric.h"
##include "httpMethods/handle_HTTP_GET_hello.h"
##include "httpMethods/TimeSession.hh"
class CannonSimObject : public Trick::SimObject {
public:
CANNON cannon ;
int foo;
CannonSimObject() {
("default_data") cannon_default_data( &cannon ) ;
("initialization") cannon_init( &cannon ) ;
("derivative") cannon_deriv( &cannon ) ;
("integration") trick_ret = cannon_integ( &cannon ) ;
("dynamic_event") cannon_impact( &cannon) ;
}
} ;
CannonSimObject dyn ;
IntegLoop dyn_integloop (0.01) dyn;
void create_connections() {
dyn_integloop.getIntegrator(Runge_Kutta_4, 5);
web.server.installHTTPGEThandler( "hello", &handle_HTTP_GET_hello );
web.server.installWebSocketSessionMaker( "Time", &makeTimeSession );
}

View File

@ -0,0 +1,3 @@
TRICK_CFLAGS += -I../models
TRICK_CXXFLAGS += -I../models

View File

@ -0,0 +1,61 @@
[1627019884] [error] [client ] ssl_use_pem_file: cannot open certificate file server2.pem: error:02001002:system library:fopen:No such file or directory
[1627019884] [error] [client ] Error initializing SSL context
[1627020168] [error] [client ] ssl_use_pem_file: cannot open certificate file server2.pem: error:02001002:system library:fopen:No such file or directory
[1627020168] [error] [client ] Error initializing SSL context
[1627020209] [error] [client ] ssl_use_pem_file: cannot open certificate file server2.pem: error:02001002:system library:fopen:No such file or directory
[1627020209] [error] [client ] Error initializing SSL context
[1627020293] [error] [client ] ssl_use_pem_file: cannot open certificate file /home/cherpin/.ssl/temp/server.pem: error:02001002:system library:fopen:No such file or directory
[1627020293] [error] [client ] Error initializing SSL context
[1627020369] [error] [client ] ssl_use_pem_file: cannot open certificate file /home/cherpin/.ssl/temp/server.pem: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
[1627020369] [error] [client ] Error initializing SSL context
[1627020490] [error] [client ] ssl_use_pem_file: cannot open certificate file /home/cherpin/.ssl/temp/server.pem: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
[1627020490] [error] [client ] Error initializing SSL context
[1627021005] [error] [client ] ssl_use_pem_file: cannot open certificate file /home/cherpin/.ssl/server.pem: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
[1627021005] [error] [client ] Error initializing SSL context
[1627021051] [error] [client ] ssl_use_pem_file: cannot open certificate file /home/cherpin/.ssl/server.pem: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
[1627021051] [error] [client ] Error initializing SSL context
[1627021380] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021380] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021380] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021414] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021414] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021414] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021423] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021423] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021423] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021487] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021487] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021487] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021493] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021493] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021493] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021573] [error] [client 127.0.0.1] SSL syscall error 0
[1627021688] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021688] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021688] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021688] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021688] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021688] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021700] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021700] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627021700] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047794] [error] [client 127.0.0.1] SSL syscall error 0
[1627047846] [error] [client 127.0.0.1] SSL syscall error 0
[1627047883] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047883] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047883] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047892] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047892] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047892] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047892] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627047892] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627051754] [error] [client 127.0.0.1] SSL syscall error 0
[1627051779] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627051781] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627051794] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627051808] [error] [client 127.0.0.1] sslize error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown
[1627063781] [error] [client 127.0.0.1] sslize error: error:1408F09C:SSL routines:ssl3_get_record:http request
[1627063781] [error] [client 127.0.0.1] sslize error: error:1408F09C:SSL routines:ssl3_get_record:http request
[1627063781] [error] [client 127.0.0.1] sslize error: error:1408F09C:SSL routines:ssl3_get_record:http request
[1627063781] [error] [client 127.0.0.1] sslize error: error:1408F09C:SSL routines:ssl3_get_record:http request
[1627063781] [error] [client 127.0.0.1] sslize error: error:1408F09C:SSL routines:ssl3_get_record:http request

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -0,0 +1,4 @@
[1627052322] [error] [client ] ssl_use_pem_file: cannot open certificate file /home/cherpin/.ssl/server.pem1: error:02001002:system library:fopen:No such file or directory
[1627052322] [error] [client ] Error initializing SSL context
[1627052348] [error] [client ] ssl_use_pem_file: cannot open certificate file /home/cherpin/.ssl/server.pem1: error:02001002:system library:fopen:No such file or directory
[1627052348] [error] [client ] Error initializing SSL context

View File

@ -0,0 +1,46 @@
-----BEGIN CERTIFICATE-----
MIIDKTCCAhECFBi5Yir4ZFsWfbb/IZc3jlO+6tAqMA0GCSqGSIb3DQEBCwUAMFEx
CzAJBgNVBAYTAlVTMQ4wDAYDVQQIDAVUZXhhczEPMA0GA1UEBwwGQXVzdGluMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwHhcNMjEwNzE5MTM1MjQ4
WhcNMzEwNzE3MTM1MjQ4WjBRMQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
DzANBgNVBAcMBkF1c3RpbjEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkg
THRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArXU/3YeqT4T8NoDe
GBmhTyZMXCFrP1IK9b2UM0VIiaz3TceCfeiEl5qCKS0kBWpwA2xpxkpmN3XkaoBd
R3P6XsDHR3jEq/3vgk8S2fe/IWOw+VjmhWdYHRjyt+P3S8yrUgcUfHQE/z0S87EI
ufsUV1CYLaF6Esv2OLL5PxPXEoEdCmNVISdHue1KuoG2cZ9VFrxRMP/J4EKpwVa+
Ihv0sXIiGEn8fIt8GoKQaTl/17iFetKDBcdOrknVqERg0vHlbZY6RJmBuMf9KU8F
5AR/ojKVSXS9auuR66u81ThEH/7ShutAFt+dPlLJRUpuBjqYRLGxOYSAkeEXRTXk
sejfTwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBH9STrVBzLDhaOOPosXWosynV4
WmvH7q42v6m7jjx02vowNju+RJ8+KLzbFjjQ+fos81clMkRX+HcE3z50PUJcL1II
TlAEAEWiMsCfv7X6cduYI/2I7WEQZOvi+nVOvBp/z1DiZPir53OzBPaaSv7Mkzdt
GELtnsoos3x4A1ICdVJaL2VIYGF4p89mfPAy3TeToyKtJD8sniWAdTZU/Kvg7liH
zVVlrSFwSw7Tgks69ZJNeFWJgg/G+F/FXFslnN5tgTVao3l90CjHZeKPFK1Xh9yu
D6ohKGzqDMuZstHLmG6uFlgf/Qy4QViTsj+lAFm8XQyu5/oGGU6qFjKDuXL1
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEArXU/3YeqT4T8NoDeGBmhTyZMXCFrP1IK9b2UM0VIiaz3TceC
feiEl5qCKS0kBWpwA2xpxkpmN3XkaoBdR3P6XsDHR3jEq/3vgk8S2fe/IWOw+Vjm
hWdYHRjyt+P3S8yrUgcUfHQE/z0S87EIufsUV1CYLaF6Esv2OLL5PxPXEoEdCmNV
ISdHue1KuoG2cZ9VFrxRMP/J4EKpwVa+Ihv0sXIiGEn8fIt8GoKQaTl/17iFetKD
BcdOrknVqERg0vHlbZY6RJmBuMf9KU8F5AR/ojKVSXS9auuR66u81ThEH/7ShutA
Ft+dPlLJRUpuBjqYRLGxOYSAkeEXRTXksejfTwIDAQABAoIBAEkJRKH3vMuM2FHu
wxVsvVJBcweb/reDyR+d+qf39UobLWpvpk9zt1jKcyH5YuBw58dZP9SBgTa7CjmZ
4Szz9akuDPrYLB+rZcz9lJd4zN63Rk5Hk5D6acyes5ygfYFKJZz9ZC/e/jemtLMt
iNoekXsOcXVNN8RwYzWOjopzxSyBxRcP+VXRAXhOM/J4E5XMAIi8XvbVkvXPjSX1
n/IyMNh80uNhJua0D9JLjP4B5blsxsRapPWp8hxyMUSyaLwtHwNG30AIndHCqt9V
fIXT5nLdOZGnsqXYQY7/iaV/4ByuHA+np1eYwwrIhqJIE5Pvdx2sRBsVZfDdOW9v
Em9fCKECgYEA4ouNsnYRHLHm4lN0vWP9g00U8WZnBCHCWs7BK3qtb1KADM4jOROq
5suSfYZgdc80hDRaD0htVbBpuJyTbJxcfkcqbjv6QQfl8fQes17j6hxcKfaODruL
h/eD/JVszjaMVrtwxoDkpPgFewNlWpFbjbROZDr5wpSCmJQuJzpO6BECgYEAxAK3
Y3mb5N2+SSa202O+1cK+SDBOJloJDWjqQSzoloIxM1+LPYi1CCxi+f/6j0Rk8ZPK
dVBbOiQHc2W8uPbvZdQ8oKx0taSkXTeBM3BjoG9OgaxgLlUG5FxdCEabyhrty+K/
dYUrXLsMXM47OVNHV7OLWg/6ZoE44grkahJdsV8CgYBx+r6e9FIlusgsRMruYrlw
7z5DOj9IT+fmIjIEOyO5Z6uvRaNpGyEYH4Ijj5FGlKqafXB2Uf1YaHq4fGab9Yt/
qTSK47hEMcIaWrV7j5lh90TThA3zEZ7hGMIaOd/VXJJ9LK9P4BepfHPdcVb0G0AR
6o6qVRXGNUwDkkIqUGbU0QKBgGiM/l7cBfBs6svAD7LvuGHyz2ZYBcdlLQDvHkyH
dMSbSz0Y0H+RBOcILf8lr/NtSt6ks1Ah/ZckkqjV8nVCme1Z6MDXXCVrXZSvP4Y9
g5aW6Gw4ktED33o9Xg5FA2IpPQAMwY0g7EE5MF3sTyDDsAEyrrjqXukAMmQ35SBD
DaDHAoGAGEvqvjjcq4Nl5fpjqViEvPhHgxxOTc+IOXo2L7kkOHRqpNoi6dJoyhyO
559PfIFjke0dwvGvHZqZaPPUbdJqJtLcV3UK6AjxLVR9BWcdCV5EpkvQCpHe0Vh/
kTNT7CB3rjuNrfioNDqAKg15FOqU15UI8PGHMVUArfhk3SPj0Ig=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,156 @@
<!DOCTYPE html>
<html>
<head>
<title>Trick Memory Allocations</title>
</head>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px; }
tr:nth-child(even){background-color: #f2f2f2}
th { background-color: #562399; color: white; }
</style>
<body>
<header>
</header>
<div class="trickMemoryAllocations">
</div>
<div class="navigation" style="background:#562399">
<button class="previous" style="font-size:20px" onClick="previous_page()">Previous</button>
<button class="next" style="font-size:20px" onClick="next_page()">Next</button>
<select id="countSelect" style="font-size:20px" onChange="updatePageWithSelectedCount()">
<option value="10" >10 per page</option>
<option value="20" >20 per page</option>
<option value="50" >50 per page</option>
<option value="100">100 per page</option>
</select>
</div>
<script type="text/javascript">
function showHeader(allocData) {
let para = document.createElement('p');
para.textContent = `URL: ${document.URL}`;
header.appendChild(para);
let label = document.createElement('h2');
label.textContent = 'Trick Memory Allocations';
header.appendChild(label);
}
function updateHeader(allocData) {
let first = allocData.chunk_start + 1;
let last = allocData.chunk_start + allocData.alloc_list.length;
let label = header.getElementsByTagName("h2")[0];
label.textContent = `Trick Memory Allocations (${first}..${last}) of ${allocData.alloc_total}`;
}
function createAllocInfoTable(allocData) {
let mytable = document.createElement('table');
let trow = document.createElement('tr');
let table_headings = ['Name', 'Address', 'Num', 'Size', 'Type Specifier', 'StorageClass'];
for (let i = 0; i < table_headings.length ; i++) {
let th = document.createElement('th');
th.textContent = table_headings[i];
trow.appendChild(th);
}
mytable.appendChild(trow);
for (let i = 0; i < allocData.alloc_list.length; i++) {
let trow = document.createElement('tr');
let td1 = document.createElement('td');
td1.textContent = allocData.alloc_list[i].name;
let td2 = document.createElement('td');
td2.textContent = allocData.alloc_list[i].start;
let td3 = document.createElement('td');
td3.textContent = allocData.alloc_list[i].num;
let td4 = document.createElement('td');
td4.textContent = allocData.alloc_list[i].size;
let td5 = document.createElement('td');
td5.textContent = allocData.alloc_list[i].type;
let td6 = document.createElement('td');
td6.textContent = allocData.alloc_list[i].stcl;
trow.appendChild(td1);
trow.appendChild(td2);
trow.appendChild(td3);
trow.appendChild(td4);
trow.appendChild(td5);
trow.appendChild(td6);
mytable.appendChild(trow);
}
return mytable;
}
function updateNavButtons(allocData) {
nextButton.style.opacity = "1.0"
if (allocData.chunk_start + allocData.chunk_size >= allocData.alloc_total) {
nextButton.style.opacity = "0.6";
}
prevButton.style.opacity = "1.0";
if (allocData.chunk_start - allocData.chunk_size < 0) {
prevButton.style.opacity = "0.6";
}
}
function updatePage(start, count) {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
allocData = JSON.parse(xhr.responseText);
let newTable = createAllocInfoTable(allocData);
let oldTable = trickMemoryAllocations.getElementsByTagName("table")[0];
trickMemoryAllocations.replaceChild(newTable, oldTable);
updateNavButtons(allocData);
updateHeader(allocData);
}
}
xhr.open('GET', `/api/http/alloc_info?start=${start}&count=${count}`);
xhr.send(null);
}
function updatePageWithSelectedCount() {
let newCount = parseInt( document.getElementById("countSelect").value, 10);
updatePage(allocData.chunk_start, newCount);
}
function next_page() {
let nextStart = allocData.chunk_start + allocData.chunk_size;
if (nextStart < allocData.alloc_total) {
updatePage(nextStart, allocData.chunk_size);
}
}
function previous_page() {
if (allocData.chunk_start > 0) {
let prevStart = allocData.chunk_start - allocData.chunk_size;
if (prevStart < 0) prevStart = 0;
updatePage(prevStart, allocData.chunk_size);
}
}
var myOrigin = new URL(document.URL);
var header = document.querySelector('header');
var trickMemoryAllocations = document.querySelector('div.trickMemoryAllocations');
var prevButton = document.querySelector('button.previous');
var nextButton = document.querySelector('button.next');
var allocData;
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
allocData = JSON.parse(xhr.responseText);
showHeader();
let allocInfoTable = createAllocInfoTable(allocData);
trickMemoryAllocations.appendChild(allocInfoTable);
updateNavButtons(allocData);
updateHeader(allocData);
}
}
xhr.open('GET', '/api/http/alloc_info?start=0&count=10');
xhr.send(null);
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,18 @@
{
"files": {
"main.css": "./static/css/main.a82b4685.chunk.css",
"main.js": "./static/js/main.593ee672.chunk.js",
"main.js.map": "./static/js/main.593ee672.chunk.js.map",
"runtime~main.js": "./static/js/runtime~main.d653cc00.js",
"runtime~main.js.map": "./static/js/runtime~main.d653cc00.js.map",
"static/css/2.335e4b44.chunk.css": "./static/css/2.335e4b44.chunk.css",
"static/js/2.fd0d41cf.chunk.js": "./static/js/2.fd0d41cf.chunk.js",
"static/js/2.fd0d41cf.chunk.js.map": "./static/js/2.fd0d41cf.chunk.js.map",
"index.html": "./index.html",
"precache-manifest.9d8f7ddf3680a6a6d643dad7fa7c8492.js": "./precache-manifest.9d8f7ddf3680a6a6d643dad7fa7c8492.js",
"service-worker.js": "./service-worker.js",
"static/css/2.335e4b44.chunk.css.map": "./static/css/2.335e4b44.chunk.css.map",
"static/css/main.a82b4685.chunk.css.map": "./static/css/main.a82b4685.chunk.css.map",
"static/media/index.css": "./static/media/roboto-latin-900italic.ebf6d164.woff2"
}
}

View File

@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="./TrickLogoSmall.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><title>React App</title><link href="./static/css/2.335e4b44.chunk.css" rel="stylesheet"><link href="./static/css/main.a82b4685.chunk.css" rel="stylesheet"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.fd0d41cf.chunk.js"></script><script src="./static/js/main.593ee672.chunk.js"></script></body></html>

View File

@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -0,0 +1,122 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "577c8ea84fd85c60dc5f5c579560e83d",
"url": "./index.html"
},
{
"revision": "6c79f9b2aedb002d302c",
"url": "./static/css/2.335e4b44.chunk.css"
},
{
"revision": "9b46f0f8321ce396aba6",
"url": "./static/css/main.a82b4685.chunk.css"
},
{
"revision": "6c79f9b2aedb002d302c",
"url": "./static/js/2.fd0d41cf.chunk.js"
},
{
"revision": "9b46f0f8321ce396aba6",
"url": "./static/js/main.593ee672.chunk.js"
},
{
"revision": "8c97409f0ee389fe75da",
"url": "./static/js/runtime~main.d653cc00.js"
},
{
"revision": "5cb7edfceb233100075dc9a1e12e8da3",
"url": "./static/media/roboto-latin-100.5cb7edfc.woff"
},
{
"revision": "7370c3679472e9560965ff48a4399d0b",
"url": "./static/media/roboto-latin-100.7370c367.woff2"
},
{
"revision": "f8b1df51ba843179fa1cc9b53d58127a",
"url": "./static/media/roboto-latin-100italic.f8b1df51.woff2"
},
{
"revision": "f9e8e590b4e0f1ff83469bb2a55b8488",
"url": "./static/media/roboto-latin-100italic.f9e8e590.woff"
},
{
"revision": "b00849e00f4c2331cddd8ffb44a6720b",
"url": "./static/media/roboto-latin-300.b00849e0.woff"
},
{
"revision": "ef7c6637c68f269a882e73bcb57a7f6a",
"url": "./static/media/roboto-latin-300.ef7c6637.woff2"
},
{
"revision": "14286f3ba79c6627433572dfa925202e",
"url": "./static/media/roboto-latin-300italic.14286f3b.woff2"
},
{
"revision": "4df32891a5f2f98a363314f595482e08",
"url": "./static/media/roboto-latin-300italic.4df32891.woff"
},
{
"revision": "479970ffb74f2117317f9d24d9e317fe",
"url": "./static/media/roboto-latin-400.479970ff.woff2"
},
{
"revision": "60fa3c0614b8fb2f394fa29944c21540",
"url": "./static/media/roboto-latin-400.60fa3c06.woff"
},
{
"revision": "51521a2a8da71e50d871ac6fd2187e87",
"url": "./static/media/roboto-latin-400italic.51521a2a.woff2"
},
{
"revision": "fe65b8335ee19dd944289f9ed3178c78",
"url": "./static/media/roboto-latin-400italic.fe65b833.woff"
},
{
"revision": "020c97dc8e0463259c2f9df929bb0c69",
"url": "./static/media/roboto-latin-500.020c97dc.woff2"
},
{
"revision": "87284894879f5b1c229cb49c8ff6decc",
"url": "./static/media/roboto-latin-500.87284894.woff"
},
{
"revision": "288ad9c6e8b43cf02443a1f499bdf67e",
"url": "./static/media/roboto-latin-500italic.288ad9c6.woff"
},
{
"revision": "db4a2a231f52e497c0191e8966b0ee58",
"url": "./static/media/roboto-latin-500italic.db4a2a23.woff2"
},
{
"revision": "2735a3a69b509faf3577afd25bdf552e",
"url": "./static/media/roboto-latin-700.2735a3a6.woff2"
},
{
"revision": "adcde98f1d584de52060ad7b16373da3",
"url": "./static/media/roboto-latin-700.adcde98f.woff"
},
{
"revision": "81f57861ed4ac74741f5671e1dff2fd9",
"url": "./static/media/roboto-latin-700italic.81f57861.woff"
},
{
"revision": "da0e717829e033a69dec97f1e155ae42",
"url": "./static/media/roboto-latin-700italic.da0e7178.woff2"
},
{
"revision": "9b3766ef4a402ad3fdeef7501a456512",
"url": "./static/media/roboto-latin-900.9b3766ef.woff2"
},
{
"revision": "bb1e4dc6333675d11ada2e857e7f95d7",
"url": "./static/media/roboto-latin-900.bb1e4dc6.woff"
},
{
"revision": "28f9151055c950874d2c6803a39b425b",
"url": "./static/media/roboto-latin-900italic.28f91510.woff"
},
{
"revision": "ebf6d1640ccddb99fb49f73c052c55a8",
"url": "./static/media/roboto-latin-900italic.ebf6d164.woff2"
}
]);

View File

@ -0,0 +1,39 @@
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"./precache-manifest.9d8f7ddf3680a6a6d643dad7fa7c8492.js"
);
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
workbox.core.clientsClaim();
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), {
blacklist: [/^\/_/,/\/[^\/]+\.[^\/]+$/],
});

View File

@ -0,0 +1,2 @@
@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:100;src:local("Roboto Thin "),local("Roboto-Thin"),url(../../static/media/roboto-latin-100.7370c367.woff2) format("woff2"),url(../../static/media/roboto-latin-100.5cb7edfc.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:100;src:local("Roboto Thin italic"),local("Roboto-Thinitalic"),url(../../static/media/roboto-latin-100italic.f8b1df51.woff2) format("woff2"),url(../../static/media/roboto-latin-100italic.f9e8e590.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:300;src:local("Roboto Light "),local("Roboto-Light"),url(../../static/media/roboto-latin-300.ef7c6637.woff2) format("woff2"),url(../../static/media/roboto-latin-300.b00849e0.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:300;src:local("Roboto Light italic"),local("Roboto-Lightitalic"),url(../../static/media/roboto-latin-300italic.14286f3b.woff2) format("woff2"),url(../../static/media/roboto-latin-300italic.4df32891.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:400;src:local("Roboto Regular "),local("Roboto-Regular"),url(../../static/media/roboto-latin-400.479970ff.woff2) format("woff2"),url(../../static/media/roboto-latin-400.60fa3c06.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:400;src:local("Roboto Regular italic"),local("Roboto-Regularitalic"),url(../../static/media/roboto-latin-400italic.51521a2a.woff2) format("woff2"),url(../../static/media/roboto-latin-400italic.fe65b833.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:500;src:local("Roboto Medium "),local("Roboto-Medium"),url(../../static/media/roboto-latin-500.020c97dc.woff2) format("woff2"),url(../../static/media/roboto-latin-500.87284894.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:500;src:local("Roboto Medium italic"),local("Roboto-Mediumitalic"),url(../../static/media/roboto-latin-500italic.db4a2a23.woff2) format("woff2"),url(../../static/media/roboto-latin-500italic.288ad9c6.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:700;src:local("Roboto Bold "),local("Roboto-Bold"),url(../../static/media/roboto-latin-700.2735a3a6.woff2) format("woff2"),url(../../static/media/roboto-latin-700.adcde98f.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:700;src:local("Roboto Bold italic"),local("Roboto-Bolditalic"),url(../../static/media/roboto-latin-700italic.da0e7178.woff2) format("woff2"),url(../../static/media/roboto-latin-700italic.81f57861.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:900;src:local("Roboto Black "),local("Roboto-Black"),url(../../static/media/roboto-latin-900.9b3766ef.woff2) format("woff2"),url(../../static/media/roboto-latin-900.bb1e4dc6.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:900;src:local("Roboto Black italic"),local("Roboto-Blackitalic"),url(../../static/media/roboto-latin-900italic.ebf6d164.woff2) format("woff2"),url(../../static/media/roboto-latin-900italic.28f91510.woff) format("woff")}
/*# sourceMappingURL=2.335e4b44.chunk.css.map */

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}
/*# sourceMappingURL=main.a82b4685.chunk.css.map */

View File

@ -0,0 +1 @@
{"version":3,"sources":["index.css"],"names":[],"mappings":"AACA,KACE,QAAS,CACT,mIAEY,CACZ,kCAAmC,CACnC,iCACF,CAEA,KACE,uEAEF","file":"main.a82b4685.chunk.css","sourcesContent":["\nbody {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\",\n \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\",\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n}\n"]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
!function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c<i.length;c++)f=i[c],o[f]&&s.push(o[f][0]),o[f]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var l=t[i];0!==o[l]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var i=window.webpackJsonp=window.webpackJsonp||[],l=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var p=l;t()}([]);
//# sourceMappingURL=runtime~main.d653cc00.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html>
<head>
<title>Variable Server Connections</title>
</head>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px; }
tr:nth-child(even){background-color: #f2f2f2}
th { background-color: #562399; color: white; }
</style>
<body>
<header>
</header>
<section>
</section>
<script type="text/javascript">
function showHeader() {
let para = document.createElement('p');
para.textContent = `URL: ${document.URL}`;
header.appendChild(para);
let label = document.createElement('h2');
label.textContent = 'Variable Server Connections';
header.appendChild(label);
}
function showVSConnections(myObj) {
let mytable = document.createElement('table');
let trow = document.createElement('tr');
let table_headings = ['Name', 'Address', 'Port', 'Format', 'Rate'];
for (let i = 0; i < table_headings.length ; i++) {
let th = document.createElement('th');
th.textContent = table_headings[i];
trow.appendChild(th);
}
mytable.appendChild(trow);
for (let i = 0; i < myObj.variable_server_connections.length; i++) {
let trow = document.createElement('tr');
let td1 = document.createElement('td');
td1.textContent = myObj.variable_server_connections[i].connection.client_tag;
let td2 = document.createElement('td');
td2.textContent = myObj.variable_server_connections[i].connection.client_IP_address;
let td3 = document.createElement('td');
td3.textContent = myObj.variable_server_connections[i].connection.client_port;
let td4 = document.createElement('td');
td4.textContent = myObj.variable_server_connections[i].connection.format;
let td5 = document.createElement('td');
td5.textContent = myObj.variable_server_connections[i].connection.update_rate;
trow.appendChild(td1);
trow.appendChild(td2);
trow.appendChild(td3);
trow.appendChild(td4);
trow.appendChild(td5);
mytable.appendChild(trow);
}
section.appendChild(mytable);
}
var header = document.querySelector('header');
var section = document.querySelector('section');
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
var myObj = JSON.parse(xhr.responseText);
showHeader();
showVSConnections(myObj);
}
}
xhr.open('GET', '/api/http/vs_connections');
xhr.send(null);
</script>
</body>
</html>

View File

@ -0,0 +1,98 @@
<!DOCTYPE html>
<html>
<head>
<title>WS Experiments</title>
</head>
<body>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px; }
tr:nth-child(even){background-color: #f2f2f2}
th { background-color: #562399; color: white; }
</style>
<header>
</header>
<div class="variableDisplay"></div>
<table class="variables">
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</table>
<div id="output"></div>
<script type="text/javascript">
function log(s) {
var p = document.createElement("p");
p.style.wordWrap = "break-word";
p.textContent = s;
output.appendChild(p);
}
function sendMessage(msg) {
ws.send(msg);
//log("Sent : " + msg);
}
// Interface to Trick WebSocket Variable Server
function setPeriod(period) {
sendMessage(`{"cmd":"var_cycle","period":${period}}`);
}
function addVarTableRow(name, value) {
// create a row in the table that contains two <td>s, one for the var_name and one for its value.
let tr = document.createElement('tr');
let td1 = document.createElement('td');
td1.textContent = `${name}`;
let td2 = document.createElement('td');
td2.textContent = `${value}`;
td2.className = "values";
tr.appendChild(td1);
tr.appendChild(td2);
varTable.appendChild(tr);
}
function addVariable(name, value) {
sendMessage(`{"cmd":"var_add","var_name": "${name}"}`);
addVarTableRow(name, value);
}
var varTable = document.querySelector('table.variables');
var ws = new WebSocket("ws://localhost:8888/api/ws/VariableServer", "myProtocol");
// WebSocket Event Handlers
ws.onopen = function(e) {
//log("Connection established");
setPeriod(100);
addVarTableRow("Time", 0.0);
addVariable("dyn.cannon.pos[0]", 0.0);
addVariable("dyn.cannon.pos[1]", 0.0);
addVariable("dyn.cannon.vel[0]", 0.0);
addVariable("dyn.cannon.vel[1]", 0.0);
addVariable("dyn.cannon.time", 0.0);
addVariable("dyn.cannon.timeRate", 0.0);
addVariable("dyn.cannon.impact", 0.0);
addVariable("I.dont.exist", 0.0);
sendMessage("{\"cmd\":\"var_unpause\"}");
};
ws.onmessage = function(e) {
//log("Recieved : " + e.data);
let msg = JSON.parse(e.data);
if (msg.msg_type == "values") {
let valueNodes = varTable.getElementsByClassName("values");
valueNodes[0].textContent = msg.time;
for (let i = 0; i < msg.values.length; i++ ) {
valueNodes[i+1].textContent = msg.values[i];
}
}
};
ws.onerror = function(e) {
console.log("WebSocket Error: " , e);
handleErrors(e);
};
ws.onclose = function(e) {
console.log("Connection closed", e);
};
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Trick Simulation</title>
<div class="header">
<table>
<th><img src="images/trick_icon.png" height="64" width="64"></th>
<th><h1>SIM_cannon_numeric</h1></th>
</table>
</div>
</head>
<body>
<div style="background:#efefef">
<ul>
<li><a href="http://github.com/nasa/trick">Trick on GitHub</a></li>
<li><a href="http://github.com/nasa/trick/wiki/Tutorial">Trick Tutorial</a></li>
<li><a href="http://github.com/nasa/trick/wiki/Documentation-Home">Trick Documentation</a></li>
</ul>
</div>
<div style="background:#efefef">
<ul>
<li><a href="/apps/vs_connections.html">Variable Server Connections</a></li>
<li><a href="/apps/alloc_info.html">Trick Memory Allocations</a></li>
<li><a href="/apps/wsexp.html">Websocket Experiment</a></li>
<li><a href="/apps/react/index.html">Sim Control and TV Mockup</a></li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,19 @@
h1 {
font-family: fantasy, cursive, serif;
font-size: 32px;
margin-left: 1em;
}
h2 {
font-family: sans-serif;
font-size: 18px;
margin-left: 1em;
}
a {
font-family: sans-serif;
font-size: 16px;
}
div.header { background-image: linear-gradient(#afafff, white); }