Skip to content

Commit 2cf39bf

Browse files
committed
README Formatting improvements and added key concepts #285
1 parent 407de9e commit 2cf39bf

15 files changed

Lines changed: 127 additions & 99 deletions

File tree

source/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ All `.mc` files include inline comments and documentation describing the purpose
2828

2929
---
3030

31-
## Subfolders
31+
## Folder Structure
3232

3333
### Subfolder `config/`
3434

source/config/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Garmin SDK’s _Properties_ are stored externally from the app and persist a
1414

1515
---
1616

17-
## Structure and Usage
17+
## Key Concepts
1818

1919
All devices inherit default values from `BaseConfig` and `GlanceBaseConfig`, which define all configuration values used in the _Widget_ and _Glance_, respectively.
2020

@@ -24,7 +24,7 @@ Additional base classes can be introduced for specific device families. For exam
2424

2525
---
2626

27-
## Key Files and Directories
27+
## Folder Structure
2828

2929
- `base/`:
3030
Contains `BaseConfig` and `GlanceBaseConfig`, which define the baseline values for all devices.

source/main/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ While most code in this directory is shared, certain parts are conditionally inc
77

88
---
99

10-
## Subfolder Structure
10+
## Folder Structure
1111

1212
### Subfolder `data/`
1313

@@ -22,8 +22,6 @@ This includes:
2222

2323
For more details, see the folder’s [README](data/README.md).
2424

25-
---
26-
2725
### Subfolder `infrastructure/`
2826

2927
Provides the technical foundation of the application.
@@ -32,8 +30,6 @@ It contains the main `OHApp` class responsible for managing the application life
3230

3331
For more details, see the folder’s [README](infrastructure/README.md).
3432

35-
---
36-
3733
### Subfolder `user-interface/`
3834

3935
Contains all presentation-layer code.

source/main/data/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,20 @@ Implements the data layer of the application.
44

55
---
66

7-
## Subfolder Structure
7+
## Folder Structure
88

99
### Subfolder `communications/`
1010

1111
Responsibel for keeping the data layer in sync with the openHAB server.
1212

1313
For more details, see the folder’s [README](communications/README.md).
1414

15-
---
16-
1715
### Subfolder `sitemap/`
1816

1917
This folder defines the data model for parsing and representing sitemap content from openHAB. The classes defined in sitemap feed the data to be displayed to the user interface.
2018

2119
For more details, see the folder’s [README](sitemap/README.md).
2220

23-
---
24-
2521
### Subfolder `storage/`
2622

2723
Handles reading from and writing to persistent storage.

source/main/data/communications/README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,40 @@ This folder contains the connection management logic, HTTP request handling and
66

77
---
88

9-
## Subfolder Structure
9+
## Key Concepts
10+
11+
### Connection Mode
12+
13+
The app supports two connection modes: Bluetooth Low Energy (BLE) via the paired phone and direct Wi-Fi.
14+
15+
The BLE connection is effectively always on and allows regular polling of the sitemap, including state updates. In contrast, using Wi-Fi requires entering a dedicated Garmin sync mode. During this process, native Garmin system views are shown to indicate sync progress and completion.
16+
17+
Because of this limitation, no item states are displayed while operating in Wi-Fi mode. Commands can still be sent, but they are executed within the sync workflow. A manual sitemap refresh can also be triggered from the settings menu, though this updates only the sitemap structure and does not display live states.
18+
19+
The decision not to display states in Wi-Fi mode is intentional. State accuracy is critical, and showing potentially outdated or inconsistent information would be misleading. In particular, after sending a command there is no reliable way to predict possible side effects on related items. For example, switching on a light could affect a nearby group item. Without real-time updates, the UI might display inconsistent states. In such cases, it is preferable to show no state at all rather than an incorrect one.
20+
21+
See also the user manual’s [Network Access](https://next.openhab.org/docs/apps/garmin/#network-access) section for a user-facing explanation of this behavior.
22+
23+
### Sitemap Updates
24+
25+
Connect IQ does not support subscribing to sitemap updates from openHAB. Therefore, the app periodically polls the complete sitemap via a web request and rebuilds the menu structure based on the response.
26+
27+
The polling interval can be configured by the user in the app settings.
28+
29+
### Commands
30+
31+
Commands are sent using a dedicated command web request. This request is triggered by the menu items representing the corresponding sitemap elements.
32+
33+
---
34+
35+
## Folder Structure
1036

1137
### Subfolder `connection/`
1238

1339
Contains the `ConnectionManager`, which tracks the currently available connection type (BLE vs. Wi-Fi) and manages transitions between normal, degraded (Wi-Fi), and offline modes.
1440

1541
For more details on connection behavior, see the [Network Access](https://next.openhab.org/docs/apps/garmin/#network-access) section of the user manual.
1642

17-
---
18-
1943
### Subfolder `sync-delegates/`
2044

2145
Implements Wi-Fi-based synchronization used when no BLE connection is available.
@@ -35,7 +59,7 @@ Implements communication with the openHAB server using the Connect IQ SDK’s `T
3559

3660
These requests are used for both BLE communication and Wi-Fi mode. In addition to sending and receiving data, this layer is responsible for processing server responses—for example, initializing a new sitemap and forwarding it to the user interface.
3761

38-
#### Subfolders
62+
#### Folder Structure
3963

4064
- **`web-requests/base/`**
4165
Contains `BaseRequest`, the abstract base class for all HTTP requests.

source/main/data/sitemap/README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,31 @@ See the user manual for details: [User Manual – Sitemap Setup](https://next.op
88

99
---
1010

11-
## Subfolder Structure
11+
## Key Concepts
12+
13+
The sitemap data structure represents a single sitemap response received from openHAB. It is therefore inherently transient and exists only until the next response is received from the server, at which point it is fully replaced.
14+
15+
As a general rule, the sitemap data structure is not modified after it has been created. Instead, it reflects exactly the state provided by the server.
16+
17+
There is one exception to this rule. When a command is sent successfully, the UI immediately reflects the expected new state without waiting for the next server response. This behavior is controlled by the corresponding menu items, which update the sitemap data structure locally to match the anticipated state. We refer to this as an internal update.
18+
19+
---
20+
21+
## Folder Structure
1222

1323
### Subfolder `base/`
1424

1525
Contains `SitemapElement.mc`, the abstract base class for all sitemap elements.
1626

1727
It defines shared properties and common parsing logic used by all concrete sitemap element types.
1828

19-
---
20-
2129
### Subfolder `json/`
2230

2331
The Connect IQ API delivers JSON data as a dictionary.
2432
`JsonObjectAdapter` provides type-safe accessors for retrieving objects, arrays, strings, numbers, and booleans from the JSON structure.
2533

2634
This layer isolates JSON handling details from the higher-level sitemap model.
2735

28-
---
29-
3036
### Subfolder `pages/`
3137

3238
Contains classes representing the **content** of container-type sitemap elements (e.g., frames or groups).
@@ -35,15 +41,13 @@ These classes model the internal structure and child elements of a container. Th
3541

3642
To keep the UI responsive and avoid limitations such as the Watchdog timeout for long-running code and stack size restrictions caused by recursive processing, pages are processed asynchronously and non-recursively. The work is split into small tasks that are executed by the task queue implementation.
3743

38-
---
39-
4044
### Subfolder `widgets/`
4145

4246
Contains `SitemapElement` subclasses representing concrete sitemap widgets, such as switches, sliders, text labels, and container elements.
4347

4448
For container-type elements (e.g., frames or groups), the widget class describes the container itself and links to the corresponding implementation in `pages/` to represent its content.
4549

46-
#### Subfolders
50+
#### Folder Structure
4751

4852
- **`base/`**
4953
Contains `SitemapWidget`, the base class for all widget-type elements.

source/main/infrastructure/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ It contains the main `OHApp` class responsible for managing the application life
66

77
---
88

9-
## Subfolder Structure
9+
## Folder Structure
1010

1111
### Subfolder `appbase/`
1212

source/main/user-interface/README.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ This directory defines how the app is rendered and how users interact with it. I
66

77
---
88

9-
## Subfolder `base/`
9+
## Folder Structure
10+
11+
### Subfolder `base/`
1012

1113
Provides abstract and shared base classes for menu implementations:
1214

@@ -20,19 +22,15 @@ Provides abstract and shared base classes for menu implementations:
2022
Additional sitemap-specific styling logic is implemented in
2123
`features/sitemap/menu-items/base/BaseSitemapMenuItem`.
2224

23-
---
24-
25-
## Subfolder `fallbacks/`
25+
### Subfolder `fallbacks/`
2626

2727
Contains components responsible for fallback behavior, such as error handling and the loading view.
2828

2929
These classes are used when normal feature rendering cannot proceed (e.g., due to communication failures or missing data). They ensure that the application remains robust and provides meaningful feedback to the user.
3030

3131
For more details, see the folder’s [README](fallbacks/README.md).
3232

33-
---
34-
35-
## Subfolder `features/`
33+
### Subfolder `features/`
3634

3735
Implements the main user-facing features of the application.
3836

@@ -44,19 +42,15 @@ The current feature categories are:
4442

4543
For more details, see the folder’s [README](features/README.md).
4644

47-
---
48-
49-
## Subfolder `shared/`
45+
### Subfolder `shared/`
5046

5147
Contains reusable UI components that are used across multiple features.
5248

5349
These classes represent visible UI elements or composable building blocks that can be rendered in different contexts.
5450

5551
For more details, see the folder’s [README](shared/README.md).
5652

57-
---
58-
59-
## Subfolder `ui-infrastructure/`
53+
### Subfolder `ui-infrastructure/`
6054

6155
Contains central, stateful runtime facilities that support the user interface.
6256

source/main/user-interface/fallbacks/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Contains components responsible for fallback behavior, including error handling
44

55
---
66

7-
## Subfolder `error-handling/`
7+
## Folder Structure
8+
9+
### Subfolder `error-handling/`
810

911
Manages the detection, handling, and presentation of exceptions within the app.
1012

@@ -17,9 +19,7 @@ Manages the detection, handling, and presentation of exceptions within the app.
1719
- `WarningToastHandler`
1820
Determines whether a non-fatal error should be displayed as a toast notification and provides the functionality to show these notifications.
1921

20-
---
21-
22-
## Subfolder `loading-view/`
22+
### Subfolder `loading-view/`
2323

2424
Implements a full-screen loading indicator that signals data is being retrieved.
2525

source/main/user-interface/features/README.md

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -30,64 +30,21 @@ The _Settings_ menu is also implemented using `CustomMenu`.
3030

3131
---
3232

33-
## Subfolder `glance/`
33+
## Folder Structure
3434

35-
Implements the Glance feature.
36-
37-
`GlanceSitemapView` provides a compact view that reads the sitemap label from persistent storage and displays it in the glance carousel.
38-
39-
When the app is launched in glance mode, `OHApp.getGlanceView()` acts as the entry point and prepares the corresponding view.
35+
### Subfolder `glance/`
4036

41-
### Memory Constraints
42-
43-
When running as a glance, available memory is very limited. Connect IQ supports scoped classes and resources for this purpose. Classes required in glance mode must be annotated with `(:glance)`, and only the strictly necessary classes should be included in this scope.
37+
Implements the Glance feature.
4438

45-
---
39+
For detailed information, see the folder’s [README](glance/README.md).
4640

47-
## Subfolder `settings-menu/`
41+
### Subfolder `settings/`
4842

4943
Implements the _Settings_ feature.
5044

51-
Currently provides the following information and actions:
52-
53-
- App version
54-
- openHAB server URL
55-
- Current connection mode (Phone/BLE, Wi-Fi, Offline)
56-
- Timestamp of the last sitemap update
57-
- Manual sitemap update over Wi-Fi
58-
59-
Because Wi-Fi mode does not automatically poll for structural sitemap changes, updates must be triggered manually when operating without a BLE connection.
60-
See [No Polling of Sitemap Changes and States](https://next.openhab.org/docs/apps/garmin/#no-polling-of-sitemap-changes-and-states) in the user manual for details and screenshots.
61-
62-
### Platform-Specific Behavior
63-
64-
- **Button-based devices**
65-
The _Settings_ menu appears as a parallel menu to the homepage. It is accessed by scrolling beyond the title or footer of the _Homepage_ menu, mimicking the system settings access pattern on devices such as the Fenix 7 Pro or Epix 2 Pro.
66-
67-
- **Touch-based devices**
68-
Due to more limited gesture support, the _Settings_ menu is implemented as a regular menu item within the _Homepage_.
69-
70-
Device-specific behavior is defined in the `monkey.jungle` build file. Exclusion annotations (also used in input delegates) ensure that the correct implementation is compiled per device.
71-
72-
### Subfolders
73-
74-
#### Subfolder `manager/`
75-
76-
Contains `SettingsMenuManager`, which controls the lifecycle and presentation of the settings menu.
77-
78-
It maintains singleton instances of the menu and its input delegate, tracks whether the menu is currently visible, and coordinates transitions between the homepage and the settings view. It also determines focus behavior based on slide direction and input type, and manages pushing and popping the view on the `ViewStack`.
79-
80-
#### Subfolder `menu/`
81-
82-
Contains the `SettingsMenu` implementation based on `BaseMenu`, along with the corresponding input delegates for handling user interaction.
83-
84-
#### Subfolder `menu-items/`
85-
86-
Contains the individual menu items displayed within the _Settings_ menu.
87-
88-
---
45+
For detailed information, see the folder’s [README](settings/README.md).
8946

90-
## Subfolder `sitemap/`
47+
### Subfolder `sitemap/`
9148

9249
Implements the core UI for displaying and interacting with openHAB sitemap content.
9350

0 commit comments

Comments
 (0)