hw08 done, please check
This commit is contained in:
parent
fbb2885e44
commit
5c69d8540e
3 changed files with 229 additions and 0 deletions
|
@ -1045,6 +1045,234 @@ Exceed: Also, document the Web API using the OpenAPI language. You can use the [
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
To build the interface diagram, I choose to use the top-down model as it provides a simple view with the integration between SmartHut and IoT devices. Interface directions are slightly revised between the devices and the "Users and Devices" components to better suit the operations / events / properties notation.
|
||||||
|
|
||||||
|
As already discussed in class, the three "backend" components "Users and Devices", "Triggers and Automations" and "Scenes" each implement a RESTful Web API. The diagram includes each endpoint found in the OpenAPI specification of the project.
|
||||||
|
|
||||||
|
A copy of the JSON OpenAPI V2 specification can be found in the file `openapi-spec.json` located in the directory where the specification is located. As the **OpenAPI-to-Tree** tool appears to be down at the moment (HTTP 502 when trying to access the page) I provide a PDF export of the Swagger frontend generated by the specification in the file `openapi-spec.pdf`located in the directory where the specification is located.
|
||||||
|
|
||||||
|
```puml
|
||||||
|
@startuml
|
||||||
|
skinparam componentStyle rectangle
|
||||||
|
|
||||||
|
!include <tupadr3/font-awesome/database>
|
||||||
|
|
||||||
|
interface " " as IOTDF
|
||||||
|
interface " " as IOTSF
|
||||||
|
interface " " as DEVF
|
||||||
|
interface " " as TRIGF
|
||||||
|
interface " " as SCF
|
||||||
|
interface " " as UICF
|
||||||
|
|
||||||
|
[Smart Device] as IOTD
|
||||||
|
[Smart Sensor] as IOTS
|
||||||
|
[User Interface] as UIC
|
||||||
|
[Users and Devices] as DEV
|
||||||
|
[Triggers and Automations] as TRIG
|
||||||
|
[Scenes] as SC
|
||||||
|
|
||||||
|
IOTD--IOTDF
|
||||||
|
IOTS--IOTSF
|
||||||
|
DEVF--DEV
|
||||||
|
TRIGF--TRIG
|
||||||
|
SCF--SC
|
||||||
|
UIC--UICF
|
||||||
|
|
||||||
|
DEV--(TRIGF
|
||||||
|
TRIG--(SCF
|
||||||
|
DEVF)--UIC
|
||||||
|
UIC--(TRIGF
|
||||||
|
UIC--(SCF
|
||||||
|
DEVF)--SC
|
||||||
|
IOTDF)--DEV
|
||||||
|
IOTSF)--DEV
|
||||||
|
UICF)--DEV
|
||||||
|
|
||||||
|
note left of IOTDF
|
||||||
|
operation:
|
||||||
|
..
|
||||||
|
setState(state)
|
||||||
|
checkAlive()
|
||||||
|
|
||||||
|
--
|
||||||
|
events:
|
||||||
|
..
|
||||||
|
state_changed
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of IOTSF
|
||||||
|
operation:
|
||||||
|
..
|
||||||
|
checkAlive()
|
||||||
|
|
||||||
|
--
|
||||||
|
events:
|
||||||
|
..
|
||||||
|
state_changed
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of UICF
|
||||||
|
operation:
|
||||||
|
..
|
||||||
|
updateState(state)
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of DEVF
|
||||||
|
operation:
|
||||||
|
..
|
||||||
|
POST /auth/login
|
||||||
|
GET /auth/profile
|
||||||
|
|
||||||
|
POST /buttonDimmer
|
||||||
|
PUT /buttonDimmer/dim
|
||||||
|
GET /buttonDimmer/{id}
|
||||||
|
DELETE /buttonDimmer/{id}
|
||||||
|
POST /buttonDimmer/{id}/lights
|
||||||
|
DELETE /buttonDimmer/{id}/lights
|
||||||
|
|
||||||
|
POST /curtains
|
||||||
|
PUT /curtains
|
||||||
|
DELETE /curtains/{id}
|
||||||
|
POST /curtains/{id}/state
|
||||||
|
|
||||||
|
GET /device
|
||||||
|
PUT /device
|
||||||
|
|
||||||
|
POST /dimmableLight
|
||||||
|
PUT /dimmableLight
|
||||||
|
DELETE /dimmableLight/{id}
|
||||||
|
POST /dimmableLight/{id}/state
|
||||||
|
|
||||||
|
PUT /dimmableState
|
||||||
|
DELETE /dimmableState/{id}
|
||||||
|
|
||||||
|
GET /user
|
||||||
|
GET /user/guests
|
||||||
|
PUT /user/guests
|
||||||
|
GET /user/hosts
|
||||||
|
PUT /user/permissions
|
||||||
|
|
||||||
|
POST /knobDimmer
|
||||||
|
PUT /knobDimmer/dimTo
|
||||||
|
GET /knobDimmer/{id}
|
||||||
|
DELETE /knobDimmer/{id}
|
||||||
|
POST /knobDimmer/{id}/lights
|
||||||
|
DELETE /knobDimmer/{id}/lights
|
||||||
|
|
||||||
|
POST /motionSensor
|
||||||
|
DELETE /motionSensor/{id}
|
||||||
|
PUT /motionSensor/{id}/detect
|
||||||
|
|
||||||
|
POST /rangeCondition
|
||||||
|
PUT /rangeCondition
|
||||||
|
GET /rangeCondition/{automationId}
|
||||||
|
DELETE /rangeCondition/{id}
|
||||||
|
|
||||||
|
POST /rangeTrigger
|
||||||
|
PUT /rangeTrigger
|
||||||
|
GET /rangeTrigger/{automationId}
|
||||||
|
DELETE /rangeTrigger/{id}
|
||||||
|
|
||||||
|
GET /regularLight
|
||||||
|
POST /regularLight
|
||||||
|
PUT /regularLight
|
||||||
|
GET /regularLight/{id}
|
||||||
|
DELETE /regularLight/{id}
|
||||||
|
POST /regularLight/{id}/state
|
||||||
|
|
||||||
|
GET /room
|
||||||
|
POST /room
|
||||||
|
GET /room/{id}
|
||||||
|
PUT /room/{id}
|
||||||
|
DELETE /room/{id}
|
||||||
|
GET /room/{roomId}/devices
|
||||||
|
|
||||||
|
POST /securityCamera
|
||||||
|
PUT /securityCamera
|
||||||
|
DELETE /securityCamera/{id}
|
||||||
|
POST /securityCamera/{id}/state
|
||||||
|
|
||||||
|
POST /sensor
|
||||||
|
DELETE /sensor/{id}
|
||||||
|
PUT /sensor/{id}/simulation
|
||||||
|
PUT /sensor/{id}/value
|
||||||
|
|
||||||
|
POST /smartPlug
|
||||||
|
PUT /smartPlug
|
||||||
|
DELETE /smartPlug/{id}
|
||||||
|
DELETE /smartPlug/{id}/meter
|
||||||
|
POST /smartPlug/{id}/state
|
||||||
|
|
||||||
|
POST /switch
|
||||||
|
PUT /switch/operate
|
||||||
|
GET /switch/{id}
|
||||||
|
DELETE /switch/{id}
|
||||||
|
POST /switch/{id}/lights
|
||||||
|
DELETE /switch/{id}/lights
|
||||||
|
|
||||||
|
PUT /switchableState
|
||||||
|
DELETE /switchableState/{id}
|
||||||
|
|
||||||
|
POST /thermostat
|
||||||
|
PUT /thermostat
|
||||||
|
DELETE /thermostat/{id}
|
||||||
|
POST /thermostat/{id}/state
|
||||||
|
|
||||||
|
POST /register
|
||||||
|
GET /register/confirm-account
|
||||||
|
POST /register/init-reset-password
|
||||||
|
PUT /register/reset-password
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of TRIGF
|
||||||
|
operation:
|
||||||
|
..
|
||||||
|
GET /automation
|
||||||
|
POST /automation
|
||||||
|
PUT /automation
|
||||||
|
PUT /automation/fast
|
||||||
|
GET /automation/{id}
|
||||||
|
DELETE /automation/{id}
|
||||||
|
|
||||||
|
POST /booleanCondition
|
||||||
|
PUT /booleanCondition
|
||||||
|
GET /booleanCondition/{automationId}
|
||||||
|
DELETE /booleanCondition/{id}
|
||||||
|
|
||||||
|
POST /booleanTrigger
|
||||||
|
PUT /booleanTrigger
|
||||||
|
GET /booleanTrigger/{automationId}
|
||||||
|
DELETE /booleanTrigger/{id}
|
||||||
|
|
||||||
|
POST /thermostatCondition
|
||||||
|
PUT /thermostatCondition
|
||||||
|
GET /thermostatCondition/{automationId}
|
||||||
|
DELETE /thermostatCondition/{id}
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of SCF
|
||||||
|
operation:
|
||||||
|
..
|
||||||
|
GET /scene
|
||||||
|
POST /scene
|
||||||
|
PUT /scene/{id}
|
||||||
|
DELETE /scene/{id}
|
||||||
|
POST /scene/{id}/apply
|
||||||
|
POST /scene/{id}/copyFrom/{copyId}
|
||||||
|
GET /scene/{sceneId}/states
|
||||||
|
|
||||||
|
POST /scenePriority
|
||||||
|
PUT /scenePriority
|
||||||
|
GET /scenePriority/{automationId}
|
||||||
|
DELETE /scenePriority/{id}
|
||||||
|
end note
|
||||||
|
|
||||||
|
skinparam monochrome true
|
||||||
|
skinparam shadowing false
|
||||||
|
skinparam defaultFontName Courier
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
# Ex - Connector View
|
# Ex - Connector View
|
||||||
|
|
||||||
{.instructions
|
{.instructions
|
||||||
|
|
1
src/sa/model/openapi-spec.json
Normal file
1
src/sa/model/openapi-spec.json
Normal file
File diff suppressed because one or more lines are too long
BIN
src/sa/model/openapi-spec.pdf
Normal file
BIN
src/sa/model/openapi-spec.pdf
Normal file
Binary file not shown.
Reference in a new issue