From 32cf7ec290c5176e58378d94b45e8d261cc8384e Mon Sep 17 00:00:00 2001
From: Benjamin Leendert Montavon <benjamin.montavon@rwth-aachen.de>
Date: Thu, 3 Mar 2022 10:10:00 +0100
Subject: [PATCH] Added PAR-Mode

---
 OpenAPI/openapi.yml                           | 15 +++-
 .../OBJ-Entities/OBJ-Entity/PAR-Mode.yml      | 87 +++++++++++++++++++
 .../OBJ-LSM/OBJ-Entities/OBJ-Entity/index.yml |  4 +-
 OpenAPI/responses/NotAllowed.yml              |  6 ++
 OpenAPI/responses/index.yml                   |  4 +-
 5 files changed, 113 insertions(+), 3 deletions(-)
 create mode 100644 OpenAPI/responses/NotAllowed.yml

diff --git a/OpenAPI/openapi.yml b/OpenAPI/openapi.yml
index 1201dbe..1064054 100644
--- a/OpenAPI/openapi.yml
+++ b/OpenAPI/openapi.yml
@@ -1,7 +1,18 @@
 openapi: '3.0.2'
+
 info:
   title: Large-Scale Metrology Instrument
-  version: '1.0'
+  version: '0.1'
+  
+  # This line is against the schema but should be compatible
+  description: >
+    ## Introduction
+  
+  contact:
+    name: Benjamin Montavon
+    email: b.montavon@wzl-mq.rwth-aachen.de
+    
+
 servers:
   - url: http://localhost:8000/
   - url: https://iot.wzl-mq.rwth-aachen.de/public/SOIL/devices/LSM/
@@ -51,6 +62,8 @@ paths:
     $ref: '././paths/index.yml#/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/FUN-Reset'
   /OBJ-LSM/OBJ-Entities/{uuid}/PAR-Calibration/:
     $ref: '././paths/index.yml#/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/PAR-Calibration'
+  /OBJ-LSM/OBJ-Entities/{uuid}/PAR-Mode/:
+    $ref: '././paths/index.yml#/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/PAR-Mode'
 
 components:
   schemas:
diff --git a/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/PAR-Mode.yml b/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/PAR-Mode.yml
index e69de29..624295d 100644
--- a/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/PAR-Mode.yml
+++ b/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/PAR-Mode.yml
@@ -0,0 +1,87 @@
+description: >
+  **Acquisition Mode**  
+
+  Current acquisition mode of the entity. The following values are supported:  
+
+    * `CONTINUOUS`: Values are dispatched as fast as possible.
+    * `TRIGGERED`: Values are only dispatched after a software trigger, e.g. using *FUN-Trigger*.
+    * `EXTERNAL`: Values are dispatched in accordance to an external trigger, e.g. probe or TTL.
+    * `IDLE`: The entity is currently unused.
+
+get:
+  tags:
+    - Entity
+  description: 
+    $ref: '#/description'
+  parameters:
+    - $ref: '../../../../../parameters/index.yml#/OBJ-Entity-uuid'  
+  responses:
+    '200':
+        description: >
+          **OK**  
+
+          Everything occurred as expected.
+        content:
+          application/json:
+            schema: 
+              $ref: '../../../../../schemas/index.yml#/Parameter'
+            example:
+              uuid: PAR-Mode
+              name: Acquisition Mode
+              description: Acquisition mode of the entity governing how measurements are dispatched
+              ontology: null
+              datatype: enum
+              dimension: []
+              unit: null
+              range: ["CONTINUOUS", "TRIGGERED", "EXTERNAL", "IDLE"]
+              constant: false
+              value: CONTINUOUS
+              timestamp: '2022-03-01T12:54:29.147062Z'
+    '500':
+      $ref: "../../../../../responses/index.yml#/InternalError"
+patch:
+  tags:
+    - Entity
+  description: 
+    $ref: '#/description'
+  parameters:
+    - $ref: '../../../../../parameters/index.yml#/OBJ-Entity-uuid'  
+  requestBody:
+    content:
+      application/json:
+        schema:
+          type: object
+          properties:
+            value: 
+              type: string
+              enum: ["CONTINUOUS", "TRIGGERED", "EXTERNAL", "IDLE"]
+        example:
+          value: TRIGGERED
+  responses:
+    '200':
+        description: >
+          **OK**  
+
+          Everything occurred as expected.
+        content:
+          application/json:
+            schema: 
+              $ref: '../../../../../schemas/index.yml#/Parameter'
+            example:
+              uuid: PAR-Mode
+              name: Acquisition Mode
+              description: Acquisition mode of the entity governing how measurements are dispatched
+              ontology: null
+              datatype: enum
+              dimension: []
+              unit: null
+              range: ["CONTINUOUS", "TRIGGERED", "EXTERNAL", "IDLE"]
+              constant: false
+              value: TRIGGERED
+              timestamp: '2022-03-01T12:54:29.147062Z'
+    '405':
+      $ref: "../../../../../responses/index.yml#/NotAllowed"
+    '500':
+      $ref: "../../../../../responses/index.yml#/InternalError"
+    
+      
\ No newline at end of file
diff --git a/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/index.yml b/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/index.yml
index 0c66be9..58ced7f 100644
--- a/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/index.yml
+++ b/OpenAPI/paths/OBJ-ROOT/OBJ-LSM/OBJ-Entities/OBJ-Entity/index.yml
@@ -5,4 +5,6 @@ FUN-Reset:
 FUN-Trigger:
   $ref: './FUN-Trigger.yml'
 PAR-Calibration:
-  $ref: './PAR-Calibration.yml'
\ No newline at end of file
+  $ref: './PAR-Calibration.yml'
+PAR-Mode:
+  $ref: './PAR-Mode.yml'
\ No newline at end of file
diff --git a/OpenAPI/responses/NotAllowed.yml b/OpenAPI/responses/NotAllowed.yml
new file mode 100644
index 0000000..cfc48b0
--- /dev/null
+++ b/OpenAPI/responses/NotAllowed.yml
@@ -0,0 +1,6 @@
+description: >
+  **Not Allowed**  
+
+  The use of this method is not allowed (e.g. not supported or not enabled by device).
+content:
+  application/json: {}
\ No newline at end of file
diff --git a/OpenAPI/responses/index.yml b/OpenAPI/responses/index.yml
index 06c39cc..d342227 100644
--- a/OpenAPI/responses/index.yml
+++ b/OpenAPI/responses/index.yml
@@ -3,4 +3,6 @@ InternalError:
 NotFound:
   $ref: './NotFound.yml'
 NotImplemented:
-  $ref: './NotImplemented.yml'
\ No newline at end of file
+  $ref: './NotImplemented.yml'
+NotAllowed:
+  $ref: './NotAllowed.yml'
\ No newline at end of file
-- 
GitLab