19 lines
866 B
C
19 lines
866 B
C
/* Объявление VibeChat: VC, версия 2, 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 2 /* DATA Write Without Response/Notify; версия 1 несовместима. */
|
|
#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
|