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

generic knx helpers More...

#include "oc_api.h"
#include "oc_helpers.h"

Go to the source code of this file.

Macros

#define PAGE_SIZE   20
 

Functions

int add_next_page_indicator (char *url, int next_page_num)
 helper function to frame next page indicator, if more requests (pages) are needed to get the full list More...
 
int check_if_query_l_exist (oc_request_t *request, bool *ps_exists, bool *total_exists)
 helper function to check if query parameter l exists More...
 
bool check_if_query_pn_exist (oc_request_t *request, int *pn_value, int *ps_value)
 helper function to check if query parameter pn exists More...
 
int oc_frame_integer (int value)
 helper function to frame an integer in the response: More...
 
int oc_frame_query_l (char *url, bool ps_exists, int ps, bool total_exists, int total)
 helper function to frame url part of query response: spec 1.0: More...
 

Detailed Description

generic knx helpers

Definition in file oc_knx_helpers.h.

Function Documentation

◆ add_next_page_indicator()

int add_next_page_indicator ( char *  url,
int  next_page_num 
)

helper function to frame next page indicator, if more requests (pages) are needed to get the full list

Parameters
urlthe url to be framed
next_page_numthe next page number to be framed
Returns
total bytes framed

◆ check_if_query_l_exist()

int check_if_query_l_exist ( oc_request_t request,
bool *  ps_exists,
bool *  total_exists 
)

helper function to check if query parameter l exists

example: /fp/r?l=total&l=ps

Parameters
requestthe request
ps_existsreturn value if l=ps exists
total_existsreturn value if l=total exists
Returns
1 == l exists (with either ps or total or both)
-1 == invalid l parameters
0 == l doesn't exist

◆ check_if_query_pn_exist()

bool check_if_query_pn_exist ( oc_request_t request,
int *  pn_value,
int *  ps_value 
)

helper function to check if query parameter pn exists

example: /dev/ipv6?pn=0&ps=3

Parameters
requestthe request
pn_valuereturn -1 if not exist otherwise value
ps_valuereturn -1 if not exist otherwise value
Returns
true == pn exists

◆ oc_frame_integer()

int oc_frame_integer ( int  value)

helper function to frame an integer in the response:

Parameters
valuethe value to be framed, max 9 chars
Returns
total bytes framed

◆ oc_frame_query_l()

int oc_frame_query_l ( char *  url,
bool  ps_exists,
int  ps,
bool  total_exists,
int  total 
)

helper function to frame url part of query response: spec 1.0:

  • <url?l=ps>
  • <url?l=total>
  • <url?l=ps;ps=total> spec 1.1:
  • url
Parameters
urlthe url to be framed
ps_existsframe ps
pspage size
total_existsframe total
totaltotal items
Returns
total bytes framed