Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds RGB and Thermometer Controlers Updates #57

Open
wants to merge 5 commits into
base: new_implementation
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/engine/reference/builder/#dockerignore-file

**/.DS_Store
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
59 changes: 59 additions & 0 deletions Californium.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#Californium CoAP Properties file
#Thu Aug 03 16:28:57 CEST 2023
HEALTH_STATUS_INTERVAL=0
ACK_TIMEOUT=2000
UDP_CONNECTOR_SEND_BUFFER=0
ACK_TIMEOUT_SCALE=2.0
HTTP_SERVER_SOCKET_TIMEOUT=100000
USE_RANDOM_MID_START=true
BLOCKWISE_STRICT_BLOCK2_OPTION=false
MAX_ACTIVE_PEERS=150000
PROTOCOL_STAGE_THREAD_COUNT=12
BLOCKWISE_STATUS_LIFETIME=300000
MAX_RESOURCE_BODY_SIZE=8192
HTTP_CACHE_SIZE=32
UDP_CONNECTOR_DATAGRAM_SIZE=2048
UDP_CONNECTOR_RECEIVE_BUFFER=0
DTLS_CONNECTION_ID_NODE_ID=
MAX_TRANSMIT_WAIT=93000
NOTIFICATION_REREGISTRATION_BACKOFF=2000
DEDUPLICATOR=DEDUPLICATOR_MARK_AND_SWEEP
COAP_PORT=5683
MID_TACKER=GROUPED
COAP_SECURE_PORT=5684
NETWORK_STAGE_RECEIVER_THREAD_COUNT=1
HTTP_CACHE_RESPONSE_MAX_AGE=86400
MULTICAST_BASE_MID=65000
HTTP_SERVER_SOCKET_BUFFER_SIZE=8192
EXCHANGE_LIFETIME=247000
TLS_HANDSHAKE_TIMEOUT=10000
DEDUPLICATOR_AUTO_REPLACE=true
TCP_CONNECTION_IDLE_TIMEOUT=10
LEISURE=5000
HTTP_PORT=8080
DTLS_CONNECTION_ID_LENGTH=
NOTIFICATION_CHECK_INTERVAL=86400000
CONGESTION_CONTROL_ALGORITHM=Cocoa
RESPONSE_MATCHING=STRICT
MID_TRACKER_GROUPS=16
TOKEN_SIZE_LIMIT=8
NETWORK_STAGE_SENDER_THREAD_COUNT=1
TCP_WORKER_THREADS=1
SECURE_SESSION_TIMEOUT=86400
TCP_CONNECT_TIMEOUT=10000
MAX_RETRANSMIT=4
MAX_MESSAGE_SIZE=1024
ACK_RANDOM_FACTOR=1.5
NSTART=1
MAX_LATENCY=100000
PROBING_RATE=1.0
USE_CONGESTION_CONTROL=false
MAX_SERVER_RESPONSE_DELAY=250000
CROP_ROTATION_PERIOD=247000
MAX_PEER_INACTIVITY_PERIOD=600
UDP_CONNECTOR_OUT_CAPACITY=2147483647
DTLS_AUTO_RESUME_TIMEOUT=30000
PREFERRED_BLOCK_SIZE=512
NON_LIFETIME=145000
NOTIFICATION_CHECK_INTERVAL_COUNT=100
MARK_AND_SWEEP_INTERVAL=10000
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Use an official Maven image as the base image
FROM maven:3-openjdk-17 AS build
ADD target/virtual-smart-home-plus.jar virtual-smart-home-plus.jar
ENTRYPOINT ["java", "-jar", "virtual-smart-home-plus.jar"]
EXPOSE 8081
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
# Virtual smart home plus
# Virtual Smart Home Plus

## Description
Virtual Smart Home Plus is a Java-based project that uses Spring Boot and Maven. It aims to provide a virtual representation of a smart home, allowing users to interact with various home appliances and systems in a simulated environment.

## Installation

### Prerequisites
- Java 17 or higher
- Maven
- Docker

### Steps
1. Clone the repository
2. Navigate to the project directory
3. Run `mvn spring-boot:run` to start the application

## Create and Run the Docker Container
To create and run the Docker container, follow these steps:
1. mvn clean install
2. docker build -t virtual-smart-home-plus .
3. docker run -p local_port:docker_port virtual-smart-home-plus

## License
This project is licensed under the Apache License, Version 2.0.

## API Endpoints

The application provides the following RESTful endpoints:

### GET Endpoints
1. **GET /api/{apiVersion}/house/device/fireplace/{id}**: Returns the status of the fireplace device with the specified ID in the virtual house.
2. **GET /api/{apiVersion}/house/device/door/{id}**: Returns the status of the door device with the specified ID in the virtual house.
3. **GET /api/{apiVersion}/house/device/thermometer/{id}**: Returns the status of the thermometer device with the specified ID in the virtual house.
4. **GET /api/{apiVersion}/house/device/rgb/{id}**: Returns the status of the RGB light device with the specified ID in the virtual house.
5. **GET /api/{apiVersion}/house/device**: Returns a list of all devices in the virtual house.
6. **GET /api/{apiVersion}/house/device/{id}**: Returns the details of the device with the specified ID in the virtual house.
7. **GET /api/{apiVersion}/house**: Returns the details of the virtual house.
8. **GET /api/{apiVersion}/house/status**: Returns the status of the house.

### POST Endpoints
1. **POST /api/{apiVersion}/house/device/fireplace/{id}**: Creates or updates the fireplace device with the specified ID in the virtual house. The request body should include the new status.
2. **POST /api/{apiVersion}/house/device/door/{id}**: Creates or updates the door device with the specified ID in the virtual house. The request body should include the new status.
3. **POST /api/{apiVersion}/house/device/thermometer/{id}**: Creates or updates the thermometer device with the specified ID in the virtual house. The request body should include the new status.
4. **POST /api/{apiVersion}/house/device/rgb/{id}**: Creates or updates the RGB light device with the specified ID in the virtual house. The request body should include the new status.

### PUT Endpoints
1. **PUT /api/{apiVersion}/house/device/fireplace/{id}**: Updates the status of the fireplace device with the specified ID in the virtual house. The request body should include the new status.
2. **PUT /api/{apiVersion}/house/device/door/{id}**: Updates the status of the door device with the specified ID in the virtual house. The request body should include the new status.
3. **PUT /api/{apiVersion}/house/device/thermometer/{id}**: Updates the status of the thermometer device with the specified ID in the virtual house. The request body should include the new status.
4. **PUT /api/{apiVersion}/house/device/rgb/{id}**: Updates the status of the RGB light device with the specified ID in the virtual house. The request body should include the new status.

### DELETE Endpoints
1. **DELETE /api/{apiVersion}/house/device/fireplace/{id}**: Deletes the fireplace device with the specified ID in the virtual house.
2. **DELETE /api/{apiVersion}/house/device/door/{id}**: Deletes the door device with the specified ID in the virtual house.
3. **DELETE /api/{apiVersion}/house/device/thermometer/{id}**: Deletes the thermometer device with the specified ID in the virtual house.
4. **DELETE /api/{apiVersion}/house/device/rgb/{id}**: Deletes the RGB light device with the specified ID in the virtual house.

Please replace `{apiVersion}` with the actual API version you are using (e.g., `v0.1` or `v1.0`), and `{id}` with the actual ID of the resource you want to access.

Please note that all requests and responses are in JSON format.
10 changes: 5 additions & 5 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
<!-- See https://checkstyle.sourceforge.io/config_javadoc.html -->
<module name="JavadocMethod">
<property name="accessModifiers" value="public"/>
<property name="severity" value="warning" />
<property name="severity" value="warning"/>
</module>
<module name="JavadocType">
<property name="scope" value="public"/>
<property name="severity" value="warning" />
<property name="severity" value="warning"/>
</module>
<module name="JavadocStyle">
<property name="scope" value="public"/>
<property name="checkFirstSentence" value="false"/>
<property name="severity" value="warning" />
<property name="severity" value="warning"/>
</module>

<!-- Checks for import related problems. -->
Expand Down Expand Up @@ -116,13 +116,13 @@
<module name="ArrayTypeStyle"/>
<module name="CommentsIndentation"/>
<module name="Indentation">
<property name="basicOffset" value="8"/>
<property name="basicOffset" value="4"/>
</module>
</module>

<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile" />
<module name="NewlineAtEndOfFile"/>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
Expand Down
Loading