├── .gitignore ├── .gitmodules ├── README-resources └── branching_schema.png ├── README.md ├── package-lock.json └── software ├── communications ├── arduino │ └── sketches │ │ ├── multiple_sensors │ │ └── multiple_sensors.ino │ │ └── sensor_example_code │ │ ├── MPU9250 │ │ └── MPU9250.ino │ │ ├── RTD │ │ └── RTD.ino │ │ ├── SPT25-20-0200A │ │ └── SPT25-20-0200A.ino │ │ ├── TMP006 │ │ └── TMP006.ino │ │ └── publishing_with_multiple_sensors │ │ └── publishing_with_multiple_sensors.ino ├── libraries │ ├── Adafruit_Unified_Sensor │ │ ├── Adafruit_Sensor.cpp │ │ ├── Adafruit_Sensor.h │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── examples │ │ │ └── sensortest │ │ │ │ └── sensortest.ino │ │ └── library.properties │ ├── arduino_cobs_serial_transport │ │ ├── arduino_cobs_serial_transport.cpp │ │ └── arduino_cobs_serial_transport.hpp │ ├── channel │ │ ├── library.properties │ │ └── src │ │ │ ├── channel.cpp │ │ │ ├── channel.hpp │ │ │ └── enums.hpp │ ├── common │ │ ├── library.properties │ │ └── src │ │ │ ├── Sensor.cpp │ │ │ ├── Sensor.h │ │ │ └── crc32.h │ ├── libserial │ │ ├── ABOUT-NLS │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── COPYING.LESSER │ │ ├── ChangeLog │ │ ├── INSTALL │ │ ├── LICENSE.txt │ │ ├── Makefile.am │ │ ├── Makefile.dist │ │ ├── NEWS │ │ ├── README │ │ ├── README.md │ │ ├── configure.ac │ │ ├── doc │ │ │ ├── .cvsignore │ │ │ ├── Makefile.am │ │ │ ├── UML │ │ │ │ ├── .cvsignore │ │ │ │ ├── Makefile.am │ │ │ │ └── libserial_class_diagram.dia │ │ │ └── user_manual │ │ │ │ ├── Makefile │ │ │ │ ├── api_documentation.rst │ │ │ │ ├── conf.py │ │ │ │ ├── description.rst │ │ │ │ ├── design_documentation.rst │ │ │ │ ├── download.rst │ │ │ │ ├── feature_summary.rst │ │ │ │ ├── index.rst │ │ │ │ ├── install.rst │ │ │ │ ├── links.rst │ │ │ │ └── tutorial.rst │ │ ├── doxygen.conf.in │ │ ├── examples │ │ │ ├── .cvsignore │ │ │ ├── Makefile.am │ │ │ ├── read_port.cpp │ │ │ └── write_port.cpp │ │ ├── libserial.pc.in │ │ ├── libserial.spec.in │ │ ├── sip │ │ │ ├── Makefile.am │ │ │ ├── SerialPort.sip │ │ │ ├── configure.py.in │ │ │ ├── exception.sip │ │ │ ├── libserial.sip │ │ │ ├── recv_test.py │ │ │ ├── send_test.py │ │ │ ├── stdexcept.sip │ │ │ ├── string.sip │ │ │ ├── test_control_lines.py │ │ │ └── vector.sip │ │ ├── src │ │ │ ├── .cvsignore │ │ │ ├── Makefile.am │ │ │ ├── PosixSignalDispatcher.cpp │ │ │ ├── PosixSignalDispatcher.h │ │ │ ├── PosixSignalHandler.h │ │ │ ├── SerialPort.cpp │ │ │ ├── SerialPort.h │ │ │ ├── SerialStream.cc │ │ │ ├── SerialStream.h │ │ │ ├── SerialStreamBuf.cc │ │ │ ├── SerialStreamBuf.h │ │ │ └── unit_tests.cpp │ │ ├── stamp-h.in │ │ └── sync_docs.sh │ ├── linux_cobs_serial_transport │ │ ├── linux_cobs_serial_transport.cpp │ │ └── linux_cobs_serial_transport.hpp │ ├── sensor_headers │ │ ├── library.properties │ │ └── src │ │ │ ├── MPU9250 │ │ │ ├── MPU9250.cpp │ │ │ ├── MPU9250.h │ │ │ ├── MPU9250_Lib.cpp │ │ │ ├── MPU9250_Lib.h │ │ │ ├── arduinoFFT.cpp │ │ │ ├── arduinoFFT.h │ │ │ ├── quaternionFilters.cpp │ │ │ └── quaternionFilters.h │ │ │ ├── RTD │ │ │ ├── RTD.cpp │ │ │ └── RTD.h │ │ │ ├── SPT25-20-0200A │ │ │ ├── SPT25-20-0200A.cpp │ │ │ └── SPT25-20-0200A.h │ │ │ ├── TMP006 │ │ │ ├── Adafruit_TMP006.cpp │ │ │ ├── Adafruit_TMP006.h │ │ │ ├── TMP006.cpp │ │ │ └── TMP006.h │ │ │ └── sensor_headers.h │ ├── zcm │ │ ├── nonblocking.c │ │ ├── nonblocking.h │ │ ├── transport.h │ │ ├── transport │ │ │ ├── generic_serial_transport.c │ │ │ └── generic_serial_transport.h │ │ ├── zcm-cpp-impl.hpp │ │ ├── zcm-cpp.hpp │ │ ├── zcm.c │ │ ├── zcm.h │ │ ├── zcm_coretypes.h │ │ └── zcm_private.h │ ├── zcm_types │ │ ├── library.properties │ │ └── src │ │ │ ├── channel_array_msg.c │ │ │ ├── channel_array_msg.h │ │ │ ├── channel_msg.c │ │ │ ├── channel_msg.h │ │ │ ├── source │ │ │ ├── channel_array_msg.zcm │ │ │ ├── channel_msg.zcm │ │ │ └── test_msg.zcm │ │ │ ├── test_msg.c │ │ │ ├── test_msg.h │ │ │ └── test_msg.py │ └── zcm_utht │ │ ├── zcm_utht.cpp │ │ └── zcm_utht.h └── odroid │ ├── channel_handler │ ├── Makefile │ ├── channel_handler.cpp │ ├── channel_handler.hpp │ ├── channels.json │ └── json.hpp │ ├── reading_from_zcm_channels │ ├── Makefile │ ├── channel_class_test │ ├── reading_from_zcm_channels │ └── reading_from_zcm_channels.cpp │ └── zcm_receive │ ├── Makefile │ ├── zcm_receive │ └── zcm_receive.cpp └── core ├── Infrastructure ├── AngularFrontend │ ├── .browserslistrc │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── e2e │ │ ├── protractor.conf.js │ │ ├── src │ │ │ ├── app.e2e-spec.ts │ │ │ └── app.po.ts │ │ └── tsconfig.json │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app-routing.module.ts │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.module.ts │ │ │ ├── components │ │ │ │ ├── controls │ │ │ │ │ ├── controls.component.css │ │ │ │ │ ├── controls.component.html │ │ │ │ │ ├── controls.component.spec.ts │ │ │ │ │ └── controls.component.ts │ │ │ │ ├── dashboard │ │ │ │ │ ├── battery │ │ │ │ │ │ ├── battery.component.css │ │ │ │ │ │ ├── battery.component.html │ │ │ │ │ │ ├── battery.component.spec.ts │ │ │ │ │ │ └── battery.component.ts │ │ │ │ │ ├── brake │ │ │ │ │ │ ├── brake-gauge │ │ │ │ │ │ │ ├── brake-gauge.component.html │ │ │ │ │ │ │ └── brake-gauge.component.ts │ │ │ │ │ │ ├── brake-graph │ │ │ │ │ │ │ ├── brake-graph.component.html │ │ │ │ │ │ │ └── brake-graph.component.ts │ │ │ │ │ │ ├── brake.component.html │ │ │ │ │ │ └── brake.component.ts │ │ │ │ │ ├── gauge-nvibration │ │ │ │ │ │ ├── gauge-nvibration.component.css │ │ │ │ │ │ ├── gauge-nvibration.component.html │ │ │ │ │ │ ├── gauge-nvibration.component.ts │ │ │ │ │ │ ├── gaugeheight │ │ │ │ │ │ │ ├── gaugeheight.component.css │ │ │ │ │ │ │ ├── gaugeheight.component.html │ │ │ │ │ │ │ └── gaugeheight.component.ts │ │ │ │ │ │ └── vibration │ │ │ │ │ │ │ ├── vibration.component.css │ │ │ │ │ │ │ ├── vibration.component.html │ │ │ │ │ │ │ └── vibration.component.ts │ │ │ │ │ ├── position │ │ │ │ │ │ ├── position.component.html │ │ │ │ │ │ ├── position.component.spec.ts │ │ │ │ │ │ └── position.component.ts │ │ │ │ │ ├── speed │ │ │ │ │ │ ├── speed-gauge │ │ │ │ │ │ │ ├── speed-gauge.component.html │ │ │ │ │ │ │ └── speed-gauge.component.ts │ │ │ │ │ │ ├── speed-graph │ │ │ │ │ │ │ ├── speed-graph.component.html │ │ │ │ │ │ │ └── speed-graph.component.ts │ │ │ │ │ │ ├── speed.component.html │ │ │ │ │ │ └── speed.component.ts │ │ │ │ │ ├── switch │ │ │ │ │ │ ├── switch.component.html │ │ │ │ │ │ └── switch.component.ts │ │ │ │ │ └── temperature │ │ │ │ │ │ ├── temperature-gauge │ │ │ │ │ │ ├── temperature-gauge.component.html │ │ │ │ │ │ └── temperature-gauge.component.ts │ │ │ │ │ │ ├── temperature-graph │ │ │ │ │ │ ├── temperature-graph.component.html │ │ │ │ │ │ └── temperature-graph.component.ts │ │ │ │ │ │ ├── temperature.component.html │ │ │ │ │ │ └── temperature.component.ts │ │ │ │ ├── icons │ │ │ │ │ ├── battery │ │ │ │ │ │ ├── battery.component.html │ │ │ │ │ │ ├── battery.component.spec.ts │ │ │ │ │ │ └── battery.component.ts │ │ │ │ │ └── speedometer │ │ │ │ │ │ ├── ng2-gauge │ │ │ │ │ │ ├── ng2-gauge.component.html │ │ │ │ │ │ └── ng2-gauge.component.ts │ │ │ │ │ │ └── ngx-gauge │ │ │ │ │ │ ├── ngx-gauge.component.html │ │ │ │ │ │ └── ngx-gauge.component.ts │ │ │ │ ├── layout │ │ │ │ │ ├── layout.component.css │ │ │ │ │ ├── layout.component.html │ │ │ │ │ ├── layout.component.spec.ts │ │ │ │ │ └── layout.component.ts │ │ │ │ ├── logs │ │ │ │ │ ├── logs.component.css │ │ │ │ │ ├── logs.component.html │ │ │ │ │ ├── logs.component.spec.ts │ │ │ │ │ └── logs.component.ts │ │ │ │ ├── podstate-item │ │ │ │ │ ├── podstate-item.component.css │ │ │ │ │ ├── podstate-item.component.html │ │ │ │ │ ├── podstate-item.component.spec.ts │ │ │ │ │ └── podstate-item.component.ts │ │ │ │ ├── podstate │ │ │ │ │ ├── podstate.component.css │ │ │ │ │ ├── podstate.component.html │ │ │ │ │ ├── podstate.component.spec.ts │ │ │ │ │ └── podstate.component.ts │ │ │ │ ├── sensor-group │ │ │ │ │ ├── sensor-group.component.css │ │ │ │ │ ├── sensor-group.component.html │ │ │ │ │ ├── sensor-group.component.spec.ts │ │ │ │ │ └── sensor-group.component.ts │ │ │ │ ├── sensor-item │ │ │ │ │ ├── sensor-item.component.css │ │ │ │ │ ├── sensor-item.component.html │ │ │ │ │ ├── sensor-item.component.spec.ts │ │ │ │ │ └── sensor-item.component.ts │ │ │ │ └── sensors │ │ │ │ │ ├── sensors.component.css │ │ │ │ │ ├── sensors.component.html │ │ │ │ │ ├── sensors.component.spec.ts │ │ │ │ │ └── sensors.component.ts │ │ │ └── services │ │ │ │ ├── websocket.service.spec.ts │ │ │ │ └── websocket.service.ts │ │ ├── assets │ │ │ ├── .gitkeep │ │ │ ├── braking.png │ │ │ ├── images │ │ │ │ └── pod-bird-eye.png │ │ │ └── open-sans-v18-latin │ │ │ │ ├── open-sans-v18-latin-regular.eot │ │ │ │ ├── open-sans-v18-latin-regular.svg │ │ │ │ ├── open-sans-v18-latin-regular.ttf │ │ │ │ ├── open-sans-v18-latin-regular.woff │ │ │ │ └── open-sans-v18-latin-regular.woff2 │ │ ├── custom-theme.scss │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.css │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── tslint.json ├── README.md ├── UTHT │ ├── .browserslistrc │ ├── .editorconfig │ ├── .gitignore │ ├── README.md │ ├── angular.json │ ├── e2e │ │ ├── protractor.conf.js │ │ ├── src │ │ │ ├── app.e2e-spec.ts │ │ │ └── app.po.ts │ │ └── tsconfig.json │ ├── electron-main.js │ ├── electronSrc │ │ ├── controller │ │ │ └── controller.js │ │ ├── index.html │ │ ├── index.js │ │ ├── models │ │ │ ├── Classes │ │ │ │ ├── acceleration-sensor.js │ │ │ │ ├── battery-sensor.js │ │ │ │ ├── dc_current-sensor.js │ │ │ │ ├── gapHeight-sensor.js │ │ │ │ ├── position-sensor.js │ │ │ │ ├── pressure-sensor.js │ │ │ │ ├── sensor.js │ │ │ │ ├── state_machine-sensor.js │ │ │ │ ├── temp-sensor.js │ │ │ │ ├── velocity-sensor.js │ │ │ │ └── vibration-sensor.js │ │ │ ├── Digester │ │ │ │ ├── README.md │ │ │ │ ├── index.js │ │ │ │ └── test.js │ │ │ ├── Encapsulate │ │ │ │ ├── index.js │ │ │ │ └── test.json │ │ │ ├── constant │ │ │ │ └── classes.js │ │ │ ├── dataCorrector │ │ │ │ ├── commonErrors.json │ │ │ │ ├── corrector.js │ │ │ │ ├── test_data.json │ │ │ │ └── test_error.json │ │ │ ├── externalSocketParser │ │ │ │ ├── README.md │ │ │ │ └── parser.js │ │ │ ├── utilities │ │ │ │ ├── broadcast.js │ │ │ │ └── mock.js │ │ │ └── validator │ │ │ │ ├── commonErrors.js │ │ │ │ ├── createErrorObj.js │ │ │ │ ├── test.json │ │ │ │ ├── validate-old.js │ │ │ │ └── validate.js │ │ ├── preload.js │ │ ├── renderer.js │ │ └── style.css │ ├── karma.conf.js │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── app-routing.module.ts │ │ │ ├── app.component.css │ │ │ ├── app.component.html │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.module.ts │ │ │ ├── components │ │ │ │ ├── controls │ │ │ │ │ ├── controls.component.css │ │ │ │ │ ├── controls.component.html │ │ │ │ │ ├── controls.component.spec.ts │ │ │ │ │ └── controls.component.ts │ │ │ │ ├── dashboard │ │ │ │ │ ├── acceleration │ │ │ │ │ │ ├── acceleration.component.css │ │ │ │ │ │ ├── acceleration.component.html │ │ │ │ │ │ ├── acceleration.component.spec.ts │ │ │ │ │ │ └── acceleration.component.ts │ │ │ │ │ ├── battery │ │ │ │ │ │ ├── battery.component.css │ │ │ │ │ │ ├── battery.component.html │ │ │ │ │ │ ├── battery.component.spec.ts │ │ │ │ │ │ └── battery.component.ts │ │ │ │ │ ├── brake │ │ │ │ │ │ ├── brake-gauge │ │ │ │ │ │ │ ├── brake-gauge.component.html │ │ │ │ │ │ │ └── brake-gauge.component.ts │ │ │ │ │ │ ├── brake-graph │ │ │ │ │ │ │ ├── brake-graph.component.html │ │ │ │ │ │ │ └── brake-graph.component.ts │ │ │ │ │ │ ├── brake.component.html │ │ │ │ │ │ └── brake.component.ts │ │ │ │ │ ├── gauge-nvibration │ │ │ │ │ │ ├── gauge-nvibration.component.css │ │ │ │ │ │ ├── gauge-nvibration.component.html │ │ │ │ │ │ ├── gauge-nvibration.component.ts │ │ │ │ │ │ ├── gaugeheight │ │ │ │ │ │ │ ├── gaugeheight.component.css │ │ │ │ │ │ │ ├── gaugeheight.component.html │ │ │ │ │ │ │ └── gaugeheight.component.ts │ │ │ │ │ │ └── vibration │ │ │ │ │ │ │ ├── vibration.component.css │ │ │ │ │ │ │ ├── vibration.component.html │ │ │ │ │ │ │ └── vibration.component.ts │ │ │ │ │ ├── position │ │ │ │ │ │ ├── position.component.html │ │ │ │ │ │ ├── position.component.spec.ts │ │ │ │ │ │ └── position.component.ts │ │ │ │ │ ├── speed │ │ │ │ │ │ ├── speed-gauge │ │ │ │ │ │ │ ├── speed-gauge.component.html │ │ │ │ │ │ │ └── speed-gauge.component.ts │ │ │ │ │ │ ├── speed-graph │ │ │ │ │ │ │ ├── speed-graph.component.html │ │ │ │ │ │ │ └── speed-graph.component.ts │ │ │ │ │ │ ├── speed.component.html │ │ │ │ │ │ └── speed.component.ts │ │ │ │ │ ├── switch │ │ │ │ │ │ ├── switch.component.html │ │ │ │ │ │ └── switch.component.ts │ │ │ │ │ └── temperature │ │ │ │ │ │ ├── temperature-gauge │ │ │ │ │ │ ├── temperature-gauge.component.html │ │ │ │ │ │ └── temperature-gauge.component.ts │ │ │ │ │ │ ├── temperature-graph │ │ │ │ │ │ ├── temperature-graph.component.html │ │ │ │ │ │ └── temperature-graph.component.ts │ │ │ │ │ │ ├── temperature.component.html │ │ │ │ │ │ └── temperature.component.ts │ │ │ │ ├── icons │ │ │ │ │ ├── battery │ │ │ │ │ │ ├── battery.component.html │ │ │ │ │ │ ├── battery.component.spec.ts │ │ │ │ │ │ └── battery.component.ts │ │ │ │ │ └── speedometer │ │ │ │ │ │ ├── ng2-gauge │ │ │ │ │ │ ├── ng2-gauge.component.html │ │ │ │ │ │ └── ng2-gauge.component.ts │ │ │ │ │ │ └── ngx-gauge │ │ │ │ │ │ ├── ngx-gauge.component.html │ │ │ │ │ │ └── ngx-gauge.component.ts │ │ │ │ ├── layout │ │ │ │ │ ├── layout.component.css │ │ │ │ │ ├── layout.component.html │ │ │ │ │ ├── layout.component.spec.ts │ │ │ │ │ └── layout.component.ts │ │ │ │ ├── logs │ │ │ │ │ ├── logs.component.css │ │ │ │ │ ├── logs.component.html │ │ │ │ │ ├── logs.component.spec.ts │ │ │ │ │ └── logs.component.ts │ │ │ │ ├── podstate-item │ │ │ │ │ ├── podstate-item.component.css │ │ │ │ │ ├── podstate-item.component.html │ │ │ │ │ ├── podstate-item.component.spec.ts │ │ │ │ │ └── podstate-item.component.ts │ │ │ │ ├── podstate │ │ │ │ │ ├── podstate.component.css │ │ │ │ │ ├── podstate.component.html │ │ │ │ │ ├── podstate.component.spec.ts │ │ │ │ │ └── podstate.component.ts │ │ │ │ ├── sensor-group │ │ │ │ │ ├── sensor-group.component.css │ │ │ │ │ ├── sensor-group.component.html │ │ │ │ │ ├── sensor-group.component.spec.ts │ │ │ │ │ └── sensor-group.component.ts │ │ │ │ ├── sensor-item │ │ │ │ │ ├── sensor-item.component.css │ │ │ │ │ ├── sensor-item.component.html │ │ │ │ │ ├── sensor-item.component.spec.ts │ │ │ │ │ └── sensor-item.component.ts │ │ │ │ └── sensors │ │ │ │ │ ├── sensors.component.css │ │ │ │ │ ├── sensors.component.html │ │ │ │ │ ├── sensors.component.spec.ts │ │ │ │ │ └── sensors.component.ts │ │ │ └── services │ │ │ │ ├── websocket.service.spec.ts │ │ │ │ └── websocket.service.ts │ │ ├── assets │ │ │ ├── .gitkeep │ │ │ ├── braking.png │ │ │ ├── images │ │ │ │ └── pod-bird-eye.png │ │ │ └── open-sans-v18-latin │ │ │ │ ├── open-sans-v18-latin-regular.eot │ │ │ │ ├── open-sans-v18-latin-regular.svg │ │ │ │ ├── open-sans-v18-latin-regular.ttf │ │ │ │ ├── open-sans-v18-latin-regular.woff │ │ │ │ └── open-sans-v18-latin-regular.woff2 │ │ ├── custom-theme.scss │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.css │ │ └── test.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.spec.json │ └── tslint.json ├── backend │ ├── Classes │ │ ├── acceleration-sensor.js │ │ ├── battery-sensor.js │ │ ├── dc_current-sensor.js │ │ ├── gapHeight-sensor.js │ │ ├── position-sensor.js │ │ ├── pressure-sensor.js │ │ ├── sensor.js │ │ ├── state_machine-sensor.js │ │ ├── temp-sensor.js │ │ ├── velocity-sensor.js │ │ └── vibration-sensor.js │ ├── Digester │ │ ├── README.md │ │ ├── index.js │ │ └── test.js │ ├── Encapsulate │ │ ├── index.js │ │ └── test.json │ ├── README.md │ ├── constant │ │ └── classes.js │ ├── dataCorrector │ │ ├── commonErrors.json │ │ ├── corrector.js │ │ ├── test_data.json │ │ └── test_error.json │ ├── db │ │ ├── README.md │ │ └── pod1models.js │ ├── externalSocketParser │ │ ├── README.md │ │ └── parser.js │ ├── index.js │ ├── package-lock.json │ ├── package.json │ ├── test.json │ ├── utilities │ │ ├── broadcast.js │ │ └── mock.js │ └── validator │ │ ├── commonErrors.js │ │ ├── createErrorObj.js │ │ ├── test.json │ │ ├── validate-old.js │ │ └── validate.js ├── c++ │ ├── Makefile │ ├── classes │ │ └── sensor.h │ ├── socket │ ├── socket.cpp │ └── socketBoost.cpp ├── package-lock.json ├── readme │ └── Architecture.png └── scripts │ ├── .gitignore │ ├── RegressionTest │ ├── RTest.py │ ├── requirements.txt │ └── test.json │ ├── debug.txt │ ├── package-lock.json │ ├── package.json │ ├── route.rest │ ├── routes │ └── pod1.js │ ├── server.js │ └── simulation │ ├── requirements.txt │ ├── simulation.py │ └── test.json └── Makefile /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "software/lcm"] 2 | path = software/lcm 3 | url = https://github.com/lcm-proj/lcm.git 4 | [submodule "software/communications/libraries/PacketSerial"] 5 | path = software/communications/libraries/PacketSerial 6 | url = https://github.com/gizatt/PacketSerial.git 7 | -------------------------------------------------------------------------------- /README-resources/branching_schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/README-resources/branching_schema.png -------------------------------------------------------------------------------- /software/communications/libraries/Adafruit_Unified_Sensor/library.properties: -------------------------------------------------------------------------------- 1 | name=Adafruit Unified Sensor 2 | version=1.1.4 3 | author=Adafruit 4 | maintainer=Adafruit 5 | sentence=Required for all Adafruit Unified Sensor based libraries. 6 | paragraph=A unified sensor abstraction layer used by many Adafruit sensor libraries. 7 | category=Sensors 8 | url=https://github.com/adafruit/Adafruit_Sensor 9 | architectures=* 10 | includes=Adafruit_Sensor.h 11 | 12 | -------------------------------------------------------------------------------- /software/communications/libraries/channel/library.properties: -------------------------------------------------------------------------------- 1 | name=Channel 2 | version=1.0 3 | author=UTHT 4 | maintainer=UTHT 5 | sentence=Channel Class files 6 | paragraph=are generated here 7 | category=Communication 8 | url=utht.com 9 | architectures=* -------------------------------------------------------------------------------- /software/communications/libraries/channel/src/channel.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CHANNEL_H 3 | #define CHANNEL_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include "enums.hpp" 16 | 17 | using namespace std; 18 | 19 | class Channel { 20 | private: 21 | string channel_name; 22 | string serial_port; 23 | string arduino_id; 24 | zcm_t* zcm; 25 | mutex lock; 26 | 27 | vector current_values; 28 | double min_value; 29 | double max_value; 30 | time_t last_comm_time; 31 | 32 | static void callbackHandler(const zcm_recv_buf_t* rbuf, const char* channel, const channel_array* msg, void* user); 33 | 34 | public: 35 | Channel(string channel_name, string serial_port, string arduino_id, double min_value, double max_value); 36 | 37 | vector getCurrentValues(); 38 | zcm_t* getZCM(); 39 | string getChannelName(); 40 | 41 | channel_array_subscription_t* subscribeToChannel(); 42 | int validateCurrentValue(); 43 | }; 44 | 45 | // The channel handler needs to populate this channel_map 46 | extern unordered_map channel_map; 47 | 48 | #endif -------------------------------------------------------------------------------- /software/communications/libraries/channel/src/enums.hpp: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CHANNELSTATUS_H 3 | #define CHANNELSTATUS_H 4 | enum ChannelStatus { NO_VALUE, OUT_OF_RANGE, NO_COMMS, FUNCTIONING }; 5 | 6 | #endif -------------------------------------------------------------------------------- /software/communications/libraries/common/library.properties: -------------------------------------------------------------------------------- 1 | name=Common 2 | version=1.0 3 | author=UTHT 4 | maintainer=UTHT 5 | sentence=Common files 6 | paragraph=are generated here 7 | category=Communication 8 | url=utht.com 9 | architectures=* -------------------------------------------------------------------------------- /software/communications/libraries/libserial/ABOUT-NLS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/communications/libraries/libserial/ABOUT-NLS -------------------------------------------------------------------------------- /software/communications/libraries/libserial/AUTHORS: -------------------------------------------------------------------------------- 1 | Manish P. Pagey 2 | Crayzee Wulf 3 | Jay Sachdev 4 | Jan Wedekind 5 | 6 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-09-19 2 | 3 | * configure.in: Released version 0.5.0. 4 | 5 | * src/PosixSignalDispatcher.cpp (Repository): Formatting changes 6 | only. No logical changes. 7 | 8 | * src/PosixSignalDispatcher.h (Repository): Formatting changes 9 | only. No logical changes. 10 | 11 | * src/SerialPort.cpp (Repository): Formatting changes only. No 12 | logical changes. 13 | 14 | 2005-09-18 15 | 16 | * src/SerialPort.h (class SerialPort): The constructor for the 17 | class is now "explicit" to make sure that a std::string does not 18 | get converted to a SerialPort object through implicit 19 | conversion. The destructor is not virtual anymore as this class is 20 | not designed to be polymorphic. 21 | 22 | 2005-09-06 Jan Wedekind 23 | 24 | * examples/write_port.cpp: An example for writing commands to 25 | the serial port was added. 26 | * src/SerialStream.h: Functions for adjusting the port's VTIME- 27 | and VMIN-parameter where added. 28 | * src/SerialStreamBuf.cc: Missing return statement was added. 29 | 30 | 2003-12-30 Manish P. Pagey 31 | 32 | * src/SerialStreamBuf.cc: Interchanged "case 1" and "case 2" in 33 | SerialStreamBuf::SetNumOfStopBits() to make sure that stop bits 34 | are set correctly. This bug was pointed out by Olivier Chambard. 35 | 36 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/LICENSE.txt: -------------------------------------------------------------------------------- 1 | This software is released under "GNU LESSER GENERAL PUBLIC LICENSE". 2 | 3 | See the file named COPYING.LESSER for more details about this license. 4 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS=src doc examples 2 | 3 | if PYTHON 4 | SUBDIRS += sip 5 | endif 6 | 7 | ACLOCAL_AMFLAGS=-I m4 8 | 9 | EXTRA_DIST = doxygen.conf.in Makefile.dist libserial.spec libserial.pc 10 | 11 | docs: 12 | make dox 13 | 14 | dox: 15 | doxygen doxygen.conf 16 | 17 | pkgconfigdir = $(libdir)/pkgconfig 18 | pkgconfig_DATA = libserial.pc 19 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/Makefile.dist: -------------------------------------------------------------------------------- 1 | all: 2 | mkdir -pv m4 3 | autoreconf -i --force --verbose 4 | 5 | configure: 6 | ./configure 7 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/communications/libraries/libserial/NEWS -------------------------------------------------------------------------------- /software/communications/libraries/libserial/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/communications/libraries/libserial/README -------------------------------------------------------------------------------- /software/communications/libraries/libserial/README.md: -------------------------------------------------------------------------------- 1 | libserial 2 | ========= 3 | 4 | This library can be used to access the serial ports on POSIX 5 | systems. You will need a recent g++ release (anything after gcc-3.2 6 | should work) to compile libserial. 7 | 8 | If you get the source from github, you need to generate the configure script first: 9 | 10 | ``` 11 | make -f Makefile.dist 12 | ``` 13 | 14 | You can skip this step if you are using a release package (which already contains the `configure` script). Once you have the `configure` script, run the following commands: 15 | 16 | ```shell 17 | ./configure 18 | make 19 | make install 20 | ``` 21 | 22 | Complete documentation is available [here](http://crayzeewulf.github.io/libserial). 23 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/configure.ac: -------------------------------------------------------------------------------- 1 | AC_REVISION($Revision: 1.14 $) 2 | dnl 3 | dnl Indicate the package name and the version to automake 4 | dnl 5 | AC_INIT([libserial], [0.6.0rc3]) 6 | AC_CONFIG_SRCDIR([src/SerialStream.cc]) 7 | AM_CONFIG_HEADER(config.h) 8 | AC_CONFIG_MACRO_DIR([m4]) 9 | AM_INIT_AUTOMAKE 10 | AM_MAINTAINER_MODE 11 | 12 | dnl Checks for programs. 13 | AC_PROG_CXX 14 | AC_PROG_AWK 15 | AC_PROG_CC 16 | AC_PROG_INSTALL 17 | AC_PROG_LN_S 18 | AC_PROG_MAKE_SET 19 | AC_PROG_LIBTOOL 20 | 21 | AC_CHECK_PROG(DOCBOOK2PDF,docbook2pdf,docbook2pdf,no) 22 | if test "x$DOCBOOK2PDF" == "xno"; then 23 | AC_MSG_WARN([Could not find docbook2pdf. Disabling creation of user manual therefore.]) 24 | HAVE_DOCBOOK2PDF="no" 25 | else 26 | HAVE_DOCBOOK2PDF="yes" 27 | fi 28 | AC_SUBST(DOCBOOK2PDF) 29 | AM_CONDITIONAL(HAVE_DOCBOOK2PDF, test x$HAVE_DOCBOOK2PDF = xyes) 30 | 31 | dnl Checks for header files. 32 | AC_CHECK_HEADERS(fcntl.h unistd.h) 33 | 34 | dnl Checks for typedefs, structures, and compiler characteristics. 35 | AC_C_CONST 36 | AC_C_INLINE 37 | 38 | AC_ARG_WITH([python], 39 | AS_HELP_STRING([--without-python], [Disable Python bindings]), 40 | [], [with_python=yes]) 41 | AM_CONDITIONAL([PYTHON], [test "${with_python}" != "no"]) 42 | 43 | AC_OUTPUT([Makefile 44 | doxygen.conf 45 | libserial.spec 46 | doc/UML/Makefile 47 | doc/Makefile 48 | examples/Makefile 49 | src/Makefile 50 | sip/configure.py 51 | sip/Makefile 52 | libserial.pc]) 53 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | UserManual.pdf 4 | 5 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS=UML 2 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/UML/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | 4 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/UML/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/UML/libserial_class_diagram.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/communications/libraries/libserial/doc/UML/libserial_class_diagram.dia -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/user_manual/api_documentation.rst: -------------------------------------------------------------------------------- 1 | API Documentation 2 | ================= 3 | 4 | The API documentation generated by doxygen is available `here 5 | `_. 6 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/user_manual/design_documentation.rst: -------------------------------------------------------------------------------- 1 | Design Documentation 2 | ==================== 3 | 4 | Coming soon. 5 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/user_manual/download.rst: -------------------------------------------------------------------------------- 1 | Download 2 | ======== 3 | 4 | The latest version of LibSerial is 0.6.0rc2. You can download the source code 5 | for LibSerial-0.6.0rc2 from `here `_. 6 | Older versions of LibSerial may also be downloaded from the above site. 7 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/user_manual/feature_summary.rst: -------------------------------------------------------------------------------- 1 | Feature Summary 2 | =============== 3 | 4 | * Simplified serial port programming in C++ under POSIX operating systems. 5 | * Support for USB-serial converters. 6 | * Access serial ports from scripting languages such as PHP, Python, Perl, 7 | Ruby, and Java (coming soon in version 0.6.0). 8 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/user_manual/index.rst: -------------------------------------------------------------------------------- 1 | .. LibSerial documentation master file, created by 2 | sphinx-quickstart on Sat Apr 18 17:19:33 2015. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to LibSerial's documentation! 7 | ===================================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | feature_summary 15 | description 16 | download 17 | install 18 | tutorial 19 | api_documentation 20 | design_documentation 21 | links 22 | 23 | Indices and tables 24 | ================== 25 | 26 | * :ref:`genindex` 27 | * :ref:`modindex` 28 | * :ref:`search` 29 | 30 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/user_manual/install.rst: -------------------------------------------------------------------------------- 1 | Install 2 | ======= 3 | 4 | 5 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/doc/user_manual/links.rst: -------------------------------------------------------------------------------- 1 | Links 2 | ===== 3 | 4 | 5 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/examples/.cvsignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | Makefile 4 | Makefile.in 5 | readport 6 | writeport 7 | 8 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/examples/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CXXFLAGS = -Weffc++ 2 | 3 | noinst_PROGRAMS = readport writeport 4 | # noinst_PROGRAMS = readport writeport xmodem_rx xmodem_tx process_rope_command test_echo 5 | 6 | readport_SOURCES = read_port.cpp 7 | 8 | writeport_SOURCES = write_port.cpp 9 | 10 | # xmodem_rx_SOURCES = xmodem_rx.cpp xmodem.cpp xmodem.h crc16.cpp crc16.h byte_xfer.cpp byte_xfer.h 11 | 12 | # xmodem_tx_SOURCES = xmodem_tx.cpp xmodem.cpp xmodem.h crc16.cpp crc16.h byte_xfer.cpp byte_xfer.h 13 | 14 | # test_echo_SOURCES = test_echo.cpp 15 | 16 | # process_rope_command_SOURCES = process_rope_command.cpp 17 | 18 | AM_CPPFLAGS = -I@top_srcdir@/src 19 | 20 | readport_LDADD = ../src/libserial.la -lpthread 21 | writeport_LDADD = ../src/libserial.la -lpthread 22 | # xmodem_rx_LDADD = ../src/libserial.la 23 | # xmodem_tx_LDADD = ../src/libserial.la 24 | # test_echo_LDADD = ../src/libserial.la 25 | # process_rope_command_LDADD = ../src/libserial.la 26 | 27 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/libserial.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libserial 7 | Description: C++ Serial port library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lserial 10 | Cflags: -I${includedir} 11 | 12 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/sip/Makefile.am: -------------------------------------------------------------------------------- 1 | SIPFILES = \ 2 | exception.sip \ 3 | libserial.sip \ 4 | SerialPort.sip \ 5 | stdexcept.sip \ 6 | string.sip \ 7 | vector.sip 8 | 9 | EXTRA_DIST = \ 10 | configure.py.in \ 11 | recv_test.py \ 12 | send_test.py \ 13 | $(SIPFILES) 14 | 15 | all: libserial.so 16 | 17 | libserial.so: Makefile.sip @top_srcdir@/src/libserial.la 18 | make -f Makefile.sip 19 | 20 | Makefile.sip: configure.py $(SIPFILES) 21 | python ./configure.py 22 | 23 | clean-local: Makefile.sip 24 | make -f Makefile.sip clean 25 | 26 | CLEANFILES = \ 27 | siplibserialcmodule.cpp \ 28 | siplibserialSerialPortAlreadyOpen.cpp \ 29 | siplibserialSerialPort.cpp \ 30 | siplibserialSerialPortNotOpen.cpp \ 31 | siplibserialSerialPortOpenFailed.cpp \ 32 | siplibserialSerialPortReadTimeout.cpp \ 33 | siplibserialSerialPortUnsupportedBaudRate.cpp \ 34 | siplibserialstd.cpp \ 35 | siplibserialstdexception.cpp \ 36 | siplibserialstdinvalid_argument.cpp \ 37 | siplibserialstdlogic_error.cpp \ 38 | siplibserialstdruntime_error.cpp \ 39 | siplibserialstdstring.cpp \ 40 | siplibserialstdvector.cpp \ 41 | libserial.sbf \ 42 | sipAPIlibserial.h \ 43 | Makefile.sip -------------------------------------------------------------------------------- /software/communications/libraries/libserial/sip/exception.sip: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | class exception 4 | { 5 | %TypeHeaderCode 6 | #include 7 | %End 8 | public: 9 | exception() throw() ; 10 | virtual ~exception() throw(); 11 | 12 | virtual const char* what() const throw(); 13 | } ; 14 | } ; 15 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/sip/libserial.sip: -------------------------------------------------------------------------------- 1 | %Module libserial 0 2 | 3 | %Include exception.sip 4 | %Include stdexcept.sip 5 | %Include string.sip 6 | %Include SerialPort.sip 7 | %Include vector.sip 8 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/sip/recv_test.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | from libserial import SerialPort 3 | import errno 4 | import sys 5 | 6 | def main(): 7 | serial_port = SerialPort( "/dev/ttyUSB11" ) 8 | serial_port.Open( SerialPort.BAUD_115200, 9 | SerialPort.CHAR_SIZE_DEFAULT, 10 | SerialPort.PARITY_DEFAULT, 11 | SerialPort.STOP_BITS_DEFAULT, 12 | SerialPort.FLOW_CONTROL_HARD ) 13 | try: 14 | while True: 15 | sys.stdout.write( serial_port.ReadByte() ) 16 | except IOError, (errorNumber, errorMessage): 17 | if ( errno.EINTR == errorNumber ): 18 | print 19 | print "Ignoring EINTR." 20 | pass 21 | else: 22 | raise 23 | except KeyboardInterrupt: 24 | sys.exit(0) 25 | 26 | if __name__ == "__main__": 27 | main() 28 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/sip/send_test.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import sys 3 | import libserial 4 | 5 | def main(): 6 | serial_port = libserial.SerialPort( "/dev/ttyUSB0" ) 7 | serial_port.Open( libserial.SerialPort.BAUD_115200, 8 | libserial.SerialPort.CHAR_SIZE_DEFAULT, 9 | libserial.SerialPort.PARITY_DEFAULT, 10 | libserial.SerialPort.STOP_BITS_DEFAULT, 11 | libserial.SerialPort.FLOW_CONTROL_HARD ) 12 | try: 13 | while True: 14 | for i in range( 65, 91 ): 15 | serial_port.WriteByte( chr(i) ) 16 | sys.stdout.write( chr(i) ) 17 | except KeyboardInterrupt: 18 | sys.exit(0) 19 | 20 | if __name__ == "__main__": 21 | main() 22 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/sip/stdexcept.sip: -------------------------------------------------------------------------------- 1 | namespace std 2 | { 3 | class logic_error : std::exception 4 | { 5 | %TypeHeaderCode 6 | #include 7 | %End 8 | public: 9 | explicit 10 | logic_error(const std::string& __arg); 11 | 12 | virtual 13 | ~logic_error() throw(); 14 | 15 | virtual const char* 16 | what() const throw(); 17 | }; 18 | 19 | class runtime_error : std::exception 20 | { 21 | public: 22 | %TypeHeaderCode 23 | #include 24 | %End 25 | explicit 26 | runtime_error(const std::string& __arg); 27 | 28 | virtual 29 | ~runtime_error() throw(); 30 | 31 | virtual const char* 32 | what() const throw(); 33 | }; 34 | 35 | class invalid_argument : std::logic_error 36 | { 37 | %TypeHeaderCode 38 | #include 39 | %End 40 | public: 41 | explicit invalid_argument(const std::string& __arg); 42 | virtual ~invalid_argument() throw() ; 43 | %MethodCode 44 | return ; 45 | %End 46 | }; 47 | }; -------------------------------------------------------------------------------- /software/communications/libraries/libserial/src/.cvsignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | Makefile 4 | Makefile.in 5 | *.lo 6 | lib*.la 7 | 8 | 9 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/src/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CXXFLAGS = -Weffc++ 2 | 3 | noinst_PROGRAMS = unit_tests 4 | 5 | lib_LTLIBRARIES = libserial.la 6 | 7 | include_HEADERS = SerialStreamBuf.h SerialStream.h SerialPort.h 8 | 9 | libserial_la_SOURCES = SerialStreamBuf.cc SerialStreamBuf.h SerialStream.cc \ 10 | SerialStream.h SerialPort.cpp SerialPort.h PosixSignalDispatcher.cpp 11 | 12 | unit_tests_SOURCES = unit_tests.cpp 13 | unit_tests_LDADD = libserial.la -lboost_unit_test_framework 14 | 15 | noinst_HEADERS = PosixSignalDispatcher.h PosixSignalHandler.h 16 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/src/PosixSignalHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef _PosixSignalHandler_h_ 2 | #define _PosixSignalHandler_h_ 3 | 4 | /** 5 | * Gets a method called when the corresponding signal is received. 6 | * A PosixSignalHandler must be connected to the PosixSignalDispatcher 7 | * for it to be called. 8 | */ 9 | class PosixSignalHandler 10 | { 11 | public: 12 | /** 13 | * This method is called when the specified POSIX signal is 14 | * received by the PosixSignalDispatcher that is managing 15 | * this handler. 16 | */ 17 | virtual void HandlePosixSignal( int signalNumber ) = 0 ; 18 | 19 | /** 20 | * Destructor is declared virtual as we expect this class to be 21 | * subclassed. It is also declared pure abstract to make this 22 | * class a pure abstract class. 23 | */ 24 | virtual ~PosixSignalHandler() = 0 ; 25 | } ; 26 | 27 | inline 28 | PosixSignalHandler::~PosixSignalHandler() 29 | { 30 | /* empty */ 31 | } 32 | #endif // #ifndef _PosixSignalHandler_h_ 33 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/src/unit_tests.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define BOOST_TEST_MODULE libserial 5 | #define BOOST_TEST_DYN_LINK 6 | #define BOOST_TEST_MAIN 7 | #include 8 | 9 | BOOST_AUTO_TEST_CASE( SerialStreamBuf_Constructor_Test ) 10 | { 11 | using namespace LibSerial ; 12 | SerialStreamBuf buf ; 13 | BOOST_CHECK( false == buf.is_open() ) ; 14 | } 15 | 16 | BOOST_AUTO_TEST_CASE( SerialStream_Constructor_Test ) 17 | { 18 | using namespace LibSerial ; 19 | SerialStream serial_stream ; 20 | BOOST_CHECK( false == serial_stream.IsOpen() ) ; 21 | } 22 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/stamp-h.in: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /software/communications/libraries/libserial/sync_docs.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | rsync -avP doc/user_manual/_build/html/ libserial:/home/project-web/libserial/htdocs/ 3 | rsync -avP doc/html/ libserial:/home/project-web/libserial/htdocs/doxygen/ 4 | -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/library.properties: -------------------------------------------------------------------------------- 1 | name=Sensor_headers 2 | version=1.0 3 | author=UTHT 4 | maintainer=UTHT 5 | sentence=Common files 6 | paragraph=are generated here 7 | category=Communication 8 | url=utht.com 9 | architectures=* -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/MPU9250/quaternionFilters.h: -------------------------------------------------------------------------------- 1 | #ifndef _QUATERNIONFILTERS_H_ 2 | #define _QUATERNIONFILTERS_H_ 3 | 4 | #include 5 | 6 | void MadgwickQuaternionUpdate(float ax, float ay, float az, float gx, float gy, 7 | float gz, float mx, float my, float mz, 8 | float deltat); 9 | void MahonyQuaternionUpdate(float ax, float ay, float az, float gx, float gy, 10 | float gz, float mx, float my, float mz, 11 | float deltat); 12 | const float * getQ(); 13 | 14 | #endif // _QUATERNIONFILTERS_H_ -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/RTD/RTD.cpp: -------------------------------------------------------------------------------- 1 | #include "RTD.h" 2 | 3 | const char* arr_RTD[2] = {"deg F (Raw)", "deg F"}; 4 | t_datasetup datasetup_RTD = {2, arr_RTD}; 5 | 6 | RTD::RTD(uint8_t pin, arduino_t arduino) : Sensor(S_PROSENSERTD, arduino, datasetup_RTD, 500){ 7 | this->pin = pin; 8 | } 9 | 10 | errorlevel_t RTD::init(){ 11 | pinMode(pin, INPUT); 12 | return ERR_NONE; 13 | } 14 | 15 | double prosense_rtd_map(const int x, const double in_min, const double in_max, const double out_min, const double out_max) { 16 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 17 | } 18 | 19 | // TODO Calibrate temperature readings 20 | errorlevel_t RTD::read(t_datum* data, uint8_t numdata){ 21 | // NOTE: Convention - check that numdata given matches expected 22 | if(numdata != 2){ //TODO: globally declare the array size instead of using the int value 23 | return ERR_FAIL; 24 | } 25 | int val = analogRead(pin); 26 | data[0].data = (float)val; 27 | data[1].data = (float)prosense_rtd_map(val, 180, 901, -40, 300); 28 | // TODO: other error conditions? 29 | return ERR_NONE; 30 | } -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/RTD/RTD.h: -------------------------------------------------------------------------------- 1 | #ifndef RTD_H 2 | #define RTD_H 3 | 4 | #include "Sensor.h" 5 | 6 | class RTD : public Sensor { 7 | public: 8 | RTD(uint8_t pin, arduino_t arduino); 9 | private: 10 | errorlevel_t read(t_datum* data, uint8_t numdata) override; 11 | errorlevel_t init() override; 12 | /** 13 | * Analog input pin. 14 | * */ 15 | uint8_t pin; 16 | }; 17 | 18 | #endif -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/SPT25-20-0200A/SPT25-20-0200A.cpp: -------------------------------------------------------------------------------- 1 | #include "SPT25-20-0200A.h" 2 | 3 | const char* arr_SPT[2] = {"kPa (Raw)", "kPa"}; 4 | t_datasetup datasetup_SPT = {2, arr_SPT}; 5 | 6 | SPT25_20_0200A::SPT25_20_0200A(uint8_t pin, arduino_t arduino) : Sensor(S_SPTD25_20_0200A, arduino, datasetup_SPT, 250){ 7 | this->pin = pin; 8 | } 9 | 10 | errorlevel_t SPT25_20_0200A::init(){ 11 | pinMode(pin, INPUT); 12 | return ERR_NONE; 13 | } 14 | 15 | double spt25_20_200a_map(const int x, const double in_min, const double in_max, const double out_min, const double out_max) { 16 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 17 | } 18 | 19 | // TODO Calibrate from 0 psi to 200 psi 20 | // Currently sensorValue at 0 psi is 176 - 177 21 | errorlevel_t SPT25_20_0200A::read(t_datum* data, uint8_t numdata){ 22 | // NOTE: Convention - check that numdata given matches expected 23 | if(numdata != 2){//TODO: globally declare the array size instead of using the int value 24 | return ERR_FAIL; 25 | } 26 | int val = analogRead(pin); 27 | data[0].data = (float)val; 28 | data[1].data = (float)spt25_20_200a_map(val, 176.0, 1023.0, 0, 200.0); 29 | // TODO: other error conditions? 30 | return ERR_NONE; 31 | } 32 | -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/SPT25-20-0200A/SPT25-20-0200A.h: -------------------------------------------------------------------------------- 1 | #ifndef SPT25_20_0200A_H 2 | #define SPT25_20_0200A_H 3 | 4 | #include "Sensor.h" 5 | 6 | class SPT25_20_0200A : public Sensor { 7 | public: 8 | SPT25_20_0200A(uint8_t pin, arduino_t arduino); 9 | private: 10 | errorlevel_t read(t_datum* data, uint8_t numdata) override; 11 | errorlevel_t init() override; 12 | /** 13 | * Analog input pin. 14 | * */ 15 | uint8_t pin; 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/TMP006/TMP006.cpp: -------------------------------------------------------------------------------- 1 | #include "TMP006.h" 2 | 3 | const char* arr[2] = {"deg C [Object]", "deg C [Die]"}; 4 | t_datasetup datasetup = {2, arr}; 5 | 6 | TMP006::TMP006(uint8_t addr, arduino_t arduino) : Sensor(S_TMP006, arduino, datasetup, 250){ 7 | this->tmp006 = new Adafruit_TMP006(addr); 8 | } 9 | 10 | errorlevel_t TMP006::init(){ 11 | //TODO is tmp006.wake(); required after tmp006.begin() to turn on the tmp006 12 | return (tmp006->begin(TMP006_CFG_4SAMPLE) ? ERR_NONE : ERR_FAIL); 13 | } 14 | 15 | // TODO Calibrate temperature readings 16 | errorlevel_t TMP006::read(t_datum* data, uint8_t numdata){ 17 | // NOTE: Convention - check that numdata given matches expected 18 | if(numdata != 2){ //TODO: globally declare the array size instead of using the int value 19 | return ERR_FAIL; 20 | } 21 | 22 | // Copy buffer 23 | data[0].data = tmp006->readObjTempC(); 24 | data[1].data = tmp006->readDieTempC(); 25 | 26 | // TODO: other error conditions? 27 | return ERR_NONE; 28 | } 29 | -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/TMP006/TMP006.h: -------------------------------------------------------------------------------- 1 | #ifndef TMP006_H 2 | #define TMP006_H 3 | 4 | #include "Sensor.h" 5 | #include 6 | #include 7 | #include "Adafruit_TMP006.h" 8 | 9 | class TMP006 : public Sensor { 10 | public: 11 | TMP006(uint8_t addr, arduino_t arduino); 12 | private: 13 | Adafruit_TMP006* tmp006; 14 | errorlevel_t read(t_datum* data, uint8_t numdata) override; 15 | errorlevel_t init() override; 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /software/communications/libraries/sensor_headers/src/sensor_headers.h: -------------------------------------------------------------------------------- 1 | // Empty file. Needs to be imported for Arduino to recognize the sensor 2 | // header files. 3 | -------------------------------------------------------------------------------- /software/communications/libraries/zcm/nonblocking.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT MODIFY THIS FILE BY HAND 3 | */ 4 | #undef ZCM_EMBEDDED 5 | #define ZCM_EMBEDDED 6 | #ifndef _ZCM_NONBLOCKING_H 7 | #define _ZCM_NONBLOCKING_H 8 | 9 | #include "zcm.h" 10 | #include "transport.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | typedef struct zcm_nonblocking zcm_nonblocking_t; 17 | 18 | int zcm_nonblocking_try_create(zcm_nonblocking_t** zcm, zcm_t* z, zcm_trans_t* zt); 19 | 20 | void zcm_nonblocking_destroy(zcm_nonblocking_t* zcm); 21 | 22 | int zcm_nonblocking_publish(zcm_nonblocking_t* zcm, const char* channel, 23 | const uint8_t* data, uint32_t len); 24 | 25 | zcm_sub_t* zcm_nonblocking_subscribe(zcm_nonblocking_t* zcm, const char* channel, 26 | zcm_msg_handler_t cb, void* usr); 27 | 28 | int zcm_nonblocking_unsubscribe(zcm_nonblocking_t* zcm, zcm_sub_t* sub); 29 | 30 | /* Returns 1 if a message was dispatched, and 0 otherwise */ 31 | int zcm_nonblocking_handle_nonblock(zcm_nonblocking_t* zcm); 32 | 33 | void zcm_nonblocking_flush(zcm_nonblocking_t* zcm); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _ZCM_NONBLOCKING_H */ 40 | -------------------------------------------------------------------------------- /software/communications/libraries/zcm/transport/generic_serial_transport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT MODIFY THIS FILE BY HAND 3 | */ 4 | #undef ZCM_EMBEDDED 5 | #define ZCM_EMBEDDED 6 | #ifndef _ZCM_TRANS_NONBLOCKING_SERIAL_H 7 | #define _ZCM_TRANS_NONBLOCKING_SERIAL_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include 14 | 15 | #include "zcm.h" 16 | #include "transport.h" 17 | 18 | zcm_trans_t *zcm_trans_generic_serial_create( 19 | size_t (*get)(uint8_t* data, size_t nData, void* usr), 20 | size_t (*put)(const uint8_t* data, size_t nData, void* usr), 21 | void* put_get_usr, 22 | uint64_t (*timestamp_now)(void* usr), 23 | void* time_usr, 24 | size_t MTU, size_t bufSize); 25 | 26 | // frees all resources inside of zt and frees zt itself 27 | void zcm_trans_generic_serial_destroy(zcm_trans_t* zt); 28 | 29 | int serial_update_rx(zcm_trans_t *zt); 30 | int serial_update_tx(zcm_trans_t *zt); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif /* _ZCM_TRANS_NONBLOCKING_SERIAL_H */ 37 | -------------------------------------------------------------------------------- /software/communications/libraries/zcm/zcm_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT MODIFY THIS FILE BY HAND 3 | */ 4 | #undef ZCM_EMBEDDED 5 | #define ZCM_EMBEDDED 6 | /* This file hides some internal data structs from public header files */ 7 | #ifndef _ZCM_PRIVATE_H 8 | #define _ZCM_PRIVATE_H 9 | 10 | #include "zcm.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /* A subscription descriptor object */ 17 | struct zcm_sub_t 18 | { 19 | char channel[ZCM_CHANNEL_MAXLEN + 1]; 20 | int regex; /* true(1) or false(0) */ 21 | void *regexobj; 22 | zcm_msg_handler_t callback; 23 | void *usr; 24 | }; 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /software/communications/libraries/zcm_types/library.properties: -------------------------------------------------------------------------------- 1 | name=ZCM_Types 2 | version=1.0 3 | author=UTHT 4 | maintainer=UTHT 5 | sentence=ZCM types 6 | paragraph=are generated here 7 | category=Communication 8 | url=utht.com 9 | architectures=* -------------------------------------------------------------------------------- /software/communications/libraries/zcm_types/src/source/channel_array_msg.zcm: -------------------------------------------------------------------------------- 1 | struct channel_array 2 | { 3 | int8_t arduino_id; 4 | string sensor; 5 | int64_t sz; 6 | double data[sz]; 7 | string units; 8 | } -------------------------------------------------------------------------------- /software/communications/libraries/zcm_types/src/source/channel_msg.zcm: -------------------------------------------------------------------------------- 1 | struct channel_msg { 2 | int8_t arduino_id; 3 | int8_t sensor_id; 4 | double sensor_value; 5 | } -------------------------------------------------------------------------------- /software/communications/libraries/zcm_types/src/source/test_msg.zcm: -------------------------------------------------------------------------------- 1 | struct test_msg 2 | { 3 | string str; 4 | } -------------------------------------------------------------------------------- /software/communications/libraries/zcm_utht/zcm_utht.cpp: -------------------------------------------------------------------------------- 1 | #include "zcm_utht.h" 2 | 3 | zcm_t* create_zcm(int port) { 4 | zcm_trans_t* zcm_trans = arduino_transport_create(port); 5 | return zcm_create_from_trans(zcm_trans); 6 | } 7 | -------------------------------------------------------------------------------- /software/communications/libraries/zcm_utht/zcm_utht.h: -------------------------------------------------------------------------------- 1 | #ifndef ZCM_UTHT_H 2 | #define ZCM_UTHT_H 3 | 4 | #include "../arduino_cobs_serial_transport/arduino_cobs_serial_transport.hpp" 5 | 6 | zcm_t* create_zcm(int port); 7 | 8 | 9 | #endif -------------------------------------------------------------------------------- /software/communications/odroid/channel_handler/channel_handler.hpp: -------------------------------------------------------------------------------- 1 | //Header file for Channel Handler 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | 11 | bool subscribeToChannels(char *serial_port); 12 | void add_to_channel(Channel temp); 13 | void populate_channel_map(); 14 | 15 | // ChannelHandler(vector channels); -------------------------------------------------------------------------------- /software/communications/odroid/channel_handler/channels.json: -------------------------------------------------------------------------------- 1 | { 2 | "channels": [ 3 | { 4 | "sensor": "temperature_1", 5 | "serial_port": "/dev/cu.usbmodem14501", 6 | "arduino_id": "1", 7 | "min_value": 10, 8 | "max_value": 30 9 | }, 10 | { 11 | "sensor": "resistance_1", 12 | "serial_port": "/dev/cu.usbmodem14501", 13 | "arduino_id": "2", 14 | "min_value": 1, 15 | "max_value": 5 16 | }, 17 | { 18 | "sensor": "voltage_1", 19 | "serial_port": "/dev/cu.usbmodem14501", 20 | "arduino_id": "3", 21 | "min_value": 1, 22 | "max_value": 10 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /software/communications/odroid/reading_from_zcm_channels/channel_class_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/communications/odroid/reading_from_zcm_channels/channel_class_test -------------------------------------------------------------------------------- /software/communications/odroid/reading_from_zcm_channels/reading_from_zcm_channels: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/communications/odroid/reading_from_zcm_channels/reading_from_zcm_channels -------------------------------------------------------------------------------- /software/communications/odroid/reading_from_zcm_channels/reading_from_zcm_channels.cpp: -------------------------------------------------------------------------------- 1 | // #include 2 | // #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | int main(int argc, char** argv) { 12 | char* serial_port; 13 | 14 | // Get the serial port from the Arduino IDE and pass it to the program. 15 | if (argc == 2) { 16 | serial_port = argv[1]; 17 | } else { 18 | serial_port = (char *) "/dev/cu.usbmodem14501"; 19 | } 20 | 21 | cout << "Listening on port: " << serial_port << endl; 22 | 23 | // Define the sensor and subscribe to the channel 24 | Channel SPT("SPT25-20-0200A", (string) serial_port, (string) "ARDUINO1", 0, 1000); 25 | Channel TMP("TMP006", (string) serial_port, (string) "ARDUINO1", 0, 1000); 26 | 27 | SPT.subscribeToChannel(); 28 | TMP.subscribeToChannel(); 29 | 30 | while (true) { 31 | for (auto it : channel_map) { 32 | Channel* channel = it.second; 33 | zcm_handle_nonblock(channel->getZCM()); 34 | } 35 | } 36 | 37 | return 0; 38 | } -------------------------------------------------------------------------------- /software/communications/odroid/zcm_receive/zcm_receive: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/communications/odroid/zcm_receive/zcm_receive -------------------------------------------------------------------------------- /software/communications/odroid/zcm_receive/zcm_receive.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | static void test_msg_handler(const zcm_recv_buf_t* rbuf, const char* channel, const test_msg* msg, void* user) { 11 | cout << "Message received on channel: " << channel << endl; 12 | cout << "Message: " << msg->str << endl; 13 | } 14 | 15 | int main(int argc, char** argv) { 16 | char* serial_port; 17 | 18 | // Get the serial port from the Arduino IDE and pass it to the program. 19 | if (argc == 2) { 20 | serial_port = argv[1]; 21 | } else { 22 | serial_port = (char *) "/dev/cu.usbmodem14501"; 23 | } 24 | 25 | cout << "Listening on port: " << serial_port << endl; 26 | 27 | zcm_trans_t* linux_cobs_serial_transport = linux_cobs_serial_transport_create(serial_port); 28 | zcm_t* zcm = zcm_create_from_trans(linux_cobs_serial_transport); 29 | 30 | test_msg_subscribe(zcm, "TEST", &test_msg_handler, NULL); 31 | 32 | while (true) { 33 | zcm_handle_nonblock(zcm); 34 | } 35 | 36 | return 0; 37 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line. 18 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 19 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/README.md: -------------------------------------------------------------------------------- 1 | # AngularFrontend 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ 31 | spec: { 32 | displayStacktrace: StacktraceOption.PRETTY 33 | } 34 | })); 35 | } 36 | }; -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('AngularFrontend app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/AngularFrontend'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { LayoutComponent } from './components/layout/layout.component'; 4 | import { LogsComponent } from './components/logs/logs.component'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | pathMatch: 'full', 10 | component: LayoutComponent 11 | }, 12 | { 13 | path: 'logs', 14 | component: LogsComponent 15 | } 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [RouterModule.forRoot(routes)], 20 | exports: [RouterModule] 21 | }) 22 | export class AppRoutingModule { } 23 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/app/app.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { WebsocketService } from './services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'], 8 | }) 9 | export class AppComponent{ 10 | title = "AngularFrontend"; 11 | 12 | constructor(private websocket: WebsocketService){ 13 | websocket.connect() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/controls/controls.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/app/components/controls/controls.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/controls/controls.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/controls/controls.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ControlsComponent } from './controls.component'; 4 | 5 | describe('ControlsComponent', () => { 6 | let component: ControlsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ControlsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ControlsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/controls/controls.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'app-controls', 6 | templateUrl: './controls.component.html', 7 | styleUrls: ['./controls.component.css'] 8 | }) 9 | export class ControlsComponent implements OnInit { 10 | 11 | constructor(private wsService: WebsocketService) { } 12 | 13 | ngOnInit(): void { 14 | } 15 | 16 | onClick(){ 17 | this.wsService.getMockData() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/battery/battery.component.css: -------------------------------------------------------------------------------- 1 | .battery { 2 | display: flex; 3 | flex-wrap: nowrap; 4 | } 5 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/battery/battery.component.html: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |
12 |
13 | 14 |
15 |
16 |
17 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/brake/brake-gauge/brake-gauge.component.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/brake/brake-gauge/brake-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'brake-gauge-component', 5 | templateUrl: './brake-gauge.component.html' 6 | }) 7 | export class BrakeGaugeComponent { 8 | @Input() brakePressure: number; 9 | @Input() name: string; 10 | 11 | gaugeType = "arch"; 12 | gaugeValue = 0; 13 | gaugeLabel = ""; 14 | gaugeAppendText = "bar"; 15 | 16 | ngOnInit() { 17 | this.gaugeValue = this.brakePressure; 18 | this.gaugeLabel = this.name; 19 | this.getBrakePressure(); 20 | } 21 | getBrakePressure() { 22 | this.gaugeValue = Math.round(this.brakePressure * 10) / 10; 23 | setTimeout(() => { this.getBrakePressure(); }, 50); 24 | } 25 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/brake/brake-graph/brake-graph.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 13 |
14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/brake/brake.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 | 11 |
12 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/gauge-nvibration.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 |
7 | 8 |
9 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/gauge-nvibration.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'app-gaugenvibration', 6 | templateUrl: './gauge-nvibration.component.html', 7 | styleUrls: ['./gauge-nvibration.component.css'] 8 | }) 9 | export class GaugeNvibrationComponent implements OnInit { 10 | 11 | constructor(private wsService: WebsocketService) { } 12 | 13 | ngOnInit(): void { 14 | } 15 | 16 | 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | 12 | 13 |
14 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../../services/websocket.service'; 3 | 4 | 5 | @Component({ 6 | selector: 'gauge-height', 7 | templateUrl: './gaugeheight.component.html', 8 | styleUrls: ['./gaugeheight.component.css'] 9 | }) 10 | export class GaugeheightComponent implements OnInit { 11 | 12 | speed: number; 13 | 14 | gaugeType = "arch"; 15 | gaugeValue = 0; 16 | gaugeLabel = "Gap Height"; 17 | gaugeAppendText = ""; 18 | constructor(private wsService: WebsocketService) { } 19 | 20 | ngOnInit(): void { 21 | this.randomize(); 22 | } 23 | 24 | randomize() { 25 | this.wsService.history.subscribe(historyArray => { 26 | if (historyArray && historyArray.length > 0){ 27 | //console.log(historyArray); 28 | this.gaugeValue = historyArray[historyArray.length-1].obj.GAPHEIGHT[0]._value; 29 | 30 | } 31 | }) 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | 11 | 12 |
13 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../../services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'vibration-gauge', 6 | templateUrl: './vibration.component.html', 7 | styleUrls: ['./vibration.component.css'] 8 | }) 9 | export class VibrationComponent implements OnInit { 10 | 11 | speed: number; 12 | 13 | vibrationType = "arch"; 14 | vibrationValue = 0; 15 | vibrationLabel = "Vibration"; 16 | vibrationAppendText = ""; 17 | 18 | constructor(private wsService: WebsocketService) { } 19 | 20 | ngOnInit(): void { 21 | this.randomize(); 22 | } 23 | 24 | randomize() { 25 | this.wsService.history.subscribe(historyArray => { 26 | if (historyArray && historyArray.length > 0){ 27 | //console.log(historyArray); 28 | this.vibrationValue = historyArray[historyArray.length-1].obj.VIBRATION[0]._value; 29 | 30 | } 31 | }) 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/position/position.component.html: -------------------------------------------------------------------------------- 1 | 10 |
11 |
12 | 13 | 14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/position/position.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PositionComponent } from './position.component'; 4 | 5 | const testCases = [ 6 | { 7 | position: 0 8 | }, 9 | { 10 | position: 25 11 | }, 12 | { 13 | position: 100 14 | } 15 | ] 16 | 17 | testCases.forEach(test => { 18 | describe('PositionComponent', () => { 19 | let component: PositionComponent; 20 | let fixture: ComponentFixture; 21 | 22 | beforeEach(async () => { 23 | await TestBed.configureTestingModule({ 24 | declarations: [PositionComponent] 25 | }) 26 | .compileComponents(); 27 | }); 28 | 29 | beforeEach(() => { 30 | fixture = TestBed.createComponent(PositionComponent); 31 | component = fixture.componentInstance; 32 | 33 | component.position = test.position; 34 | 35 | fixture.detectChanges(); 36 | }); 37 | 38 | it('should create', () => { 39 | expect(component).toBeTruthy(); 40 | }); 41 | 42 | it('should be defined', () => { 43 | expect(component.position).toBeDefined(); 44 | }) 45 | 46 | it('should match input', () => { 47 | expect(component.position).toEqual(test.position); 48 | }) 49 | }); 50 | }); -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/position/position.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | /** 4 | * @title Determinate progress-bar 5 | */ 6 | @Component({ 7 | selector: 'position-component', 8 | templateUrl: './position.component.html', 9 | }) 10 | export class PositionComponent { 11 | mode = 'determinate'; 12 | color = 'warn'; 13 | @Input() public position: number = 0; 14 | 15 | ngOnInit(): void { 16 | //this.updatePosition(); 17 | } 18 | 19 | updatePosition() { 20 | this.position += 0.1; 21 | // update every 0.1s 22 | setTimeout(() => { this.updatePosition(); }, 100); 23 | } 24 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/speed/speed-gauge/speed-gauge.component.html: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/speed/speed-gauge/speed-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'speed-gauge-component', 5 | templateUrl: './speed-gauge.component.html' 6 | }) 7 | export class SpeedGaugeComponent { 8 | @Input() 9 | speed: number; 10 | 11 | gaugeType = "arch"; 12 | gaugeValue = 0; 13 | gaugeLabel = "Speed"; 14 | gaugeAppendText = "km/h"; 15 | 16 | ngOnInit() { 17 | this.gaugeValue = this.speed; 18 | this.getSpeed(); 19 | } 20 | getSpeed() { 21 | this.gaugeValue = this.speed | 0; 22 | setTimeout(() => { this.getSpeed(); }, 50); 23 | } 24 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/speed/speed-graph/speed-graph.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 13 |
14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/speed/speed.component.html: -------------------------------------------------------------------------------- 1 | 15 |
16 | 20 |
21 | 24 |
25 |
26 | 28 |
29 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/speed/speed.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'speed-component', 6 | templateUrl: './speed.component.html', 7 | // styleUrls: ['./speed.component.css'] 8 | }) 9 | export class SpeedComponent implements OnInit { 10 | currSpeed = 0; 11 | speedArray = [[0,0]]; 12 | count = 0; 13 | 14 | constructor(private wsService: WebsocketService) { } 15 | 16 | ngOnInit(): void { 17 | this.randomize(); 18 | } 19 | randomize() { 20 | // Gauge updates every 50ms 21 | // Graph updates every 5s 22 | 23 | this.wsService.history.subscribe(historyArray => { 24 | if (historyArray && historyArray.length > 0){ 25 | //console.log(historyArray); 26 | this.currSpeed = historyArray[historyArray.length-1].obj.VELOCITY[0]._value; 27 | this.count += 50; 28 | // if (this.count % 5000 == 0){ 29 | this.speedArray.push([this.count/1000,Math.floor(this.currSpeed)]) 30 | if (this.speedArray.length > 10){ 31 | this.speedArray.shift(); 32 | } 33 | // } 34 | } 35 | }) 36 | } 37 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/switch/switch.component.html: -------------------------------------------------------------------------------- 1 | 8 |
9 | 10 |
11 | 12 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/switch/switch.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'switch-component', 5 | templateUrl: './switch.component.html', 6 | }) 7 | export class SwitchComponent {} -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/temperature/temperature-gauge/temperature-gauge.component.html: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/temperature/temperature-gauge/temperature-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'temperature-gauge-component', 5 | templateUrl: './temperature-gauge.component.html' 6 | }) 7 | export class TemperatureGaugeComponent { 8 | @Input() temperature: number; 9 | @Input() name: string; 10 | 11 | gaugeType = "semi"; 12 | gaugeValue = 0; 13 | gaugeLabel = ""; 14 | gaugeAppendText = "°C"; 15 | 16 | ngOnInit() { 17 | this.gaugeValue = this.temperature; 18 | this.gaugeLabel = this.name; 19 | this.getTemperature(); 20 | } 21 | getTemperature() { 22 | this.gaugeValue = this.temperature | 0; 23 | setTimeout(() => { this.getTemperature(); }, 50); 24 | } 25 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/temperature/temperature-graph/temperature-graph.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 13 |
14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/temperature/temperature.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 | 12 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/dashboard/temperature/temperature.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../services/websocket.service'; 3 | 4 | 5 | @Component({ 6 | selector: 'temperature-component', 7 | templateUrl: './temperature.component.html', 8 | // styleUrls: ['./temperature.component.css'] 9 | }) 10 | export class TemperatureComponent implements OnInit { 11 | @Input() label: string; 12 | @Input() temp: number; 13 | @Input() idNum: string; 14 | currTemperature = 0; 15 | temperatureArray = [[0,0]]; 16 | count = 0; 17 | 18 | constructor(private wsService: WebsocketService) { } 19 | 20 | ngOnInit(): void { 21 | this.updateTemperature(); 22 | } 23 | updateTemperature() { 24 | this.wsService.history.subscribe(historyArray => { 25 | if (historyArray && historyArray.length > 0){ 26 | //console.log(historyArray); 27 | this.currTemperature = historyArray[historyArray.length-1].obj.TEMPERATURE[this.idNum]._value; 28 | this.count += 50; 29 | // if (this.count % 5000 == 0){ 30 | this.temperatureArray.push([this.count/1000,Math.floor(this.currTemperature)]) 31 | if (this.temperatureArray.length > 10){ 32 | this.temperatureArray.shift(); 33 | } 34 | // } 35 | } 36 | }) 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/icons/battery/battery.component.html: -------------------------------------------------------------------------------- 1 | 9 |
10 | 11 |
12 |
13 |
14 |
15 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/icons/battery/battery.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BatteryPercentageComponent } from './battery.component'; 4 | 5 | describe('BatteryPercentageComponent', () => { 6 | let component: BatteryPercentageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BatteryPercentageComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BatteryPercentageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/icons/battery/battery.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input, AfterViewInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'battery-component', 5 | templateUrl: './battery.component.html' 6 | }) 7 | export class BatteryPercentageComponent { 8 | @Input() public color: string; 9 | @Input() public percentage: number; 10 | arrayColor = []; 11 | totalPin = 5; 12 | pinColor = '#efefed'; 13 | 14 | constructor() {} 15 | 16 | ngOnInit() { 17 | this.color = '#3DCC93'; 18 | this.percentage = 100; 19 | this.renderArrayColor(); 20 | } 21 | 22 | renderArrayColor() { 23 | const part = 100 / this.totalPin; 24 | let currentLevel = 0 + part; 25 | for (let i = 0; i < this.totalPin; i++) { 26 | if (this.percentage >= currentLevel) { 27 | this.arrayColor.push({ full: true, color: this.color, width: '70px' }); 28 | currentLevel += part; 29 | } else { 30 | const newWidth = ((this.percentage - currentLevel + part) * 70) / 20; 31 | this.arrayColor.push({ full: false, color: this.pinColor, width: newWidth + 'px' }); 32 | for (let j = i + 1; j < this.totalPin; j++) { 33 | this.arrayColor.push({ full: true, color: this.pinColor, width: '70px' }); 34 | } 35 | break; 36 | } 37 | } 38 | } 39 | 40 | public randomize(): void { 41 | this.arrayColor = [] 42 | this.percentage -= 1; 43 | this.renderArrayColor(); 44 | setTimeout(() => { this.randomize(); }, 200); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/icons/speedometer/ng2-gauge/ng2-gauge.component.html: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/icons/speedometer/ng2-gauge/ng2-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ng2-gauge-component', 5 | templateUrl: './ng2-gauge.component.html' 6 | }) 7 | export class Ng2GaugeComponent { 8 | input = 5000; 9 | max = 9000; 10 | sectors = [{ 11 | from: 6500, 12 | to: 8000, 13 | color: 'orange' 14 | }, { 15 | from: 8000, 16 | to: 9000, 17 | color: 'red' 18 | }]; 19 | public randomize(): void { 20 | 21 | this.input += Math.round(4* (Math.round(Math.random()) * 4 - 1)); 22 | setTimeout(() => { this.randomize(); }, 50); 23 | } 24 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/icons/speedometer/ngx-gauge/ngx-gauge.component.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/icons/speedometer/ngx-gauge/ngx-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ngx-gauge-component', 5 | templateUrl: './ngx-gauge.component.html' 6 | }) 7 | export class NgxGaugeComponent { 8 | 9 | gaugeType = "semi"; 10 | gaugeValue = 28.3; 11 | gaugeLabel = "Speed"; 12 | gaugeAppendText = "km/hr"; 13 | 14 | public randomize(): void { 15 | 16 | this.gaugeValue += 0.1*(Math.round(Math.random()) * 4 - 1); 17 | setTimeout(() => { this.randomize(); }, 50); 18 | } 19 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/layout/layout.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LayoutComponent } from './layout.component'; 4 | 5 | describe('LayoutComponent', () => { 6 | let component: LayoutComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LayoutComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LayoutComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/layout/layout.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-layout', 5 | templateUrl: './layout.component.html', 6 | styleUrls: ['./layout.component.css'] 7 | }) 8 | export class LayoutComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/logs/logs.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | height: 100vh; 3 | display: flex; 4 | align-items: center; 5 | } 6 | 7 | * { 8 | margin: 0; 9 | padding: 0; 10 | box-sizing: border-box; 11 | } 12 | 13 | .dashboard { 14 | max-width: 1444px; 15 | margin: auto; 16 | display: grid; 17 | grid-template-columns: repeat(3, 1fr); 18 | grid-template-rows: repeat(12, 1fr); 19 | height: 98vh; 20 | width: 100%; 21 | grid-gap: 10px; 22 | } 23 | 24 | /* Each region */ 25 | .dashboard > * { 26 | background: #232323; 27 | display: flex; 28 | justify-content: center; 29 | align-items: center; 30 | color: white; 31 | border-radius: 5px; 32 | padding: 0.5rem; 33 | } 34 | 35 | .switch { 36 | grid-column-start: 1; 37 | } 38 | 39 | .logs { 40 | grid-column: 2 / span 2; 41 | grid-row: 1 / span 12; 42 | display: flex; 43 | flex-wrap: wrap; 44 | justify-content: center; 45 | grid-gap: 20px; 46 | } 47 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/logs/logs.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 | Logs 7 |
8 |
9 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/logs/logs.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LogsComponent } from './logs.component'; 4 | 5 | describe('LogsComponent', () => { 6 | let component: LogsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LogsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LogsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/logs/logs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-logs', 5 | templateUrl: './logs.component.html', 6 | styleUrls: ['./logs.component.css'] 7 | }) 8 | export class LogsComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/podstate-item/podstate-item.component.css: -------------------------------------------------------------------------------- 1 | :host > div { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | text-align: center; 6 | background-color: #504f4f; 7 | height: 100%; 8 | font-size: 0.8rem; 9 | padding: 0 0.5rem; 10 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); 11 | border-radius: 2px; 12 | } 13 | 14 | .disable-select { 15 | -webkit-user-select: none; 16 | -moz-user-select: none; 17 | -ms-user-select: none; 18 | user-select: none; 19 | } 20 | 21 | .active { 22 | background: #53da70 !important; 23 | box-shadow: 0 0 5px 2px #53da70 !important; 24 | } 25 | 26 | .error { 27 | background-color: #e04949 !important; 28 | box-shadow: 0 0 5px 2px #e04949 !important; 29 | animation: blink 1000ms infinite; 30 | } 31 | 32 | @keyframes blink { 33 | 0% { 34 | background-color: #e04949 !important; 35 | } 36 | 100% { 37 | background-color: #504f4f !important; 38 | } 39 | } 40 | 41 | @media only screen and (max-height: 870px) { 42 | :host > div { 43 | font-size: 0.6rem; 44 | } 45 | } 46 | 47 | @media only screen and (max-height: 650px) { 48 | :host > div { 49 | white-space: nowrap; 50 | overflow: hidden; 51 | text-overflow: ellipsis; 52 | font-size: 0.5rem; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/podstate-item/podstate-item.component.html: -------------------------------------------------------------------------------- 1 |
2 | {{title}} 3 |
4 | 5 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/podstate-item/podstate-item.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PodstateItemComponent } from './podstate-item.component'; 4 | 5 | describe('PodstateItemComponent', () => { 6 | let component: PodstateItemComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PodstateItemComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PodstateItemComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/podstate-item/podstate-item.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-podstate-item', 5 | templateUrl: './podstate-item.component.html', 6 | styleUrls: ['./podstate-item.component.css'] 7 | }) 8 | export class PodstateItemComponent implements OnInit { 9 | @Input() title: string; 10 | @Input() isActive: Boolean =false; 11 | @Input() isError: Boolean; 12 | 13 | constructor() { } 14 | 15 | ngOnInit(): void { 16 | } 17 | 18 | toggleActive(): void { 19 | this.isActive = !this.isActive 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/podstate/podstate.component.html: -------------------------------------------------------------------------------- 1 |
2 |

{{stateGroupMap[group.name].title}}

3 |
4 | 5 |
6 |
7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/podstate/podstate.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PodstateComponent } from './podstate.component'; 4 | 5 | describe('PodstateComponent', () => { 6 | let component: PodstateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PodstateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PodstateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensor-group/sensor-group.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | /* border: 1px solid rgb(86, 86, 86); */ 3 | border-radius: 5px; 4 | padding: 5px; 5 | /* display: grid; 6 | grid-template-rows: auto 1fr; */ 7 | background: rgba(0, 0, 0, 0.6); 8 | display: flex; 9 | flex-wrap: wrap; 10 | align-items: center; 11 | justify-content: space-around; 12 | width: 75px; 13 | height: 75px; 14 | position: absolute; 15 | } 16 | 17 | h1 { 18 | font-size: 0.8rem; 19 | font-weight: 500; 20 | text-transform: capitalize; 21 | } 22 | 23 | .grid { 24 | display: grid; 25 | grid-template-columns: repeat(5, 1fr); 26 | grid-template-rows: repeat(4, 1fr); 27 | grid-gap: 2px; 28 | } 29 | 30 | /* .wrapper { 31 | position: relative; 32 | } */ 33 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensor-group/sensor-group.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensor-group/sensor-group.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-sensor-group', 5 | templateUrl: './sensor-group.component.html', 6 | styleUrls: ['./sensor-group.component.css'] 7 | }) 8 | export class SensorGroupComponent implements OnInit { 9 | @Input() title: string; 10 | 11 | @Input() data: any[]; 12 | 13 | constructor() { } 14 | 15 | ngOnInit(): void { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensor-item/sensor-item.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | align-items: center; 4 | } 5 | 6 | .indicator { 7 | width: 8px; 8 | height: 8px; 9 | border-radius: 1000px; 10 | background: #989898; 11 | margin-right: 0.4rem; 12 | } 13 | 14 | p { 15 | font-size: 0.8rem; 16 | line-height: 0.5rem; 17 | color: #c9c9c9; 18 | } 19 | 20 | .active { 21 | background: #53da70; 22 | box-shadow: 0 0 2px 1px #53da70; 23 | } 24 | 25 | .error { 26 | background: #e04949; 27 | box-shadow: 0 0 2px 1px #e04949; 28 | } 29 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensor-item/sensor-item.component.html: -------------------------------------------------------------------------------- 1 |
2 |

{{id}}

-------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensor-item/sensor-item.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SensorItemComponent } from './sensor-item.component'; 4 | 5 | describe('SensorItemComponent', () => { 6 | let component: SensorItemComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ SensorItemComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SensorItemComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensor-item/sensor-item.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-sensor-item', 5 | templateUrl: './sensor-item.component.html', 6 | styleUrls: ['./sensor-item.component.css'] 7 | }) 8 | export class SensorItemComponent implements OnInit { 9 | @Input() id:string; 10 | @Input() state:string; 11 | 12 | constructor() { } 13 | 14 | ngOnInit(): void { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensors/sensors.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | width: 100%; 3 | height: 100%; 4 | /* display: grid; 5 | grid-gap: 0.5rem; 6 | grid-template-columns: repeat(2, 1fr); 7 | grid-template-rows: auto 1fr 1fr; */ 8 | background-image: url("/assets/images/pod-bird-eye.png"); 9 | background-size: cover; 10 | } 11 | 12 | h1 { 13 | grid-column: 1/-1; 14 | font-size: 1rem; 15 | text-align: center; 16 | color: black; 17 | } 18 | 19 | .wrapper { 20 | position: relative; 21 | height: 100%; 22 | } 23 | 24 | .front { 25 | top: calc(53% - 50px); 26 | left: 10%; 27 | } 28 | .back { 29 | top: calc(53% - 50px); 30 | right: 15%; 31 | } 32 | .left { 33 | top: calc(33% - 50px); 34 | right: 50%; 35 | } 36 | .right { 37 | top: calc(73% - 50px); 38 | right: 50%; 39 | } 40 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensors/sensors.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/components/sensors/sensors.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SensorsComponent } from './sensors.component'; 4 | 5 | describe('SensorsComponent', () => { 6 | let component: SensorsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ SensorsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SensorsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/app/services/websocket.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { WebsocketService } from './websocket.service'; 4 | 5 | describe('WebsocketService', () => { 6 | let service: WebsocketService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(WebsocketService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/assets/.gitkeep -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/assets/braking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/assets/braking.png -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/assets/images/pod-bird-eye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/assets/images/pod-bird-eye.png -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.eot -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.ttf -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff2 -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/AngularFrontend/src/favicon.ico -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularFrontend 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | @import "~@angular/material/prebuilt-themes/purple-green.css"; 4 | 5 | @font-face { 6 | font-family: 'Open Sans'; 7 | src: url(/assets/open-sans-v18-latin/open-sans-v18-latin.ttf) format("truetype"); 8 | font-weight:300; 9 | } 10 | 11 | body { 12 | background: #434343; 13 | font-family: "Open Sans", sans-serif; 14 | } 15 | 16 | * { 17 | margin: 0; 18 | padding: 0; 19 | box-sizing: border-box; 20 | } 21 | 22 | html, body { height: 100%; } 23 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 24 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "module": "es2020", 15 | "lib": [ 16 | "es2018", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /software/core/Infrastructure/AngularFrontend/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/README.md: -------------------------------------------------------------------------------- 1 | # AngularFrontend 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ 31 | spec: { 32 | displayStacktrace: StacktraceOption.PRETTY 33 | } 34 | })); 35 | } 36 | }; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('AngularFrontend app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electron-main.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron') 2 | 3 | function createWindow () { 4 | const win = new BrowserWindow({ 5 | width: 800, 6 | height: 600, 7 | webPreferences: { 8 | nodeIntegration: true 9 | } 10 | }) 11 | 12 | win.loadFile('./dist/utht/index.html') 13 | } 14 | 15 | app.whenReady().then(createWindow) 16 | 17 | app.on('window-all-closed', () => { 18 | if (process.platform !== 'darwin') { 19 | app.quit() 20 | } 21 | }) 22 | 23 | app.on('activate', () => { 24 | if (BrowserWindow.getAllWindows().length === 0) { 25 | createWindow() 26 | } 27 | }) 28 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UTHT Dashboard 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/index.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron') 2 | const path = require('path') 3 | const WebSocketController = require('./controller/controller'); 4 | 5 | function createWindow () { 6 | WebSocketController() 7 | const win = new BrowserWindow({ 8 | width: 1200, 9 | height: 800, 10 | webPreferences: { 11 | preload: path.join(__dirname, 'preload.js') 12 | } 13 | }) 14 | 15 | win.loadFile('./dist/AngularFrontend/index.html') 16 | //win.loadURL('http://localhost:8080'); 17 | win.focus(); 18 | // mainWindow.setFullScreen(true); 19 | 20 | // Open the DevTools. 21 | win.webContents.openDevTools(); 22 | 23 | ipcMain.handle('dark-mode:toggle', () => { 24 | if (nativeTheme.shouldUseDarkColors) { 25 | nativeTheme.themeSource = 'light' 26 | } else { 27 | nativeTheme.themeSource = 'dark' 28 | } 29 | return nativeTheme.shouldUseDarkColors 30 | }) 31 | } 32 | 33 | app.whenReady().then(() => { 34 | createWindow() 35 | }) 36 | 37 | app.on('window-all-closed', () => { 38 | if (process.platform !== 'darwin') { 39 | app.quit() 40 | } 41 | }) 42 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/acceleration-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class AccelerationSensor extends Sensor { 4 | sensor_type = "ACCELERATION"; 5 | constructor(value, name = "acceleration") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = AccelerationSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/battery-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class BatterySensor extends Sensor { 4 | sensor_type = "BATTERY"; 5 | constructor(value, name = "battery") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | // const sensor1 = new BatterySensor("mysensor", 2); 12 | 13 | // console.log(sensor1.name); 14 | // console.log(sensor1.value); 15 | 16 | // sensor1.name = "updatedsensor"; 17 | // sensor1.value = 3; 18 | 19 | // console.log(sensor1.name); 20 | // console.log(sensor1.value); 21 | 22 | module.exports = BatterySensor; 23 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/dc_current-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class DCcurrentSensor extends Sensor { 4 | sensor_type = "DC_CURRENT"; 5 | constructor(value, name = "dc_current") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = DCcurrentSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/gapHeight-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class GapHeightSensor extends Sensor { 4 | sensor_type = "GAPHEIGHT"; 5 | constructor(value, name = "gapHeight") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = GapHeightSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/position-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class PositionSensor extends Sensor { 4 | sensor_type = "POSITION"; 5 | constructor(x, y, name = "position") { 6 | super(name); 7 | this._x = x; 8 | this._y = y; 9 | this._name = name; 10 | this.value = [this._x, this._y]; 11 | } 12 | 13 | set x(value) { 14 | this._x = value; 15 | } 16 | 17 | set y(value) { 18 | this._y = value; 19 | } 20 | get x() { 21 | return this._x; 22 | } 23 | 24 | get y() { 25 | return this._y; 26 | } 27 | 28 | get coordinates() { 29 | return [this._x, this._y]; 30 | } 31 | } 32 | 33 | // const sensor1 = new PositionSensor("mysensor", 2, 3.21, 4.66); 34 | 35 | // console.log(sensor1.name); 36 | // console.log(sensor1.value); 37 | // console.log(sensor1.x); 38 | // console.log(sensor1.y); 39 | // console.log(sensor1.coordinates); 40 | 41 | // sensor1.name = "updatedsensor"; 42 | // sensor1.value = 3; 43 | // sensor1.x = 3.6; 44 | // sensor1.y = 4.6; 45 | 46 | // console.log(sensor1.name); 47 | // console.log(sensor1.value); 48 | // console.log(sensor1.x); 49 | // console.log(sensor1.y); 50 | // console.log(sensor1.coordinates); 51 | 52 | module.exports = PositionSensor; 53 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/pressure-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class PressureSensor extends Sensor { 4 | sensor_type = "PRESSURE"; 5 | 6 | constructor(value, name = "pressure") { 7 | super(name, value); 8 | this._name = name; 9 | } 10 | } 11 | 12 | module.exports = PressureSensor; 13 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/sensor.js: -------------------------------------------------------------------------------- 1 | //Which ever sensor inherited from this class should make use of the value property when possible 2 | //avoid unit-specific property such as pressure - this makes it harder on the front-end to parse 3 | 4 | class Sensor { 5 | sensor_type = ""; 6 | constructor(name, value = null) { 7 | this._name = name; 8 | this._value = value; 9 | } 10 | 11 | get name() { 12 | return this._name; 13 | } 14 | 15 | get value() { 16 | return this._value; 17 | } 18 | 19 | set name(newName) { 20 | this._name = newName; 21 | } 22 | 23 | set value(newValue) { 24 | this._value = newValue; 25 | } 26 | 27 | get sensor_type() { 28 | return this.sensor_type; 29 | } 30 | } 31 | 32 | // const sensor1 = new Sensor("mysensor", 2); 33 | 34 | // console.log(sensor1.name); 35 | // console.log(sensor1.value); 36 | 37 | // sensor1.name = "updatedsensor"; 38 | // sensor1.value = 3; 39 | 40 | // console.log(sensor1.name); 41 | // console.log(sensor1.value); 42 | 43 | module.exports = Sensor; 44 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/state_machine-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class StateMachineSensor extends Sensor { 4 | sensor_type = "StateMachineSensor"; 5 | constructor(value, name = "state") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | // const sensor1 = new BatterySensor("mysensor", 2); 12 | 13 | // console.log(sensor1.name); 14 | // console.log(sensor1.value); 15 | 16 | // sensor1.name = "updatedsensor"; 17 | // sensor1.value = 3; 18 | 19 | // console.log(sensor1.name); 20 | // console.log(sensor1.value); 21 | 22 | module.exports = StateMachineSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/temp-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class TempSensor extends Sensor { 4 | sensor_type = "TEMPERATURE"; 5 | constructor(name, value) { 6 | super(name, value); 7 | } 8 | } 9 | 10 | // const sensor1 = new TempSensor("mysensor", 2); 11 | 12 | // console.log(sensor1.name); 13 | // console.log(sensor1.value); 14 | 15 | // sensor1.name = "updatedsensor"; 16 | // sensor1.value = 3; 17 | 18 | // console.log(sensor1.name); 19 | // console.log(sensor1.value); 20 | 21 | module.exports = TempSensor; 22 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/velocity-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class VelocitySensor extends Sensor { 4 | sensor_type = "VELOCITY"; 5 | 6 | constructor(value, name = "velocity") { 7 | super(name, value); 8 | this._name = name; 9 | } 10 | } 11 | 12 | // const sensor1 = new SpeedSensor("mysensor", 2); 13 | 14 | // console.log(sensor1.name); 15 | // console.log(sensor1.value); 16 | 17 | // sensor1.name = "updatedsensor"; 18 | // sensor1.value = 3; 19 | 20 | // console.log(sensor1.name); 21 | // console.log(sensor1.value); 22 | 23 | module.exports = VelocitySensor; 24 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Classes/vibration-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class VibrationSensor extends Sensor { 4 | sensor_type = "VIBRATION"; 5 | constructor(value, name = "vibration") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = VibrationSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Digester/README.md: -------------------------------------------------------------------------------- 1 | # Digster Module Crash Report 2 | 3 | - when speed object completely removed 4 | - TypeError: Cannot read property 'map' of undefined 5 | - when temperature object completely removed 6 | - TypeError: Cannot read property 'map' of undefined 7 | - position completely removed 8 | - TypeError: Cannot read property '0' of undefined 9 | - when brakes object completely removed 10 | - TypeError: Cannot read property 'map' of undefined 11 | - when battery object completely removed 12 | - TypeError: Cannot read property 'map' of undefined 13 | 14 | 15 | ## Other notes: 16 | - For brakes, not accounting for "status" -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/Encapsulate/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "speed": [ 3 | { 4 | "name": "speed", "value":250 5 | } 6 | ], 7 | "temperatures": [ 8 | { 9 | "name": "motor", "value":56 10 | }, 11 | { "name": "battery", "value": 78} 12 | ], 13 | "position" : [127, 46], 14 | "brakes":[ 15 | { 16 | "name": "brakes_left", "status": 0,"pressure":257 17 | }, 18 | { 19 | "name": "brakes_right", "status": 0,"pressure":257 20 | } 21 | ], 22 | "battery":[ 23 | { 24 | "name" : "battery_1", "value":67 25 | }, 26 | { 27 | "name" : "battery_2", "value":64 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/constant/classes.js: -------------------------------------------------------------------------------- 1 | const classes_constants = { 2 | 0: "SPEED", 3 | 1: "TEMPERATURE", 4 | 2: "POSITION", 5 | 3: "BATTERY", 6 | }; 7 | 8 | module.exports = classes_constants; 9 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/dataCorrector/commonErrors.json: -------------------------------------------------------------------------------- 1 | { 2 | "negativeValueError": "", 3 | "nullValueError": "", 4 | "valueNotFoundError": "", 5 | "nameNotFoundError": "", 6 | "statusNotFoundError": "", 7 | "pressureNotFoundError": "", 8 | "speedNotFoundError": "", 9 | "temperatureNotFoundError": "", 10 | "positionNotFoundError": "", 11 | "brakesNotFoundError": "", 12 | "batteryNotFoundError": "", 13 | "valueExceedsThresholdError": "" 14 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/dataCorrector/test_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "speed": [ 3 | { 4 | "value": -8 5 | } 6 | ], 7 | "temperatures": [ 8 | { 9 | "value": 2300 10 | }, 11 | { 12 | "name": "helo", 13 | "value": 23 14 | } 15 | ], 16 | "position": [ 17 | 127, 18 | -46 19 | ], 20 | "brakes": [ 21 | { 22 | "status": 0, 23 | "pressure": 170.2323 24 | }, 25 | { 26 | "name": "brakes_right", 27 | "pressure": 243 28 | }, 29 | { 30 | "name": "brakes_right", 31 | "status": 1 32 | } 33 | ], 34 | "battery": [ 35 | { 36 | "value": 670 37 | }, 38 | { 39 | "name": "battery_2" 40 | } 41 | ], 42 | "current": [ 43 | { 44 | "value": "200" 45 | } 46 | ], 47 | "vibration": [ 48 | { 49 | "value": "200" 50 | } 51 | ], 52 | "gapHeight": [ 53 | { 54 | "value": "233" 55 | } 56 | ], 57 | "acceleration": [ 58 | { 59 | "value": "23" 60 | } 61 | ] 62 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/externalSocketParser/README.md: -------------------------------------------------------------------------------- 1 | # Parser 2 | 3 | Any receiving object from the socket will be first passed through a parser. The parser will convert any data sent from Odroid into JSON object. -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/externalSocketParser/parser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The function converts the String receiving from Odroid or JSON from Angular 3 | * and return JSON Object 4 | * @param {String} externalJson: String object recieving from the Odroid or JSON 5 | * object from Angular 6 | * @returns {Object}; return JSON Object for manipulation by backend 7 | */ 8 | 9 | const JSONParser = (externalJson) => { 10 | // If incoming data is from Odroid 11 | if ( 12 | externalJson !== null && 13 | typeof externalJson === "string" 14 | ) 15 | 16 | { 17 | let dataPreparation = externalJson.replace(/'/g, '"'); 18 | let JSONobject = JSON.parse(dataPreparation); 19 | return JSONobject; 20 | 21 | } else { 22 | // If incoming data is from dashbord 23 | return JSON.parse(externalJson); 24 | } 25 | } 26 | 27 | module.exports = JSONParser; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/utilities/broadcast.js: -------------------------------------------------------------------------------- 1 | const WebSocket = require("ws"); 2 | 3 | //A function to send messages to a specific clientType initialized into the ws object during the connection event 4 | function broadcast(wss, data, clientType) { 5 | wss.clients.forEach((client) => { 6 | if ( 7 | client.readyState === WebSocket.OPEN && 8 | client.clientType === clientType 9 | ) { 10 | client.send(JSON.stringify(data)); 11 | } 12 | }); 13 | } 14 | 15 | module.exports = broadcast; 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/utilities/mock.js: -------------------------------------------------------------------------------- 1 | const digest = require("../Digester"); 2 | const encapsulate = require("../Encapsulate"); 3 | 4 | //Return a mock object for the data that needs to be handled on the front-end 5 | 6 | function mock() { 7 | const newData = { 8 | speed: [ 9 | { 10 | name: "speed", 11 | value: 25 * Math.random(), 12 | }, 13 | ], 14 | temperatures: [ 15 | { 16 | name: "motor", 17 | value: 55 * Math.random() + 20, 18 | }, 19 | { name: "battery", value: 55 * Math.random() + 20}, 20 | ], 21 | position: [100 * Math.random(), 46], 22 | brakes: [ 23 | { 24 | name: "brakes_left", 25 | status: 0, 26 | value: 3 * Math.random(), 27 | }, 28 | { 29 | name: "brakes_right", 30 | status: 0, 31 | value: 3 * Math.random(), 32 | }, 33 | ], 34 | battery: [ 35 | { 36 | name: "battery_1", 37 | value: 100 * Math.random(), 38 | }, 39 | { 40 | name: "battery_2", 41 | value: 100 * Math.random(), 42 | }, 43 | ], 44 | }; 45 | 46 | const Digest = digest(newData); 47 | const Encapsulate = encapsulate(Digest); 48 | return Encapsulate; 49 | } 50 | 51 | module.exports = mock; 52 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/models/validator/commonErrors.js: -------------------------------------------------------------------------------- 1 | 2 | commonErrorsDict = { 3 | "0": "negativeValueError", 4 | "1": "nullValueError", 5 | "2": "valueNotFoundError", 6 | "3": "nameNotFoundError", 7 | "4": "statusNotFoundError", 8 | "5": "pressureNotFoundError", 9 | "6": "valueExceedsThresholdError", 10 | "7": "velocityNotFoundError", 11 | "8": "temperatureNotFoundError", 12 | "9": "positionNotFoundError", 13 | "10": "batteryNotFoundError", 14 | "11": "currentNotFoundError", 15 | "12": "vibrationNotFoundError", 16 | "13": "gapHeightNotFoundError", 17 | "14": "accelerationNotFoundError", 18 | "15": "podStateNotFoundError" 19 | } 20 | module.exports = commonErrorsDict; -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/preload.js: -------------------------------------------------------------------------------- 1 | const { contextBridge, ipcRenderer } = require('electron') 2 | 3 | contextBridge.exposeInMainWorld('darkMode', { 4 | toggle: () => ipcRenderer.invoke('dark-mode:toggle') 5 | }) 6 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/renderer.js: -------------------------------------------------------------------------------- 1 | document.getElementById('toggle-dark-mode').addEventListener('click', async () => { 2 | const isDarkMode = await window.darkMode.toggle() 3 | }) 4 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/electronSrc/style.css: -------------------------------------------------------------------------------- 1 | @media (prefers-color-scheme: dark) { 2 | body { background: #333; color: white; } 3 | } 4 | 5 | @media (prefers-color-scheme: light) { 6 | body { background: #ddd; color: black; } 7 | } 8 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/AngularFrontend'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import { LayoutComponent } from './components/layout/layout.component'; 4 | import { LogsComponent } from './components/logs/logs.component'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | pathMatch: 'full', 10 | component: LayoutComponent 11 | }, 12 | { 13 | path: 'logs', 14 | component: LogsComponent 15 | } 16 | ]; 17 | 18 | @NgModule({ 19 | imports: [RouterModule.forRoot(routes)], 20 | exports: [RouterModule] 21 | }) 22 | export class AppRoutingModule { } 23 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/app/app.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { WebsocketService } from './services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'], 8 | }) 9 | export class AppComponent{ 10 | title = "AngularFrontend"; 11 | 12 | constructor(private websocket: WebsocketService){ 13 | websocket.connect() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/controls/controls.component.css: -------------------------------------------------------------------------------- 1 | button{ 2 | margin: 15px; 3 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/controls/controls.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/controls/controls.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ControlsComponent } from './controls.component'; 4 | 5 | describe('ControlsComponent', () => { 6 | let component: ControlsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ControlsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ControlsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/controls/controls.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../services/websocket.service'; 3 | 4 | 5 | enum ButtonType{ 6 | Start = 0, 7 | Drive = 1, 8 | Emergency_button = 2 9 | } 10 | 11 | 12 | @Component({ 13 | selector: 'app-controls', 14 | templateUrl: './controls.component.html', 15 | styleUrls: ['./controls.component.css'] 16 | }) 17 | export class ControlsComponent implements OnInit { 18 | 19 | 20 | constructor(private wsService: WebsocketService) { } 21 | 22 | ngOnInit(): void { 23 | } 24 | 25 | onClickStart(){ 26 | this.wsService.sendButtonData(ButtonType.Start) 27 | } 28 | 29 | onClickDrive(){ 30 | this.wsService.sendButtonData(ButtonType.Drive) 31 | } 32 | 33 | onClickEmergency(){ 34 | this.wsService.sendButtonData(ButtonType.Emergency_button) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/acceleration/acceleration.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/app/components/dashboard/acceleration/acceleration.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/acceleration/acceleration.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 | 11 |
12 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/acceleration/acceleration.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AccelerationComponent } from './acceleration.component'; 4 | 5 | describe('AccelerationComponent', () => { 6 | let component: AccelerationComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AccelerationComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AccelerationComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/battery/battery.component.css: -------------------------------------------------------------------------------- 1 | .battery { 2 | display: flex; 3 | flex-wrap: nowrap; 4 | } 5 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/battery/battery.component.html: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |
12 |
13 | 14 |
15 |
16 |
17 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/brake/brake-gauge/brake-gauge.component.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/brake/brake-gauge/brake-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'brake-gauge-component', 5 | templateUrl: './brake-gauge.component.html' 6 | }) 7 | export class BrakeGaugeComponent { 8 | @Input() brakePressure: number; 9 | @Input() name: string; 10 | 11 | gaugeType = "arch"; 12 | gaugeValue = 0; 13 | gaugeLabel = ""; 14 | gaugeAppendText = "bar"; 15 | 16 | ngOnInit() { 17 | this.gaugeValue = this.brakePressure; 18 | this.gaugeLabel = this.name; 19 | this.getBrakePressure(); 20 | } 21 | getBrakePressure() { 22 | this.gaugeValue = Math.round(this.brakePressure * 10) / 10; 23 | setTimeout(() => { this.getBrakePressure(); }, 50); 24 | } 25 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/brake/brake-graph/brake-graph.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 13 |
14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/brake/brake.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 | 11 |
12 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/brake/brake.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, Output, OnInit, OnChanges, EventEmitter } from '@angular/core'; 2 | import {WebsocketService} from '../../../services/websocket.service'; 3 | 4 | 5 | 6 | @Component({ 7 | selector: 'brake-component', 8 | templateUrl: './brake.component.html', 9 | // styleUrls: ['./brake.component.css'] 10 | }) 11 | export class BrakeComponent implements OnInit { 12 | @Input() label: string; 13 | @Input() idNum: string; 14 | @Input() pressure: number; 15 | @Input() pressureArray: any[]; 16 | pressureDataPoints: any[]; 17 | currBrakePressure = 1; 18 | brakePressureArray = [[0,0]]; 19 | count = 0; 20 | 21 | constructor(private wsService: WebsocketService) { } 22 | 23 | ngOnInit(): void { 24 | this.randomize(); 25 | } 26 | 27 | randomize() { 28 | this.wsService.history.subscribe(historyArray => { 29 | if (historyArray && historyArray.length > 0){ 30 | //console.log(historyArray); 31 | this.currBrakePressure = historyArray[historyArray.length-1].obj.PRESSURE[this.idNum]._value; 32 | this.count += 50; 33 | // if (this.count % 5000 == 0){ 34 | this.brakePressureArray.push([this.count/1000,Math.floor(this.currBrakePressure)]) 35 | if (this.brakePressureArray.length > 10){ 36 | this.brakePressureArray.shift(); 37 | } 38 | // } 39 | } 40 | }) 41 | 42 | // setTimeout(() => { this.randomize(); }, 50); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/gauge-nvibration.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 |
7 | 8 |
9 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/gauge-nvibration.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'app-gaugenvibration', 6 | templateUrl: './gauge-nvibration.component.html', 7 | styleUrls: ['./gauge-nvibration.component.css'] 8 | }) 9 | export class GaugeNvibrationComponent implements OnInit { 10 | 11 | constructor(private wsService: WebsocketService) { } 12 | 13 | ngOnInit(): void { 14 | } 15 | 16 | 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | 12 | 13 |
14 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/gaugeheight/gaugeheight.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../../services/websocket.service'; 3 | 4 | 5 | @Component({ 6 | selector: 'gauge-height', 7 | templateUrl: './gaugeheight.component.html', 8 | styleUrls: ['./gaugeheight.component.css'] 9 | }) 10 | export class GaugeheightComponent implements OnInit { 11 | 12 | speed: number; 13 | 14 | gaugeType = "arch"; 15 | gaugeValue = 0; 16 | gaugeLabel = "Gap Height"; 17 | gaugeAppendText = ""; 18 | constructor(private wsService: WebsocketService) { } 19 | 20 | ngOnInit(): void { 21 | this.randomize(); 22 | } 23 | 24 | randomize() { 25 | this.wsService.history.subscribe(historyArray => { 26 | if (historyArray && historyArray.length > 0){ 27 | //console.log(historyArray); 28 | this.gaugeValue = historyArray[historyArray.length-1].obj.GAPHEIGHT[0]._value; 29 | 30 | } 31 | }) 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.css -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | 11 | 12 |
13 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/gauge-nvibration/vibration/vibration.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../../services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'vibration-gauge', 6 | templateUrl: './vibration.component.html', 7 | styleUrls: ['./vibration.component.css'] 8 | }) 9 | export class VibrationComponent implements OnInit { 10 | 11 | speed: number; 12 | 13 | vibrationType = "arch"; 14 | vibrationValue = 0; 15 | vibrationLabel = "Vibration"; 16 | vibrationAppendText = ""; 17 | 18 | constructor(private wsService: WebsocketService) { } 19 | 20 | ngOnInit(): void { 21 | this.randomize(); 22 | } 23 | 24 | randomize() { 25 | this.wsService.history.subscribe(historyArray => { 26 | if (historyArray && historyArray.length > 0){ 27 | //console.log(historyArray); 28 | this.vibrationValue = historyArray[historyArray.length-1].obj.VIBRATION[0]._value; 29 | 30 | } 31 | }) 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/position/position.component.html: -------------------------------------------------------------------------------- 1 | 10 |
11 |
12 | 13 | 14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/position/position.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PositionComponent } from './position.component'; 4 | 5 | const testCases = [ 6 | { 7 | position: 0 8 | }, 9 | { 10 | position: 25 11 | }, 12 | { 13 | position: 100 14 | } 15 | ] 16 | 17 | testCases.forEach(test => { 18 | describe('PositionComponent', () => { 19 | let component: PositionComponent; 20 | let fixture: ComponentFixture; 21 | 22 | beforeEach(async () => { 23 | await TestBed.configureTestingModule({ 24 | declarations: [PositionComponent] 25 | }) 26 | .compileComponents(); 27 | }); 28 | 29 | beforeEach(() => { 30 | fixture = TestBed.createComponent(PositionComponent); 31 | component = fixture.componentInstance; 32 | 33 | component.position = test.position; 34 | 35 | fixture.detectChanges(); 36 | }); 37 | 38 | it('should create', () => { 39 | expect(component).toBeTruthy(); 40 | }); 41 | 42 | it('should be defined', () => { 43 | expect(component.position).toBeDefined(); 44 | }) 45 | 46 | it('should match input', () => { 47 | expect(component.position).toEqual(test.position); 48 | }) 49 | }); 50 | }); -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/position/position.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | /** 4 | * @title Determinate progress-bar 5 | */ 6 | @Component({ 7 | selector: 'position-component', 8 | templateUrl: './position.component.html', 9 | }) 10 | export class PositionComponent { 11 | mode = 'determinate'; 12 | color = 'warn'; 13 | @Input() public position: number = 0; 14 | 15 | ngOnInit(): void { 16 | //this.updatePosition(); 17 | } 18 | 19 | updatePosition() { 20 | this.position += 0.1; 21 | // update every 0.1s 22 | setTimeout(() => { this.updatePosition(); }, 100); 23 | } 24 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/speed/speed-gauge/speed-gauge.component.html: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/speed/speed-gauge/speed-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'speed-gauge-component', 5 | templateUrl: './speed-gauge.component.html' 6 | }) 7 | export class SpeedGaugeComponent { 8 | @Input() 9 | speed: number; 10 | 11 | gaugeType = "arch"; 12 | gaugeValue = 0; 13 | gaugeLabel = "Speed"; 14 | gaugeAppendText = "km/h"; 15 | 16 | ngOnInit() { 17 | this.gaugeValue = this.speed; 18 | this.getSpeed(); 19 | } 20 | getSpeed() { 21 | this.gaugeValue = this.speed | 0; 22 | setTimeout(() => { this.getSpeed(); }, 50); 23 | } 24 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/speed/speed-graph/speed-graph.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 13 |
14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/speed/speed.component.html: -------------------------------------------------------------------------------- 1 | 15 |
16 | 20 |
21 | 24 |
25 |
26 | 28 |
29 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/speed/speed.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../services/websocket.service'; 3 | 4 | @Component({ 5 | selector: 'speed-component', 6 | templateUrl: './speed.component.html', 7 | // styleUrls: ['./speed.component.css'] 8 | }) 9 | export class SpeedComponent implements OnInit { 10 | currSpeed = 0; 11 | speedArray = [[0,0]]; 12 | count = 0; 13 | 14 | constructor(private wsService: WebsocketService) { } 15 | 16 | ngOnInit(): void { 17 | this.randomize(); 18 | } 19 | randomize() { 20 | // Gauge updates every 50ms 21 | // Graph updates every 5s 22 | 23 | this.wsService.history.subscribe(historyArray => { 24 | if (historyArray && historyArray.length > 0){ 25 | //console.log(historyArray); 26 | this.currSpeed = historyArray[historyArray.length-1].obj.VELOCITY[0]._value; 27 | this.count += 50; 28 | // if (this.count % 5000 == 0){ 29 | this.speedArray.push([this.count/1000,Math.floor(this.currSpeed)]) 30 | if (this.speedArray.length > 10){ 31 | this.speedArray.shift(); 32 | } 33 | // } 34 | } 35 | }) 36 | } 37 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/switch/switch.component.html: -------------------------------------------------------------------------------- 1 | 8 |
9 | 10 |
11 | 12 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/switch/switch.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'switch-component', 5 | templateUrl: './switch.component.html', 6 | }) 7 | export class SwitchComponent {} -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/temperature/temperature-gauge/temperature-gauge.component.html: -------------------------------------------------------------------------------- 1 |
2 | 8 | 9 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/temperature/temperature-gauge/temperature-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'temperature-gauge-component', 5 | templateUrl: './temperature-gauge.component.html' 6 | }) 7 | export class TemperatureGaugeComponent { 8 | @Input() temperature: number; 9 | @Input() name: string; 10 | 11 | gaugeType = "semi"; 12 | gaugeValue = 0; 13 | gaugeLabel = ""; 14 | gaugeAppendText = "°C"; 15 | 16 | ngOnInit() { 17 | this.gaugeValue = this.temperature; 18 | this.gaugeLabel = this.name; 19 | this.getTemperature(); 20 | } 21 | getTemperature() { 22 | this.gaugeValue = this.temperature | 0; 23 | setTimeout(() => { this.getTemperature(); }, 50); 24 | } 25 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/temperature/temperature-graph/temperature-graph.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 13 |
14 |
15 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/temperature/temperature.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 | 12 |
-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/dashboard/temperature/temperature.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import {WebsocketService} from '../../../services/websocket.service'; 3 | 4 | 5 | @Component({ 6 | selector: 'temperature-component', 7 | templateUrl: './temperature.component.html', 8 | // styleUrls: ['./temperature.component.css'] 9 | }) 10 | export class TemperatureComponent implements OnInit { 11 | @Input() label: string; 12 | @Input() temp: number; 13 | @Input() idNum: string; 14 | currTemperature = 0; 15 | temperatureArray = [[0,0]]; 16 | count = 0; 17 | 18 | constructor(private wsService: WebsocketService) { } 19 | 20 | ngOnInit(): void { 21 | this.updateTemperature(); 22 | } 23 | updateTemperature() { 24 | this.wsService.history.subscribe(historyArray => { 25 | if (historyArray && historyArray.length > 0){ 26 | //console.log(historyArray); 27 | this.currTemperature = historyArray[historyArray.length-1].obj.TEMPERATURE[this.idNum]._value; 28 | this.count += 50; 29 | // if (this.count % 5000 == 0){ 30 | this.temperatureArray.push([this.count/1000,Math.floor(this.currTemperature)]) 31 | if (this.temperatureArray.length > 10){ 32 | this.temperatureArray.shift(); 33 | } 34 | // } 35 | } 36 | }) 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/icons/battery/battery.component.html: -------------------------------------------------------------------------------- 1 | 9 |
10 | 11 |
12 |
13 |
14 |
15 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/icons/battery/battery.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BatteryPercentageComponent } from './battery.component'; 4 | 5 | describe('BatteryPercentageComponent', () => { 6 | let component: BatteryPercentageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BatteryPercentageComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BatteryPercentageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/icons/battery/battery.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input, AfterViewInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'battery-component', 5 | templateUrl: './battery.component.html' 6 | }) 7 | export class BatteryPercentageComponent { 8 | @Input() public color: string; 9 | @Input() public percentage: number; 10 | arrayColor = []; 11 | totalPin = 5; 12 | pinColor = '#efefed'; 13 | 14 | constructor() {} 15 | 16 | ngOnInit() { 17 | this.color = '#3DCC93'; 18 | this.percentage = 100; 19 | this.renderArrayColor(); 20 | } 21 | 22 | renderArrayColor() { 23 | const part = 100 / this.totalPin; 24 | let currentLevel = 0 + part; 25 | for (let i = 0; i < this.totalPin; i++) { 26 | if (this.percentage >= currentLevel) { 27 | this.arrayColor.push({ full: true, color: this.color, width: '70px' }); 28 | currentLevel += part; 29 | } else { 30 | const newWidth = ((this.percentage - currentLevel + part) * 70) / 20; 31 | this.arrayColor.push({ full: false, color: this.pinColor, width: newWidth + 'px' }); 32 | for (let j = i + 1; j < this.totalPin; j++) { 33 | this.arrayColor.push({ full: true, color: this.pinColor, width: '70px' }); 34 | } 35 | break; 36 | } 37 | } 38 | } 39 | 40 | public randomize(): void { 41 | this.arrayColor = [] 42 | this.percentage -= 1; 43 | this.renderArrayColor(); 44 | setTimeout(() => { this.randomize(); }, 200); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/icons/speedometer/ng2-gauge/ng2-gauge.component.html: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/icons/speedometer/ng2-gauge/ng2-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ng2-gauge-component', 5 | templateUrl: './ng2-gauge.component.html' 6 | }) 7 | export class Ng2GaugeComponent { 8 | input = 5000; 9 | max = 9000; 10 | sectors = [{ 11 | from: 6500, 12 | to: 8000, 13 | color: 'orange' 14 | }, { 15 | from: 8000, 16 | to: 9000, 17 | color: 'red' 18 | }]; 19 | public randomize(): void { 20 | 21 | this.input += Math.round(4* (Math.round(Math.random()) * 4 - 1)); 22 | setTimeout(() => { this.randomize(); }, 50); 23 | } 24 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/icons/speedometer/ngx-gauge/ngx-gauge.component.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/icons/speedometer/ngx-gauge/ngx-gauge.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ngx-gauge-component', 5 | templateUrl: './ngx-gauge.component.html' 6 | }) 7 | export class NgxGaugeComponent { 8 | 9 | gaugeType = "semi"; 10 | gaugeValue = 28.3; 11 | gaugeLabel = "Speed"; 12 | gaugeAppendText = "km/hr"; 13 | 14 | public randomize(): void { 15 | 16 | this.gaugeValue += 0.1*(Math.round(Math.random()) * 4 - 1); 17 | setTimeout(() => { this.randomize(); }, 50); 18 | } 19 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/layout/layout.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LayoutComponent } from './layout.component'; 4 | 5 | describe('LayoutComponent', () => { 6 | let component: LayoutComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LayoutComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LayoutComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/layout/layout.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-layout', 5 | templateUrl: './layout.component.html', 6 | styleUrls: ['./layout.component.css'] 7 | }) 8 | export class LayoutComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/logs/logs.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | height: 100vh; 3 | display: flex; 4 | align-items: center; 5 | } 6 | 7 | * { 8 | margin: 0; 9 | padding: 0; 10 | box-sizing: border-box; 11 | } 12 | 13 | .dashboard { 14 | max-width: 1444px; 15 | margin: auto; 16 | display: grid; 17 | grid-template-columns: repeat(3, 1fr); 18 | grid-template-rows: repeat(12, 1fr); 19 | height: 98vh; 20 | width: 100%; 21 | grid-gap: 10px; 22 | } 23 | 24 | /* Each region */ 25 | .dashboard > * { 26 | background: #232323; 27 | display: flex; 28 | justify-content: center; 29 | align-items: center; 30 | color: white; 31 | border-radius: 5px; 32 | padding: 0.5rem; 33 | } 34 | 35 | .switch { 36 | grid-column-start: 1; 37 | } 38 | 39 | .logs { 40 | grid-column: 2 / span 2; 41 | grid-row: 1 / span 12; 42 | display: flex; 43 | flex-wrap: wrap; 44 | justify-content: center; 45 | grid-gap: 20px; 46 | } 47 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/logs/logs.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 | Logs 7 |
8 |
9 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/logs/logs.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LogsComponent } from './logs.component'; 4 | 5 | describe('LogsComponent', () => { 6 | let component: LogsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LogsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LogsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/logs/logs.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-logs', 5 | templateUrl: './logs.component.html', 6 | styleUrls: ['./logs.component.css'] 7 | }) 8 | export class LogsComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/podstate-item/podstate-item.component.css: -------------------------------------------------------------------------------- 1 | :host > div { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | text-align: center; 6 | background-color: #504f4f; 7 | height: 100%; 8 | font-size: 0.8rem; 9 | padding: 0 0.5rem; 10 | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); 11 | border-radius: 2px; 12 | } 13 | 14 | .disable-select { 15 | -webkit-user-select: none; 16 | -moz-user-select: none; 17 | -ms-user-select: none; 18 | user-select: none; 19 | } 20 | 21 | .active { 22 | background: #53da70 !important; 23 | box-shadow: 0 0 5px 2px #53da70 !important; 24 | } 25 | 26 | .error { 27 | background-color: #e04949 !important; 28 | box-shadow: 0 0 5px 2px #e04949 !important; 29 | animation: blink 1000ms infinite; 30 | } 31 | 32 | @keyframes blink { 33 | 0% { 34 | background-color: #e04949 !important; 35 | } 36 | 100% { 37 | background-color: #504f4f !important; 38 | } 39 | } 40 | 41 | @media only screen and (max-height: 870px) { 42 | :host > div { 43 | font-size: 0.6rem; 44 | } 45 | } 46 | 47 | @media only screen and (max-height: 650px) { 48 | :host > div { 49 | white-space: nowrap; 50 | overflow: hidden; 51 | text-overflow: ellipsis; 52 | font-size: 0.5rem; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/podstate-item/podstate-item.component.html: -------------------------------------------------------------------------------- 1 |
2 | {{title}} 3 |
4 | 5 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/podstate-item/podstate-item.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PodstateItemComponent } from './podstate-item.component'; 4 | 5 | describe('PodstateItemComponent', () => { 6 | let component: PodstateItemComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PodstateItemComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PodstateItemComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/podstate-item/podstate-item.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-podstate-item', 5 | templateUrl: './podstate-item.component.html', 6 | styleUrls: ['./podstate-item.component.css'] 7 | }) 8 | export class PodstateItemComponent implements OnInit { 9 | @Input() title: string; 10 | @Input() isActive: Boolean =false; 11 | @Input() isError: Boolean; 12 | 13 | constructor() { } 14 | 15 | ngOnInit(): void { 16 | } 17 | 18 | toggleActive(): void { 19 | this.isActive = !this.isActive 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/podstate/podstate.component.html: -------------------------------------------------------------------------------- 1 |
2 |

{{stateGroupMap[group.name].title}}

3 |
4 | 5 |
6 |
7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/podstate/podstate.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PodstateComponent } from './podstate.component'; 4 | 5 | describe('PodstateComponent', () => { 6 | let component: PodstateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PodstateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PodstateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensor-group/sensor-group.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | /* border: 1px solid rgb(86, 86, 86); */ 3 | border-radius: 5px; 4 | padding: 5px; 5 | /* display: grid; 6 | grid-template-rows: auto 1fr; */ 7 | background: rgba(0, 0, 0, 0.6); 8 | display: flex; 9 | flex-wrap: wrap; 10 | align-items: center; 11 | justify-content: space-around; 12 | width: 75px; 13 | height: 75px; 14 | position: absolute; 15 | } 16 | 17 | h1 { 18 | font-size: 0.8rem; 19 | font-weight: 500; 20 | text-transform: capitalize; 21 | } 22 | 23 | .grid { 24 | display: grid; 25 | grid-template-columns: repeat(5, 1fr); 26 | grid-template-rows: repeat(4, 1fr); 27 | grid-gap: 2px; 28 | } 29 | 30 | /* .wrapper { 31 | position: relative; 32 | } */ 33 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensor-group/sensor-group.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensor-group/sensor-group.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-sensor-group', 5 | templateUrl: './sensor-group.component.html', 6 | styleUrls: ['./sensor-group.component.css'] 7 | }) 8 | export class SensorGroupComponent implements OnInit { 9 | @Input() title: string; 10 | 11 | @Input() data: any[]; 12 | 13 | constructor() { } 14 | 15 | ngOnInit(): void { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensor-item/sensor-item.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | display: flex; 3 | align-items: center; 4 | } 5 | 6 | .indicator { 7 | width: 8px; 8 | height: 8px; 9 | border-radius: 1000px; 10 | background: #989898; 11 | margin-right: 0.4rem; 12 | } 13 | 14 | p { 15 | font-size: 0.8rem; 16 | line-height: 0.5rem; 17 | color: #c9c9c9; 18 | } 19 | 20 | .active { 21 | background: #53da70; 22 | box-shadow: 0 0 2px 1px #53da70; 23 | } 24 | 25 | .error { 26 | background: #e04949; 27 | box-shadow: 0 0 2px 1px #e04949; 28 | } 29 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensor-item/sensor-item.component.html: -------------------------------------------------------------------------------- 1 |
2 |

{{id}}

-------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensor-item/sensor-item.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SensorItemComponent } from './sensor-item.component'; 4 | 5 | describe('SensorItemComponent', () => { 6 | let component: SensorItemComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ SensorItemComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SensorItemComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensor-item/sensor-item.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-sensor-item', 5 | templateUrl: './sensor-item.component.html', 6 | styleUrls: ['./sensor-item.component.css'] 7 | }) 8 | export class SensorItemComponent implements OnInit { 9 | @Input() id:string; 10 | @Input() state:string; 11 | 12 | constructor() { } 13 | 14 | ngOnInit(): void { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensors/sensors.component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | width: 100%; 3 | height: 100%; 4 | /* display: grid; 5 | grid-gap: 0.5rem; 6 | grid-template-columns: repeat(2, 1fr); 7 | grid-template-rows: auto 1fr 1fr; */ 8 | background-image: url("../../../assets/images/pod-bird-eye.png"); 9 | background-size: cover; 10 | } 11 | 12 | h1 { 13 | grid-column: 1/-1; 14 | font-size: 1rem; 15 | text-align: center; 16 | color: black; 17 | } 18 | 19 | .wrapper { 20 | position: relative; 21 | height: 100%; 22 | } 23 | 24 | .front { 25 | top: calc(53% - 50px); 26 | left: 10%; 27 | } 28 | .back { 29 | top: calc(53% - 50px); 30 | right: 15%; 31 | } 32 | .left { 33 | top: calc(33% - 50px); 34 | right: 50%; 35 | } 36 | .right { 37 | top: calc(73% - 50px); 38 | right: 50%; 39 | } 40 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensors/sensors.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/components/sensors/sensors.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SensorsComponent } from './sensors.component'; 4 | 5 | describe('SensorsComponent', () => { 6 | let component: SensorsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ SensorsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SensorsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/app/services/websocket.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { WebsocketService } from './websocket.service'; 4 | 5 | describe('WebsocketService', () => { 6 | let service: WebsocketService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(WebsocketService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/assets/.gitkeep -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/assets/braking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/assets/braking.png -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/assets/images/pod-bird-eye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/assets/images/pod-bird-eye.png -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.eot -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.ttf -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/assets/open-sans-v18-latin/open-sans-v18-latin-regular.woff2 -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/UTHT/src/favicon.ico -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularFrontend 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | @import "~@angular/material/prebuilt-themes/purple-green.css"; 4 | 5 | @font-face { 6 | font-family: 'Open Sans'; 7 | src: url(/assets/open-sans-v18-latin/open-sans-v18-latin.ttf) format("truetype"); 8 | font-weight:300; 9 | } 10 | 11 | body { 12 | background: #434343; 13 | font-family: "Open Sans", sans-serif; 14 | } 15 | 16 | * { 17 | margin: 0; 18 | padding: 0; 19 | box-sizing: border-box; 20 | } 21 | 22 | html, body { height: 100%; } 23 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 24 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "module": "es2020", 15 | "lib": [ 16 | "es2018", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /software/core/Infrastructure/UTHT/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/acceleration-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class AccelerationSensor extends Sensor { 4 | sensor_type = "ACCELERATION"; 5 | constructor(value, name = "acceleration") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = AccelerationSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/battery-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class BatterySensor extends Sensor { 4 | sensor_type = "BATTERY"; 5 | constructor(value, name = "battery") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | // const sensor1 = new BatterySensor("mysensor", 2); 12 | 13 | // console.log(sensor1.name); 14 | // console.log(sensor1.value); 15 | 16 | // sensor1.name = "updatedsensor"; 17 | // sensor1.value = 3; 18 | 19 | // console.log(sensor1.name); 20 | // console.log(sensor1.value); 21 | 22 | module.exports = BatterySensor; 23 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/dc_current-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class DCcurrentSensor extends Sensor { 4 | sensor_type = "DC_CURRENT"; 5 | constructor(value, name = "dc_current") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = DCcurrentSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/gapHeight-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class GapHeightSensor extends Sensor { 4 | sensor_type = "GAPHEIGHT"; 5 | constructor(value, name = "gapHeight") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = GapHeightSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/position-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class PositionSensor extends Sensor { 4 | sensor_type = "POSITION"; 5 | constructor(x, y, name = "position") { 6 | super(name); 7 | this._x = x; 8 | this._y = y; 9 | this._name = name; 10 | this.value = [this._x, this._y]; 11 | } 12 | 13 | set x(value) { 14 | this._x = value; 15 | } 16 | 17 | set y(value) { 18 | this._y = value; 19 | } 20 | get x() { 21 | return this._x; 22 | } 23 | 24 | get y() { 25 | return this._y; 26 | } 27 | 28 | get coordinates() { 29 | return [this._x, this._y]; 30 | } 31 | } 32 | 33 | // const sensor1 = new PositionSensor("mysensor", 2, 3.21, 4.66); 34 | 35 | // console.log(sensor1.name); 36 | // console.log(sensor1.value); 37 | // console.log(sensor1.x); 38 | // console.log(sensor1.y); 39 | // console.log(sensor1.coordinates); 40 | 41 | // sensor1.name = "updatedsensor"; 42 | // sensor1.value = 3; 43 | // sensor1.x = 3.6; 44 | // sensor1.y = 4.6; 45 | 46 | // console.log(sensor1.name); 47 | // console.log(sensor1.value); 48 | // console.log(sensor1.x); 49 | // console.log(sensor1.y); 50 | // console.log(sensor1.coordinates); 51 | 52 | module.exports = PositionSensor; 53 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/pressure-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class PressureSensor extends Sensor { 4 | sensor_type = "PRESSURE"; 5 | 6 | constructor(value, name = "pressure") { 7 | super(name, value); 8 | this._name = name; 9 | } 10 | } 11 | 12 | module.exports = PressureSensor; 13 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/sensor.js: -------------------------------------------------------------------------------- 1 | //Which ever sensor inherited from this class should make use of the value property when possible 2 | //avoid unit-specific property such as pressure - this makes it harder on the front-end to parse 3 | 4 | class Sensor { 5 | sensor_type = ""; 6 | constructor(name, value = null) { 7 | this._name = name; 8 | this._value = value; 9 | } 10 | 11 | get name() { 12 | return this._name; 13 | } 14 | 15 | get value() { 16 | return this._value; 17 | } 18 | 19 | set name(newName) { 20 | this._name = newName; 21 | } 22 | 23 | set value(newValue) { 24 | this._value = newValue; 25 | } 26 | 27 | get sensor_type() { 28 | return this.sensor_type; 29 | } 30 | } 31 | 32 | // const sensor1 = new Sensor("mysensor", 2); 33 | 34 | // console.log(sensor1.name); 35 | // console.log(sensor1.value); 36 | 37 | // sensor1.name = "updatedsensor"; 38 | // sensor1.value = 3; 39 | 40 | // console.log(sensor1.name); 41 | // console.log(sensor1.value); 42 | 43 | module.exports = Sensor; 44 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/state_machine-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class StateMachineSensor extends Sensor { 4 | sensor_type = "StateMachineSensor"; 5 | constructor(value, name = "state") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | // const sensor1 = new BatterySensor("mysensor", 2); 12 | 13 | // console.log(sensor1.name); 14 | // console.log(sensor1.value); 15 | 16 | // sensor1.name = "updatedsensor"; 17 | // sensor1.value = 3; 18 | 19 | // console.log(sensor1.name); 20 | // console.log(sensor1.value); 21 | 22 | module.exports = StateMachineSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/temp-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class TempSensor extends Sensor { 4 | sensor_type = "TEMPERATURE"; 5 | constructor(name, value) { 6 | super(name, value); 7 | } 8 | } 9 | 10 | // const sensor1 = new TempSensor("mysensor", 2); 11 | 12 | // console.log(sensor1.name); 13 | // console.log(sensor1.value); 14 | 15 | // sensor1.name = "updatedsensor"; 16 | // sensor1.value = 3; 17 | 18 | // console.log(sensor1.name); 19 | // console.log(sensor1.value); 20 | 21 | module.exports = TempSensor; 22 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/velocity-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class VelocitySensor extends Sensor { 4 | sensor_type = "VELOCITY"; 5 | 6 | constructor(value, name = "velocity") { 7 | super(name, value); 8 | this._name = name; 9 | } 10 | } 11 | 12 | // const sensor1 = new SpeedSensor("mysensor", 2); 13 | 14 | // console.log(sensor1.name); 15 | // console.log(sensor1.value); 16 | 17 | // sensor1.name = "updatedsensor"; 18 | // sensor1.value = 3; 19 | 20 | // console.log(sensor1.name); 21 | // console.log(sensor1.value); 22 | 23 | module.exports = VelocitySensor; 24 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Classes/vibration-sensor.js: -------------------------------------------------------------------------------- 1 | const Sensor = require("./sensor"); 2 | 3 | class VibrationSensor extends Sensor { 4 | sensor_type = "VIBRATION"; 5 | constructor(value, name = "vibration") { 6 | super(name, value); 7 | this._name = name; 8 | } 9 | } 10 | 11 | module.exports = VibrationSensor; -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Digester/README.md: -------------------------------------------------------------------------------- 1 | # Digster Module Crash Report 2 | 3 | - when speed object completely removed 4 | - TypeError: Cannot read property 'map' of undefined 5 | - when temperature object completely removed 6 | - TypeError: Cannot read property 'map' of undefined 7 | - position completely removed 8 | - TypeError: Cannot read property '0' of undefined 9 | - when brakes object completely removed 10 | - TypeError: Cannot read property 'map' of undefined 11 | - when battery object completely removed 12 | - TypeError: Cannot read property 'map' of undefined 13 | 14 | 15 | ## Other notes: 16 | - For brakes, not accounting for "status" -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/Encapsulate/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "speed": [ 3 | { 4 | "name": "speed", "value":250 5 | } 6 | ], 7 | "temperatures": [ 8 | { 9 | "name": "motor", "value":56 10 | }, 11 | { "name": "battery", "value": 78} 12 | ], 13 | "position" : [127, 46], 14 | "brakes":[ 15 | { 16 | "name": "brakes_left", "status": 0,"pressure":257 17 | }, 18 | { 19 | "name": "brakes_right", "status": 0,"pressure":257 20 | } 21 | ], 22 | "battery":[ 23 | { 24 | "name" : "battery_1", "value":67 25 | }, 26 | { 27 | "name" : "battery_2", "value":64 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/README.md: -------------------------------------------------------------------------------- 1 | ## MongoDB Installation Guide 2 | 3 | [For Linux follow this link](https://docs.mongodb.com/manual/administration/install-on-linux/) 4 | * You will need to click on the appropriate link relating to the distribution of Linux you have 5 | 6 | [For macOS follow this link](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/) 7 | 8 | [For Windows follow this link](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/) 9 | * Set up MongoDb as a Windows Service 10 | 11 | Good [tutorial](https://www.youtube.com/watch?v=-56x56UppqQ) on installing via macOS and Windows 12 | 13 | Mongo DB [cheatsheet](https://gist.github.com/bradtraversy/f407d642bdc3b31681bc7e56d95485b6) -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/constant/classes.js: -------------------------------------------------------------------------------- 1 | const classes_constants = { 2 | 0: "SPEED", 3 | 1: "TEMPERATURE", 4 | 2: "POSITION", 5 | 3: "BATTERY", 6 | }; 7 | 8 | module.exports = classes_constants; 9 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/dataCorrector/commonErrors.json: -------------------------------------------------------------------------------- 1 | { 2 | "negativeValueError": "", 3 | "nullValueError": "", 4 | "valueNotFoundError": "", 5 | "nameNotFoundError": "", 6 | "statusNotFoundError": "", 7 | "pressureNotFoundError": "", 8 | "speedNotFoundError": "", 9 | "temperatureNotFoundError": "", 10 | "positionNotFoundError": "", 11 | "brakesNotFoundError": "", 12 | "batteryNotFoundError": "", 13 | "valueExceedsThresholdError": "" 14 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/dataCorrector/test_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "speed": [ 3 | { 4 | "value": -8 5 | } 6 | ], 7 | "temperatures": [ 8 | { 9 | "value": 2300 10 | }, 11 | { 12 | "name": "helo", 13 | "value": 23 14 | } 15 | ], 16 | "position": [ 17 | 127, 18 | -46 19 | ], 20 | "brakes": [ 21 | { 22 | "status": 0, 23 | "pressure": 170.2323 24 | }, 25 | { 26 | "name": "brakes_right", 27 | "pressure": 243 28 | }, 29 | { 30 | "name": "brakes_right", 31 | "status": 1 32 | } 33 | ], 34 | "battery": [ 35 | { 36 | "value": 670 37 | }, 38 | { 39 | "name": "battery_2" 40 | } 41 | ], 42 | "current": [ 43 | { 44 | "value": "200" 45 | } 46 | ], 47 | "vibration": [ 48 | { 49 | "value": "200" 50 | } 51 | ], 52 | "gapHeight": [ 53 | { 54 | "value": "233" 55 | } 56 | ], 57 | "acceleration": [ 58 | { 59 | "value": "23" 60 | } 61 | ] 62 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/externalSocketParser/README.md: -------------------------------------------------------------------------------- 1 | # Parser 2 | 3 | Any receiving object from the socket will be first passed through a parser. The parser will convert any data sent from Odroid into JSON object. -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/externalSocketParser/parser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The function converts the String receiving from Odroid or JSON from Angular 3 | * and return JSON Object 4 | * @param {String} externalJson: String object recieving from the Odroid or JSON 5 | * object from Angular 6 | * @returns {Object}; return JSON Object for manipulation by backend 7 | */ 8 | 9 | const JSONParser = (externalJson) => { 10 | // If incoming data is from Odroid 11 | if ( 12 | externalJson !== null && 13 | typeof externalJson === "string" 14 | ) 15 | 16 | { 17 | let dataPreparation = externalJson.replace(/'/g, '"'); 18 | let JSONobject = JSON.parse(dataPreparation); 19 | return JSONobject; 20 | 21 | } else { 22 | // If incoming data is from dashbord 23 | return JSON.parse(externalJson); 24 | } 25 | } 26 | 27 | module.exports = JSONParser; -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend", 3 | "version": "1.0.0", 4 | "description": "Backend for the infrastructure module", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node index.js", 9 | "dev": "nodemon index.js" 10 | }, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "bufferutil": "^3.0.5", 15 | "express": "^4.17.1", 16 | "lodash": "^4.17.21", 17 | "mongoose": "^5.11.8", 18 | "node": "^14.12.0", 19 | "validator": "^13.5.2", 20 | "websocket": "^1.0.32", 21 | "ws": "^1.1.5" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "speed": [ 3 | { 4 | "name": "speed", "value":250 5 | } 6 | ], 7 | "temperatures": [ 8 | { 9 | "name": "motor", "value":56 10 | }, 11 | { "name": "battery", "value": 78} 12 | ], 13 | "position" : [127, 46], 14 | "brakes":[ 15 | { 16 | "name": "brakes_left", "status": 0,"pressure":257 17 | }, 18 | { 19 | "name": "brakes_right", "status": 0,"pressure":257 20 | } 21 | ], 22 | "battery":[ 23 | { 24 | "name" : "battery_1", "value":67 25 | }, 26 | { 27 | "name" : "battery_2", "value":64 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/utilities/broadcast.js: -------------------------------------------------------------------------------- 1 | const WebSocket = require("ws"); 2 | 3 | //A function to send messages to a specific clientType initialized into the ws object during the connection event 4 | function broadcast(wss, data, clientType) { 5 | wss.clients.forEach((client) => { 6 | if ( 7 | client.readyState === WebSocket.OPEN && 8 | client.clientType === clientType 9 | ) { 10 | client.send(JSON.stringify(data)); 11 | } 12 | }); 13 | } 14 | 15 | module.exports = broadcast; 16 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/utilities/mock.js: -------------------------------------------------------------------------------- 1 | const digest = require("../Digester"); 2 | const encapsulate = require("../Encapsulate"); 3 | 4 | //Return a mock object for the data that needs to be handled on the front-end 5 | 6 | function mock() { 7 | const newData = { 8 | speed: [ 9 | { 10 | name: "speed", 11 | value: 25 * Math.random(), 12 | }, 13 | ], 14 | temperatures: [ 15 | { 16 | name: "motor", 17 | value: 55 * Math.random() + 20, 18 | }, 19 | { name: "battery", value: 55 * Math.random() + 20}, 20 | ], 21 | position: [100 * Math.random(), 46], 22 | brakes: [ 23 | { 24 | name: "brakes_left", 25 | status: 0, 26 | value: 3 * Math.random(), 27 | }, 28 | { 29 | name: "brakes_right", 30 | status: 0, 31 | value: 3 * Math.random(), 32 | }, 33 | ], 34 | battery: [ 35 | { 36 | name: "battery_1", 37 | value: 100 * Math.random(), 38 | }, 39 | { 40 | name: "battery_2", 41 | value: 100 * Math.random(), 42 | }, 43 | ], 44 | }; 45 | 46 | const Digest = digest(newData); 47 | const Encapsulate = encapsulate(Digest); 48 | return Encapsulate; 49 | } 50 | 51 | module.exports = mock; 52 | -------------------------------------------------------------------------------- /software/core/Infrastructure/backend/validator/commonErrors.js: -------------------------------------------------------------------------------- 1 | 2 | commonErrorsDict = { 3 | "0": "negativeValueError", 4 | "1": "nullValueError", 5 | "2": "valueNotFoundError", 6 | "3": "nameNotFoundError", 7 | "4": "statusNotFoundError", 8 | "5": "pressureNotFoundError", 9 | "6": "valueExceedsThresholdError", 10 | "7": "velocityNotFoundError", 11 | "8": "temperatureNotFoundError", 12 | "9": "positionNotFoundError", 13 | "10": "batteryNotFoundError", 14 | "11": "currentNotFoundError", 15 | "12": "vibrationNotFoundError", 16 | "13": "gapHeightNotFoundError", 17 | "14": "accelerationNotFoundError", 18 | "15": "podStateNotFoundError" 19 | } 20 | module.exports = commonErrorsDict; -------------------------------------------------------------------------------- /software/core/Infrastructure/c++/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ -std=c++11 2 | #CC = g++ -std=c++11 3 | LDFLAGS= -L/usr/local/opt/openssl/lib 4 | CPPFLAGS= -I/usr/local/opt/openssl/include 5 | 6 | socket: socketBoost.cpp 7 | $(CC) socketBoost.cpp -o socket -pthread 8 | 9 | all: socket 10 | 11 | clean: 12 | rm -rf *.o socket *.dSYM 13 | -------------------------------------------------------------------------------- /software/core/Infrastructure/c++/socket: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/c++/socket -------------------------------------------------------------------------------- /software/core/Infrastructure/readme/Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UTHT/pod1-software-core/e2848bef3bc3c007f63e4d42ec8b2976a10f7f01/software/core/Infrastructure/readme/Architecture.png -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/RegressionTest/requirements.txt: -------------------------------------------------------------------------------- 1 | attrs==20.3.0 2 | autobahn==21.3.1 3 | Automat==20.2.0 4 | cffi==1.14.5 5 | constantly==15.1.0 6 | cryptography==3.4.6 7 | hyperlink==21.0.0 8 | idna==3.1 9 | incremental==21.3.0 10 | pycparser==2.20 11 | six==1.15.0 12 | Twisted==21.2.0 13 | txaio==21.2.1 14 | zope.interface==5.3.0 15 | -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/RegressionTest/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "speed": [ 3 | { 4 | "name": "speed", "value":0 5 | } 6 | ], 7 | "temperatures": [ 8 | { 9 | "name": "motor", "value":0 10 | }, 11 | { "name": "battery", "value": 0} 12 | ], 13 | "position" : [0, 0], 14 | "brakes":[ 15 | { 16 | "name": "brakes_left", "status": 0,"pressure":0 17 | }, 18 | { 19 | "name": "brakes_right", "status": 0,"pressure":0 20 | } 21 | ], 22 | "battery":[ 23 | { 24 | "name" : "battery_1", "value":0 25 | }, 26 | { 27 | "name" : "battery_2", "value":0 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/debug.txt: -------------------------------------------------------------------------------- 1 | Ran this command to download the library: sudo apt-get install libcpprest-dev 2 | 3 | 4 | Tried the commands below to make compilation run properly: 5 | g++ -std=c++11 socket.cpp -lcpprest -lcrypto -lssl 6 | g++ -std=c++11 socket.cpp /usr/include/openssl /usr/include/cpprest /usr/include/boost -lcpprest -lcrypto -lssl -lboost_system -lboost_chrono -lboost_thread-mt 7 | -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "name": "mongoose-test", 4 | "version": "1.0.0", 5 | "description": "", 6 | "main": "index.js", 7 | "dependencies": { 8 | "mongoose": "^5.10.13", 9 | "express": "^4.17.1", 10 | "validator": "^13.1.17" 11 | }, 12 | "devDependencies": { 13 | "dotenv": "^8.2.0", 14 | "nodemon": "^2.0.6" 15 | }, 16 | "scripts": { 17 | "devStart": "nodemon server.js" 18 | }, 19 | "author": "", 20 | "license": "ISC" 21 | } 22 | -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/route.rest: -------------------------------------------------------------------------------- 1 | GET http://localhost:3000/pod1 2 | 3 | ### 4 | 5 | GET http://localhost:3000/pod1/12 -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/routes/pod1.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const router = express.Router() 3 | 4 | //May not need routes, could implement directly in websockets 5 | //could implement in future 6 | 7 | // Getting all 8 | router.get('/', (req, res) => { 9 | res.send('Hello World') 10 | }) 11 | 12 | 13 | 14 | // Getting one 15 | router.get('/:id', (req, res) => { 16 | res.send(req.params.id) 17 | }) 18 | 19 | // Creating one 20 | router.post('/', (req, res) => { 21 | 22 | }) 23 | 24 | // updating one 25 | router.get('/:id', (req, res) => { 26 | 27 | }) 28 | 29 | // Deleting one 30 | router.delete('/:id', (req, res) => { 31 | 32 | }) 33 | 34 | module.exports = router -------------------------------------------------------------------------------- /software/core/Infrastructure/scripts/simulation/requirements.txt: -------------------------------------------------------------------------------- 1 | attrs==20.3.0 2 | autobahn==21.3.1 3 | Automat==20.2.0 4 | cffi==1.14.5 5 | constantly==15.1.0 6 | cryptography==3.4.6 7 | hyperlink==21.0.0 8 | idna==3.1 9 | incremental==21.3.0 10 | pycparser==2.20 11 | six==1.15.0 12 | Twisted==21.2.0 13 | txaio==21.2.1 14 | zope.interface==5.3.0 15 | -------------------------------------------------------------------------------- /software/core/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = core 2 | BUILD_DIRS=build 3 | CFLAGS=`pkg-config --cflags lcm` 4 | LDFLAGS=`pkg-config --libs lcm` 5 | OPTIONS=-std=c++17 -lstdc++fs 6 | $(shell mkdir -p $(BUILD_DIRS)) 7 | INC=-Iinclude 8 | 9 | all: ${TARGET} 10 | core: src/main.cpp 11 | g++ $(INC) $(CFLAGS) $(LDFLAGS) $(OPTIONS) -o build/main src/* 12 | clean: 13 | rm -f ${TARGET} 14 | --------------------------------------------------------------------------------