KNX IoT
KNX IoT Point API stack implementation
|
KNX mandatory resources implementation. More...
Go to the source code of this file.
Data Structures | |
struct | oc_device_info_t |
device information More... | |
struct | oc_knx_version_info_t |
version information e.g. More... | |
struct | oc_platform_info_t |
platform information More... | |
Macros | |
#define | OC_CORE_CREATE_CONST_RESOURCE_FINAL(resource_name, ...) |
Create const CORE linked to a final, non-const dummy. More... | |
#define | OC_CORE_CREATE_CONST_RESOURCE_INTERNAL( resource_name, next_resource, device_index, uri, iface_mask, content_format, properties, get_cb, put_cb, post_cb, delete_cb, dpt, num_resource_types, ...) |
Create const CORE resource Should only be used internally! More... | |
#define | OC_CORE_CREATE_CONST_RESOURCE_LINKED(resource_name, next_resource, ...) |
Create const CORE linked to the next one. More... | |
#define | OC_CORE_EXTERN_CONST_RESOURCE(resource_name) extern const oc_resource_t core_resource_##resource_name; |
generate an extern declaration of a core const resource More... | |
#define | OC_CORE_RESOURCE_NAME(name) core_resource_##name |
get the internal name of a core const resource More... | |
Typedefs | |
typedef void(* | oc_core_add_device_cb_t) (void *data) |
callback for adding a device More... | |
typedef void(* | oc_core_init_platform_cb_t) (void *data) |
callback for initializing the platform More... | |
typedef struct oc_device_info_t | oc_device_info_t |
device information More... | |
typedef struct oc_knx_version_info_t | oc_knx_version_info_t |
version information e.g. More... | |
typedef struct oc_platform_info_t | oc_platform_info_t |
platform information More... | |
Functions | |
void | oc_check_uri (const char *uri) |
Ensure that the given URI starts with a forward slash. More... | |
oc_device_info_t * | oc_core_add_device (const char *name, const char *version, const char *base, const char *serial_number, oc_core_add_device_cb_t add_device_cb, void *data) |
Add device to the platform. More... | |
void | oc_core_bind_dpt_resource (int core_resource, size_t device_index, const char *dpt) |
bind dpt to a core resource More... | |
void | oc_core_encode_interfaces_mask (CborEncoder *parent, oc_interface_mask_t iface_mask) |
encode the interfaces with the cbor (payload) encoder More... | |
uint64_t | oc_core_get_device_iid (size_t device_index) |
sets the installation identifier (iid) (unsigned int) More... | |
oc_device_info_t * | oc_core_get_device_info (size_t device) |
retrieve the device info from the device index More... | |
size_t | oc_core_get_num_devices (void) |
retrieve the amount of devices More... | |
oc_platform_info_t * | oc_core_get_platform_info (void) |
retrieve the platform information More... | |
const oc_resource_t * | oc_core_get_resource_by_index (int type, size_t device) |
retrieve the resource by type (e.g. More... | |
const oc_resource_t * | oc_core_get_resource_by_uri (const char *uri, size_t device) |
retrieve the resource by uri More... | |
void | oc_core_init (void) |
initialize the core functionality More... | |
oc_platform_info_t * | oc_core_init_platform (const char *mfg_name, oc_core_init_platform_cb_t init_cb, void *data) |
initialize the platform More... | |
void | oc_core_populate_resource (int core_resource, size_t device_index, const char *uri, oc_interface_mask_t iface_mask, oc_content_format_t content_format, int properties, oc_request_callback_t get_cb, oc_request_callback_t put_cb, oc_request_callback_t post_cb, oc_request_callback_t delete_cb, int num_resource_types,...) |
populate core resource mainly used for creation of core resources More... | |
int | oc_core_set_and_store_device_ia (size_t device_index, uint32_t ia) |
sets and stores the internal address More... | |
int | oc_core_set_and_store_device_iid (size_t device_index, uint64_t iid) |
sets the installation identifier (iid) and store it More... | |
int | oc_core_set_device_ap (size_t device_index, int major, int minor, int patch) |
sets the application version number More... | |
int | oc_core_set_device_fid (size_t device_index, uint64_t fid) |
sets the fabric identifier (fid) More... | |
int | oc_core_set_device_fwv (size_t device_index, int major, int minor, int patch) |
set the firmware version More... | |
int | oc_core_set_device_hostname (size_t device_index, const char *host_name) |
sets the host name (string) More... | |
int | oc_core_set_device_hwt (size_t device_index, const char *hardware_type) |
sets the hardware type (string) input string should not be larger than 6, note that if the input is larger than 6, it will be truncated to 6 chars More... | |
int | oc_core_set_device_hwv (size_t device_index, int major, int minor, int patch) |
sets the hardware version number More... | |
int | oc_core_set_device_ia (size_t device_index, uint32_t ia) |
sets the internal address More... | |
int | oc_core_set_device_iid (size_t device_index, uint64_t iid) |
sets the installation identifier (iid) (unsigned int) More... | |
int | oc_core_set_device_mid (size_t device_index, uint32_t mid) |
sets the manufacturer id More... | |
int | oc_core_set_device_model (size_t device_index, const char *model) |
sets the model (string) More... | |
int | oc_core_set_device_pm (size_t device_index, bool pm) |
sets the programming mode (boolean) More... | |
int | oc_core_set_mid (size_t device_index, int32_t mid) |
sets the manufacturer id More... | |
void | oc_core_shutdown (void) |
shutdown the core functionality More... | |
bool | oc_filter_resource_by_if (const oc_resource_t *resource, oc_request_t *request) |
filter if the query parameters of the request contains the resource (determined by resource type "if") including wild carts More... | |
bool | oc_filter_resource_by_rt (const oc_resource_t *resource, oc_request_t *request) |
filter if the query parameters of the request contains the resource (determined by resource type "rt") including wild carts More... | |
int | oc_filter_resource_by_urn (const oc_resource_t *resource, oc_request_t *request) |
remove "urn:knx" from response when already provided in query More... | |
int | oc_frame_interfaces_mask_in_response (oc_interface_mask_t iface_mask, int truncated) |
frame the interface mask in the response, as string in the uri example: full tag if= ":if.i" this function frames ":if.i" (truncated) or "urn:knx:if.i" More... | |
KNX mandatory resources implementation.
Definition in file oc_core_res.h.
#define OC_CORE_CREATE_CONST_RESOURCE_FINAL | ( | resource_name, | |
... | |||
) |
Create const CORE linked to a final, non-const dummy.
resource_name | name of this resource |
Definition at line 112 of file oc_core_res.h.
#define OC_CORE_CREATE_CONST_RESOURCE_INTERNAL | ( | resource_name, | |
next_resource, | |||
device_index, | |||
uri, | |||
iface_mask, | |||
content_format, | |||
properties, | |||
get_cb, | |||
put_cb, | |||
post_cb, | |||
delete_cb, | |||
dpt, | |||
num_resource_types, | |||
... | |||
) |
Create const CORE resource Should only be used internally!
Definition at line 63 of file oc_core_res.h.
#define OC_CORE_CREATE_CONST_RESOURCE_LINKED | ( | resource_name, | |
next_resource, | |||
... | |||
) |
Create const CORE linked to the next one.
resource_name | name of this resource |
next_resource | name of next resource |
Definition at line 91 of file oc_core_res.h.
#define OC_CORE_EXTERN_CONST_RESOURCE | ( | resource_name | ) | extern const oc_resource_t core_resource_##resource_name; |
generate an extern
declaration of a core const resource
resource_name | name of resource to create decl for |
Definition at line 38 of file oc_core_res.h.
#define OC_CORE_RESOURCE_NAME | ( | name | ) | core_resource_##name |
get the internal name of a core const resource
name | name of resource |
Definition at line 45 of file oc_core_res.h.
typedef void(* oc_core_add_device_cb_t) (void *data) |
callback for adding a device
Definition at line 128 of file oc_core_res.h.
typedef void(* oc_core_init_platform_cb_t) (void *data) |
callback for initializing the platform
Definition at line 122 of file oc_core_res.h.
typedef struct oc_device_info_t oc_device_info_t |
device information
This structure contains
typedef struct oc_knx_version_info_t oc_knx_version_info_t |
version information e.g.
[major, minor, patch]
typedef struct oc_platform_info_t oc_platform_info_t |
platform information
void oc_check_uri | ( | const char * | uri | ) |
Ensure that the given URI starts with a forward slash.
uri | the URI to check |
oc_device_info_t* oc_core_add_device | ( | const char * | name, |
const char * | version, | ||
const char * | base, | ||
const char * | serial_number, | ||
oc_core_add_device_cb_t | add_device_cb, | ||
void * | data | ||
) |
Add device to the platform.
name | the name of the device |
version | the version of the KNX spec |
base | the base url |
serial_number | the serial number of the device |
add_device_cb | device callback |
data | the supplied user data |
void oc_core_bind_dpt_resource | ( | int | core_resource, |
size_t | device_index, | ||
const char * | dpt | ||
) |
bind dpt to a core resource
core_resource | the resource index |
device_index | the device index |
dpt | the DPT value of the resource |
void oc_core_encode_interfaces_mask | ( | CborEncoder * | parent, |
oc_interface_mask_t | iface_mask | ||
) |
encode the interfaces with the cbor (payload) encoder
parent | the cbor encoder |
iface_mask | the interfaces (as bit mask) |
uint64_t oc_core_get_device_iid | ( | size_t | device_index | ) |
sets the installation identifier (iid) (unsigned int)
device_index | the device index |
oc_device_info_t* oc_core_get_device_info | ( | size_t | device | ) |
retrieve the device info from the device index
device | the device index |
Referenced by app_init().
size_t oc_core_get_num_devices | ( | void | ) |
retrieve the amount of devices
oc_platform_info_t* oc_core_get_platform_info | ( | void | ) |
retrieve the platform information
const oc_resource_t* oc_core_get_resource_by_index | ( | int | type, |
size_t | device | ||
) |
retrieve the resource by type (e.g.
index) on a specific device
type | the index of the resource |
device | the device index |
const oc_resource_t* oc_core_get_resource_by_uri | ( | const char * | uri, |
size_t | device | ||
) |
retrieve the resource by uri
uri | the URI |
device | the device index |
void oc_core_init | ( | void | ) |
initialize the core functionality
oc_platform_info_t* oc_core_init_platform | ( | const char * | mfg_name, |
oc_core_init_platform_cb_t | init_cb, | ||
void * | data | ||
) |
initialize the platform
mfg_name | the manufacturer name |
init_cb | the callback |
data | the user data |
void oc_core_populate_resource | ( | int | core_resource, |
size_t | device_index, | ||
const char * | uri, | ||
oc_interface_mask_t | iface_mask, | ||
oc_content_format_t | content_format, | ||
int | properties, | ||
oc_request_callback_t | get_cb, | ||
oc_request_callback_t | put_cb, | ||
oc_request_callback_t | post_cb, | ||
oc_request_callback_t | delete_cb, | ||
int | num_resource_types, | ||
... | |||
) |
populate core resource mainly used for creation of core resources
core_resource | the resource index |
device_index | the device index |
uri | the URI for the resource |
iface_mask | interfaces (as mask) to be implemented on the resource |
content_format | the content type that should be listed as ct in link-format responses |
properties | the properties (as mask) |
get_cb | get callback function |
put_cb | put callback function |
post_cb | post callback function |
delete_cb | delete callback function |
num_resource_types | amount of resource types, listed as variable arguments after this argument |
... | Resource types, passed as zero-terminated strings. In order to save memory, the maximum length of each resource type is 32 bytes. |
int oc_core_set_and_store_device_ia | ( | size_t | device_index, |
uint32_t | ia | ||
) |
sets and stores the internal address
device_index | the device index |
ia | the internal address |
int oc_core_set_and_store_device_iid | ( | size_t | device_index, |
uint64_t | iid | ||
) |
sets the installation identifier (iid) and store it
device_index | the device index |
iid | the KNX installation id |
int oc_core_set_device_ap | ( | size_t | device_index, |
int | major, | ||
int | minor, | ||
int | patch | ||
) |
sets the application version number
device_index | the device index |
major | the xxx number of xxx.yyy.zzz |
minor | the yyy number of xxx.yyy.zz |
patch | the zzz number of xxx.yyy.zzz |
int oc_core_set_device_fid | ( | size_t | device_index, |
uint64_t | fid | ||
) |
sets the fabric identifier (fid)
device_index | the device index |
fid | the fabric id |
int oc_core_set_device_fwv | ( | size_t | device_index, |
int | major, | ||
int | minor, | ||
int | patch | ||
) |
set the firmware version
device_index | the device index |
major | the xxx number of xxx.yyy.zzz |
minor | the yyy number of xxx.yyy.zz |
patch | the zzz number of xxx.yyy.zzz |
int oc_core_set_device_hostname | ( | size_t | device_index, |
const char * | host_name | ||
) |
sets the host name (string)
device_index | the device index |
host_name | the host name |
int oc_core_set_device_hwt | ( | size_t | device_index, |
const char * | hardware_type | ||
) |
sets the hardware type (string) input string should not be larger than 6, note that if the input is larger than 6, it will be truncated to 6 chars
device_index | the device index |
hardware_type | the hardware type |
int oc_core_set_device_hwv | ( | size_t | device_index, |
int | major, | ||
int | minor, | ||
int | patch | ||
) |
sets the hardware version number
device_index | the device index |
major | the xxx number of xxx.yyy.zzz |
minor | the yyy number of xxx.yyy.zz |
patch | the zzz number of xxx.yyy.zzz |
int oc_core_set_device_ia | ( | size_t | device_index, |
uint32_t | ia | ||
) |
sets the internal address
device_index | the device index |
ia | the internal address |
int oc_core_set_device_iid | ( | size_t | device_index, |
uint64_t | iid | ||
) |
sets the installation identifier (iid) (unsigned int)
device_index | the device index |
iid | the KNX installation id |
int oc_core_set_device_mid | ( | size_t | device_index, |
uint32_t | mid | ||
) |
sets the manufacturer id
device_index | the device index |
mid | the manufacturer id |
int oc_core_set_device_model | ( | size_t | device_index, |
const char * | model | ||
) |
sets the model (string)
device_index | the device index |
model | the device model |
int oc_core_set_device_pm | ( | size_t | device_index, |
bool | pm | ||
) |
sets the programming mode (boolean)
device_index | the device index |
pm | the programming mode |
int oc_core_set_mid | ( | size_t | device_index, |
int32_t | mid | ||
) |
sets the manufacturer id
device_index | the device index |
mid | the manufacturer id |
void oc_core_shutdown | ( | void | ) |
shutdown the core functionality
bool oc_filter_resource_by_if | ( | const oc_resource_t * | resource, |
oc_request_t * | request | ||
) |
filter if the query parameters of the request contains the resource (determined by resource type "if") including wild carts
resource | the resource to look for |
request | the request to scan |
bool oc_filter_resource_by_rt | ( | const oc_resource_t * | resource, |
oc_request_t * | request | ||
) |
filter if the query parameters of the request contains the resource (determined by resource type "rt") including wild carts
resource | the resource to look for |
request | the request to scan |
int oc_filter_resource_by_urn | ( | const oc_resource_t * | resource, |
oc_request_t * | request | ||
) |
remove "urn:knx" from response when already provided in query
resource | the resource to look for |
request | the request to scan |
int oc_frame_interfaces_mask_in_response | ( | oc_interface_mask_t | iface_mask, |
int | truncated | ||
) |
frame the interface mask in the response, as string in the uri example: full tag if= ":if.i" this function frames ":if.i" (truncated) or "urn:knx:if.i"
iface_mask | The interface masks to frame |
truncated | 1 = do not frame "urn:knx" |