-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Pairing): Added installation info to pairing results
- Loading branch information
1 parent
28374eb
commit c7b2ae3
Showing
16 changed files
with
150 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
import json, tables | ||
import base | ||
import ../../../../app_service/service/accounts/dto/accounts | ||
|
||
import ../../../../app_service/service/devices/dto/installation | ||
import ../../../../app_service/service/devices/dto/local_pairing_event | ||
|
||
|
||
type LocalPairingSignal* = ref object of Signal | ||
eventType*: string | ||
action*: int | ||
eventType*: EventType | ||
action*: Action | ||
error*: string | ||
account*: AccountDto | ||
installation*: InstallationDto | ||
|
||
proc fromEvent*(T: type LocalPairingSignal, event: JsonNode): LocalPairingSignal = | ||
result = LocalPairingSignal() | ||
let e = event["event"] | ||
if e.contains("type"): | ||
result.eventType = e["type"].getStr | ||
result.eventType = e["type"].getStr().parse() | ||
if e.contains("action"): | ||
result.action = e["action"].getInt | ||
result.action = e["action"].getInt().parse() | ||
if e.contains("error"): | ||
result.error = e["error"].getStr | ||
if e.contains("data"): | ||
result.account = e["data"].toAccountDto() | ||
result.error = e["error"].getStr() | ||
if not e.contains("data"): | ||
return | ||
case result.eventType: | ||
of EventReceivedAccount: | ||
result.account = e["data"].toAccountDto() | ||
of EventReceivedInstallation: | ||
result.installation = e["data"].toInstallationDto() | ||
else: | ||
discard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.