From 0821b085a198cc419219666e00c131bc70322dc1 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Sun, 2 Apr 2023 19:11:10 +0200 Subject: [PATCH] hw7: done component diagram, wip on process diagram, todo ADRs --- src/sa/model/index.md | 90 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 15 deletions(-) diff --git a/src/sa/model/index.md b/src/sa/model/index.md index 0fb000c..b34ea25 100644 --- a/src/sa/model/index.md +++ b/src/sa/model/index.md @@ -794,18 +794,17 @@ title Smarthut.sm Logical View interface " " as DIF interface " " as TF interface " " as SCF -interface " " as UIF -component "[EXTERNAL] IoT Devices" as IOT { +component "IoT Devices" as IOT { interface " " as HDF interface " " as HSF interface " " as ZDF interface " " as ZSF - [HomeKit smart device] as HD - [HomeKit smart sensor] as HS - [Zigbee smart device] as ZD - [Zigbee smart sensor] as ZS + [HomeKit smart device] as HD <> + [HomeKit smart sensor] as HS <> + [Zigbee smart device] as ZD <> + [Zigbee smart sensor] as ZS <> HD--HDF HS--HSF @@ -813,23 +812,38 @@ component "[EXTERNAL] IoT Devices" as IOT { ZS--ZSF } -[User Interface] as UI +component "User Interface" as UIC { + interface " " as WSCF + + [User Interface] as UI + [WebSockets API (JavaScript)] <> as WSC + + WSCF)--UI + WSC--WSCF +} component "Users and Devices" as DEV { interface " " as DIDBF interface " " as HAPF interface " " as ZIGF + interface " " as WSSF - [HAP-java] as HAP - [zigbee4java] as ZIG + [HAP-java] as HAP <> + [zigbee4java] as ZIG <> [Device Engine] as DI - [User and Device DB <$database{scale=0.33}>] as DIDB + + note left of DI: Already implemented using Spring Boot + + [Spring WebSocket API] as WSS <> + [User and Device DB <$database{scale=0.33}> (PostgreSQL)] <> as DIDB HDF )-- HAP HSF )-- HAP ZDF )-- ZIG ZSF )-- ZIG + DI--(WSSF + WSSF--WSS HAP--HAPF ZIG--ZIGF HAPF )-- DI @@ -842,7 +856,7 @@ component "Triggers and Automations" as TRIG { interface " " as TDBF [Trigger and Automation Engine] as T - [Trigger and Automation DB <$database{scale=0.33}>] as TDB + [Trigger and Automation DB <$database{scale=0.33}> (PostgreSQL)] <> as TDB TDBF-TDB T -( TDBF @@ -852,21 +866,19 @@ component "Scenes" as SCENE { interface " " as SCDBF [Scene Engine] as SC - [Scene DB <$database{scale=0.33}>] as SCDB + [Scene DB <$database{scale=0.33}> (PostgreSQL)] <> as SCDB SCDBF-SCDB SC -( SCDBF } -UIF--UI DI--DIF TF--T SCF--SC - +WSS <..> WSC: WebSocket protocol (RFC 6455) DI --( TF T --( SCF DIF )-- SC -DI --( UIF DIF )-- UI UI --( SCF UI --( TF @@ -877,6 +889,54 @@ skinparam defaultFontName Courier @enduml ``` +Use case: a user alters manually the state of device 'D' in the UI, and the device updates accordingly. Device 'D' is not part of any defined trigger. + +```puml +@startuml +title Process View: UI updates state of device + +box "IoT Devices" + participant "HomeKit dev." as HD + participant "HomeKit sens." as HS + participant "Zigbee dev." as ZD + participant "Zigbee sens." as ZS +end box + +box "User Interface" + participant "UI" as UI + participant "WebSockets API (JS)" as WSC +end box + +box "Users and Devices" + participant "HAP-java" as HAP + participant "zigbee4java" as ZIG + participant "Engine" as DI + participant "DB" as DIDB + participant "Spring WS API" as WSS +end box + +box "Triggers and Automations" + participant "Engine" as T + participant "DB" as TDB +end box + +box "Scenes" + participant "Engine" as SC + participant "DB" as SCDB +end box + +UI -> DI: request state update +DI -> ZD: apply new state +ZD -> DI: report successful application +DI -> DIDB: store new state +DI -> UI: display new state +DI -> T: report latest device state + +skinparam monochrome true +skinparam shadowing false +skinparam defaultFontName Courier +@enduml +``` # Ex - Interface/API Specification