# cy035/new architecture

> Architecture diagram of the GitHub repository cy035/new, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cy035/new
- Repository: https://github.com/cy035/new

## Overview

This repository implements a medicine-box IoT system: embedded firmware gathers health and gas readings, exchanges data over SLE, and reports to a cloud IoT service; a WeChat mini-program displays reported measurements and can publish commands. The main firmware workflow is visible in excerpts, as are the mini-program’s MQTT subscription and command publication. Several client, cloud, and gas-server internals are indexed but not excerpted, so uncertain links are omitted. The README provides no additional product capabilities.

Main entry points: [`hispark+liteos/client/app.c`](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/app.c) (Device orchestration), [`hispark+liteos/health_server/app.c`](https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/app.c) (Health tasks), [`hispark+liteos/小程序/pages/index/index.js`](https://github.com/cy035/new/blob/master/hispark%2Bliteos/%E5%B0%8F%E7%A8%8B%E5%BA%8F/pages/index/index.js) (Health dashboard), [`hispark+liteos/client/client.c`](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/client.c) (SLE client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Device firmware"]
  node_firmware_app["Device orchestration<br/>[app.c]"]
  node_device_data["Reading model<br/>[app.h]"]
end

subgraph group_sensors["Sensing and SLE"]
  node_sle_client["SLE client<br/>[client.c]"]
  node_health_app["Health tasks<br/>[app.c]"]
  node_heart_sensor["Heart sensor<br/>[heart.c]"]
  node_temperature_sensor["Temperature sensor<br/>[JX90614.c]"]
  node_health_service["Health SLE service<br/>[server.c]"]
  node_health_advertising["Health advertising<br/>[server_adv.c]"]
  node_gas_service["Gas SLE service<br/>[server.c]"]
  node_gas_advertising["Gas advertising<br/>[server_adv.c]"]
  node_gas_app["Gas service app<br/>[app.c]"]
end

subgraph group_cloud["Cloud connectivity"]
  node_cloud_runtime["IoT runtime<br/>[iot_main.c]"]
  node_cloud_profile["IoT profile<br/>[iot_profile.c]"]
  node_wifi_connection["Wi-Fi connection<br/>[connect.c]"]
end

subgraph group_miniapp["Mini-program"]
  node_miniapp_index["Health dashboard<br/>[index.js]"]
  node_mqtt_client["MQTT utility<br/>[mqtt.js]"]
  node_miniapp_logs["Logs page<br/>[logs.js]"]
end

node_device(("Medicine box"))
node_cloud_service(("IoT cloud"))

node_device -->|"runs on"| node_firmware_app
node_firmware_app -->|"starts task"| node_sle_client
node_firmware_app -->|"starts runtime"| node_cloud_runtime
node_firmware_app -->|"reports readings"| node_cloud_profile
node_firmware_app -->|"checks connection"| node_wifi_connection
node_firmware_app -->|"formats readings"| node_device_data
node_health_app -->|"starts service"| node_health_service
node_health_app -->|"starts measurement"| node_heart_sensor
node_health_app -->|"reads temperature"| node_temperature_sensor
node_health_service -->|"initializes advertising"| node_health_advertising
node_gas_service -->|"initializes advertising"| node_gas_advertising
node_gas_app -.-> node_gas_service
node_sle_client -.->|"receives notifications"| node_health_service
node_sle_client -.->|"receives notifications"| node_gas_service
node_cloud_runtime -.-> node_cloud_profile
node_cloud_profile -.->|"publishes telemetry"| node_cloud_service
node_miniapp_index -->|"uses client"| node_mqtt_client
node_miniapp_index -->|"subscribes and publishes"| node_cloud_service
node_miniapp_index -.-> node_miniapp_logs

click node_firmware_app "https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/app.c"
click node_device_data "https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/app.h"
click node_sle_client "https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/client.c"
click node_health_app "https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/app.c"
click node_heart_sensor "https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/heart.c"
click node_temperature_sensor "https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/JX90614.c"
click node_health_service "https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/server.c"
click node_health_advertising "https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/server_adv.c"
click node_gas_service "https://github.com/cy035/new/blob/master/hispark%2Bliteos/gas_server/server.c"
click node_gas_advertising "https://github.com/cy035/new/blob/master/hispark%2Bliteos/gas_server/server_adv.c"
click node_gas_app "https://github.com/cy035/new/blob/master/hispark%2Bliteos/gas_server/app.c"
click node_cloud_runtime "https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/iot_main.c"
click node_cloud_profile "https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/iot_profile.c"
click node_wifi_connection "https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/connect.c"
click node_miniapp_index "https://github.com/cy035/new/blob/master/hispark%2Bliteos/%E5%B0%8F%E7%A8%8B%E5%BA%8F/pages/index/index.js"
click node_mqtt_client "https://github.com/cy035/new/blob/master/hispark%2Bliteos/%E5%B0%8F%E7%A8%8B%E5%BA%8F/utils/mqtt.js"
click node_miniapp_logs "https://github.com/cy035/new/blob/master/hispark%2Bliteos/%E5%B0%8F%E7%A8%8B%E5%BA%8F/pages/logs/logs.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_firmware_app,node_device_data toneBlue
class node_sle_client,node_health_app,node_heart_sensor,node_temperature_sensor,node_health_service,node_health_advertising,node_gas_service,node_gas_advertising,node_gas_app toneAmber
class node_cloud_runtime,node_cloud_profile,node_wifi_connection toneMint
class node_miniapp_index,node_mqtt_client,node_miniapp_logs toneRose
class node_device,node_cloud_service toneIndigo
```

## Components

### Device firmware

- [Device orchestration](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/app.c): `hispark+liteos/client/app.c`
- [Reading model](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/app.h): `hispark+liteos/client/app.h`

### Sensing and SLE

- [SLE client](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/client.c): `hispark+liteos/client/client.c`
- [Health tasks](https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/app.c): `hispark+liteos/health_server/app.c`
- [Heart sensor](https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/heart.c): `hispark+liteos/health_server/heart.c`
- [Temperature sensor](https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/JX90614.c): `hispark+liteos/health_server/JX90614.c`
- [Health SLE service](https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/server.c): `hispark+liteos/health_server/server.c`
- [Health advertising](https://github.com/cy035/new/blob/master/hispark%2Bliteos/health_server/server_adv.c): `hispark+liteos/health_server/server_adv.c`
- [Gas SLE service](https://github.com/cy035/new/blob/master/hispark%2Bliteos/gas_server/server.c): `hispark+liteos/gas_server/server.c`
- [Gas advertising](https://github.com/cy035/new/blob/master/hispark%2Bliteos/gas_server/server_adv.c): `hispark+liteos/gas_server/server_adv.c`
- [Gas service app](https://github.com/cy035/new/blob/master/hispark%2Bliteos/gas_server/app.c): `hispark+liteos/gas_server/app.c`

### Cloud connectivity

- [IoT runtime](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/iot_main.c): `hispark+liteos/client/iot_main.c`
- [IoT profile](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/iot_profile.c): `hispark+liteos/client/iot_profile.c`
- [Wi-Fi connection](https://github.com/cy035/new/blob/master/hispark%2Bliteos/client/connect.c): `hispark+liteos/client/connect.c`

### Mini-program

- [Health dashboard](https://github.com/cy035/new/blob/master/hispark%2Bliteos/%E5%B0%8F%E7%A8%8B%E5%BA%8F/pages/index/index.js): `hispark+liteos/小程序/pages/index/index.js`
- [MQTT utility](https://github.com/cy035/new/blob/master/hispark%2Bliteos/%E5%B0%8F%E7%A8%8B%E5%BA%8F/utils/mqtt.js): `hispark+liteos/小程序/utils/mqtt.js`
- [Logs page](https://github.com/cy035/new/blob/master/hispark%2Bliteos/%E5%B0%8F%E7%A8%8B%E5%BA%8F/pages/logs/logs.js): `hispark+liteos/小程序/pages/logs/logs.js`

### Other components

- **Medicine box**
- **IoT cloud**

## Connections

- Medicine box → Device orchestration: runs on (evidence: `hispark+liteos/client/app.c`)
- Device orchestration → SLE client: starts task (evidence: `hispark+liteos/client/app.c`)
- Device orchestration → IoT runtime: starts runtime (evidence: `hispark+liteos/client/app.c`)
- Device orchestration → IoT profile: reports readings (evidence: `hispark+liteos/client/app.c`)
- Device orchestration → Wi-Fi connection: checks connection (evidence: `hispark+liteos/client/app.c`)
- Device orchestration → Reading model: formats readings (evidence: `hispark+liteos/client/app.c`)
- Health tasks → Health SLE service: starts service (evidence: `hispark+liteos/health_server/app.c`)
- Health tasks → Heart sensor: starts measurement (evidence: `hispark+liteos/health_server/app.c`)
- Health tasks → Temperature sensor: reads temperature (evidence: `hispark+liteos/health_server/app.c`)
- Health SLE service → Health advertising: initializes advertising (evidence: `hispark+liteos/health_server/server.c`)
- Gas SLE service → Gas advertising: initializes advertising (evidence: `hispark+liteos/gas_server/server.c`)
- Gas service app → Gas SLE service
- SLE client → Health SLE service: receives notifications
- SLE client → Gas SLE service: receives notifications
- IoT runtime → IoT profile
- IoT profile → IoT cloud: publishes telemetry
- Health dashboard → MQTT utility: uses client (evidence: `hispark+liteos/小程序/pages/index/index.js`)
- Health dashboard → IoT cloud: subscribes and publishes (evidence: `hispark+liteos/小程序/pages/index/index.js`)
- Health dashboard → Logs page (evidence: `hispark+liteos/小程序/pages/logs/logs.js`)
