Core Library Functions
The Hublink library provides several key functions for managing BLE communication and file transfer:
sync(uint32_t temporaryConnectFor = 0)
Section titled “sync(uint32_t temporaryConnectFor = 0)”Manages BLE advertising and connection cycles. Returns true if a connection was established.
temporaryConnectFor: Optional duration in seconds to override the default advertising period- Returns: boolean indicating if connection was successful
sleep(uint64_t seconds)
Section titled “sleep(uint64_t seconds)”Puts the ESP32 into light sleep mode for the specified duration to conserve battery.
setBatteryLevel(uint8_t level)
Section titled “setBatteryLevel(uint8_t level)”Sets the battery level for the node characteristic. Range 0-255 (0 indicates not set).
setAlert(const String &alert)
Section titled “setAlert(const String &alert)”Sets an alert message that will be synced to the cloud. The user must persist the alert in their
sketch—it is automatically cleared after the hublink.sync() completes. Alerts can also be cleared
in the dashboard by a user.