SDK สำหรับ TESAIoT Dev Kit
คู่มืออ้างอิง API และ Tutorial (ModusToolbox)
Toggle main menu visibility
Loading...
Searching...
No Matches
sensor_stream.h
Go to the documentation of this file.
1
/*******************************************************************************
2
* File Name: sensor_stream.h
3
*
4
* Description: Periodic sensor sampler for the Bento Desktop Buddy bridge.
5
* Emits `bento.sensor.data` NUS events at a caller-specified
6
* interval. v1 supports a single active stream at a time; the
7
* ring-of-active-streams design is deferred
8
* until multi-sensor dashboards are needed.
9
*
10
******************************************************************************/
11
12
#ifndef SENSOR_STREAM_H
13
#define SENSOR_STREAM_H
14
15
#include <stdbool.h>
16
#include <stddef.h>
17
#include <stdint.h>
18
19
#ifdef __cplusplus
20
extern
"C"
{
21
#endif
22
23
/* One-time FreeRTOS task spawn. Safe to call multiple times — subsequent
24
* calls are no-ops. Invoked lazily the first time a stream is started. */
25
int
sensor_stream_init
(
void
);
26
27
/* Start streaming sensor id at the given interval (clamped to [10, 5000] ms).
28
* Replaces any in-progress stream (v1 single-stream). Returns 0 on success,
29
* -1 if id is not recognised. */
30
int
sensor_stream_start
(
const
char
*
id
, uint32_t interval_ms);
31
32
/* Stop the active stream. Idempotent. */
33
void
sensor_stream_stop
(
const
char
*
id
);
34
35
/* Number of samples dropped because the NUS TX queue refused to accept
36
* them (link disconnected or buffer full). Exposed for bento.info.board. */
37
uint32_t
sensor_stream_dropped_count
(
void
);
38
39
/* True iff a stream is currently active. Used by the firmware-update handler
40
* to return {"ok":false,"error":"busy"} when a flash attempt races a running
41
* stream. */
42
bool
sensor_stream_is_active
(
void
);
43
44
/* Stop any active stream unconditionally. Idempotent. Called by the firmware-
45
* update flow on Y-approve so the flasher operates on a quiescent device. */
46
void
sensor_stream_stop_all
(
void
);
47
48
#ifdef __cplusplus
49
}
50
#endif
51
52
#endif
/* SENSOR_STREAM_H */
sensor_stream_stop_all
void sensor_stream_stop_all(void)
หยุด stream ที่ทำงานอยู่ทั้งหมดโดยไม่มีเงื่อนไข — เป็นเส้นทางพักเครื่องให้นิ่งก่อนอัปเดต
sensor_stream_is_active
bool sensor_stream_is_active(void)
คืน true ก็ต่อเมื่อมี stream ทำงานอยู่ เป็นตัวกัน "busy" ของ handler การอัปเดต
sensor_stream_stop
void sensor_stream_stop(const char *id)
หยุด stream ที่ทำงานอยู่ เป็น idempotent
sensor_stream_start
int sensor_stream_start(const char *id, uint32_t interval_ms)
เริ่มสตรีมเซนเซอร์หนึ่งตัว ผู้เรียกที่มีอยู่จริงในของที่ส่งมอบบีบค่า interval ให้อยู่ในช่วง [10,...
sensor_stream_dropped_count
uint32_t sensor_stream_dropped_count(void)
จำนวนตัวอย่างที่เส้นทาง NUS TX ปฏิเสธไว้ (link หลุดหรือบัฟเฟอร์เต็ม) ใช้ในข้อมูลวินิจฉัยของบอร์ด
sensor_stream_init
int sensor_stream_init(void)
สร้าง task ครั้งเดียว ถูกเรียกแบบ lazy โดย sensor_stream_start() — ห้ามเรียกโดยตรง
dist
ble_nus
include
sensor_stream.h
Generated by
1.18.0