1
|
@startuml
|
2
|
interface IProcessDection {
|
3
|
+ void RunPeriodicDetection()
|
4
|
}
|
5
|
|
6
|
class ProcessDetection {
|
7
|
____
|
8
|
+ ProcessProcessDetection(string processName,
|
9
|
uint detectionPeriodMs,
|
10
|
InfoFetcher infoFetcher,
|
11
|
IApiClient apiClient)
|
12
|
|
13
|
+ async void RunPeriodicDetection()
|
14
|
}
|
15
|
|
16
|
interface IApiClient {
|
17
|
+ Task SendPayloadAsync(Payload payload)
|
18
|
+ void Run()
|
19
|
}
|
20
|
|
21
|
class ApiClient {
|
22
|
____
|
23
|
+ ApiClient(string url, uint port,
|
24
|
string path, uint retryPeriod,
|
25
|
uint maxEntries, uint maxRetries,
|
26
|
string cacheFilename)
|
27
|
|
28
|
+ async Task SendPayloadAsync(Payload payload)
|
29
|
+ async void Run()
|
30
|
}
|
31
|
|
32
|
class InfoFetcher {
|
33
|
____
|
34
|
+ string HeadSerialNumber
|
35
|
+ string BodySerialNumber
|
36
|
|
37
|
+ InfoFetcher(uint maxAttempts, uint waitPeriodMs,
|
38
|
string infoFilePath, string f32RemExecutable,
|
39
|
string[] f32RemArguments, int f32SuccessExitCode,
|
40
|
int f32WaitTimeoutMs)
|
41
|
|
42
|
+ async Task<bool> FetchDataAsync()
|
43
|
}
|
44
|
|
45
|
class DebuggerInfoParser {
|
46
|
+ {static} static (string headSerialNumber,
|
47
|
{static} string bodySerialNumber) Parse(string dataTxt)
|
48
|
}
|
49
|
|
50
|
abstract class ALogger{
|
51
|
+ ALogger Current
|
52
|
|
53
|
- LogVerbosity _verbosity
|
54
|
- LogFlow _logFlow
|
55
|
|
56
|
+ void Info(string message)
|
57
|
+ void Debug(string message)
|
58
|
+ void Error(string message)
|
59
|
+ void Error(Exception e)
|
60
|
|
61
|
# ALogger()
|
62
|
|
63
|
{abstract} # CreateLog(string message)
|
64
|
}
|
65
|
|
66
|
|
67
|
class FileLogger{
|
68
|
# CreateLog(string message)
|
69
|
- void Rotate(string filePat)
|
70
|
|
71
|
}
|
72
|
|
73
|
class ConsoleLogger{
|
74
|
# CreateLog(string message)
|
75
|
|
76
|
}
|
77
|
|
78
|
enum LogVerbosity{
|
79
|
None
|
80
|
Exceptions
|
81
|
Full
|
82
|
}
|
83
|
|
84
|
enum LogFlow{
|
85
|
Console
|
86
|
File
|
87
|
}
|
88
|
|
89
|
|
90
|
class Payload{
|
91
|
+ string UserName
|
92
|
+ string HostName
|
93
|
+ string TimeStamp
|
94
|
+ DebuggerInfo HeadDevice
|
95
|
+ DebuggerInfo BodyDevice
|
96
|
+ ConnectionStatus Status
|
97
|
}
|
98
|
|
99
|
class DebuggerInfo{
|
100
|
+ string SerialNumber
|
101
|
}
|
102
|
|
103
|
enum ConnectionStatus{
|
104
|
Connected
|
105
|
Disconnected
|
106
|
}
|
107
|
|
108
|
LogVerbosity -[hidden] ALogger
|
109
|
ALogger -left[hidden] LogFlow
|
110
|
|
111
|
ALogger ---left[hidden] ProcessDetection
|
112
|
|
113
|
Payload -right[hidden] ApiClient
|
114
|
|
115
|
ALogger <|.. FileLogger
|
116
|
ALogger <|.. ConsoleLogger
|
117
|
ALogger .. LogVerbosity
|
118
|
ALogger .. LogFlow
|
119
|
|
120
|
Payload o- DebuggerInfo
|
121
|
Payload o- ConnectionStatus
|
122
|
|
123
|
IProcessDection <|.. ProcessDetection : implements
|
124
|
IApiClient <|.. ApiClient : implements
|
125
|
DebuggerInfoParser <.. InfoFetcher : calls (uses)
|
126
|
ProcessDetection o-- IApiClient : is held in
|
127
|
note on link: Uses ApiClient to send\ndatato the server
|
128
|
ProcessDetection o-- InfoFetcher : is held in
|
129
|
note on link: Calls FetchDataAsync,\nreads the status\ncode (true/false)
|
130
|
|
131
|
class DebuggerInfoParser
|
132
|
note left: Parses the content of a .txt file \n(throws an ArgumentException)
|
133
|
|
134
|
class InfoFetcher
|
135
|
note left: Sends commands to the\ndebugger, periodically attempts\nto parse the .txt file
|
136
|
|
137
|
class ApiClient
|
138
|
note left: Sends data (payload) to the server,\nmanages a file-based cache.
|
139
|
|
140
|
class ProcessDetection
|
141
|
note top: Detects a running\nprocess (t32mtc)
|
142
|
|
143
|
note top of ALogger
|
144
|
Wraps up common logging functions.
|
145
|
Singleton design pattern
|
146
|
end note
|
147
|
|
148
|
note bottom of FileLogger
|
149
|
Transfers logs into file. Upon reaching
|
150
|
specified size starts logging into new file.
|
151
|
Full block of files are zipped.
|
152
|
end note
|
153
|
|
154
|
@enduml
|