File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/main/kotlin/infrastructure/digitaltwins Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import com.azure.digitaltwins.core.implementation.models.ErrorResponseException
16
16
import com.azure.identity.DefaultAzureCredentialBuilder
17
17
import entity.zone.Room
18
18
import entity.zone.RoomID
19
+ import infrastructure.digitaltwins.adtpresentation.RoomAdtPresentation.toDigitalTwin
20
+ import infrastructure.digitaltwins.adtpresentation.RoomAdtPresentation.toRoom
19
21
20
22
/* *
21
23
* Implementation of the Digital Twin manager.
@@ -34,7 +36,15 @@ class DigitalTwinManager : RoomDigitalTwinManager {
34
36
.buildClient()
35
37
36
38
override fun createRoomDigitalTwin (room : Room ): Boolean {
37
- return true
39
+ with (room.toDigitalTwin()) {
40
+ try {
41
+ dtClient.createOrReplaceDigitalTwin(this .id, this , BasicDigitalTwin ::class .java)
42
+ return true
43
+ } catch (e: ErrorResponseException ) {
44
+ println (e) // log the exception.
45
+ return false
46
+ }
47
+ }
38
48
}
39
49
40
50
override fun deleteRoomDigitalTwin (roomId : RoomID ): Boolean {
You can’t perform that action at this time.
0 commit comments