77
88namespace Meadow . Devices . Clima . Controllers ;
99
10+ /// <summary>
11+ /// Controller for handling cloud-related operations.
12+ /// </summary>
1013public class CloudController
1114{
15+ /// <summary>
16+ /// Waits for all data to be sent to the cloud.
17+ /// </summary>
1218 public async Task WaitForDataToSend ( )
1319 {
1420 // TODO: add a timeout here
@@ -20,27 +26,31 @@ public async Task WaitForDataToSend()
2026 Resolver . Log . Info ( $ "All cloud data has been sent") ;
2127 }
2228
29+ /// <summary>
30+ /// Logs the application startup after a crash.
31+ /// </summary>
2332 public void LogAppStartupAfterCrash ( )
2433 {
2534 SendEvent ( CloudEventIds . DeviceStarted , $ "Device restarted after crash") ;
2635 }
2736
37+ /// <summary>
38+ /// Logs the application startup with the specified hardware revision.
39+ /// </summary>
40+ /// <param name="hardwareRevision">The hardware revision of the device.</param>
2841 public void LogAppStartup ( string hardwareRevision )
2942 {
3043 SendEvent ( CloudEventIds . DeviceStarted , $ "Device started (hardware { hardwareRevision } )") ;
3144 }
3245
46+ /// <summary>
47+ /// Logs the device information including name and location.
48+ /// </summary>
49+ /// <param name="deviceName">The name of the device.</param>
50+ /// <param name="latitiude">The latitude of the device location.</param>
51+ /// <param name="longitude">The longitude of the device location.</param>
3352 public void LogDeviceInfo ( string deviceName , double latitiude , double longitude )
3453 {
35- // {
36- // "description": "Clima Boot Telemetry",
37- // "eventId": 109,
38- // "timestamp": "2024-05-20T22:25:15.862Z",
39- // "measurements": {
40- // "lat": 34.2277472,
41- // "long": -118.2273136
42- // }
43- // }
4454 var cloudEvent = new CloudEvent
4555 {
4656 Description = "Clima Position Telemetry" ,
@@ -51,19 +61,33 @@ public void LogDeviceInfo(string deviceName, double latitiude, double longitude)
5161 cloudEvent . Measurements . Add ( "device_name" , deviceName ) ;
5262 cloudEvent . Measurements . Add ( "lat" , latitiude ) ;
5363 cloudEvent . Measurements . Add ( "long" , longitude ) ;
54-
64+
5565 SendEvent ( cloudEvent ) ;
5666 }
67+
68+ /// <summary>
69+ /// Logs a warning message.
70+ /// </summary>
71+ /// <param name="message">The warning message to log.</param>
5772 public void LogWarning ( string message )
5873 {
5974 SendLog ( message , "warning" ) ;
6075 }
6176
77+ /// <summary>
78+ /// Logs an informational message.
79+ /// </summary>
80+ /// <param name="message">The informational message to log.</param>
6281 public void LogMessage ( string message )
6382 {
6483 SendLog ( message , "information" ) ;
6584 }
6685
86+ /// <summary>
87+ /// Logs telemetry data from sensors and power data.
88+ /// </summary>
89+ /// <param name="sensorData">The sensor data to log.</param>
90+ /// <param name="powerData">The power data to log.</param>
6791 public void LogTelemetry ( SensorData sensorData , PowerData powerData )
6892 {
6993 var measurements = sensorData
0 commit comments