|
SDK สำหรับ TESAIoT Dev Kit
คู่มืออ้างอิง API และ Tutorial (MTB & µPython)
|
#include <stdint.h>#include <stdbool.h>#include <stddef.h>#include "optiga_util.h"#include "common/optiga_lib_types.h"Go to the source code of this file.
Functions | |
| bool | optiga_manager_init (callback_handler_t callback, void *context) |
| นำ OPTIGA stack ขึ้นทำงาน (idempotent — เรียกซ้ำแล้วได้ผลเดิม) เรียกได้เฉพาะใน task context — คืน false หากชิปไม่ตอบ | |
| optiga_util_t * | optiga_manager_acquire (void) |
| instance ของ optiga_util ที่ใช้ร่วมกัน; เป็น NULL จนกว่า optiga_manager_init() จะทำงานแล้ว | |
| void | optiga_manager_release (void) |
| ปล่อย instance ที่ acquire มา — เพียงครั้งเดียวต่อหนึ่งการ acquire ที่ไม่ใช่ NULL ในทุกเส้นทางออก | |
| bool | optiga_manager_lock (void) |
| จับ mutex ของ manager; คืน false เมื่อไม่เคย initialise — เป็นการทดสอบ "manager ขึ้นแล้วหรือยัง" ที่แท้จริง | |
| void | optiga_manager_unlock (void) |
| unlock หนึ่งครั้งต่อ lock ที่สำเร็จหนึ่งครั้ง รวมทุกเส้นทางออกก่อนกำหนด; ให้ปล่อย touch hold ก่อน | |
| bool | optiga_chip_enter (void) |
| เปิดเซสชันกับชิป (re-entrant ต่อหนึ่ง task); ค่า false เป็นความล้มเหลวเด็ดขาดของการเรียกครั้งนี้ — และไม่ใช่การตรวจสอบว่า init แล้วหรือยัง | |
| void | optiga_chip_exit (void) |
| exit หนึ่งครั้งต่อ enter ที่สำเร็จหนึ่งครั้ง; ห้ามเรียกหลังจาก enter ที่ล้มเหลว | |
| void | optiga_manager_touch_hold (void) |
| การจับไว้ (hold) แบบนับจำนวน ครอบการติดต่อกับชิปทั้งชุด; การจับไว้ครั้งแรกจะหลับ 50 ms | |
| void | optiga_manager_touch_hold_reason (const char *reason) |
| การจับไว้แบบนับจำนวนแบบเดียวกัน พร้อมข้อความ busy modal ที่ CM55 แสดงระหว่างที่การสัมผัสถูกปิด | |
| void | optiga_manager_touch_release (void) |
| ลดค่าตัวนับการจับไว้ — จับคู่ 1:1 อย่างเคร่งครัดกับการจับไว้ทุกครั้ง ในทุกการคืนค่าก่อนกำหนด | |
| int | publish_csr (uint8_t *csr, size_t csr_length, uint16_t target_oid, uint16_t trust_anchor_oid, uint32_t payload_version) |
| publish CSR ที่สร้างไว้เสร็จแล้วเพื่อให้แพลตฟอร์มเซ็นให้; เป็น weak — ให้ตรวจ NULL ก่อน และเป็นตัวตั้ง ingest ให้พร้อมรับ | |
| int | tesaiot_publish_protected_update (const char *target_oid, const char *trust_anchor_oid, uint32_t payload_version, bool with_csr) |
| ขอ Protected Update จากแพลตฟอร์ม (OID เป็น hex string); เป็น weak — ให้ตรวจ NULL ก่อน | |
| void | tesaiot_run_protected_update_isolated_test (void) |
| การทดสอบ Protected Update แบบโต้ตอบตั้งแต่ต้นจนจบกับ slot ทดสอบที่แยกไว้; บล็อกอยู่ที่ scanf() | |
| void | trustm_update_state (trustm_state_t new_state, const char *status_code, const char *detail) |
| เป็น setter ที่แนบเวลากำกับ ไม่ใช่ dispatcher; ให้ตั้งสถานะ WAITING_* ก่อนที่ transport จะเริ่ม | |
| void | trustm_reset_state (void) |
| กลับสู่ IDLE และล้าง correlation id เป็นศูนย์ — นี่คือสิ่งที่จบรอบการทำงาน; ให้เรียกที่ทุกเส้นทางออก | |
| uint16_t | trustm_requested_target_oid (void) |
| OID เป้าหมายที่คำขอครั้งล่าสุดระบุไว้; เป็น weak — ให้ตรวจ NULL และถอยไปใช้ 0xE0E1. | |
| uint16_t | trustm_requested_anchor_oid (void) |
| trust anchor ที่คำขอครั้งล่าสุดระบุไว้; เป็น weak — รูปแบบเดียวกัน ค่าเริ่มต้น 0xE0E8 | |
| const char * | trustm_current_correlation_id (void) |
| id ของรอบที่กำลังทำงานอยู่ หรือ NULL; NULL หมายถึงให้ทิ้ง bundle ที่เข้ามา — นี่คือการป้องกันการเล่นซ้ำ | |
| enum trustm_state_t |
Where the enrolment state machine is.