Skip to content

ROTehc/SmartApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROTehc Smart App

Generic badge oneM2M

Built with Deno and Opine to comunicate with a OneM2M CSE.

Our SmartApp is responsible for coordinating sensors and actuators in our project. It finds the closest sensor to any actuator and calculates the AQI (Air Quality Index) every time a new reading is available. Once the AQI for a sensor has been calculated, the app will send its value to the appropriate actuators.

The app also fetches and parses data from the CSE to send it to the ROTehc frontend in order to plot all sensors.

Usage

Run

deno run --allow-net --allow-read src/main.ts

Test

Run all tests:

deno test

Run specific tests:

deno test tests/NAME.test.ts

Config

ae.config.json

{
	"SCHEMA": "http",
	"ADDR": "x.x.x.x",
	"PORT": port
}

cse.config.json

{
	"SCHEMA": "http",
	"ADDR": "x.x.x.x",
	"PORT": port
}

Project Structure

📦SmartApp
 ┣ 📂config
 ┃ ┣ 📜ae.config.json
 ┃ ┗ 📜cse.config.json
 ┣ 📂src
 ┃ ┣ 📜cse-com.ts
 ┃ ┣ 📜log.ts
 ┃ ┣ 📜logic.ts
 ┃ ┣ 📜main.ts
 ┃ ┗ 📜types.ts
 ┣ 📂tests
 ┃ ┣ 📜aqi.test.ts
 ┃ ┣ 📜closest.test.ts
 ┃ ┗ 📜distance.test.ts
 ┣ 📜.gitignore
 ┣ 📜LICENSE
 ┗ 📜README.md