Guía de Desarrollador de Plataforma DejaOS
Publicado 2026-08-26
中ENDejaOS es la plataforma de sistema operativo IoT de CoolCode酷豆 para terminales de acceso (sobre LVGL). Esta guía cubre rutas de acceso, el subprotocolo Widget y ejemplos de API abierta en la nube.
DejaOS is CoolCode酷豆’s IoT operating-system platform for smart access terminals, built on the LVGL graphics framework to unify device UI, interaction logic and rendering parameters; try it live at dejaos.coolcode.com.
1. Developer access paths
① Cloud open API: org sync, bulk permission push, access/alarm log return — for platform-level integration; ② device-side Widget: embeds AI/interaction into the terminal UI, handshaking securely with the terminal via a WebSocket subprotocol.
2. Cloud open API (org-sync sample)
Create an enterprise space on the CoolCode酷豆 cloud platform to get the API Key and device-group ID; then push personnel and permissions via the "org sync" API. The sample below is an honest skeleton — fields per the open API docs:
```js // Pseudocode: org-sync bulk push (fields per open API docs) const res = await fetch(`${PLATFORM_BASE}/api/v1/org/sync`, { method: "POST", headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ groupId: DEVICE_GROUP_ID, users: [{ id, name, perm }] }) }); ```
3. Device-side Widget subprotocol (CoolCode.widget.v1)
The Widget handshakes with the terminal over WebSocket. The browser WebSocket API cannot set custom headers; the only channel to carry a credential at handshake is Sec-WebSocket-Protocol. The sample below shows negotiating CoolCode.widget.v1 — an honest skeleton:
```js // Pseudocode: handshake via subprotocol (token in subprotocol, not URL) const protocols = ["CoolCode.widget.v1", `kd-token.${btoa(urlSafe(TOKEN))}`]; const ws = new WebSocket("wss://dejaos.coolcode.com/widget", protocols); ws.onopen = () => console.log("subprotocol:", ws.protocol); // echoes CoolCode.widget.v1 ```
4. Integration notes
① Pass tokens via subprotocol, never in the URL (avoids access-log leakage); ② exact fields and token issuance follow the latest open-platform / product-manual docs; ③ debug end-to-end in a test space before switching to production.
Preguntas frecuentes
¿Qué es DejaOS?
La plataforma de sistema operativo IoT de CoolCode酷豆 para terminales de acceso inteligente, construida sobre el framework gráfico LVGL para unificar UI, lógica e interacción.
¿Qué rutas de acceso tienen los desarrolladores?
Dos: ① API abierta en la nube (sincronización, envío de permisos, registros); ② Widget en dispositivo vía subprotocolo WebSocket CoolCode.widget.v1.
¿Cómo se autentica el subprotocolo Widget?
En el handshake, el token CoolCode.widget.v1 y la credencial viajan por Sec-WebSocket-Protocol; el token exacto es el Widget Token de la plataforma abierta — pásalo por subprotocolo, no en la URL.
