Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

hawkBit event API. More...

Macros

#define HAWKBIT_EVENT_CREATE_CALLBACK(_callback, _handler, _event)
 Macro to create and initialize a struct hawkbit_event_callback properly.
 

Typedefs

typedef void(* hawkbit_event_callback_handler_t) (struct hawkbit_event_callback *cb, enum hawkbit_event_type event)
 Define the application callback handler function signature.
 

Enumerations

enum  hawkbit_event_type {
  HAWKBIT_EVENT_ERROR , HAWKBIT_EVENT_ERROR_NETWORKING , HAWKBIT_EVENT_ERROR_PERMISSION , HAWKBIT_EVENT_ERROR_METADATA ,
  HAWKBIT_EVENT_ERROR_DOWNLOAD , HAWKBIT_EVENT_ERROR_ALLOC , HAWKBIT_EVENT_UPDATE_DOWNLOADED , HAWKBIT_EVENT_NO_UPDATE ,
  HAWKBIT_EVENT_CANCEL_UPDATE , HAWKBIT_EVENT_START_DOWNLOAD , HAWKBIT_EVENT_END_DOWNLOAD , HAWKBIT_EVENT_START_RUN ,
  HAWKBIT_EVENT_END_RUN , HAWKBIT_EVENT_BEFORE_REBOOT
}
 hawkBit event type. More...
 

Functions

static void hawkbit_event_init_callback (struct hawkbit_event_callback *callback, hawkbit_event_callback_handler_t handler, enum hawkbit_event_type event)
 Helper to initialize a struct hawkbit_event_callback properly.
 
int hawkbit_event_add_callback (struct hawkbit_event_callback *cb)
 Add an application callback.
 
int hawkbit_event_remove_callback (struct hawkbit_event_callback *cb)
 Remove an application callback.
 

Detailed Description

hawkBit event API.

Macro Definition Documentation

◆ HAWKBIT_EVENT_CREATE_CALLBACK

#define HAWKBIT_EVENT_CREATE_CALLBACK ( _callback,
_handler,
_event )

#include <zephyr/mgmt/hawkbit/event.h>

Value:
struct hawkbit_event_callback _callback = { \
.handler = _handler, \
.event = _event, \
}

Macro to create and initialize a struct hawkbit_event_callback properly.

This macro can be used instead of hawkbit_event_init_callback().

Parameters
_callbackName of the callback structure
_handlerA valid handler function pointer.
_eventThe event of hawkbit_event_type that will trigger the callback

Typedef Documentation

◆ hawkbit_event_callback_handler_t

typedef void(* hawkbit_event_callback_handler_t) (struct hawkbit_event_callback *cb, enum hawkbit_event_type event)

#include <zephyr/mgmt/hawkbit/event.h>

Define the application callback handler function signature.

Parameters
cbOriginal struct hawkbit_event_callback owning this handler
eventThe event that triggered the callback

Note: cb pointer can be used to retrieve private data through CONTAINER_OF() if original struct hawkbit_event_callback is stored in another private structure.

Enumeration Type Documentation

◆ hawkbit_event_type

#include <zephyr/mgmt/hawkbit/event.h>

hawkBit event type.

These events are used to register the callback functions.

Enumerator
HAWKBIT_EVENT_ERROR 

Event triggered when there was an error.

HAWKBIT_EVENT_ERROR_NETWORKING 

Event triggered when there was a networking error.

HAWKBIT_EVENT_ERROR_PERMISSION 

Event triggered when there was a permission error.

HAWKBIT_EVENT_ERROR_METADATA 

Event triggered when there was a metadata error.

HAWKBIT_EVENT_ERROR_DOWNLOAD 

Event triggered when there was a download error.

HAWKBIT_EVENT_ERROR_ALLOC 

Event triggered when there was an allocation error.

HAWKBIT_EVENT_UPDATE_DOWNLOADED 

Event triggered when a new update was downloaded.

HAWKBIT_EVENT_NO_UPDATE 

Event triggered when there is no update available.

HAWKBIT_EVENT_CANCEL_UPDATE 

Event triggered when the update was canceled by the server.

HAWKBIT_EVENT_START_DOWNLOAD 

Event triggered before the download starts.

HAWKBIT_EVENT_END_DOWNLOAD 

Event triggered after the download ends.

HAWKBIT_EVENT_START_RUN 

Event triggered before the hawkBit run starts.

HAWKBIT_EVENT_END_RUN 

Event triggered after the hawkBit run ends.

HAWKBIT_EVENT_BEFORE_REBOOT 

Event triggered before hawkBit does a reboot.

Function Documentation

◆ hawkbit_event_add_callback()

int hawkbit_event_add_callback ( struct hawkbit_event_callback * cb)

#include <zephyr/mgmt/hawkbit/event.h>

Add an application callback.

Parameters
cbA valid application's callback structure pointer.
Returns
0 if successful, negative errno code on failure.

◆ hawkbit_event_init_callback()

static void hawkbit_event_init_callback ( struct hawkbit_event_callback * callback,
hawkbit_event_callback_handler_t handler,
enum hawkbit_event_type event )
inlinestatic

#include <zephyr/mgmt/hawkbit/event.h>

Helper to initialize a struct hawkbit_event_callback properly.

Parameters
callbackA valid Application's callback structure pointer.
handlerA valid handler function pointer.
eventThe event of hawkbit_event_type that will trigger the callback.

◆ hawkbit_event_remove_callback()

int hawkbit_event_remove_callback ( struct hawkbit_event_callback * cb)

#include <zephyr/mgmt/hawkbit/event.h>

Remove an application callback.

Parameters
cbA valid application's callback structure pointer.
Returns
0 if successful, negative errno code on failure.