38 #define OC_CORE_EXTERN_CONST_RESOURCE(resource_name) \
39 extern const oc_resource_t core_resource_##resource_name;
45 #define OC_CORE_RESOURCE_NAME(name) core_resource_##name
51 #if defined _MSC_VER && !defined __INTEL_COMPILER
52 #define OC_CORE_CREATE_CONST_RESOURCE_INTERNAL( \
53 resource_name, next_resource, device_index, uri, iface_mask, content_format, \
54 properties, get_cb, put_cb, post_cb, delete_cb, dpt, num_resource_types, \
56 _Pragma("warning(disable:4090)"); \
57 oc_ri_internal_expand_call( \
58 oc_ri_create_const_resource_internal, core_resource_##next_resource, \
59 core_resource_##resource_name, device_index, NULL, uri, dpt, iface_mask, \
60 content_format, properties, get_cb, put_cb, post_cb, delete_cb, NULL, 0, \
61 0, num_resource_types, __VA_ARGS__) _Pragma("warning(default:4090)")
63 #define OC_CORE_CREATE_CONST_RESOURCE_INTERNAL( \
64 resource_name, next_resource, device_index, uri, iface_mask, content_format, \
65 properties, get_cb, put_cb, post_cb, delete_cb, dpt, num_resource_types, \
67 _Pragma("GCC diagnostic push"); \
68 _Pragma("GCC diagnostic ignored \"-Wdiscarded-array-qualifiers\""); \
69 oc_ri_create_const_resource_internal( \
70 core_resource_##next_resource, core_resource_##resource_name, \
71 device_index, NULL, uri, dpt, iface_mask, content_format, properties, \
72 get_cb, put_cb, post_cb, delete_cb, NULL, 0, 0, num_resource_types, \
74 _Pragma("GCC diagnostic pop")
84 #if defined _MSC_VER && !defined __INTEL_COMPILER
85 #define OC_CORE_CREATE_CONST_RESOURCE_LINKED(resource_name, next_resource, \
87 extern const oc_resource_t core_resource_##next_resource; \
88 oc_ri_internal_expand_call(OC_CORE_CREATE_CONST_RESOURCE_INTERNAL, \
89 resource_name, next_resource, __VA_ARGS__)
91 #define OC_CORE_CREATE_CONST_RESOURCE_LINKED(resource_name, next_resource, \
93 extern const oc_resource_t core_resource_##next_resource; \
94 OC_CORE_CREATE_CONST_RESOURCE_INTERNAL(resource_name, next_resource, \
105 #if defined _MSC_VER && !defined __INTEL_COMPILER
106 #define OC_CORE_CREATE_CONST_RESOURCE_FINAL(resource_name, ...) \
107 oc_resource_dummy_t core_resource_##resource_name##_final = { NULL, -1 }; \
108 oc_ri_internal_expand_call(OC_CORE_CREATE_CONST_RESOURCE_INTERNAL, \
109 resource_name, resource_name##_final, \
112 #define OC_CORE_CREATE_CONST_RESOURCE_FINAL(resource_name, ...) \
113 oc_resource_dummy_t core_resource_##resource_name##_final = { NULL, -1 }; \
114 OC_CORE_CREATE_CONST_RESOURCE_INTERNAL(resource_name, resource_name##_final, \
215 const char *serial_number,
447 int num_resource_types, ...);
int oc_core_set_device_fwv(size_t device_index, int major, int minor, int patch)
set the firmware version
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 l...
struct oc_knx_version_info_t oc_knx_version_info_t
version information e.g.
int oc_core_set_device_model(size_t device_index, const char *model)
sets the model (string)
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
int oc_core_set_device_mid(size_t device_index, uint32_t mid)
sets the manufacturer id
int oc_core_set_device_fid(size_t device_index, uint64_t fid)
sets the fabric identifier (fid)
int oc_core_set_device_hwv(size_t device_index, int major, int minor, int patch)
sets the hardware version number
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.
uint64_t oc_core_get_device_iid(size_t device_index)
sets the installation identifier (iid) (unsigned int)
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
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"...
void oc_core_shutdown(void)
shutdown the core functionality
void oc_core_bind_dpt_resource(int core_resource, size_t device_index, const char *dpt)
bind dpt to a core resource
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....
void(* oc_core_init_platform_cb_t)(void *data)
callback for initializing the platform
const oc_resource_t * oc_core_get_resource_by_uri(const char *uri, size_t device)
retrieve the resource by uri
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"...
const oc_resource_t * oc_core_get_resource_by_index(int type, size_t device)
retrieve the resource by type (e.g.
struct oc_platform_info_t oc_platform_info_t
platform information
int oc_core_set_device_iid(size_t device_index, uint64_t iid)
sets the installation identifier (iid) (unsigned int)
int oc_core_set_device_ap(size_t device_index, int major, int minor, int patch)
sets the application version number
int oc_core_set_and_store_device_ia(size_t device_index, uint32_t ia)
sets and stores the internal address
size_t oc_core_get_num_devices(void)
retrieve the amount of devices
void oc_check_uri(const char *uri)
Ensure that the given URI starts with a forward slash.
int oc_core_set_device_pm(size_t device_index, bool pm)
sets the programming mode (boolean)
void(* oc_core_add_device_cb_t)(void *data)
callback for adding a device
int oc_core_set_device_ia(size_t device_index, uint32_t ia)
sets the internal address
int oc_core_set_device_hostname(size_t device_index, const char *host_name)
sets the host name (string)
int oc_core_set_and_store_device_iid(size_t device_index, uint64_t iid)
sets the installation identifier (iid) and store it
oc_device_info_t * oc_core_get_device_info(size_t device)
retrieve the device info from the device index
int oc_core_set_mid(size_t device_index, int32_t mid)
sets the manufacturer id
oc_platform_info_t * oc_core_get_platform_info(void)
retrieve the platform information
struct oc_device_info_t oc_device_info_t
device information
void oc_core_init(void)
initialize the core functionality
void oc_core_encode_interfaces_mask(CborEncoder *parent, oc_interface_mask_t iface_mask)
encode the interfaces with the cbor (payload) encoder
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
implementation of /.well-known/knx and /k resources
enum oc_lsm_state oc_lsm_state_t
LSM state machine values.
oc_content_format_t
payload content formats
oc_interface_mask_t
interface masks security access scopes defined as interfaces note that scope = 1 is not used.
void(* oc_request_callback_t)(oc_request_t *, oc_interface_mask_t, void *)
request callback
oc_knx_version_info_t fwv
fwv firmware version
oc_lsm_state_t lsm_s
knx lsm states
oc_string_t hwt
knx hardware type, should not be larger than 6 chars
uint32_t ia
knx ia Device individual address
oc_string_t hostname
knx host name
oc_knx_version_info_t ap
fwv application version
oc_knx_version_info_t hwv
knx hardware version
uint64_t fid
knx fabric id
uint32_t port
coap port number
oc_string_t model
knx model
oc_core_add_device_cb_t add_device_cb
callback when device is changed
oc_string_t serialnumber
knx serial number
uint32_t mid
knx manufactorer ID
uint64_t iid
knx iid (installation id)
bool pm
knx programming mode
uint32_t mport
multicast port number
int patch
patch version number
int major
major version number
int minor
minor version number
request information structure