19 lines
876 B
C
19 lines
876 B
C
/* Объявление VibeChat: VC, версия 3, node_id BE64, имя UTF-8 до 13 байт.
|
||
* encode возвращает размер 11..24 либо -1; decode возвращает 0 либо -1.
|
||
* Имя сокращается по целому символу; decode отклоняет неверный UTF-8 и нулевой ID. */
|
||
#ifndef VIBECHAT_BLE_IDENTITY_H
|
||
#define VIBECHAT_BLE_IDENTITY_H
|
||
#include <stdint.h>
|
||
#include <stddef.h>
|
||
#define BLE_IDENTITY_VERSION 3 /* DATA с 16-bit flow ID и обязательной ACK-характеристикой. */
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
struct ble_identity { uint64_t node_id; char name[14]; };
|
||
int ble_identity_encode(uint8_t output[24], uint64_t node_id, const char* name);
|
||
int ble_identity_decode(struct ble_identity* output, const uint8_t* data, size_t size);
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
#endif
|