Refactor code structure for improved readability and maintainability
This commit is contained in:
91
diagrams/raspi/03_structure_classes.puml
Normal file
91
diagrams/raspi/03_structure_classes.puml
Normal file
@@ -0,0 +1,91 @@
|
||||
@startuml Structure des Classes et Composants
|
||||
|
||||
skinparam {
|
||||
BackgroundColor white
|
||||
ClassBackgroundColor lightcyan
|
||||
ClassBorderColor gray
|
||||
ClassFontName Arial
|
||||
ClassFontSize 12
|
||||
}
|
||||
|
||||
class Config {
|
||||
+ BASE_DIR : string
|
||||
+ CONFIG_DIR : string
|
||||
+ PROJECT_DIR : string
|
||||
+ LOG_FILE : string
|
||||
+ CONFIG_FILE : string
|
||||
+ API_BASE_URL : string
|
||||
+ API_ENDPOINTS : dict
|
||||
+ DEFAULT_CONFIG : dict
|
||||
--
|
||||
+ ensure_directories()
|
||||
+ setup_logging()
|
||||
+ load_config()
|
||||
+ save_config()
|
||||
+ update_config(new_config)
|
||||
+ get(key, default)
|
||||
+ set(key, value)
|
||||
+ delete_config_file()
|
||||
+ decrement_remaining_images()
|
||||
}
|
||||
|
||||
class APIClient {
|
||||
- base_url : string
|
||||
- headers : dict
|
||||
--
|
||||
+ get_camera_status()
|
||||
+ upload_measurement(image_path, timestamp, temperature, humidity)
|
||||
+ confirm_stop()
|
||||
+ update_camera_config(status)
|
||||
+ check_connection()
|
||||
}
|
||||
|
||||
class TimelapseCaptureManager {
|
||||
- offline_dir : string
|
||||
--
|
||||
+ single_capture(online)
|
||||
+ run_capture_sequence(online)
|
||||
+ sync_offline_captures()
|
||||
+ count_offline_captures()
|
||||
- _move_to_offline(image_path, json_path)
|
||||
- _cleanup_local_capture(image_path, json_path)
|
||||
}
|
||||
|
||||
class "timelapse_online.py" as TimelapseOnline {
|
||||
+ main()
|
||||
}
|
||||
|
||||
class "timelapse_offline.py" as TimelapseOffline {
|
||||
+ main()
|
||||
}
|
||||
|
||||
package "sensors" {
|
||||
class EnvironmentalSensor {
|
||||
+ read_data()
|
||||
}
|
||||
|
||||
class Camera {
|
||||
+ capture_image()
|
||||
}
|
||||
|
||||
class MicroController {
|
||||
+ send_interval(interval)
|
||||
}
|
||||
}
|
||||
|
||||
Config "1" <-- "1" TimelapseOnline : utilise
|
||||
Config "1" <-- "1" TimelapseOffline : utilise
|
||||
Config "1" <-- "1" TimelapseCaptureManager : utilise
|
||||
APIClient "1" <-- "1" TimelapseOnline : utilise
|
||||
TimelapseCaptureManager "1" <-- "1" TimelapseOnline : utilise
|
||||
TimelapseCaptureManager "1" <-- "1" TimelapseOffline : utilise
|
||||
TimelapseCaptureManager "1" --> "1" EnvironmentalSensor : utilise
|
||||
TimelapseCaptureManager "1" --> "1" Camera : utilise
|
||||
APIClient "1" --> "1" Config : utilise
|
||||
TimelapseOffline ..> MicroController : utilise
|
||||
|
||||
note bottom of Config : "Gestion de la configuration\nlocale et persistance"
|
||||
note bottom of APIClient : "Communication avec\nle serveur distant"
|
||||
note bottom of TimelapseCaptureManager : "Orchestration du processus\nde capture d'images"
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user