Skip to content
This repository was archived by the owner on Sep 26, 2021. It is now read-only.

Commit bdc3cb0

Browse files
committed
update from private repo
1 parent fbed127 commit bdc3cb0

File tree

86 files changed

+6990
-357
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+6990
-357
lines changed

INSTALL.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Xinthose Installation
2+
3+
## Angular 8
4+
5+
### Installation
6+
7+
- Angular / General
8+
- `npm i -g @angular/cli @angular/core @angular/forms @angular/forms terser typescript`
9+
- Progress
10+
- `npm i -g @progress/kendo-angular-inputs @progress/kendo-angular-notification @progress/kendo-angular-dropdowns`
11+
`
12+
- Fort/ Font Awesome
13+
- `npm i -g @fortawesome/angular-fontawesome @fortawesome/free-solid-svg-icons @fortawesome/fontawesome-svg-core`
14+
- Keypress.js: <https://github.com/dmauro/Keypress>, NPM: <https://www.npmjs.com/package/keypress.js>
15+
- `npm i -g keypress.js @types/keypress.js`
16+
- Websocket client
17+
- `npm i -g socket.io-client @types/socket.io-client`
18+
- Example Github project: <https://github.com/luixaviles/socket-io-typescript-chat>
19+
20+
### Create App (client directory)
21+
22+
- `ng new angular-cpp-websocket --style=scss --enableIvy=false --routing=true`
23+
24+
#### Angular Generate Commands
25+
26+
- `for i in home page-not-found enter-access-number enter-pin account-volume requested-volume product-type dispensing thank-you closed fault; do ng g c "${i}"; done`
27+
- `ng g service portalogic`
28+
- `ng g guard auth`
29+
30+
## General
31+
32+
- `npm i -g @angular/cli`
33+
- `npm i rxjs rxjs-compat @angular/http`
34+
35+
## Kendo-UI (Progress)
36+
37+
- `ng add @progress/kendo-angular-buttons @progress/kendo-angular-dropdowns @progress/kendo-data-query`
38+
- `npm i @progress/kendo-theme-material`
39+
40+
## MDBootstrap Pro
41+
42+
- tutorial: <https://mdbootstrap.com/angular/5min-quickstart/>
43+
- click "PRO" underneath "NPM installation"
44+
- `npm i git+https://oauth2:XXXXXXXXXX_XXXXXXXXX@git.mdbootstrap.com/mdb/angular/ng-uikit-pro-standard.git --save`
45+
- `npm i chart.js@2.5.0 @types/chart.js easy-pie-chart@2.1.7 hammerjs@2.0.8 screenfull@3.3.0 @fortawesome/fontawesome-free animate.css`
46+
- 3rd party libraries
47+
48+
### Websocket/email server using socket.io (server directory)
49+
50+
- Example Github project: <https://github.com/luixaviles/socket-io-typescript-chat>
51+
- `npm i express socket.io-client @types/socket.io-client gulp-cli cors @types/cors`
52+
- server:
53+
- `cd server`
54+
- `npm i`
55+
- `gulp build`
56+
- `npm start`
57+
58+
# C++
59+
60+
- C++ Websocket Library: <https://github.com/zaphoyd/websocketpp>
61+
62+
## Commands -------------------------------------------------------------------------------------------------------------------------
63+
64+
## Angular Commands (ng)
65+
66+
- `ng --version` // show angular version
67+
- `ng update --all --force` // update all angular packages (ignore peer dependency errors)
68+
- `ng build --prod --aot` // build for production
69+
- `ng serve --host 0.0.0.0` // allow outside PC's access to the app
70+
71+
## Kendo Node.js commands
72+
73+
- `ncu -u -f /^@progress/` // check progress widget versions
74+
75+
## Node Commands
76+
77+
- `node -v` // show node version
78+
79+
## NPM Commands (Node Package Manager)
80+
81+
- `npm -v` // show npm version
82+
- `npm i -g npm` // update npm version
83+
- `npm update` # update all packages in the app
84+
- npm i [package]@[version] // install specific version of a package
85+
- `npm ls @progress/kendo-angular-scheduler` // show version of a package
86+
- `npm i --package-lock-only` // only create `package-lock.json` file
87+
88+
### Install dependencies
89+
90+
- `npm i -g npm-install-peers`
91+
- `npm-install-peers`
92+
- `npm i @angular/cli@latest` // install latest version of angular cli
93+
94+
## Typescript Commands
95+
96+
- `tsc -v` // show typescript version
97+
98+
## Github
99+
100+
- `git config --global user.email "your github login email address"` // set email address
101+
- `git config --global user.email` // check email address
102+
103+
## pm2
104+
105+
- Github: <https://github.com/Unitech/pm2>
106+
- `npm i pm2 pm2-logrotate -g`
107+
- `pm2 ls` // list all running applications
108+
- `pm2 stop EDS4WSserver`
109+
- `pm2 restart EDS4WSserver`
110+
- `pm2 delete EDS4WSserver`
111+
- `pm2 describe EDS4WSserver`
112+
- `pm2 monit` // monitor logs, custom metrics, & application information
113+
114+
## link pm2 to <https://app.pm2.io/#/bucket/5beae26a3ca4a1db69a9056b/overview/servers>
115+
116+
- `pm2 link 90n1bqb6mdqm111 mvp52pu0qi8k4v1 EDS`
117+
118+
### Update pm2
119+
120+
- `npm i pm2@latest -g`
121+
- `pm2 update`
122+
123+
## Other
124+
125+
- `http-server`
126+
127+
## Notes
128+
129+
- `[style.height.%]="100"` // full height grid (as long as content)
130+
131+
## Troubleshooting
132+
133+
- `ERROR in The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.1 was found instead.`
134+
- `npm i typescript@">=3.4.0 <3.5.0"`

back_end/64_lib/libsioclient.a

2.15 MB
Binary file not shown.

back_end/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ endif
4040
LIBS = -lboost_system -lboost_thread -lboost_timer
4141
# Boost Logging
4242
LIBS += -DBOOST_LOG_DYN_LINK -lboost_log_setup -lboost_log -lpthread
43+
# socket.io-client-cpp
44+
LIBS += -lsioclient
4345

4446
#################### define the C source files ####################
4547
SRCS = $(wildcard src/*.cpp)
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# ATD 3-3-16
2+
3+
#################### Architecture ####################
4+
arch := $(shell gcc -dumpmachine)
5+
ifeq ($(arch),x86_64-linux-gnu)
6+
32_BIT_CPU = 0
7+
else
8+
32_BIT_CPU = 1
9+
endif
10+
11+
#################### Configuration ####################
12+
13+
# .c: gcc; .cpp/.cc: g++
14+
CC = ccache g++
15+
16+
#################### Compiler Flags ####################
17+
# -g: allows the use of gdb for finding seg faults: gdb ./main.out ; print [VALUE] ; list ; quit
18+
# -Wall turns on most, but not all, compiler warnings
19+
# -v verbose displays more compiler debugging information
20+
# -Wno-write-strings: gets rid of this warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
21+
# -O#: optimizer, makes code faster by disabling debugging features; 3 is fastest
22+
# -j #: make # files at the same time (1 for each core)
23+
# -MMD = creates dependency files (.d) from user header files
24+
# -MT = target of dependency rule
25+
# -MF = file to write dependencies to
26+
CFLAGS = -Wall -std=c++14 -Wno-write-strings -O3
27+
CFLAGS += -DBOOST_LOG_DYN_LINK
28+
ifeq ($(32_BIT_CPU),1)
29+
CFLAGS += -m32
30+
else
31+
CFLAGS += -m64
32+
endif
33+
34+
# if a header file changes, it will recompile
35+
#DEPS = $(wildcard src/*.d)
36+
37+
#################### define library paths, start with -L ####################
38+
LFLAGS = -L/usr/local/lib -L/usr/lib
39+
ifeq ($(32_BIT_CPU),1)
40+
LFLAGS += -L32_lib -L/usr/lib/i386-linux-gnu -L/lib/i386-linux-gnu
41+
else
42+
LFLAGS += -L64_lib -L/usr/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu
43+
endif
44+
45+
#################### define libraries (.so, .a) to link into executable ####################
46+
# start with -l, don't put lib in the name or an extension
47+
# Boost
48+
LIBS = -lboost_system -lboost_thread -lboost_timer
49+
# Boost Logging
50+
LIBS += -DBOOST_LOG_DYN_LINK -lboost_log_setup -lboost_log -lpthread
51+
# OpenSSL
52+
LIBS += -lssl -lcrypto
53+
54+
#################### define the C source files ####################
55+
SRCS = $(wildcard src/*.cpp)
56+
57+
# define the C object files
58+
OBJS = $(addprefix obj/, $(notdir $(SRCS:.cpp=.o)))
59+
60+
# define the executable file
61+
EXE = main
62+
63+
# make depend, make clean
64+
.PHONY: depend clean
65+
66+
#################### make ####################
67+
all: $(EXE)
68+
69+
$(EXE): $(OBJS)
70+
$(CC) $(CFLAGS) -o $(EXE) $(OBJS) $(LFLAGS) $(LIBS)
71+
72+
# this is a suffix replacement rule for building .o's from .c's
73+
# it uses automatic variables $<: the name of the prerequisite of
74+
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
75+
# (see the gnu make manual section about automatic variables)
76+
obj/%.o: src/%.cpp
77+
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
78+
79+
clean:
80+
$(RM) obj/*.o *~ $(EXE)
81+
82+
# this last blank line is needed for make to run
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* This file is subject to the terms and conditions defined in
3+
* file 'LICENSE.txt', which is part of this source code bundle.
4+
*/
5+
6+
#ifndef LOGGING_HPP
7+
#define LOGGING_HPP
8+
9+
#include <boost/log/expressions.hpp>
10+
#include <boost/log/sources/global_logger_storage.hpp>
11+
#include <boost/log/support/date_time.hpp>
12+
#include <boost/log/trivial.hpp>
13+
#include <boost/log/utility/setup.hpp>
14+
15+
#define TRACE BOOST_LOG_SEV(my_logger::get(), boost::log::trivial::trace) << __FILE__ << "(" << __FUNCTION__ << ":" << __LINE__ << ") >> "
16+
#define DEBUG BOOST_LOG_SEV(my_logger::get(), boost::log::trivial::debug) << __FILE__ << "(" << __FUNCTION__ << ":" << __LINE__ << ") >> "
17+
#define INFO BOOST_LOG_SEV(my_logger::get(), boost::log::trivial::info) << __FILE__ << "(" << __FUNCTION__ << ":" << __LINE__ << ") >> "
18+
#define WARNING BOOST_LOG_SEV(my_logger::get(), boost::log::trivial::warning) << __FILE__ << "(" << __FUNCTION__ << ":" << __LINE__ << ") >> "
19+
#define ERROR BOOST_LOG_SEV(my_logger::get(), boost::log::trivial::error) << __FILE__ << "(" << __FUNCTION__ << ":" << __LINE__ << ") >> "
20+
#define FATAL BOOST_LOG_SEV(my_logger::get(), boost::log::trivial::fatal) << __FILE__ << "(" << __FUNCTION__ << ":" << __LINE__ << ") >> "
21+
22+
#define SYS_LOGFILE "log/test.log"
23+
24+
//Narrow-char thread-safe logger.
25+
typedef boost::log::sources::severity_logger_mt<boost::log::trivial::severity_level> logger_t;
26+
27+
//declares a global logger with a custom initialization
28+
BOOST_LOG_GLOBAL_LOGGER(my_logger, logger_t)
29+
30+
#endif
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is subject to the terms and conditions defined in
3+
* file 'LICENSE.txt', which is part of this source code bundle.
4+
*/
5+
6+
#ifndef __WEBSOCKET_HPP
7+
#define __WEBSOCKET_HPP
8+
9+
#include <string>
10+
#include <vector>
11+
#include <sstream>
12+
#include <set>
13+
#include <future>
14+
#include <memory>
15+
16+
#include <simple-websocket-server/client_wss.hpp>
17+
#include <simple-websocket-server/server_wss.hpp>
18+
19+
#include "logging.hpp" // Boost logging
20+
21+
// Example server: https://gitlab.com/eidheim/Simple-WebSocket-Server/blob/master/wss_examples.cpp
22+
23+
class websocket
24+
{
25+
public:
26+
// Functions
27+
websocket(); // class constructor
28+
~websocket(); // class destructor
29+
void initialize(std::string crt_path, std::string key_path, int port);
30+
31+
private:
32+
};
33+
34+
#endif // __websocket_HPP
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This file is subject to the terms and conditions defined in
3+
* file 'LICENSE.txt', which is part of this source code bundle.
4+
*/
5+
6+
#include "../include/logging.hpp"
7+
8+
// CFLAGS += -DBOOST_LOG_DYN_LINK
9+
// LIBS += -lboost_log_setup -lboost_log -lpthread
10+
11+
namespace logging = boost::log;
12+
namespace sinks = boost::log::sinks;
13+
namespace src = boost::log::sources;
14+
namespace expr = boost::log::expressions;
15+
namespace attrs = boost::log::attributes;
16+
namespace keywords = boost::log::keywords;
17+
18+
//Defines a global logger initialization routine
19+
BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, logger_t)
20+
{
21+
logger_t lg;
22+
23+
logging::add_common_attributes();
24+
25+
logging::add_file_log(
26+
keywords::file_name = SYS_LOGFILE,
27+
keywords::rotation_size = 1024 * 1024 * 20,// megabytes
28+
keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point (0, 0, 0),
29+
keywords::auto_flush = true,
30+
keywords::format = (
31+
expr::stream << expr::format_date_time <boost::posix_time::ptime> ("TimeStamp", "%y-%m-%d %H:%M:%S.%f")
32+
<< " [" << expr::attr <boost::log::trivial::severity_level> ("Severity") << "] "
33+
<< expr::smessage
34+
)
35+
);
36+
37+
logging::add_console_log(
38+
std::cout,
39+
keywords::format = (
40+
expr::stream << expr::format_date_time <boost::posix_time::ptime> ("TimeStamp", "%y-%m-%d %H:%M:%S.%f")
41+
<< " [" << expr::attr <boost::log::trivial::severity_level> ("Severity") << "] "
42+
<< expr::smessage
43+
)
44+
);
45+
46+
logging::core::get()->set_filter
47+
(
48+
logging::trivial::severity >= logging::trivial::info
49+
);
50+
51+
return lg;
52+
}
53+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "../include/websocket.hpp"
2+
3+
int main (void)
4+
{
5+
INFO << "program started";
6+
7+
//bool debug = true;
8+
9+
try
10+
{
11+
// config
12+
websocket _websocket;
13+
std::string crt_path = "/home/elemech/Documents/github/test/angular_cpp_websocket/back_end/simple-websocket-server/ssl/server.crt";
14+
std::string key_path = "/home/elemech/Documents/github/test/angular_cpp_websocket/back_end/simple-websocket-server/ssl/server.key";
15+
int port = 8090;
16+
17+
INFO << "initialize websocket server";
18+
_websocket.initialize(crt_path, key_path, port);
19+
20+
}
21+
catch (const std::exception &e)
22+
{
23+
ERROR << "e.what() = " << e.what();
24+
return -1;
25+
}
26+
catch (int error)
27+
{
28+
ERROR << "error >> " << error;
29+
return -2;
30+
}
31+
32+
FATAL << "main ended";
33+
34+
return 0;
35+
}

0 commit comments

Comments
 (0)