Files
OpenParcelBox/firmware/app/src/opb_ble.h
T

49 lines
1.3 KiB
C

/*
* SPDX-License-Identifier: Apache-2.0
*
* OpenParcelBox
* Copyright (c) 2026
*
* Bluetooth Low Energy administration service.
*/
#ifndef OPB_BLE_H
#define OPB_BLE_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
typedef int (*opb_ble_open_lock_cb_t)(const char *source, const char *actor);
/**
* @brief Initialize BLE advertising and the OpenParcelBox GATT service.
*
* @param open_lock_cb Callback used by the BLE command service to request a
* lock opening through the normal application path.
*
* @return 0 on success, negative value on error.
*/
int opb_ble_init(opb_ble_open_lock_cb_t open_lock_cb);
/**
* @brief Get the current synchronized Unix time.
*
* @param unix_ms Output Unix timestamp in milliseconds.
*
* @return true when the phone has synchronized the clock since boot.
*/
bool opb_ble_get_unix_time_ms(int64_t *unix_ms);
/**
* @brief Notify connected clients that the readable state changed.
*/
void opb_ble_notify_state_changed(void);
bool opb_ble_take_nfc_enrollment(void);
bool opb_ble_take_nfc_enrollment_cancel(void);
void opb_ble_set_nfc_enrollment_uid(const uint8_t *uid, size_t uid_length);
void opb_ble_set_nfc_enrollment_error(const char *error);
void opb_ble_clear_bonds_after_reset(void);
#endif /* OPB_BLE_H */