KNX IoT
KNX IoT Point API stack implementation
oc_knx_client.h File Reference

client code for the device (s-mode) More...

#include <stddef.h>

Go to the source code of this file.

Typedefs

typedef void(* oc_s_mode_response_cb_t) (char *url, oc_rep_t *rep, oc_rep_t *rep_value)
 
typedef void(* oc_spake_cb_t) (int error, char *serial_number, char *oscore_id, int oscore_id_size, uint8_t *secret, int secret_size)
 the spake response callback type e.g. More...
 

Functions

void oc_do_s_mode_read (int64_t group_address)
 sends out an s-mode read request. More...
 
void oc_do_s_mode_with_scope (int scope, const char *resource_url, char *rp)
 sends (transmits) an s-mode message the value comes from the GET of the resource indicated by the resource_url the path is "k" the sia (sender individual address) is taken from the device the ga is coming from the group address table that is listing the resource url (path) the url of the resource to obtain the value from. More...
 
void oc_do_s_mode_with_scope_no_check (int scope, const char *resource_url, char *rp)
 sends (transmits) an s-mode message the value comes from the GET of the resource indicated by the resource_url the path is "k" the sia (sender individual address) is taken from the device the ga is coming from the group address table that is listing the resource url (path) the url of the resource to obtain the value from. More...
 
oc_s_mode_response_cb_t oc_get_s_mode_response_cb ()
 retrieve the callback function More...
 
int oc_initiate_spake (oc_endpoint_t *endpoint, char *password, char *recipient_id)
 initiate the spake handshake More...
 
int oc_initiate_spake_parameter_request (oc_endpoint_t *endpoint, char *serial_number, char *password, char *recipient_id, size_t recipient_id_len)
 initiate the spake handshake More...
 
bool oc_is_redirected_request (oc_request_t *request)
 checks if the request is a redirected request from /k or /p when that happened, extra information can be in the CBOR object More...
 
oc_rep_toc_s_mode_get_value (oc_request_t *request)
 parses out the value of the s-mode request. More...
 
bool oc_set_s_mode_response_cb (oc_s_mode_response_cb_t my_func)
 set the s-mode response callback e.g. More...
 
bool oc_set_spake_response_cb (oc_spake_cb_t my_func)
 set the spake response callback e.g. More...
 

Detailed Description

client code for the device (s-mode)

compile flag:

  • OC_USE_MULTICAST_SCOPE_2 also sends the multicast group events with scope =2 this is needed when the devices are running on the same PC

Definition in file oc_knx_client.h.

Typedef Documentation

◆ oc_spake_cb_t

typedef void(* oc_spake_cb_t) (int error, char *serial_number, char *oscore_id, int oscore_id_size, uint8_t *secret, int secret_size)

the spake response callback type e.g.

function prototype that is called when the spake handshake is finished

Parameters
error0 = ok
serial_numberthe serial number of the device on the other side
oscore_idthe oscore identifier (bytes)
oscore_id_sizethe size in bytes of the oscore identifier
secretthe negotiated secret (bytes)
secret_sizethe size in bytes of the secret

Definition at line 45 of file oc_knx_client.h.

Function Documentation

◆ oc_initiate_spake()

int oc_initiate_spake ( oc_endpoint_t endpoint,
char *  password,
char *  recipient_id 
)

initiate the spake handshake

NOTE: recipient id in HEX string (e.g. null terminated)

Parameters
endpointthe endpoint of the device to be used
passwordthe spake password to be used
recipient_idthe recipient id (HEX string)
Returns
int success full start up of the handshake

◆ oc_initiate_spake_parameter_request()

int oc_initiate_spake_parameter_request ( oc_endpoint_t endpoint,
char *  serial_number,
char *  password,
char *  recipient_id,
size_t  recipient_id_len 
)

initiate the spake handshake

NOTE: After the success full handshake the OSCORE context should have:

  • SID : serial number as byte array
  • RID : the recipient ID as given input
Parameters
endpointthe endpoint of the device to be used
serial_numberthe serial number of the device, to put back in the callback, this is a string, e.g. SN as HEX string e.g. "00FA10010701"
passwordthe spake password to be used
recipient_idthe recipient ID id for the resulting OSCORE context (byte string)
recipient_id_lenlength of the recipient ID byte string
Returns
int success full start up of the handshake

◆ oc_set_spake_response_cb()

bool oc_set_spake_response_cb ( oc_spake_cb_t  my_func)

set the spake response callback e.g.

function is called when the spake handshake is finished

Parameters
my_functhe callback function
Returns
true function set
false function set failed